-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
39 lines (27 loc) · 1.15 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
This module exports a binary ninja MLIL binary view of a file into a neo4j graph.
"""
from .Core.Common import Neo4jConnector
import time
from binaryninja import *
from .Core.CSV_Processing import BuildCSV
from .Core.Common import UUID_Generator
from .Core.TypeSystem.LibraryFunctionCorrelation import NodeHandlers
def export_bv(bv):
start_time = time.time()
driver = Neo4jConnector.get_driver()
binja_graph = BuildCSV.BinjaGraph(driver, bv)
binja_graph.bv_extract()
end_time = time.time()
print("Operation done in ", end_time - start_time, " seconds")
def annotate_functions(bv):
start_time = time.time()
for func in bv.functions:
if not func.name.startswith('sub_'):
type_def_tree = NodeHandlers.TypeDefinitionTree(func.name, bv)
type_def_tree.insert_type_definition_into_binaryView()
bv.reanalyze()
end_time = time.time()
print("Operation done in ", end_time - start_time, " seconds")
PluginCommand.register("Binja4j", "Export a BinaryView to Neo4j", export_bv)
PluginCommand.register("Type_Anotate", "Defines a type according to pre-parsed header files", annotate_functions)