Skip to content

Commit 58237b0

Browse files
psifertexwithzombies
authored andcommitted
use the settings api to store options
1 parent 430016a commit 58237b0

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

__init__.py

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,33 @@
1717
from binaryninja import *
1818
from collections import defaultdict
1919

20-
# Show normal form instructions (non-SSA, non-mapped) in the output
21-
show_normal = True
22-
23-
# Included MappedMediumLevelIL in the output
24-
show_mapped = False
25-
26-
# Include SSA in the output
27-
show_ssa = True
20+
Settings().register_group("bnil-graph", "BNIL Graph")
21+
Settings().register_setting("bnil-graph.showCommon", """
22+
{
23+
"title" : "Show Common ILs",
24+
"type" : "boolean",
25+
"default" : true,
26+
"description" : "Show common forms (non-SSA, non-mapped) in the output."
27+
}
28+
""")
29+
30+
Settings().register_setting("bnil-graph.showMapped", """
31+
{
32+
"title" : "Include MMLIL",
33+
"type" : "boolean",
34+
"default" : false,
35+
"description" : "Show the MappedMediumLevelIL form in the output."
36+
}
37+
""")
38+
39+
Settings().register_setting("bnil-graph.showSSA", """
40+
{
41+
"title" : "Include SSA",
42+
"type" : "boolean",
43+
"default" : true,
44+
"description" : "Include SSA forms in the output."
45+
}
46+
""")
2847

2948
# Support python 3 and python 2
3049
if sys.version_info > (3,):
@@ -135,8 +154,11 @@ def collect_ils(bv, func):
135154

136155
llil = func.low_level_il
137156
mlil = func.medium_level_il
157+
show_common = Settings().get_bool("bnil-graph.showCommon")
158+
show_mapped = Settings().get_bool("bnil-graph.showMapped")
159+
show_ssa = Settings().get_bool("bnil-graph.showSSA")
138160

139-
if show_normal:
161+
if show_common:
140162
for block in llil:
141163
for il in block:
142164
lookup["LowLevelIL"][il.address].append(il)

0 commit comments

Comments
 (0)