|
17 | 17 | from binaryninja import * |
18 | 18 | from collections import defaultdict |
19 | 19 |
|
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 | + """) |
28 | 47 |
|
29 | 48 | # Support python 3 and python 2 |
30 | 49 | if sys.version_info > (3,): |
@@ -135,8 +154,11 @@ def collect_ils(bv, func): |
135 | 154 |
|
136 | 155 | llil = func.low_level_il |
137 | 156 | 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") |
138 | 160 |
|
139 | | - if show_normal: |
| 161 | + if show_common: |
140 | 162 | for block in llil: |
141 | 163 | for il in block: |
142 | 164 | lookup["LowLevelIL"][il.address].append(il) |
|
0 commit comments