angr 9.2.130__py3-none-manylinux2014_aarch64.whl → 9.2.132__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 (127) hide show
  1. angr/__init__.py +1 -1
  2. angr/analyses/analysis.py +6 -2
  3. angr/analyses/cfg/cfg_emulated.py +5 -5
  4. angr/analyses/cfg/cfg_fast.py +2 -2
  5. angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +139 -94
  6. angr/analyses/cfg/indirect_jump_resolvers/x86_elf_pic_plt.py +1 -1
  7. angr/analyses/ddg.py +14 -11
  8. angr/analyses/decompiler/ail_simplifier.py +3 -2
  9. angr/analyses/decompiler/block_simplifier.py +10 -21
  10. angr/analyses/decompiler/clinic.py +361 -8
  11. angr/analyses/decompiler/condition_processor.py +12 -10
  12. angr/analyses/decompiler/dephication/graph_rewriting.py +1 -1
  13. angr/analyses/decompiler/dephication/rewriting_engine.py +169 -45
  14. angr/analyses/decompiler/dephication/seqnode_dephication.py +5 -4
  15. angr/analyses/decompiler/optimization_passes/__init__.py +0 -3
  16. angr/analyses/decompiler/optimization_passes/const_derefs.py +1 -0
  17. angr/analyses/decompiler/optimization_passes/div_simplifier.py +41 -16
  18. angr/analyses/decompiler/optimization_passes/engine_base.py +261 -83
  19. angr/analyses/decompiler/optimization_passes/inlined_string_transformation_simplifier.py +173 -35
  20. angr/analyses/decompiler/optimization_passes/mod_simplifier.py +5 -2
  21. angr/analyses/decompiler/optimization_passes/optimization_pass.py +39 -19
  22. angr/analyses/decompiler/peephole_optimizations/__init__.py +5 -1
  23. angr/analyses/decompiler/peephole_optimizations/a_mul_const_sub_a.py +34 -0
  24. angr/analyses/decompiler/peephole_optimizations/a_shl_const_sub_a.py +3 -1
  25. angr/analyses/decompiler/peephole_optimizations/bswap.py +10 -6
  26. angr/analyses/decompiler/peephole_optimizations/eager_eval.py +100 -19
  27. angr/analyses/decompiler/peephole_optimizations/remove_noop_conversions.py +17 -0
  28. angr/analyses/decompiler/peephole_optimizations/remove_redundant_conversions.py +42 -3
  29. angr/analyses/decompiler/peephole_optimizations/remove_redundant_shifts.py +4 -2
  30. angr/analyses/decompiler/peephole_optimizations/rol_ror.py +37 -10
  31. angr/analyses/decompiler/peephole_optimizations/shl_to_mul.py +25 -0
  32. angr/analyses/decompiler/peephole_optimizations/utils.py +18 -0
  33. angr/analyses/decompiler/presets/fast.py +0 -2
  34. angr/analyses/decompiler/presets/full.py +0 -2
  35. angr/analyses/decompiler/ssailification/rewriting.py +1 -2
  36. angr/analyses/decompiler/ssailification/rewriting_engine.py +140 -57
  37. angr/analyses/decompiler/ssailification/ssailification.py +2 -1
  38. angr/analyses/decompiler/ssailification/traversal.py +4 -6
  39. angr/analyses/decompiler/ssailification/traversal_engine.py +125 -42
  40. angr/analyses/decompiler/structured_codegen/c.py +79 -16
  41. angr/analyses/decompiler/structuring/phoenix.py +40 -14
  42. angr/analyses/decompiler/structuring/structurer_nodes.py +9 -0
  43. angr/analyses/deobfuscator/irsb_reg_collector.py +29 -60
  44. angr/analyses/deobfuscator/string_obf_finder.py +2 -2
  45. angr/analyses/init_finder.py +47 -22
  46. angr/analyses/propagator/engine_base.py +21 -14
  47. angr/analyses/propagator/engine_vex.py +149 -179
  48. angr/analyses/propagator/propagator.py +10 -28
  49. angr/analyses/propagator/top_checker_mixin.py +211 -5
  50. angr/analyses/propagator/vex_vars.py +1 -1
  51. angr/analyses/reaching_definitions/dep_graph.py +1 -1
  52. angr/analyses/reaching_definitions/engine_ail.py +304 -329
  53. angr/analyses/reaching_definitions/engine_vex.py +243 -229
  54. angr/analyses/reaching_definitions/function_handler.py +3 -3
  55. angr/analyses/reaching_definitions/rd_state.py +37 -32
  56. angr/analyses/s_propagator.py +38 -5
  57. angr/analyses/s_reaching_definitions/s_reaching_definitions.py +9 -5
  58. angr/analyses/typehoon/simple_solver.py +16 -7
  59. angr/analyses/typehoon/translator.py +8 -0
  60. angr/analyses/typehoon/typeconsts.py +10 -2
  61. angr/analyses/typehoon/typehoon.py +4 -1
  62. angr/analyses/typehoon/typevars.py +9 -7
  63. angr/analyses/variable_recovery/engine_ail.py +296 -256
  64. angr/analyses/variable_recovery/engine_base.py +137 -116
  65. angr/analyses/variable_recovery/engine_vex.py +175 -185
  66. angr/analyses/variable_recovery/irsb_scanner.py +49 -38
  67. angr/analyses/variable_recovery/variable_recovery.py +28 -5
  68. angr/analyses/variable_recovery/variable_recovery_base.py +32 -33
  69. angr/analyses/variable_recovery/variable_recovery_fast.py +2 -2
  70. angr/analyses/xrefs.py +46 -19
  71. angr/annocfg.py +19 -14
  72. angr/block.py +4 -9
  73. angr/calling_conventions.py +1 -1
  74. angr/engines/engine.py +30 -14
  75. angr/engines/light/__init__.py +11 -3
  76. angr/engines/light/engine.py +1003 -1185
  77. angr/engines/pcode/cc.py +2 -0
  78. angr/engines/successors.py +13 -9
  79. angr/engines/vex/claripy/datalayer.py +1 -1
  80. angr/engines/vex/claripy/irop.py +14 -3
  81. angr/engines/vex/light/slicing.py +2 -2
  82. angr/exploration_techniques/__init__.py +1 -124
  83. angr/exploration_techniques/base.py +126 -0
  84. angr/exploration_techniques/bucketizer.py +1 -1
  85. angr/exploration_techniques/dfs.py +3 -1
  86. angr/exploration_techniques/director.py +2 -3
  87. angr/exploration_techniques/driller_core.py +1 -1
  88. angr/exploration_techniques/explorer.py +4 -2
  89. angr/exploration_techniques/lengthlimiter.py +2 -1
  90. angr/exploration_techniques/local_loop_seer.py +2 -1
  91. angr/exploration_techniques/loop_seer.py +5 -5
  92. angr/exploration_techniques/manual_mergepoint.py +2 -1
  93. angr/exploration_techniques/memory_watcher.py +3 -1
  94. angr/exploration_techniques/oppologist.py +4 -5
  95. angr/exploration_techniques/slicecutor.py +4 -2
  96. angr/exploration_techniques/spiller.py +1 -1
  97. angr/exploration_techniques/stochastic.py +2 -1
  98. angr/exploration_techniques/stub_stasher.py +2 -1
  99. angr/exploration_techniques/suggestions.py +3 -1
  100. angr/exploration_techniques/symbion.py +3 -1
  101. angr/exploration_techniques/tech_builder.py +2 -1
  102. angr/exploration_techniques/threading.py +4 -7
  103. angr/exploration_techniques/timeout.py +4 -2
  104. angr/exploration_techniques/tracer.py +4 -3
  105. angr/exploration_techniques/unique.py +3 -2
  106. angr/exploration_techniques/veritesting.py +1 -1
  107. angr/knowledge_plugins/key_definitions/atoms.py +2 -2
  108. angr/knowledge_plugins/key_definitions/live_definitions.py +16 -13
  109. angr/knowledge_plugins/propagations/states.py +13 -8
  110. angr/knowledge_plugins/variables/variable_manager.py +23 -9
  111. angr/sim_manager.py +1 -3
  112. angr/sim_state.py +39 -41
  113. angr/sim_type.py +5 -0
  114. angr/sim_variable.py +29 -28
  115. angr/utils/bits.py +17 -0
  116. angr/utils/formatting.py +4 -1
  117. angr/utils/orderedset.py +4 -1
  118. angr/utils/ssa/__init__.py +21 -3
  119. {angr-9.2.130.dist-info → angr-9.2.132.dist-info}/METADATA +6 -6
  120. {angr-9.2.130.dist-info → angr-9.2.132.dist-info}/RECORD +124 -123
  121. angr/analyses/decompiler/optimization_passes/multi_simplifier.py +0 -223
  122. angr/analyses/propagator/engine_ail.py +0 -1562
  123. angr/storage/memory_mixins/__init__.pyi +0 -48
  124. {angr-9.2.130.dist-info → angr-9.2.132.dist-info}/LICENSE +0 -0
  125. {angr-9.2.130.dist-info → angr-9.2.132.dist-info}/WHEEL +0 -0
  126. {angr-9.2.130.dist-info → angr-9.2.132.dist-info}/entry_points.txt +0 -0
  127. {angr-9.2.130.dist-info → angr-9.2.132.dist-info}/top_level.txt +0 -0
@@ -1,223 +0,0 @@
1
- from __future__ import annotations
2
- import logging
3
-
4
- from ailment import Expr
5
- from unique_log_filter import UniqueLogFilter
6
-
7
- from .engine_base import SimplifierAILEngine, SimplifierAILState
8
- from .optimization_pass import OptimizationPass, OptimizationPassStage
9
-
10
- _l = logging.getLogger(name=__name__)
11
- _l.addFilter(UniqueLogFilter())
12
-
13
-
14
- class MultiSimplifierAILEngine(SimplifierAILEngine):
15
- """
16
- An AIL pass for the multi simplifier
17
- """
18
-
19
- def _ail_handle_Add(self, expr):
20
- operand_0 = self._expr(expr.operands[0])
21
- operand_1 = self._expr(expr.operands[1])
22
-
23
- # x + x = 2*x
24
- if (
25
- type(operand_0) in [Expr.Convert, Expr.VirtualVariable]
26
- and isinstance(operand_1, (Expr.Convert, Expr.VirtualVariable))
27
- and operand_0 == operand_1
28
- ):
29
- count = Expr.Const(expr.idx, None, 2, operand_1.bits)
30
- return Expr.BinaryOp(expr.idx, "Mul", [operand_1, count], expr.signed, **expr.tags)
31
- # 2*x + x = 3*x
32
- if Expr.BinaryOp in [type(operand_0), type(operand_1)]:
33
- if (
34
- isinstance(operand_1, Expr.BinaryOp)
35
- and operand_1.op == "Mul"
36
- and (
37
- not isinstance(operand_0, Expr.BinaryOp)
38
- or (isinstance(operand_0, Expr.BinaryOp) and operand_0.op != "Mul")
39
- )
40
- ):
41
- x0 = operand_0
42
- x1_index = 0 if isinstance(operand_1.operands[1], Expr.Const) else 1
43
- x1 = operand_1.operands[x1_index]
44
- const_x1 = operand_1.operands[1 - x1_index]
45
- if x0 == x1:
46
- new_const = Expr.Const(const_x1.idx, None, const_x1.value + 1, const_x1.bits)
47
- return Expr.BinaryOp(expr.idx, "Mul", [x0, new_const], expr.signed, **expr.tags)
48
- elif (
49
- isinstance(operand_0, Expr.BinaryOp)
50
- and operand_0.op == "Mul"
51
- and (
52
- not isinstance(operand_1, Expr.BinaryOp)
53
- or (isinstance(operand_1, Expr.BinaryOp) and operand_1.op != "Mul")
54
- )
55
- ):
56
- x1 = operand_1
57
- x0_index = 0 if isinstance(operand_0.operands[1], Expr.Const) else 1
58
- x0 = operand_0.operands[x0_index]
59
- const_x0 = operand_0.operands[1 - x0_index]
60
- if x0 == x1:
61
- new_const = Expr.Const(const_x0.idx, None, const_x0.value + 1, const_x0.bits)
62
- return Expr.BinaryOp(expr.idx, "Mul", [x1, new_const], expr.signed, **expr.tags)
63
- # 2*x + 3*x = 5*x
64
- elif (
65
- isinstance(operand_0, Expr.BinaryOp)
66
- and isinstance(operand_1, Expr.BinaryOp)
67
- and operand_0.op == "Mul"
68
- and operand_1.op == "Mul"
69
- ):
70
- if Expr.Const in [type(operand_0.operands[0]), type(operand_0.operands[1])] and Expr.Const in [
71
- type(operand_1.operands[0]),
72
- type(operand_1.operands[1]),
73
- ]:
74
- x0_index = 0 if isinstance(operand_0.operands[1], Expr.Const) else 1
75
- x0 = operand_0.operands[x0_index]
76
- const_x0 = operand_0.operands[1 - x0_index]
77
-
78
- x1_index = 0 if isinstance(operand_1.operands[1], Expr.Const) else 1
79
- x1 = operand_1.operands[x1_index]
80
- const_x1 = operand_1.operands[1 - x1_index]
81
- if x0 == x1:
82
- new_const = Expr.Const(const_x1.idx, None, const_x1.value + const_x0.value, const_x1.bits)
83
- return Expr.BinaryOp(expr.idx, "Mul", [x0, new_const], expr.signed, **expr.tags)
84
-
85
- if (operand_0, operand_1) != (expr.operands[0], expr.operands[1]):
86
- return Expr.BinaryOp(expr.idx, "Add", [operand_0, operand_1], expr.signed, **expr.tags)
87
- return expr
88
-
89
- def _ail_handle_Sub(self, expr):
90
- operand_0 = self._expr(expr.operands[0])
91
- operand_1 = self._expr(expr.operands[1])
92
-
93
- # x + x = 2*x
94
- if (
95
- type(operand_0) in [Expr.Convert, Expr.VirtualVariable]
96
- and isinstance(operand_1, (Expr.Convert, Expr.VirtualVariable))
97
- and operand_0 == operand_1
98
- ):
99
- count = Expr.Const(expr.idx, None, 0, 8)
100
- return Expr.BinaryOp(expr.idx, "Mul", [operand_1, count], expr.signed, **expr.tags)
101
-
102
- # 2*x - x = x
103
- if Expr.BinaryOp in [type(operand_0), type(operand_1)]:
104
- if (
105
- isinstance(operand_1, Expr.BinaryOp)
106
- and operand_1.op == "Mul"
107
- and (
108
- not isinstance(operand_0, Expr.BinaryOp)
109
- or (isinstance(operand_0, Expr.BinaryOp) and operand_0.op != "Mul")
110
- )
111
- ):
112
- x0 = operand_0
113
- x1_index = 0 if isinstance(operand_1.operands[1], Expr.Const) else 1
114
- x1 = operand_1.operands[x1_index]
115
- const_x1 = operand_1.operands[1 - x1_index]
116
- if x0 == x1:
117
- new_const = Expr.Const(const_x1.idx, None, const_x1.value - 1, const_x1.bits)
118
- return Expr.BinaryOp(expr.idx, "Mul", [x0, new_const], expr.signed, **expr.tags)
119
- elif (
120
- isinstance(operand_0, Expr.BinaryOp)
121
- and operand_0.op == "Mul"
122
- and (
123
- not isinstance(operand_1, Expr.BinaryOp)
124
- or (isinstance(operand_1, Expr.BinaryOp) and operand_1.op != "Mul")
125
- )
126
- ):
127
- x1 = operand_1
128
- x0_index = 0 if isinstance(operand_0.operands[1], Expr.Const) else 1
129
- x0 = operand_0.operands[x0_index]
130
- const_x0 = operand_0.operands[1 - x0_index]
131
- if x0 == x1:
132
- new_const = Expr.Const(const_x0.idx, None, const_x0.value - 1, const_x0.bits)
133
- return Expr.BinaryOp(expr.idx, "Mul", [x1, new_const], expr.signed, **expr.tags)
134
- # 3*x - 2*x = x
135
- elif (
136
- isinstance(operand_0, Expr.BinaryOp)
137
- and isinstance(operand_1, Expr.BinaryOp)
138
- and operand_0.op == "Mul"
139
- and operand_1.op == "Mul"
140
- ):
141
- if Expr.Const in [type(operand_0.operands[0]), type(operand_0.operands[1])] and Expr.Const in [
142
- type(operand_1.operands[0]),
143
- type(operand_1.operands[1]),
144
- ]:
145
- x0_index = 0 if isinstance(operand_0.operands[1], Expr.Const) else 1
146
- x0 = operand_0.operands[x0_index]
147
- const_x0 = operand_0.operands[1 - x0_index]
148
-
149
- x1_index = 0 if isinstance(operand_1.operands[1], Expr.Const) else 1
150
- x1 = operand_1.operands[x1_index]
151
- const_x1 = operand_1.operands[1 - x1_index]
152
- if x0 == x1:
153
- new_const = Expr.Const(const_x1.idx, None, const_x0.value - const_x1.value, const_x1.bits)
154
- return Expr.BinaryOp(expr.idx, "Mul", [x0, new_const], expr.signed, **expr.tags)
155
-
156
- if (operand_0, operand_1) != (expr.operands[0], expr.operands[1]):
157
- return Expr.BinaryOp(expr.idx, "Sub", [operand_0, operand_1], expr.signed, **expr.tags)
158
- return expr
159
-
160
- def _ail_handle_Shl(self, expr):
161
- operand_0 = self._expr(expr.operands[0])
162
- operand_1 = self._expr(expr.operands[1])
163
-
164
- if isinstance(operand_1, Expr.Const):
165
- new_operand = Expr.Const(operand_1.idx, None, 2**operand_1.value, operand_0.bits)
166
- return Expr.BinaryOp(expr.idx, "Mul", [operand_0, new_operand], expr.signed, **expr.tags)
167
-
168
- if (operand_0, operand_1) != (expr.operands[0], expr.operands[1]):
169
- return Expr.BinaryOp(expr.idx, "Shl", [operand_0, operand_1], expr.signed, **expr.tags)
170
- return expr
171
-
172
- def _ail_handle_Mul(self, expr):
173
- operand_0 = self._expr(expr.operands[0])
174
- operand_1 = self._expr(expr.operands[1])
175
-
176
- if Expr.Const in [type(operand_0), type(operand_1)] and Expr.BinaryOp in [type(operand_0), type(operand_1)]:
177
- const_, x0 = (operand_0, operand_1) if isinstance(operand_0, Expr.Const) else (operand_1, operand_0)
178
- if x0.op == "Mul" and Expr.Const in [type(x0.operands[0]), type(x0.operands[1])]:
179
- if isinstance(x0.operands[0], Expr.Const):
180
- const_x0, x = x0.operands[0], x0.operands[1]
181
- else:
182
- const_x0, x = x0.operands[1], x0.operands[0]
183
- new_const = Expr.Const(const_.idx, None, const_.value * const_x0.value, const_.bits)
184
- return Expr.BinaryOp(expr.idx, "Mul", [x, new_const], expr.signed, **expr.tags)
185
-
186
- if (operand_0, operand_1) != (expr.operands[0], expr.operands[1]):
187
- return Expr.BinaryOp(expr.idx, "Mul", [operand_0, operand_1], expr.signed, **expr.tags)
188
- return expr
189
-
190
-
191
- class MultiSimplifier(OptimizationPass):
192
- """
193
- Implements several different arithmetic optimizations.
194
- """
195
-
196
- ARCHES = ["X86", "AMD64"]
197
- PLATFORMS = ["linux", "windows"]
198
- STAGE = OptimizationPassStage.AFTER_GLOBAL_SIMPLIFICATION
199
- NAME = "Simplify various arithmetic expressions"
200
- DESCRIPTION = __doc__.strip()
201
-
202
- def __init__(self, func, **kwargs):
203
- super().__init__(func, **kwargs)
204
-
205
- self.state = SimplifierAILState(self.project.arch)
206
- self.engine = MultiSimplifierAILEngine()
207
-
208
- self.analyze()
209
-
210
- def _check(self):
211
- return True, None
212
-
213
- def _analyze(self, cache=None):
214
- for block in list(self._graph.nodes()):
215
- new_block = block
216
- old_block = None
217
-
218
- while new_block != old_block:
219
- old_block = new_block
220
- new_block = self.engine.process(state=self.state.copy(), block=old_block.copy())
221
- _l.debug("new block: %s", new_block.statements)
222
-
223
- self._update_block(block, new_block)