cetfor / PaperMachete

A project that uses Binary Ninja and GRAKN.AI to perform static analysis on binary files with the goal of identifying bugs in software.
MIT License
57 stars 9 forks source link

Update to grakn 1.4.2 #5

Closed devtty1er closed 5 years ago

devtty1er commented 5 years ago

Fixes #3

My suggested changes for this PR and the Dockerize PR are at https://github.com/devtty1er/PaperMachete.wiki.git (the links won't work, because they point to the upstream wiki).

Most of the changes were:

- graph = grakn.Client(uri='http://localhost:4567', keyspace=keyspace)
- some_results = graph.execute('some query; get $x;')
- for some_result in some_results:
-     print(some_result['x']['value'])
+ client = grakn.Grakn(uri='localhost:48555')
+ with client.session(keyspace=keyspace).transaction(grakn.TxType.READ) as graph:
+     some_results = [some_result.map() for some_result in graph.query('some query; get $x')]
+     for some_result in some_results:
+         print(some_result['x'].value())   

Using map() preserved the syntax of using variable names as keys; however, you could also collect_concepts(), particularly for queries of only one variable.

This PR doesn't make any functional changes, except for CWE-120, where I changed has func-name contains {} to has func-name {}, which fixes the bug where getsomething() is treated the same as gets(). The same probably needs to be done for other queries, but I will make those changes in a separate PR once I get the horsepower to test the challenge binaries.

cetfor commented 5 years ago

You are awesome! Thanks!