angr 9.2.138__py3-none-manylinux2014_x86_64.whl → 9.2.140__py3-none-manylinux2014_x86_64.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.
- angr/__init__.py +1 -1
- angr/analyses/calling_convention/calling_convention.py +48 -21
- angr/analyses/calling_convention/fact_collector.py +59 -12
- angr/analyses/calling_convention/utils.py +2 -2
- angr/analyses/cfg/cfg_base.py +13 -0
- angr/analyses/cfg/cfg_fast.py +23 -4
- angr/analyses/decompiler/ail_simplifier.py +79 -53
- angr/analyses/decompiler/block_simplifier.py +0 -2
- angr/analyses/decompiler/callsite_maker.py +80 -14
- angr/analyses/decompiler/clinic.py +99 -80
- angr/analyses/decompiler/condition_processor.py +2 -2
- angr/analyses/decompiler/decompiler.py +19 -7
- angr/analyses/decompiler/dephication/rewriting_engine.py +16 -7
- angr/analyses/decompiler/expression_narrower.py +1 -1
- angr/analyses/decompiler/optimization_passes/__init__.py +3 -0
- angr/analyses/decompiler/optimization_passes/condition_constprop.py +149 -0
- angr/analyses/decompiler/optimization_passes/const_prop_reverter.py +8 -7
- angr/analyses/decompiler/optimization_passes/deadblock_remover.py +12 -3
- angr/analyses/decompiler/optimization_passes/inlined_string_transformation_simplifier.py +1 -1
- angr/analyses/decompiler/optimization_passes/ite_region_converter.py +21 -13
- angr/analyses/decompiler/optimization_passes/optimization_pass.py +21 -12
- angr/analyses/decompiler/optimization_passes/return_duplicator_base.py +17 -9
- angr/analyses/decompiler/optimization_passes/return_duplicator_high.py +7 -10
- angr/analyses/decompiler/peephole_optimizations/eager_eval.py +12 -1
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_conversions.py +61 -25
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_shifts.py +50 -1
- angr/analyses/decompiler/presets/fast.py +2 -0
- angr/analyses/decompiler/presets/full.py +2 -0
- angr/analyses/decompiler/region_simplifiers/expr_folding.py +259 -108
- angr/analyses/decompiler/region_simplifiers/region_simplifier.py +28 -9
- angr/analyses/decompiler/ssailification/rewriting_engine.py +20 -2
- angr/analyses/decompiler/ssailification/traversal_engine.py +4 -3
- angr/analyses/decompiler/structured_codegen/c.py +10 -3
- angr/analyses/decompiler/structuring/dream.py +28 -19
- angr/analyses/decompiler/structuring/phoenix.py +253 -89
- angr/analyses/decompiler/structuring/recursive_structurer.py +1 -0
- angr/analyses/decompiler/structuring/structurer_base.py +121 -46
- angr/analyses/decompiler/structuring/structurer_nodes.py +6 -1
- angr/analyses/decompiler/utils.py +60 -1
- angr/analyses/deobfuscator/api_obf_finder.py +13 -5
- angr/analyses/deobfuscator/api_obf_type2_finder.py +166 -0
- angr/analyses/deobfuscator/string_obf_finder.py +105 -18
- angr/analyses/forward_analysis/forward_analysis.py +1 -1
- angr/analyses/propagator/top_checker_mixin.py +6 -6
- angr/analyses/reaching_definitions/__init__.py +2 -1
- angr/analyses/reaching_definitions/dep_graph.py +1 -12
- angr/analyses/reaching_definitions/engine_vex.py +36 -31
- angr/analyses/reaching_definitions/function_handler.py +15 -2
- angr/analyses/reaching_definitions/rd_state.py +1 -37
- angr/analyses/reaching_definitions/reaching_definitions.py +13 -24
- angr/analyses/s_propagator.py +129 -87
- angr/analyses/s_reaching_definitions/s_rda_model.py +7 -1
- angr/analyses/s_reaching_definitions/s_rda_view.py +2 -2
- angr/analyses/s_reaching_definitions/s_reaching_definitions.py +3 -1
- angr/analyses/stack_pointer_tracker.py +36 -22
- angr/analyses/typehoon/simple_solver.py +45 -7
- angr/analyses/typehoon/typeconsts.py +18 -5
- angr/analyses/variable_recovery/engine_ail.py +1 -1
- angr/analyses/variable_recovery/engine_base.py +62 -67
- angr/analyses/variable_recovery/engine_vex.py +1 -1
- angr/analyses/variable_recovery/irsb_scanner.py +2 -2
- angr/block.py +69 -107
- angr/callable.py +14 -7
- angr/calling_conventions.py +81 -10
- angr/distributed/__init__.py +1 -1
- angr/engines/__init__.py +7 -8
- angr/engines/engine.py +3 -138
- angr/engines/failure.py +2 -2
- angr/engines/hook.py +2 -2
- angr/engines/light/engine.py +5 -10
- angr/engines/pcode/emulate.py +2 -2
- angr/engines/pcode/engine.py +2 -14
- angr/engines/pcode/lifter.py +2 -2
- angr/engines/procedure.py +2 -2
- angr/engines/soot/engine.py +2 -2
- angr/engines/soot/statements/switch.py +1 -1
- angr/engines/successors.py +123 -17
- angr/engines/syscall.py +2 -2
- angr/engines/unicorn.py +3 -3
- angr/engines/vex/heavy/heavy.py +3 -15
- angr/engines/vex/lifter.py +2 -2
- angr/engines/vex/light/light.py +2 -2
- angr/factory.py +4 -19
- angr/knowledge_plugins/cfg/cfg_model.py +3 -2
- angr/knowledge_plugins/key_definitions/atoms.py +8 -4
- angr/knowledge_plugins/key_definitions/live_definitions.py +41 -103
- angr/knowledge_plugins/labels.py +2 -2
- angr/knowledge_plugins/obfuscations.py +1 -0
- angr/knowledge_plugins/xrefs/xref_manager.py +4 -0
- angr/sim_type.py +19 -17
- angr/state_plugins/plugin.py +19 -4
- angr/storage/memory_mixins/memory_mixin.py +1 -1
- angr/storage/memory_mixins/paged_memory/pages/multi_values.py +10 -5
- angr/utils/ssa/__init__.py +119 -4
- {angr-9.2.138.dist-info → angr-9.2.140.dist-info}/METADATA +6 -6
- {angr-9.2.138.dist-info → angr-9.2.140.dist-info}/RECORD +100 -98
- {angr-9.2.138.dist-info → angr-9.2.140.dist-info}/LICENSE +0 -0
- {angr-9.2.138.dist-info → angr-9.2.140.dist-info}/WHEEL +0 -0
- {angr-9.2.138.dist-info → angr-9.2.140.dist-info}/entry_points.txt +0 -0
- {angr-9.2.138.dist-info → angr-9.2.140.dist-info}/top_level.txt +0 -0
angr/utils/ssa/__init__.py
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from collections import defaultdict
|
|
3
|
+
from collections.abc import Callable
|
|
3
4
|
from typing import Any, Literal, overload
|
|
4
5
|
|
|
6
|
+
import networkx
|
|
7
|
+
|
|
5
8
|
import archinfo
|
|
6
9
|
from ailment import Expression, Block
|
|
7
10
|
from ailment.expression import VirtualVariable, Const, Phi, Tmp, Load, Register, StackBaseOffset, DirtyExpression, ITE
|
|
8
|
-
from ailment.statement import Statement, Assignment, Call
|
|
11
|
+
from ailment.statement import Statement, Assignment, Call, Store
|
|
9
12
|
from ailment.block_walker import AILBlockWalkerBase
|
|
10
13
|
|
|
11
14
|
from angr.knowledge_plugins.key_definitions import atoms
|
|
@@ -153,19 +156,41 @@ class AILBlacklistExprTypeWalker(AILBlockWalkerBase):
|
|
|
153
156
|
Walks an AIL expression or statement and determines if it does not contain certain types of expressions.
|
|
154
157
|
"""
|
|
155
158
|
|
|
156
|
-
def __init__(self, blacklist_expr_types: tuple[type, ...]):
|
|
159
|
+
def __init__(self, blacklist_expr_types: tuple[type, ...], skip_if_contains_vvar: int | None = None):
|
|
157
160
|
super().__init__()
|
|
158
161
|
self.blacklist_expr_types = blacklist_expr_types
|
|
159
162
|
self.has_blacklisted_exprs = False
|
|
163
|
+
self.skip_if_contains_vvar = skip_if_contains_vvar
|
|
164
|
+
|
|
165
|
+
self._has_specified_vvar = False
|
|
160
166
|
|
|
161
167
|
def _handle_expr(
|
|
162
168
|
self, expr_idx: int, expr: Expression, stmt_idx: int, stmt: Statement | None, block: Block | None
|
|
163
169
|
) -> Any:
|
|
164
170
|
if isinstance(expr, self.blacklist_expr_types):
|
|
165
|
-
self.
|
|
166
|
-
|
|
171
|
+
if self.skip_if_contains_vvar is None:
|
|
172
|
+
self.has_blacklisted_exprs = True
|
|
173
|
+
return None
|
|
174
|
+
# otherwise we do a more complicated check
|
|
175
|
+
self._has_specified_vvar = False # we do not support nested blacklisted expr types
|
|
176
|
+
has_blacklisted_exprs = True
|
|
177
|
+
r = super()._handle_expr(expr_idx, expr, stmt_idx, stmt, block)
|
|
178
|
+
if self._has_specified_vvar is False:
|
|
179
|
+
# we have seen the vvar that we are looking for! ignore this match
|
|
180
|
+
self.has_blacklisted_exprs = has_blacklisted_exprs
|
|
181
|
+
return None
|
|
182
|
+
self._has_specified_vvar = False
|
|
183
|
+
return r
|
|
184
|
+
|
|
167
185
|
return super()._handle_expr(expr_idx, expr, stmt_idx, stmt, block)
|
|
168
186
|
|
|
187
|
+
def _handle_VirtualVariable(
|
|
188
|
+
self, expr_idx: int, expr: VirtualVariable, stmt_idx: int, stmt: Statement, block: Block | None
|
|
189
|
+
):
|
|
190
|
+
if self.skip_if_contains_vvar is not None and expr.varid == self.skip_if_contains_vvar:
|
|
191
|
+
self._has_specified_vvar = True
|
|
192
|
+
return super()._handle_VirtualVariable(expr_idx, expr, stmt_idx, stmt, block)
|
|
193
|
+
|
|
169
194
|
|
|
170
195
|
def is_const_and_vvar_assignment(stmt: Statement) -> bool:
|
|
171
196
|
if isinstance(stmt, Assignment):
|
|
@@ -203,6 +228,12 @@ def is_phi_assignment(stmt: Statement) -> bool:
|
|
|
203
228
|
return isinstance(stmt, Assignment) and isinstance(stmt.src, Phi)
|
|
204
229
|
|
|
205
230
|
|
|
231
|
+
def has_load_expr(stmt: Statement, skip_if_contains_vvar: int | None = None) -> bool:
|
|
232
|
+
walker = AILBlacklistExprTypeWalker((Load,), skip_if_contains_vvar=skip_if_contains_vvar)
|
|
233
|
+
walker.walk_statement(stmt)
|
|
234
|
+
return walker.has_blacklisted_exprs
|
|
235
|
+
|
|
236
|
+
|
|
206
237
|
def phi_assignment_get_src(stmt: Statement) -> Phi | None:
|
|
207
238
|
if isinstance(stmt, Assignment) and isinstance(stmt.src, Phi):
|
|
208
239
|
return stmt.src
|
|
@@ -225,13 +256,97 @@ def has_ite_stmt(stmt: Statement) -> bool:
|
|
|
225
256
|
return walker.has_blacklisted_exprs
|
|
226
257
|
|
|
227
258
|
|
|
259
|
+
def check_in_between_stmts(
|
|
260
|
+
graph: networkx.DiGraph,
|
|
261
|
+
blocks: dict[tuple[int, int | None], Block],
|
|
262
|
+
defloc: CodeLocation,
|
|
263
|
+
useloc: CodeLocation,
|
|
264
|
+
predicate: Callable,
|
|
265
|
+
):
|
|
266
|
+
assert defloc.block_addr is not None
|
|
267
|
+
assert defloc.stmt_idx is not None
|
|
268
|
+
assert useloc.block_addr is not None
|
|
269
|
+
assert useloc.stmt_idx is not None
|
|
270
|
+
assert graph is not None
|
|
271
|
+
|
|
272
|
+
use_block = blocks[(useloc.block_addr, useloc.block_idx)]
|
|
273
|
+
def_block = blocks[(defloc.block_addr, defloc.block_idx)]
|
|
274
|
+
|
|
275
|
+
# traverse the graph, go from use_block until we reach def_block, and look for Store statements
|
|
276
|
+
seen = {use_block}
|
|
277
|
+
queue = [use_block]
|
|
278
|
+
while queue:
|
|
279
|
+
block = queue.pop(0)
|
|
280
|
+
|
|
281
|
+
starting_stmt_idx, ending_stmt_idx = 0, len(block.statements)
|
|
282
|
+
if block is def_block:
|
|
283
|
+
starting_stmt_idx = defloc.stmt_idx + 1
|
|
284
|
+
if block is use_block:
|
|
285
|
+
ending_stmt_idx = useloc.stmt_idx
|
|
286
|
+
|
|
287
|
+
for i in range(starting_stmt_idx, ending_stmt_idx):
|
|
288
|
+
if predicate(block.statements[i]):
|
|
289
|
+
return True
|
|
290
|
+
|
|
291
|
+
if block is def_block:
|
|
292
|
+
continue
|
|
293
|
+
|
|
294
|
+
for pred in graph.predecessors(block):
|
|
295
|
+
if pred not in seen:
|
|
296
|
+
seen.add(pred)
|
|
297
|
+
queue.append(pred)
|
|
298
|
+
|
|
299
|
+
return False
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def has_store_stmt_in_between_stmts(
|
|
303
|
+
graph: networkx.DiGraph, blocks: dict[tuple[int, int | None], Block], defloc: CodeLocation, useloc: CodeLocation
|
|
304
|
+
) -> bool:
|
|
305
|
+
return check_in_between_stmts(graph, blocks, defloc, useloc, lambda stmt: isinstance(stmt, Store))
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
def has_call_in_between_stmts(
|
|
309
|
+
graph: networkx.DiGraph,
|
|
310
|
+
blocks: dict[tuple[int, int | None], Block],
|
|
311
|
+
defloc: CodeLocation,
|
|
312
|
+
useloc: CodeLocation,
|
|
313
|
+
skip_if_contains_vvar: int | None = None,
|
|
314
|
+
) -> bool:
|
|
315
|
+
|
|
316
|
+
def _contains_call(stmt: Statement) -> bool:
|
|
317
|
+
if isinstance(stmt, Call):
|
|
318
|
+
return True
|
|
319
|
+
# walk the statement and check if there is a call expression
|
|
320
|
+
walker = AILBlacklistExprTypeWalker((Call,), skip_if_contains_vvar=skip_if_contains_vvar)
|
|
321
|
+
walker.walk_statement(stmt)
|
|
322
|
+
return walker.has_blacklisted_exprs
|
|
323
|
+
|
|
324
|
+
return check_in_between_stmts(graph, blocks, defloc, useloc, _contains_call)
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def has_load_expr_in_between_stmts(
|
|
328
|
+
graph: networkx.DiGraph,
|
|
329
|
+
blocks: dict[tuple[int, int | None], Block],
|
|
330
|
+
defloc: CodeLocation,
|
|
331
|
+
useloc: CodeLocation,
|
|
332
|
+
skip_if_contains_vvar: int | None = None,
|
|
333
|
+
) -> bool:
|
|
334
|
+
return check_in_between_stmts(
|
|
335
|
+
graph, blocks, defloc, useloc, lambda stmt: has_load_expr(stmt, skip_if_contains_vvar=skip_if_contains_vvar)
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
|
|
228
339
|
__all__ = (
|
|
229
340
|
"VVarUsesCollector",
|
|
341
|
+
"check_in_between_stmts",
|
|
230
342
|
"get_tmp_deflocs",
|
|
231
343
|
"get_tmp_uselocs",
|
|
232
344
|
"get_vvar_deflocs",
|
|
233
345
|
"get_vvar_uselocs",
|
|
346
|
+
"has_call_in_between_stmts",
|
|
234
347
|
"has_ite_expr",
|
|
348
|
+
"has_load_expr_in_between_stmts",
|
|
349
|
+
"has_store_stmt_in_between_stmts",
|
|
235
350
|
"is_const_and_vvar_assignment",
|
|
236
351
|
"is_const_assignment",
|
|
237
352
|
"is_const_vvar_load_assignment",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: angr
|
|
3
|
-
Version: 9.2.
|
|
3
|
+
Version: 9.2.140
|
|
4
4
|
Summary: A multi-architecture binary analysis toolkit, with the ability to perform dynamic symbolic execution and various static analyses on binaries
|
|
5
5
|
Home-page: https://github.com/angr/angr
|
|
6
6
|
License: BSD-2-Clause
|
|
@@ -16,13 +16,13 @@ Description-Content-Type: text/markdown
|
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
Requires-Dist: CppHeaderParser
|
|
18
18
|
Requires-Dist: GitPython
|
|
19
|
-
Requires-Dist: ailment==9.2.
|
|
20
|
-
Requires-Dist: archinfo==9.2.
|
|
19
|
+
Requires-Dist: ailment==9.2.140
|
|
20
|
+
Requires-Dist: archinfo==9.2.140
|
|
21
21
|
Requires-Dist: cachetools
|
|
22
22
|
Requires-Dist: capstone==5.0.3
|
|
23
23
|
Requires-Dist: cffi>=1.14.0
|
|
24
|
-
Requires-Dist: claripy==9.2.
|
|
25
|
-
Requires-Dist: cle==9.2.
|
|
24
|
+
Requires-Dist: claripy==9.2.140
|
|
25
|
+
Requires-Dist: cle==9.2.140
|
|
26
26
|
Requires-Dist: itanium-demangler
|
|
27
27
|
Requires-Dist: mulpyplexer
|
|
28
28
|
Requires-Dist: nampa
|
|
@@ -31,7 +31,7 @@ Requires-Dist: protobuf>=5.28.2
|
|
|
31
31
|
Requires-Dist: psutil
|
|
32
32
|
Requires-Dist: pycparser>=2.18
|
|
33
33
|
Requires-Dist: pyformlang
|
|
34
|
-
Requires-Dist: pyvex==9.2.
|
|
34
|
+
Requires-Dist: pyvex==9.2.140
|
|
35
35
|
Requires-Dist: rich>=13.1.0
|
|
36
36
|
Requires-Dist: sortedcontainers
|
|
37
37
|
Requires-Dist: sympy
|