angr 9.2.131__py3-none-manylinux2014_aarch64.whl → 9.2.133__py3-none-manylinux2014_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of angr might be problematic. Click here for more details.

Files changed (264) hide show
  1. angr/__init__.py +128 -128
  2. angr/analyses/__init__.py +38 -38
  3. angr/analyses/analysis.py +6 -2
  4. angr/analyses/backward_slice.py +3 -4
  5. angr/analyses/binary_optimizer.py +5 -12
  6. angr/analyses/bindiff.py +3 -6
  7. angr/analyses/calling_convention.py +3 -4
  8. angr/analyses/cfg/__init__.py +3 -3
  9. angr/analyses/cfg/cfg_base.py +1 -1
  10. angr/analyses/cfg/cfg_emulated.py +5 -5
  11. angr/analyses/cfg/cfg_fast.py +19 -17
  12. angr/analyses/cfg/indirect_jump_resolvers/__init__.py +5 -5
  13. angr/analyses/cfg/indirect_jump_resolvers/amd64_elf_got.py +1 -1
  14. angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +148 -101
  15. angr/analyses/cfg/indirect_jump_resolvers/x86_elf_pic_plt.py +1 -1
  16. angr/analyses/data_dep/__init__.py +4 -4
  17. angr/analyses/datagraph_meta.py +1 -1
  18. angr/analyses/ddg.py +16 -17
  19. angr/analyses/decompiler/__init__.py +12 -12
  20. angr/analyses/decompiler/ail_simplifier.py +24 -12
  21. angr/analyses/decompiler/block_similarity.py +2 -4
  22. angr/analyses/decompiler/block_simplifier.py +10 -21
  23. angr/analyses/decompiler/callsite_maker.py +1 -1
  24. angr/analyses/decompiler/ccall_rewriters/rewriter_base.py +1 -1
  25. angr/analyses/decompiler/clinic.py +122 -41
  26. angr/analyses/decompiler/condition_processor.py +57 -39
  27. angr/analyses/decompiler/counters/__init__.py +3 -3
  28. angr/analyses/decompiler/decompilation_cache.py +7 -7
  29. angr/analyses/decompiler/dephication/__init__.py +1 -1
  30. angr/analyses/decompiler/dephication/graph_rewriting.py +1 -1
  31. angr/analyses/decompiler/dephication/graph_vvar_mapping.py +11 -3
  32. angr/analyses/decompiler/dephication/rewriting_engine.py +169 -45
  33. angr/analyses/decompiler/dephication/seqnode_dephication.py +5 -4
  34. angr/analyses/decompiler/expression_narrower.py +1 -1
  35. angr/analyses/decompiler/graph_region.py +8 -8
  36. angr/analyses/decompiler/optimization_passes/__init__.py +20 -20
  37. angr/analyses/decompiler/optimization_passes/const_derefs.py +1 -0
  38. angr/analyses/decompiler/optimization_passes/deadblock_remover.py +1 -2
  39. angr/analyses/decompiler/optimization_passes/div_simplifier.py +41 -16
  40. angr/analyses/decompiler/optimization_passes/duplication_reverter/duplication_reverter.py +8 -7
  41. angr/analyses/decompiler/optimization_passes/duplication_reverter/utils.py +1 -3
  42. angr/analyses/decompiler/optimization_passes/engine_base.py +262 -84
  43. angr/analyses/decompiler/optimization_passes/inlined_string_transformation_simplifier.py +175 -39
  44. angr/analyses/decompiler/optimization_passes/ite_region_converter.py +2 -5
  45. angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +5 -5
  46. angr/analyses/decompiler/optimization_passes/mod_simplifier.py +12 -3
  47. angr/analyses/decompiler/optimization_passes/optimization_pass.py +42 -19
  48. angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +9 -5
  49. angr/analyses/decompiler/peephole_optimizations/__init__.py +1 -1
  50. angr/analyses/decompiler/peephole_optimizations/base.py +6 -6
  51. angr/analyses/decompiler/peephole_optimizations/remove_noop_conversions.py +2 -0
  52. angr/analyses/decompiler/peephole_optimizations/rewrite_bit_extractions.py +1 -1
  53. angr/analyses/decompiler/presets/__init__.py +1 -1
  54. angr/analyses/decompiler/region_simplifiers/expr_folding.py +3 -3
  55. angr/analyses/decompiler/region_simplifiers/switch_cluster_simplifier.py +8 -12
  56. angr/analyses/decompiler/ssailification/rewriting.py +1 -2
  57. angr/analyses/decompiler/ssailification/rewriting_engine.py +139 -56
  58. angr/analyses/decompiler/ssailification/ssailification.py +2 -1
  59. angr/analyses/decompiler/ssailification/traversal.py +4 -6
  60. angr/analyses/decompiler/ssailification/traversal_engine.py +125 -42
  61. angr/analyses/decompiler/structured_codegen/__init__.py +5 -5
  62. angr/analyses/decompiler/structured_codegen/base.py +3 -3
  63. angr/analyses/decompiler/structured_codegen/c.py +39 -40
  64. angr/analyses/decompiler/structuring/__init__.py +3 -3
  65. angr/analyses/decompiler/structuring/phoenix.py +45 -29
  66. angr/analyses/decompiler/structuring/structurer_base.py +2 -2
  67. angr/analyses/decompiler/structuring/structurer_nodes.py +23 -14
  68. angr/analyses/deobfuscator/__init__.py +3 -3
  69. angr/analyses/deobfuscator/irsb_reg_collector.py +29 -60
  70. angr/analyses/deobfuscator/string_obf_finder.py +2 -2
  71. angr/analyses/deobfuscator/string_obf_opt_passes.py +1 -1
  72. angr/analyses/disassembly.py +4 -4
  73. angr/analyses/forward_analysis/__init__.py +1 -1
  74. angr/analyses/forward_analysis/visitors/graph.py +6 -6
  75. angr/analyses/init_finder.py +47 -22
  76. angr/analyses/loop_analysis.py +1 -1
  77. angr/analyses/loopfinder.py +1 -1
  78. angr/analyses/propagator/engine_base.py +21 -14
  79. angr/analyses/propagator/engine_vex.py +149 -179
  80. angr/analyses/propagator/outdated_definition_walker.py +12 -6
  81. angr/analyses/propagator/propagator.py +10 -28
  82. angr/analyses/propagator/top_checker_mixin.py +211 -5
  83. angr/analyses/propagator/vex_vars.py +4 -4
  84. angr/analyses/reaching_definitions/__init__.py +9 -9
  85. angr/analyses/reaching_definitions/call_trace.py +2 -2
  86. angr/analyses/reaching_definitions/dep_graph.py +1 -1
  87. angr/analyses/reaching_definitions/engine_ail.py +304 -329
  88. angr/analyses/reaching_definitions/engine_vex.py +243 -229
  89. angr/analyses/reaching_definitions/function_handler.py +3 -3
  90. angr/analyses/reaching_definitions/function_handler_library/__init__.py +1 -1
  91. angr/analyses/reaching_definitions/rd_state.py +47 -42
  92. angr/analyses/reassembler.py +26 -31
  93. angr/analyses/s_liveness.py +8 -0
  94. angr/analyses/s_propagator.py +18 -3
  95. angr/analyses/s_reaching_definitions/s_rda_view.py +2 -5
  96. angr/analyses/s_reaching_definitions/s_reaching_definitions.py +9 -5
  97. angr/analyses/stack_pointer_tracker.py +4 -4
  98. angr/analyses/typehoon/simple_solver.py +14 -14
  99. angr/analyses/typehoon/translator.py +10 -2
  100. angr/analyses/typehoon/typeconsts.py +11 -3
  101. angr/analyses/typehoon/typevars.py +26 -26
  102. angr/analyses/unpacker/__init__.py +1 -1
  103. angr/analyses/variable_recovery/engine_ail.py +299 -259
  104. angr/analyses/variable_recovery/engine_base.py +138 -121
  105. angr/analyses/variable_recovery/engine_vex.py +175 -185
  106. angr/analyses/variable_recovery/irsb_scanner.py +49 -38
  107. angr/analyses/variable_recovery/variable_recovery.py +28 -5
  108. angr/analyses/variable_recovery/variable_recovery_base.py +33 -34
  109. angr/analyses/variable_recovery/variable_recovery_fast.py +4 -8
  110. angr/analyses/veritesting.py +2 -2
  111. angr/analyses/vfg.py +5 -5
  112. angr/analyses/xrefs.py +46 -19
  113. angr/angrdb/serializers/__init__.py +1 -1
  114. angr/annocfg.py +20 -15
  115. angr/blade.py +2 -2
  116. angr/block.py +20 -25
  117. angr/calling_conventions.py +12 -14
  118. angr/code_location.py +6 -10
  119. angr/codenode.py +3 -3
  120. angr/engines/__init__.py +12 -14
  121. angr/engines/engine.py +24 -61
  122. angr/engines/light/__init__.py +13 -5
  123. angr/engines/light/data.py +1 -1
  124. angr/engines/light/engine.py +1003 -1185
  125. angr/engines/pcode/__init__.py +1 -1
  126. angr/engines/pcode/behavior.py +1 -1
  127. angr/engines/pcode/cc.py +2 -0
  128. angr/engines/pcode/lifter.py +13 -15
  129. angr/engines/soot/expressions/__init__.py +12 -12
  130. angr/engines/soot/statements/__init__.py +6 -6
  131. angr/engines/soot/values/__init__.py +6 -6
  132. angr/engines/soot/values/arrayref.py +2 -2
  133. angr/engines/soot/values/constants.py +1 -1
  134. angr/engines/soot/values/instancefieldref.py +1 -1
  135. angr/engines/soot/values/paramref.py +1 -1
  136. angr/engines/soot/values/staticfieldref.py +1 -1
  137. angr/engines/successors.py +15 -14
  138. angr/engines/vex/__init__.py +5 -5
  139. angr/engines/vex/claripy/ccall.py +2 -2
  140. angr/engines/vex/claripy/datalayer.py +1 -1
  141. angr/engines/vex/claripy/irop.py +19 -19
  142. angr/engines/vex/heavy/__init__.py +2 -2
  143. angr/engines/vex/heavy/actions.py +1 -3
  144. angr/engines/vex/heavy/heavy.py +4 -6
  145. angr/engines/vex/lifter.py +2 -4
  146. angr/engines/vex/light/light.py +0 -2
  147. angr/engines/vex/light/slicing.py +5 -5
  148. angr/exploration_techniques/__init__.py +19 -142
  149. angr/exploration_techniques/base.py +126 -0
  150. angr/exploration_techniques/bucketizer.py +1 -1
  151. angr/exploration_techniques/dfs.py +3 -1
  152. angr/exploration_techniques/director.py +2 -3
  153. angr/exploration_techniques/driller_core.py +1 -1
  154. angr/exploration_techniques/explorer.py +4 -2
  155. angr/exploration_techniques/lengthlimiter.py +2 -1
  156. angr/exploration_techniques/local_loop_seer.py +2 -1
  157. angr/exploration_techniques/loop_seer.py +5 -5
  158. angr/exploration_techniques/manual_mergepoint.py +2 -1
  159. angr/exploration_techniques/memory_watcher.py +3 -1
  160. angr/exploration_techniques/oppologist.py +4 -5
  161. angr/exploration_techniques/slicecutor.py +4 -2
  162. angr/exploration_techniques/spiller.py +1 -1
  163. angr/exploration_techniques/stochastic.py +2 -1
  164. angr/exploration_techniques/stub_stasher.py +2 -1
  165. angr/exploration_techniques/suggestions.py +3 -1
  166. angr/exploration_techniques/symbion.py +3 -1
  167. angr/exploration_techniques/tech_builder.py +2 -1
  168. angr/exploration_techniques/threading.py +2 -11
  169. angr/exploration_techniques/timeout.py +4 -2
  170. angr/exploration_techniques/tracer.py +4 -3
  171. angr/exploration_techniques/unique.py +3 -2
  172. angr/exploration_techniques/veritesting.py +1 -1
  173. angr/factory.py +36 -6
  174. angr/keyed_region.py +4 -4
  175. angr/knowledge_base.py +1 -1
  176. angr/knowledge_plugins/__init__.py +11 -11
  177. angr/knowledge_plugins/cfg/__init__.py +5 -5
  178. angr/knowledge_plugins/cfg/cfg_manager.py +2 -2
  179. angr/knowledge_plugins/cfg/cfg_model.py +8 -8
  180. angr/knowledge_plugins/cfg/cfg_node.py +19 -19
  181. angr/knowledge_plugins/cfg/indirect_jump.py +6 -6
  182. angr/knowledge_plugins/cfg/memory_data.py +5 -7
  183. angr/knowledge_plugins/functions/function.py +48 -52
  184. angr/knowledge_plugins/functions/function_parser.py +4 -4
  185. angr/knowledge_plugins/key_definitions/__init__.py +3 -3
  186. angr/knowledge_plugins/key_definitions/atoms.py +8 -8
  187. angr/knowledge_plugins/key_definitions/definition.py +1 -1
  188. angr/knowledge_plugins/key_definitions/live_definitions.py +30 -27
  189. angr/knowledge_plugins/labels.py +1 -1
  190. angr/knowledge_plugins/propagations/__init__.py +1 -1
  191. angr/knowledge_plugins/propagations/prop_value.py +2 -2
  192. angr/knowledge_plugins/propagations/propagation_model.py +7 -8
  193. angr/knowledge_plugins/propagations/states.py +44 -39
  194. angr/knowledge_plugins/variables/variable_access.py +2 -2
  195. angr/knowledge_plugins/variables/variable_manager.py +24 -10
  196. angr/knowledge_plugins/xrefs/xref.py +5 -8
  197. angr/misc/__init__.py +4 -4
  198. angr/misc/hookset.py +4 -5
  199. angr/misc/loggers.py +2 -2
  200. angr/misc/telemetry.py +1 -1
  201. angr/procedures/__init__.py +1 -1
  202. angr/procedures/cgc/fdwait.py +2 -2
  203. angr/procedures/definitions/__init__.py +2 -2
  204. angr/procedures/definitions/linux_kernel.py +0 -1
  205. angr/procedures/definitions/parse_syscalls_from_local_system.py +1 -1
  206. angr/procedures/definitions/parse_win32json.py +0 -1
  207. angr/procedures/ntdll/exceptions.py +1 -1
  208. angr/procedures/stubs/format_parser.py +3 -3
  209. angr/procedures/win32/dynamic_loading.py +1 -1
  210. angr/protos/__init__.py +3 -3
  211. angr/sim_manager.py +3 -5
  212. angr/sim_state.py +40 -42
  213. angr/sim_state_options.py +3 -3
  214. angr/sim_type.py +15 -14
  215. angr/sim_variable.py +42 -45
  216. angr/simos/__init__.py +4 -4
  217. angr/simos/cgc.py +1 -1
  218. angr/simos/simos.py +1 -1
  219. angr/simos/userland.py +1 -1
  220. angr/slicer.py +4 -7
  221. angr/state_plugins/__init__.py +34 -34
  222. angr/state_plugins/callstack.py +5 -12
  223. angr/state_plugins/heap/__init__.py +2 -2
  224. angr/state_plugins/heap/heap_brk.py +2 -4
  225. angr/state_plugins/heap/heap_ptmalloc.py +1 -1
  226. angr/state_plugins/jni_references.py +3 -2
  227. angr/state_plugins/scratch.py +1 -1
  228. angr/state_plugins/sim_action.py +1 -4
  229. angr/state_plugins/sim_event.py +1 -1
  230. angr/state_plugins/solver.py +7 -9
  231. angr/state_plugins/uc_manager.py +1 -1
  232. angr/state_plugins/view.py +2 -2
  233. angr/storage/__init__.py +1 -1
  234. angr/storage/file.py +10 -10
  235. angr/storage/memory_mixins/__init__.py +46 -46
  236. angr/storage/memory_mixins/default_filler_mixin.py +1 -3
  237. angr/storage/memory_mixins/javavm_memory_mixin.py +2 -2
  238. angr/storage/memory_mixins/name_resolution_mixin.py +2 -2
  239. angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +1 -3
  240. angr/storage/memory_mixins/paged_memory/pages/__init__.py +6 -6
  241. angr/storage/memory_mixins/paged_memory/pages/list_page.py +1 -1
  242. angr/storage/memory_mixins/paged_memory/pages/multi_values.py +1 -1
  243. angr/storage/memory_mixins/paged_memory/pages/mv_list_page.py +1 -1
  244. angr/storage/memory_mixins/paged_memory/pages/ultra_page.py +2 -4
  245. angr/storage/memory_mixins/regioned_memory/__init__.py +3 -3
  246. angr/storage/memory_mixins/regioned_memory/region_data.py +5 -5
  247. angr/storage/memory_mixins/regioned_memory/region_meta_mixin.py +7 -9
  248. angr/storage/memory_mixins/regioned_memory/regioned_memory_mixin.py +4 -4
  249. angr/storage/memory_object.py +4 -4
  250. angr/utils/__init__.py +3 -3
  251. angr/utils/bits.py +12 -0
  252. angr/utils/dynamic_dictlist.py +1 -1
  253. angr/utils/graph.py +1 -1
  254. angr/utils/orderedset.py +4 -1
  255. angr/utils/segment_list.py +2 -2
  256. angr/utils/ssa/__init__.py +33 -8
  257. {angr-9.2.131.dist-info → angr-9.2.133.dist-info}/METADATA +6 -6
  258. {angr-9.2.131.dist-info → angr-9.2.133.dist-info}/RECORD +262 -263
  259. angr/analyses/propagator/engine_ail.py +0 -1562
  260. angr/storage/memory_mixins/__init__.pyi +0 -48
  261. {angr-9.2.131.dist-info → angr-9.2.133.dist-info}/LICENSE +0 -0
  262. {angr-9.2.131.dist-info → angr-9.2.133.dist-info}/WHEEL +0 -0
  263. {angr-9.2.131.dist-info → angr-9.2.133.dist-info}/entry_points.txt +0 -0
  264. {angr-9.2.131.dist-info → angr-9.2.133.dist-info}/top_level.txt +0 -0
@@ -1,50 +1,53 @@
1
1
  from __future__ import annotations
2
2
  from collections import OrderedDict
3
3
 
4
- from ailment.statement import Assignment, Call, Store, ConditionalJump
4
+ from ailment.statement import Call, Store, ConditionalJump
5
5
  from ailment.expression import Register, BinaryOp, StackBaseOffset, ITE, VEXCCallExpression, Tmp, DirtyExpression
6
6
 
7
- from angr.engines.light import SimEngineLight, SimEngineLightAILMixin
7
+ from angr.engines.light import SimEngineLightAIL
8
+ from angr.project import Project
8
9
  from angr.utils.ssa import get_reg_offset_base
9
10
  from angr.utils.orderedset import OrderedSet
10
11
  from angr.calling_conventions import default_cc
11
12
  from .traversal_state import TraversalState
12
13
 
13
14
 
14
- class SimEngineSSATraversal(
15
- SimEngineLightAILMixin,
16
- SimEngineLight,
17
- ):
15
+ class SimEngineSSATraversal(SimEngineLightAIL[TraversalState, None, None, None]):
18
16
  """
19
17
  This engine collects all register and stack variable locations and links them to the block of their creation.
20
18
  """
21
19
 
22
- state: TraversalState
23
-
24
20
  def __init__(
25
21
  self,
26
- arch,
22
+ project: Project,
27
23
  simos,
28
24
  sp_tracker=None,
29
25
  bp_as_gpr: bool = False,
30
26
  def_to_loc=None,
31
27
  loc_to_defs=None,
32
28
  stackvars: bool = False,
33
- tmps: bool = False,
29
+ use_tmps: bool = False,
34
30
  ):
35
- super().__init__()
36
-
37
- self.arch = arch
31
+ super().__init__(project)
38
32
  self.simos = simos
39
33
  self.sp_tracker = sp_tracker
40
34
  self.bp_as_gpr = bp_as_gpr
41
35
  self.stackvars = stackvars
42
- self.tmps = tmps
36
+ self.use_tmps = use_tmps
43
37
 
44
38
  self.def_to_loc = def_to_loc if def_to_loc is not None else []
45
39
  self.loc_to_defs = loc_to_defs if loc_to_defs is not None else OrderedDict()
46
40
 
47
- def _handle_Assignment(self, stmt: Assignment):
41
+ def _is_top(self, expr):
42
+ return True
43
+
44
+ def _top(self, bits):
45
+ return None
46
+
47
+ def _process_block_end(self, block, stmt_data, whitelist):
48
+ pass
49
+
50
+ def _handle_stmt_Assignment(self, stmt):
48
51
  if isinstance(stmt.dst, Register):
49
52
  codeloc = self._codeloc()
50
53
  self.def_to_loc.append((stmt.dst, codeloc))
@@ -57,7 +60,7 @@ class SimEngineSSATraversal(
57
60
 
58
61
  self._expr(stmt.src)
59
62
 
60
- def _handle_Store(self, stmt: Store):
63
+ def _handle_stmt_Store(self, stmt: Store):
61
64
  self._expr(stmt.addr)
62
65
  self._expr(stmt.data)
63
66
  if stmt.guard is not None:
@@ -72,14 +75,14 @@ class SimEngineSSATraversal(
72
75
 
73
76
  self.state.live_stackvars.add((stmt.addr.offset, stmt.size))
74
77
 
75
- def _handle_ConditionalJump(self, stmt: ConditionalJump):
78
+ def _handle_stmt_ConditionalJump(self, stmt: ConditionalJump):
76
79
  self._expr(stmt.condition)
77
80
  if stmt.true_target is not None:
78
81
  self._expr(stmt.true_target)
79
82
  if stmt.false_target is not None:
80
83
  self._expr(stmt.false_target)
81
84
 
82
- def _handle_Call(self, stmt: Call):
85
+ def _handle_stmt_Call(self, stmt: Call):
83
86
 
84
87
  # kill caller-saved registers
85
88
  cc = (
@@ -87,6 +90,7 @@ class SimEngineSSATraversal(
87
90
  if stmt.calling_convention is None
88
91
  else stmt.calling_convention
89
92
  )
93
+ assert cc is not None
90
94
  for reg_name in cc.CALLER_SAVED_REGS:
91
95
  reg_offset = self.arch.registers[reg_name][0]
92
96
  base_off = get_reg_offset_base(reg_offset, self.arch)
@@ -102,11 +106,22 @@ class SimEngineSSATraversal(
102
106
  base_off = get_reg_offset_base(stmt.ret_expr.reg_offset, self.arch)
103
107
  self.state.live_registers.add(base_off)
104
108
 
105
- super()._ail_handle_Call(stmt)
109
+ def _handle_stmt_Dummy(self, stmt):
110
+ pass
111
+
112
+ def _handle_stmt_DirtyStatement(self, stmt):
113
+ self._expr(stmt.dirty)
114
+
115
+ def _handle_stmt_Jump(self, stmt):
116
+ self._expr(stmt.target)
106
117
 
107
- _handle_CallExpr = _handle_Call
118
+ _handle_stmt_Label = _handle_stmt_Dummy
108
119
 
109
- def _handle_Register(self, expr: Register):
120
+ def _handle_stmt_Return(self, stmt):
121
+ for expr in stmt.ret_exprs:
122
+ self._expr(expr)
123
+
124
+ def _handle_expr_Register(self, expr: Register):
110
125
  base_offset = get_reg_offset_base(expr.reg_offset, self.arch)
111
126
 
112
127
  if base_offset not in self.state.live_registers:
@@ -118,8 +133,8 @@ class SimEngineSSATraversal(
118
133
 
119
134
  self.state.live_registers.add(base_offset)
120
135
 
121
- def _handle_Tmp(self, expr: Tmp):
122
- if self.tmps:
136
+ def _handle_expr_Tmp(self, expr: Tmp):
137
+ if self.use_tmps:
123
138
  codeloc = self._codeloc()
124
139
  self.def_to_loc.append((expr, codeloc))
125
140
  if codeloc not in self.loc_to_defs:
@@ -128,39 +143,99 @@ class SimEngineSSATraversal(
128
143
 
129
144
  self.state.live_tmps.add(expr.tmp_idx)
130
145
 
131
- def _handle_Cmp(self, expr: BinaryOp):
146
+ def _handle_binop_Default(self, expr: BinaryOp):
132
147
  self._expr(expr.operands[0])
133
148
  self._expr(expr.operands[1])
134
149
 
135
- _handle_CmpLE = _handle_Cmp
136
- _handle_CmpLT = _handle_Cmp
137
- _handle_CmpGE = _handle_Cmp
138
- _handle_CmpGT = _handle_Cmp
139
- _handle_CmpEQ = _handle_Cmp
140
- _handle_CmpNE = _handle_Cmp
150
+ _handle_binop_CmpLE = _handle_binop_Default
151
+ _handle_binop_CmpLT = _handle_binop_Default
152
+ _handle_binop_CmpGE = _handle_binop_Default
153
+ _handle_binop_CmpGT = _handle_binop_Default
154
+ _handle_binop_CmpEQ = _handle_binop_Default
155
+ _handle_binop_CmpNE = _handle_binop_Default
156
+ _handle_binop_Add = _handle_binop_Default
157
+ _handle_binop_AddF = _handle_binop_Default
158
+ _handle_binop_AddV = _handle_binop_Default
159
+ _handle_binop_And = _handle_binop_Default
160
+ _handle_binop_Carry = _handle_binop_Default
161
+ _handle_binop_CmpF = _handle_binop_Default
162
+ _handle_binop_Concat = _handle_binop_Default
163
+ _handle_binop_Div = _handle_binop_Default
164
+ _handle_binop_DivF = _handle_binop_Default
165
+ _handle_binop_DivV = _handle_binop_Default
166
+ _handle_binop_LogicalAnd = _handle_binop_Default
167
+ _handle_binop_LogicalOr = _handle_binop_Default
168
+ _handle_binop_Mod = _handle_binop_Default
169
+ _handle_binop_Mul = _handle_binop_Default
170
+ _handle_binop_Mull = _handle_binop_Default
171
+ _handle_binop_MulF = _handle_binop_Default
172
+ _handle_binop_MulV = _handle_binop_Default
173
+ _handle_binop_MulHiV = _handle_binop_Default
174
+ _handle_binop_Or = _handle_binop_Default
175
+ _handle_binop_Rol = _handle_binop_Default
176
+ _handle_binop_Ror = _handle_binop_Default
177
+ _handle_binop_SBorrow = _handle_binop_Default
178
+ _handle_binop_SCarry = _handle_binop_Default
179
+ _handle_binop_Sar = _handle_binop_Default
180
+ _handle_binop_Shl = _handle_binop_Default
181
+ _handle_binop_Shr = _handle_binop_Default
182
+ _handle_binop_Sub = _handle_binop_Default
183
+ _handle_binop_SubF = _handle_binop_Default
184
+ _handle_binop_SubV = _handle_binop_Default
185
+ _handle_binop_Xor = _handle_binop_Default
186
+ _handle_binop_InterleaveLOV = _handle_binop_Default
187
+ _handle_binop_InterleaveHIV = _handle_binop_Default
188
+ _handle_binop_CasCmpEQ = _handle_binop_Default
189
+ _handle_binop_CasCmpNE = _handle_binop_Default
190
+ _handle_binop_ExpCmpNE = _handle_binop_Default
191
+ _handle_binop_SarNV = _handle_binop_Default
192
+ _handle_binop_ShrNV = _handle_binop_Default
193
+ _handle_binop_ShlNV = _handle_binop_Default
194
+ _handle_binop_CmpEQV = _handle_binop_Default
195
+ _handle_binop_CmpNEV = _handle_binop_Default
196
+ _handle_binop_CmpGEV = _handle_binop_Default
197
+ _handle_binop_CmpGTV = _handle_binop_Default
198
+ _handle_binop_CmpLEV = _handle_binop_Default
199
+ _handle_binop_CmpLTV = _handle_binop_Default
200
+ _handle_binop_MinV = _handle_binop_Default
201
+ _handle_binop_MaxV = _handle_binop_Default
202
+ _handle_binop_QAddV = _handle_binop_Default
203
+ _handle_binop_QNarrowBinV = _handle_binop_Default
204
+ _handle_binop_PermV = _handle_binop_Default
205
+ _handle_binop_Set = _handle_binop_Default
206
+
207
+ def _handle_unop_Default(self, expr):
208
+ self._expr(expr.operands[0])
141
209
 
142
- def _handle_UnaryOp(self, expr):
210
+ _handle_unop_BitwiseNeg = _handle_unop_Default
211
+ _handle_unop_Dereference = _handle_unop_Default
212
+ _handle_unop_Neg = _handle_unop_Default
213
+ _handle_unop_Not = _handle_unop_Default
214
+ _handle_unop_Reference = _handle_unop_Default
215
+ _handle_unop_Clz = _handle_unop_Default
216
+ _handle_unop_Ctz = _handle_unop_Default
217
+ _handle_unop_GetMSBs = _handle_unop_Default
218
+ _handle_unop_unpack = _handle_unop_Default
219
+ _handle_unop_Sqrt = _handle_unop_Default
220
+ _handle_unop_RSqrtEst = _handle_unop_Default
221
+
222
+ def _handle_expr_UnaryOp(self, expr):
143
223
  self._expr(expr.operand)
144
224
 
145
- def _handle_BinaryOp(self, expr):
146
- self._expr(expr.operands[0])
147
- self._expr(expr.operands[1])
148
-
149
- def _handle_TernaryOp(self, expr):
225
+ def _handle_expr_BinaryOp(self, expr):
150
226
  self._expr(expr.operands[0])
151
227
  self._expr(expr.operands[1])
152
- self._expr(expr.operands[2])
153
228
 
154
- def _handle_ITE(self, expr: ITE):
229
+ def _handle_expr_ITE(self, expr: ITE):
155
230
  self._expr(expr.cond)
156
231
  self._expr(expr.iftrue)
157
232
  self._expr(expr.iffalse)
158
233
 
159
- def _handle_VEXCCallExpression(self, expr: VEXCCallExpression):
234
+ def _handle_expr_VEXCCallExpression(self, expr: VEXCCallExpression):
160
235
  for operand in expr.operands:
161
236
  self._expr(operand)
162
237
 
163
- def _handle_DirtyExpression(self, expr: DirtyExpression):
238
+ def _handle_expr_DirtyExpression(self, expr: DirtyExpression):
164
239
  for operand in expr.operands:
165
240
  self._expr(operand)
166
241
  if expr.guard is not None:
@@ -171,5 +246,13 @@ class SimEngineSSATraversal(
171
246
  def _handle_Dummy(self, expr):
172
247
  pass
173
248
 
174
- _handle_VirtualVariable = _handle_Dummy
175
- _handle_Phi = _handle_Dummy
249
+ _handle_expr_VirtualVariable = _handle_Dummy
250
+ _handle_expr_Phi = _handle_Dummy
251
+ _handle_expr_Load = _handle_Dummy
252
+ _handle_expr_Convert = _handle_Dummy
253
+ _handle_expr_Const = _handle_Dummy
254
+ _handle_expr_MultiStatementExpression = _handle_Dummy
255
+ _handle_expr_Reinterpret = _handle_Dummy
256
+ _handle_expr_StackBaseOffset = _handle_Dummy
257
+ _handle_expr_BasePointerOffset = _handle_Dummy
258
+ _handle_expr_Call = _handle_Dummy
@@ -14,12 +14,12 @@ from .dummy import DummyStructuredCodeGenerator
14
14
 
15
15
  __all__ = (
16
16
  "BaseStructuredCodeGenerator",
17
- "InstructionMapping",
18
- "InstructionMappingElement",
19
- "PositionMappingElement",
20
- "PositionMapping",
21
17
  "CStructuredCodeGenerator",
22
18
  "CStructuredCodeWalker",
23
- "ImportSourceCode",
24
19
  "DummyStructuredCodeGenerator",
20
+ "ImportSourceCode",
21
+ "InstructionMapping",
22
+ "InstructionMappingElement",
23
+ "PositionMapping",
24
+ "PositionMappingElement",
25
25
  )
@@ -9,7 +9,7 @@ from angr.sim_variable import SimVariable
9
9
 
10
10
 
11
11
  class PositionMappingElement:
12
- __slots__ = ("start", "length", "obj")
12
+ __slots__ = ("length", "obj", "start")
13
13
 
14
14
  def __init__(self, start, length, obj):
15
15
  self.start: int = start
@@ -20,7 +20,7 @@ class PositionMappingElement:
20
20
  return self.start <= offset < self.start + self.length
21
21
 
22
22
  def __repr__(self):
23
- return "<%d-%d: %s>" % (self.start, self.start + self.length, self.obj)
23
+ return f"<{self.start}-{self.start + self.length}: {self.obj}>"
24
24
 
25
25
 
26
26
  class PositionMapping:
@@ -79,7 +79,7 @@ class InstructionMappingElement:
79
79
  return self.ins_addr == offset
80
80
 
81
81
  def __repr__(self):
82
- return "<%d: %d>" % (self.ins_addr, self.posmap_pos)
82
+ return f"<{self.ins_addr}: {self.posmap_pos}>"
83
83
 
84
84
 
85
85
  class InstructionMapping:
@@ -33,6 +33,7 @@ from angr.sim_type import (
33
33
  dereference_simtype,
34
34
  SimTypeInt128,
35
35
  SimTypeInt256,
36
+ SimTypeInt512,
36
37
  )
37
38
  from angr.knowledge_plugins.functions import Function
38
39
  from angr.sim_variable import SimVariable, SimTemporaryVariable, SimStackVariable, SimMemoryVariable
@@ -387,16 +388,16 @@ class CFunction(CConstruct): # pylint:disable=abstract-method
387
388
 
388
389
  __slots__ = (
389
390
  "addr",
390
- "name",
391
- "functy",
392
391
  "arg_list",
393
- "statements",
394
- "variables_in_use",
395
- "variable_manager",
396
392
  "demangled_name",
397
- "unified_local_vars",
398
- "show_demangled_name",
393
+ "functy",
394
+ "name",
399
395
  "omit_header",
396
+ "show_demangled_name",
397
+ "statements",
398
+ "unified_local_vars",
399
+ "variable_manager",
400
+ "variables_in_use",
400
401
  )
401
402
 
402
403
  def __init__(
@@ -491,7 +492,7 @@ class CFunction(CConstruct): # pylint:disable=abstract-method
491
492
  if variable.name:
492
493
  name = variable.name
493
494
  elif isinstance(variable, SimTemporaryVariable):
494
- name = "tmp_%d" % variable.tmp_id
495
+ name = f"tmp_{variable.tmp_id}"
495
496
  else:
496
497
  name = str(variable)
497
498
 
@@ -727,8 +728,8 @@ class CWhileLoop(CLoop):
727
728
  """
728
729
 
729
730
  __slots__ = (
730
- "condition",
731
731
  "body",
732
+ "condition",
732
733
  "tags",
733
734
  )
734
735
 
@@ -775,8 +776,8 @@ class CDoWhileLoop(CLoop):
775
776
  """
776
777
 
777
778
  __slots__ = (
778
- "condition",
779
779
  "body",
780
+ "condition",
780
781
  "tags",
781
782
  )
782
783
 
@@ -825,7 +826,7 @@ class CForLoop(CStatement):
825
826
  Represents a for-loop in C.
826
827
  """
827
828
 
828
- __slots__ = ("initializer", "condition", "iterator", "body", "tags")
829
+ __slots__ = ("body", "condition", "initializer", "iterator", "tags")
829
830
 
830
831
  def __init__(self, initializer, condition, iterator, body, tags=None, **kwargs):
831
832
  super().__init__(**kwargs)
@@ -877,7 +878,7 @@ class CIfElse(CStatement):
877
878
  Represents an if-else construct in C.
878
879
  """
879
880
 
880
- __slots__ = ("condition_and_nodes", "else_node", "simplify_else_scope", "cstyle_ifs", "tags")
881
+ __slots__ = ("condition_and_nodes", "cstyle_ifs", "else_node", "simplify_else_scope", "tags")
881
882
 
882
883
  def __init__(
883
884
  self,
@@ -1084,7 +1085,7 @@ class CSwitchCase(CStatement):
1084
1085
  Represents a switch-case statement in C.
1085
1086
  """
1086
1087
 
1087
- __slots__ = ("switch", "cases", "default", "tags")
1088
+ __slots__ = ("cases", "default", "switch", "tags")
1088
1089
 
1089
1090
  def __init__(self, switch, cases, default, tags=None, **kwargs):
1090
1091
  super().__init__(**kwargs)
@@ -1143,7 +1144,7 @@ class CIncompleteSwitchCase(CStatement):
1143
1144
  structuring fails (for whatever reason).
1144
1145
  """
1145
1146
 
1146
- __slots__ = ("head", "cases", "tags")
1147
+ __slots__ = ("cases", "head", "tags")
1147
1148
 
1148
1149
  def __init__(self, head, cases, tags=None, **kwargs):
1149
1150
  super().__init__(**kwargs)
@@ -1250,15 +1251,15 @@ class CFunctionCall(CStatement, CExpression):
1250
1251
  """
1251
1252
 
1252
1253
  __slots__ = (
1253
- "callee_target",
1254
- "callee_func",
1255
1254
  "args",
1256
- "returning",
1257
- "ret_expr",
1258
- "tags",
1255
+ "callee_func",
1256
+ "callee_target",
1259
1257
  "is_expr",
1258
+ "ret_expr",
1259
+ "returning",
1260
1260
  "show_demangled_name",
1261
1261
  "show_disambiguated_name",
1262
+ "tags",
1262
1263
  )
1263
1264
 
1264
1265
  def __init__(
@@ -1396,9 +1397,9 @@ class CReturn(CStatement):
1396
1397
 
1397
1398
  class CGoto(CStatement):
1398
1399
  __slots__ = (
1400
+ "tags",
1399
1401
  "target",
1400
1402
  "target_idx",
1401
- "tags",
1402
1403
  )
1403
1404
 
1404
1405
  def __init__(self, target, target_idx, tags=None, **kwargs):
@@ -1480,9 +1481,9 @@ class CLabel(CStatement):
1480
1481
  """
1481
1482
 
1482
1483
  __slots__ = (
1483
- "name",
1484
- "ins_addr",
1485
1484
  "block_idx",
1485
+ "ins_addr",
1486
+ "name",
1486
1487
  "tags",
1487
1488
  )
1488
1489
 
@@ -1503,9 +1504,9 @@ class CLabel(CStatement):
1503
1504
 
1504
1505
  class CStructField(CExpression):
1505
1506
  __slots__ = (
1506
- "struct_type",
1507
- "offset",
1508
1507
  "field",
1508
+ "offset",
1509
+ "struct_type",
1509
1510
  "tags",
1510
1511
  )
1511
1512
 
@@ -1557,10 +1558,10 @@ class CVariable(CExpression):
1557
1558
  """
1558
1559
 
1559
1560
  __slots__ = (
1561
+ "tags",
1562
+ "unified_variable",
1560
1563
  "variable",
1561
1564
  "variable_type",
1562
- "unified_variable",
1563
- "tags",
1564
1565
  )
1565
1566
 
1566
1567
  def __init__(self, variable: SimVariable, unified_variable=None, variable_type=None, tags=None, **kwargs):
@@ -1582,7 +1583,7 @@ class CVariable(CExpression):
1582
1583
  if v.name:
1583
1584
  return v.name
1584
1585
  if isinstance(v, SimTemporaryVariable):
1585
- return "tmp_%d" % v.tmp_id
1586
+ return f"tmp_{v.tmp_id}"
1586
1587
  return str(v)
1587
1588
 
1588
1589
  def c_repr_chunks(self, indent=0, asexpr=False):
@@ -1765,7 +1766,7 @@ class CBinaryOp(CExpression):
1765
1766
  Binary operations.
1766
1767
  """
1767
1768
 
1768
- __slots__ = ("op", "lhs", "rhs", "tags", "common_type", "_cstyle_null_cmp")
1769
+ __slots__ = ("_cstyle_null_cmp", "common_type", "lhs", "op", "rhs", "tags")
1769
1770
 
1770
1771
  def __init__(self, op, lhs, rhs, tags: dict | None = None, **kwargs):
1771
1772
  super().__init__(**kwargs)
@@ -1869,7 +1870,6 @@ class CBinaryOp(CExpression):
1869
1870
  "Mul": self._c_repr_chunks_mul,
1870
1871
  "Mull": self._c_repr_chunks_mull,
1871
1872
  "Div": self._c_repr_chunks_div,
1872
- "DivMod": self._c_repr_chunks_divmod,
1873
1873
  "Mod": self._c_repr_chunks_mod,
1874
1874
  "And": self._c_repr_chunks_and,
1875
1875
  "Xor": self._c_repr_chunks_xor,
@@ -2038,9 +2038,9 @@ class CBinaryOp(CExpression):
2038
2038
 
2039
2039
  class CTypeCast(CExpression):
2040
2040
  __slots__ = (
2041
- "src_type",
2042
2041
  "dst_type",
2043
2042
  "expr",
2043
+ "src_type",
2044
2044
  "tags",
2045
2045
  )
2046
2046
 
@@ -2080,9 +2080,9 @@ class CTypeCast(CExpression):
2080
2080
 
2081
2081
  class CConstant(CExpression):
2082
2082
  __slots__ = (
2083
- "value",
2084
2083
  "reference_values",
2085
2084
  "tags",
2085
+ "value",
2086
2086
  )
2087
2087
 
2088
2088
  def __init__(self, value, type_: SimType, reference_values=None, tags: dict | None = None, **kwargs):
@@ -2133,11 +2133,8 @@ class CConstant(CExpression):
2133
2133
  result = False
2134
2134
  if isinstance(self.value, int):
2135
2135
  value_size = self._type.size if self._type is not None else None
2136
- if (
2137
- value_size == 32
2138
- and 0xF000_0000 <= self.value <= 0xFFFF_FFFF
2139
- or value_size == 64
2140
- and 0xF000_0000_0000_0000 <= self.value <= 0xFFFF_FFFF_FFFF_FFFF
2136
+ if (value_size == 32 and 0xF000_0000 <= self.value <= 0xFFFF_FFFF) or (
2137
+ value_size == 64 and 0xF000_0000_0000_0000 <= self.value <= 0xFFFF_FFFF_FFFF_FFFF
2141
2138
  ):
2142
2139
  result = True
2143
2140
 
@@ -2304,8 +2301,8 @@ class CRegister(CExpression):
2304
2301
  class CITE(CExpression):
2305
2302
  __slots__ = (
2306
2303
  "cond",
2307
- "iftrue",
2308
2304
  "iffalse",
2305
+ "iftrue",
2309
2306
  "tags",
2310
2307
  )
2311
2308
 
@@ -2339,7 +2336,7 @@ class CMultiStatementExpression(CExpression):
2339
2336
  (stmt0, stmt1, stmt2, expr)
2340
2337
  """
2341
2338
 
2342
- __slots__ = ("stmts", "expr", "tags")
2339
+ __slots__ = ("expr", "stmts", "tags")
2343
2340
 
2344
2341
  def __init__(self, stmts: CStatements, expr: CExpression, tags=None, **kwargs):
2345
2342
  super().__init__(**kwargs)
@@ -3465,7 +3462,7 @@ class CStructuredCodeGenerator(BaseStructuredCodeGenerator, Analysis):
3465
3462
 
3466
3463
  def _handle_Expr_Tmp(self, expr: Tmp, **kwargs):
3467
3464
  l.warning("FIXME: Leftover Tmp expressions are found.")
3468
- return self._variable(SimTemporaryVariable(expr.tmp_idx), expr.size)
3465
+ return self._variable(SimTemporaryVariable(expr.tmp_idx, expr.bits), expr.size)
3469
3466
 
3470
3467
  def _handle_Expr_Const(self, expr: Expr.Const, type_=None, reference_values=None, variable=None, **kwargs):
3471
3468
  inline_string = False
@@ -3590,7 +3587,9 @@ class CStructuredCodeGenerator(BaseStructuredCodeGenerator, Analysis):
3590
3587
  def _handle_Expr_Convert(self, expr: Expr.Convert, **kwargs):
3591
3588
  # width of converted type is easy
3592
3589
  dst_type: SimTypeInt | SimTypeChar
3593
- if 258 >= expr.to_bits > 128:
3590
+ if 512 >= expr.to_bits > 256:
3591
+ dst_type = SimTypeInt512()
3592
+ elif 256 >= expr.to_bits > 128:
3594
3593
  dst_type = SimTypeInt256()
3595
3594
  elif 128 >= expr.to_bits > 64:
3596
3595
  dst_type = SimTypeInt128()
@@ -20,11 +20,11 @@ def structurer_class_from_name(name: str) -> type | None:
20
20
 
21
21
 
22
22
  __all__ = (
23
+ "DEFAULT_STRUCTURER",
24
+ "STRUCTURER_CLASSES",
23
25
  "DreamStructurer",
24
26
  "PhoenixStructurer",
25
- "SAILRStructurer",
26
27
  "RecursiveStructurer",
27
- "STRUCTURER_CLASSES",
28
- "DEFAULT_STRUCTURER",
28
+ "SAILRStructurer",
29
29
  "structurer_class_from_name",
30
30
  )