angr 9.2.134__py3-none-manylinux2014_aarch64.whl → 9.2.136__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.
- angr/__init__.py +1 -1
- angr/analyses/__init__.py +5 -8
- angr/analyses/analysis.py +4 -0
- angr/analyses/backward_slice.py +1 -2
- angr/analyses/binary_optimizer.py +3 -4
- angr/analyses/bindiff.py +4 -6
- angr/analyses/boyscout.py +1 -3
- angr/analyses/callee_cleanup_finder.py +4 -4
- angr/analyses/calling_convention/__init__.py +6 -0
- angr/analyses/{calling_convention.py → calling_convention/calling_convention.py} +32 -64
- angr/analyses/calling_convention/fact_collector.py +502 -0
- angr/analyses/calling_convention/utils.py +57 -0
- angr/analyses/cdg.py +1 -2
- angr/analyses/cfg/cfb.py +1 -3
- angr/analyses/cfg/cfg.py +2 -2
- angr/analyses/cfg/cfg_base.py +37 -35
- angr/analyses/cfg/cfg_emulated.py +1 -1
- angr/analyses/cfg/cfg_fast.py +62 -15
- angr/analyses/cfg/cfg_fast_soot.py +1 -1
- angr/analyses/cfg/indirect_jump_resolvers/__init__.py +2 -0
- angr/analyses/cfg/indirect_jump_resolvers/const_resolver.py +46 -10
- angr/analyses/cfg/indirect_jump_resolvers/default_resolvers.py +5 -1
- angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +50 -14
- angr/analyses/cfg/indirect_jump_resolvers/memload_resolver.py +81 -0
- angr/analyses/cfg/indirect_jump_resolvers/propagator_utils.py +24 -5
- angr/analyses/cfg/indirect_jump_resolvers/x86_pe_iat.py +2 -5
- angr/analyses/complete_calling_conventions.py +32 -3
- angr/analyses/congruency_check.py +2 -3
- angr/analyses/data_dep/data_dependency_analysis.py +2 -2
- angr/analyses/ddg.py +1 -4
- angr/analyses/decompiler/ail_simplifier.py +3 -4
- angr/analyses/decompiler/clinic.py +42 -7
- angr/analyses/decompiler/optimization_passes/duplication_reverter/ail_merge_graph.py +2 -2
- angr/analyses/decompiler/optimization_passes/duplication_reverter/duplication_reverter.py +2 -2
- angr/analyses/decompiler/optimization_passes/ite_region_converter.py +1 -1
- angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +1 -1
- angr/analyses/decompiler/optimization_passes/register_save_area_simplifier.py +0 -6
- angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +2 -7
- angr/analyses/decompiler/optimization_passes/switch_default_case_duplicator.py +0 -6
- angr/analyses/decompiler/optimization_passes/win_stack_canary_simplifier.py +0 -6
- angr/analyses/decompiler/structuring/phoenix.py +1 -1
- angr/analyses/disassembly.py +5 -5
- angr/analyses/fcp/__init__.py +4 -0
- angr/analyses/fcp/fcp.py +429 -0
- angr/analyses/identifier/identify.py +1 -3
- angr/analyses/loopfinder.py +4 -3
- angr/analyses/patchfinder.py +1 -1
- angr/analyses/propagator/engine_base.py +4 -3
- angr/analyses/propagator/propagator.py +14 -53
- angr/analyses/reassembler.py +1 -2
- angr/analyses/s_propagator.py +1 -3
- angr/analyses/soot_class_hierarchy.py +1 -2
- angr/analyses/stack_pointer_tracker.py +18 -2
- angr/analyses/static_hooker.py +1 -2
- angr/analyses/typehoon/simple_solver.py +2 -2
- angr/analyses/variable_recovery/engine_vex.py +5 -0
- angr/analyses/variable_recovery/variable_recovery_fast.py +1 -2
- angr/analyses/veritesting.py +4 -7
- angr/analyses/vfg.py +1 -1
- angr/analyses/vsa_ddg.py +1 -2
- angr/block.py +3 -2
- angr/callable.py +1 -3
- angr/calling_conventions.py +15 -7
- angr/codenode.py +5 -1
- angr/concretization_strategies/__init__.py +1 -83
- angr/concretization_strategies/any.py +2 -1
- angr/concretization_strategies/any_named.py +1 -1
- angr/concretization_strategies/base.py +81 -0
- angr/concretization_strategies/controlled_data.py +2 -1
- angr/concretization_strategies/eval.py +2 -1
- angr/concretization_strategies/logging.py +3 -1
- angr/concretization_strategies/max.py +2 -1
- angr/concretization_strategies/nonzero.py +2 -1
- angr/concretization_strategies/nonzero_range.py +2 -1
- angr/concretization_strategies/norepeats.py +2 -1
- angr/concretization_strategies/norepeats_range.py +2 -1
- angr/concretization_strategies/range.py +2 -1
- angr/concretization_strategies/signed_add.py +2 -1
- angr/concretization_strategies/single.py +2 -1
- angr/concretization_strategies/solutions.py +2 -1
- angr/concretization_strategies/unlimited_range.py +2 -1
- angr/engines/__init__.py +8 -5
- angr/engines/engine.py +3 -5
- angr/engines/failure.py +4 -5
- angr/engines/procedure.py +5 -7
- angr/engines/soot/expressions/__init__.py +22 -23
- angr/engines/soot/expressions/base.py +4 -4
- angr/engines/soot/expressions/invoke.py +1 -2
- angr/engines/soot/statements/__init__.py +9 -10
- angr/engines/soot/values/__init__.py +9 -10
- angr/engines/soot/values/arrayref.py +3 -3
- angr/engines/soot/values/instancefieldref.py +3 -2
- angr/engines/successors.py +7 -6
- angr/engines/syscall.py +4 -6
- angr/engines/unicorn.py +3 -2
- angr/engines/vex/claripy/ccall.py +8 -10
- angr/engines/vex/claripy/datalayer.py +4 -5
- angr/exploration_techniques/__init__.py +0 -2
- angr/exploration_techniques/spiller.py +1 -3
- angr/exploration_techniques/stochastic.py +2 -3
- angr/factory.py +3 -9
- angr/knowledge_plugins/cfg/cfg_model.py +20 -17
- angr/knowledge_plugins/functions/function.py +74 -77
- angr/knowledge_plugins/functions/function_manager.py +14 -7
- angr/knowledge_plugins/functions/function_parser.py +1 -1
- angr/knowledge_plugins/functions/soot_function.py +16 -16
- angr/knowledge_plugins/propagations/propagation_model.py +4 -5
- angr/knowledge_plugins/propagations/states.py +0 -511
- angr/procedures/libc/memcpy.py +4 -4
- angr/procedures/procedure_dict.py +3 -2
- angr/protos/__init__.py +2 -5
- angr/protos/cfg_pb2.py +21 -18
- angr/protos/function_pb2.py +17 -14
- angr/protos/primitives_pb2.py +44 -39
- angr/protos/variables_pb2.py +36 -31
- angr/protos/xrefs_pb2.py +15 -12
- angr/sim_procedure.py +15 -16
- angr/sim_variable.py +13 -1
- angr/simos/__init__.py +2 -0
- angr/simos/javavm.py +4 -6
- angr/simos/xbox.py +32 -0
- angr/state_plugins/__init__.py +0 -2
- angr/state_plugins/callstack.py +4 -4
- angr/state_plugins/cgc.py +3 -2
- angr/state_plugins/gdb.py +6 -5
- angr/state_plugins/globals.py +1 -2
- angr/state_plugins/heap/heap_brk.py +1 -2
- angr/state_plugins/history.py +10 -12
- angr/state_plugins/inspect.py +3 -5
- angr/state_plugins/libc.py +2 -2
- angr/state_plugins/log.py +8 -10
- angr/state_plugins/loop_data.py +1 -2
- angr/state_plugins/posix.py +7 -7
- angr/state_plugins/preconstrainer.py +2 -3
- angr/state_plugins/scratch.py +5 -8
- angr/state_plugins/sim_action.py +3 -3
- angr/state_plugins/solver.py +8 -3
- angr/state_plugins/symbolizer.py +5 -4
- angr/state_plugins/uc_manager.py +3 -3
- angr/state_plugins/unicorn_engine.py +5 -1
- angr/state_plugins/view.py +3 -5
- angr/storage/file.py +3 -5
- angr/storage/memory_mixins/address_concretization_mixin.py +2 -2
- angr/storage/memory_mixins/bvv_conversion_mixin.py +3 -3
- angr/storage/memory_mixins/clouseau_mixin.py +1 -3
- angr/storage/memory_mixins/name_resolution_mixin.py +1 -3
- angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +13 -15
- angr/storage/memory_mixins/paged_memory/pages/__init__.py +1 -22
- angr/storage/memory_mixins/paged_memory/pages/base.py +31 -0
- angr/storage/memory_mixins/paged_memory/pages/list_page.py +1 -1
- angr/storage/memory_mixins/paged_memory/pages/mv_list_page.py +1 -1
- angr/storage/memory_mixins/paged_memory/pages/ultra_page.py +2 -4
- angr/storage/memory_mixins/paged_memory/privileged_mixin.py +3 -4
- angr/storage/memory_mixins/regioned_memory/abstract_merger_mixin.py +4 -2
- angr/storage/memory_mixins/smart_find_mixin.py +1 -1
- angr/storage/memory_mixins/underconstrained_mixin.py +1 -1
- angr/storage/memory_mixins/unwrapper_mixin.py +1 -3
- angr/utils/bits.py +13 -0
- angr/utils/enums_conv.py +28 -12
- angr/utils/segment_list.py +25 -22
- angr/utils/timing.py +18 -1
- angr/vaults.py +5 -6
- {angr-9.2.134.dist-info → angr-9.2.136.dist-info}/METADATA +6 -6
- {angr-9.2.134.dist-info → angr-9.2.136.dist-info}/RECORD +168 -164
- {angr-9.2.134.dist-info → angr-9.2.136.dist-info}/WHEEL +1 -1
- angr/analyses/propagator/outdated_definition_walker.py +0 -159
- angr/analyses/propagator/tmpvar_finder.py +0 -18
- angr/engines/concrete.py +0 -180
- angr/exploration_techniques/symbion.py +0 -80
- angr/state_plugins/concrete.py +0 -295
- {angr-9.2.134.dist-info → angr-9.2.136.dist-info}/LICENSE +0 -0
- {angr-9.2.134.dist-info → angr-9.2.136.dist-info}/entry_points.txt +0 -0
- {angr-9.2.134.dist-info → angr-9.2.136.dist-info}/top_level.txt +0 -0
angr/engines/__init__.py
CHANGED
|
@@ -8,13 +8,10 @@ from .procedure import ProcedureMixin, ProcedureEngine
|
|
|
8
8
|
from .unicorn import SimEngineUnicorn
|
|
9
9
|
from .failure import SimEngineFailure
|
|
10
10
|
from .syscall import SimEngineSyscall
|
|
11
|
-
from .concrete import SimEngineConcrete
|
|
12
11
|
from .hook import HooksMixin
|
|
13
12
|
from .soot import SootMixin
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
# The default execution engine
|
|
17
|
-
# You may remove unused mixins from this default engine to speed up execution
|
|
18
15
|
class UberEngine(
|
|
19
16
|
SimEngineFailure,
|
|
20
17
|
SimEngineSyscall,
|
|
@@ -27,7 +24,14 @@ class UberEngine(
|
|
|
27
24
|
SootMixin,
|
|
28
25
|
HeavyVEXMixin,
|
|
29
26
|
):
|
|
30
|
-
|
|
27
|
+
"""
|
|
28
|
+
The default execution engine for angr. This engine includes mixins for most
|
|
29
|
+
common functionality in angr, including VEX IR, unicorn, syscall handling,
|
|
30
|
+
and simprocedure handling.
|
|
31
|
+
|
|
32
|
+
For some performance-sensitive applications, you may want to create a custom
|
|
33
|
+
engine with only the necessary mixins.
|
|
34
|
+
"""
|
|
31
35
|
|
|
32
36
|
|
|
33
37
|
__all__ = [
|
|
@@ -37,7 +41,6 @@ __all__ = [
|
|
|
37
41
|
"ProcedureEngine",
|
|
38
42
|
"ProcedureMixin",
|
|
39
43
|
"SimEngine",
|
|
40
|
-
"SimEngineConcrete",
|
|
41
44
|
"SimEngineFailure",
|
|
42
45
|
"SimEngineSyscall",
|
|
43
46
|
"SimEngineUnicorn",
|
angr/engines/engine.py
CHANGED
|
@@ -32,9 +32,7 @@ class SimEngineBase(Generic[StateType]):
|
|
|
32
32
|
|
|
33
33
|
state: StateType
|
|
34
34
|
|
|
35
|
-
def __init__(self, project: angr.Project
|
|
36
|
-
if kwargs:
|
|
37
|
-
raise TypeError("Unused initializer args: " + ", ".join(kwargs.keys()))
|
|
35
|
+
def __init__(self, project: angr.Project):
|
|
38
36
|
self.project = project
|
|
39
37
|
self.arch = self.project.arch
|
|
40
38
|
|
|
@@ -66,8 +64,8 @@ class SuccessorsMixin(SimEngine[HeavyState, SimSuccessors]):
|
|
|
66
64
|
and dispatches to a ``process_successors`` method to fill a SimSuccessors object with the results.
|
|
67
65
|
"""
|
|
68
66
|
|
|
69
|
-
def __init__(self,
|
|
70
|
-
super().__init__(
|
|
67
|
+
def __init__(self, project: angr.Project):
|
|
68
|
+
super().__init__(project)
|
|
71
69
|
|
|
72
70
|
self.successors: SimSuccessors | None = None
|
|
73
71
|
|
angr/engines/failure.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
from .engine import SuccessorsMixin
|
|
3
|
-
from .procedure import ProcedureMixin
|
|
4
2
|
|
|
5
3
|
import logging
|
|
6
4
|
|
|
5
|
+
from angr.errors import AngrExitError
|
|
6
|
+
from .engine import SuccessorsMixin
|
|
7
|
+
from .procedure import ProcedureMixin
|
|
8
|
+
|
|
7
9
|
l = logging.getLogger(name=__name__)
|
|
8
10
|
|
|
9
11
|
|
|
@@ -23,6 +25,3 @@ class SimEngineFailure(SuccessorsMixin, ProcedureMixin):
|
|
|
23
25
|
return self.process_procedure(state, successors, terminator, **kwargs)
|
|
24
26
|
|
|
25
27
|
return super().process_successors(successors, **kwargs)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
from angr.errors import AngrExitError
|
angr/engines/procedure.py
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
import logging
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
from angr import sim_options as o
|
|
5
|
+
from angr import errors
|
|
6
|
+
from angr.state_plugins.inspect import BP_BEFORE, BP_AFTER
|
|
6
7
|
from .engine import SuccessorsMixin
|
|
7
8
|
|
|
9
|
+
|
|
10
|
+
l = logging.getLogger(name=__name__)
|
|
8
11
|
# pylint: disable=arguments-differ
|
|
9
12
|
|
|
10
13
|
|
|
@@ -65,8 +68,3 @@ class ProcedureEngine(ProcedureMixin, SuccessorsMixin):
|
|
|
65
68
|
if procedure is None:
|
|
66
69
|
raise errors.SimEngineError("Must provide the procedure explicitly to use ProcedureEngine")
|
|
67
70
|
self.process_procedure(self.state, successors, procedure, **kwargs)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
from angr import sim_options as o
|
|
71
|
-
from angr import errors
|
|
72
|
-
from angr.state_plugins.inspect import BP_BEFORE, BP_AFTER
|
|
@@ -2,29 +2,6 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
|
|
5
|
-
l = logging.getLogger("angr.engines.soot.expressions")
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def translate_expr(expr, state):
|
|
9
|
-
expr_name = expr.__class__.__name__.split(".")[-1]
|
|
10
|
-
if expr_name.startswith("Soot"):
|
|
11
|
-
expr_name = expr_name[4:]
|
|
12
|
-
if expr_name.endswith("Expr"):
|
|
13
|
-
expr_name = expr_name[:-4]
|
|
14
|
-
expr_cls_name = "SimSootExpr_" + expr_name
|
|
15
|
-
|
|
16
|
-
g = globals()
|
|
17
|
-
if expr_cls_name in g:
|
|
18
|
-
expr_cls = g[expr_cls_name]
|
|
19
|
-
else:
|
|
20
|
-
l.warning("Unsupported Soot expression %s.", expr_cls_name)
|
|
21
|
-
expr_cls = SimSootExpr_Unsupported
|
|
22
|
-
|
|
23
|
-
expr = expr_cls(expr, state)
|
|
24
|
-
expr.process()
|
|
25
|
-
return expr
|
|
26
|
-
|
|
27
|
-
|
|
28
5
|
from .arrayref import SimSootExpr_ArrayRef
|
|
29
6
|
from .binop import SimSootExpr_Binop
|
|
30
7
|
from .cast import SimSootExpr_Cast
|
|
@@ -57,6 +34,28 @@ from .paramref import SimSootExpr_ParamRef
|
|
|
57
34
|
from .unsupported import SimSootExpr_Unsupported
|
|
58
35
|
from .instanceOf import SimSootExpr_InstanceOf
|
|
59
36
|
|
|
37
|
+
l = logging.getLogger("angr.engines.soot.expressions")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def translate_expr(expr, state):
|
|
41
|
+
expr_name = expr.__class__.__name__.split(".")[-1]
|
|
42
|
+
if expr_name.startswith("Soot"):
|
|
43
|
+
expr_name = expr_name[4:]
|
|
44
|
+
if expr_name.endswith("Expr"):
|
|
45
|
+
expr_name = expr_name[:-4]
|
|
46
|
+
expr_cls_name = "SimSootExpr_" + expr_name
|
|
47
|
+
|
|
48
|
+
g = globals()
|
|
49
|
+
if expr_cls_name in g:
|
|
50
|
+
expr_cls = g[expr_cls_name]
|
|
51
|
+
else:
|
|
52
|
+
l.warning("Unsupported Soot expression %s.", expr_cls_name)
|
|
53
|
+
expr_cls = SimSootExpr_Unsupported
|
|
54
|
+
|
|
55
|
+
expr = expr_cls(expr, state)
|
|
56
|
+
expr.process()
|
|
57
|
+
return expr
|
|
58
|
+
|
|
60
59
|
|
|
61
60
|
__all__ = (
|
|
62
61
|
"SimSootExpr_ArrayRef",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
import angr
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class SimSootExpr:
|
|
@@ -15,7 +15,7 @@ class SimSootExpr:
|
|
|
15
15
|
raise NotImplementedError
|
|
16
16
|
|
|
17
17
|
def _translate_expr(self, expr):
|
|
18
|
-
return translate_expr(expr, self.state)
|
|
18
|
+
return angr.engines.soot.expressions.translate_expr(expr, self.state)
|
|
19
19
|
|
|
20
20
|
def _translate_value(self, value):
|
|
21
|
-
return translate_value(value, self.state)
|
|
21
|
+
return angr.engines.soot.values.translate_value(value, self.state)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from archinfo.arch_soot import SootArgument, SootMethodDescriptor
|
|
3
3
|
|
|
4
|
-
from . import translate_expr
|
|
5
4
|
from angr.engines.soot.method_dispatcher import resolve_method
|
|
6
5
|
from angr.engines.soot.exceptions import SootMethodNotLoadedException
|
|
7
6
|
from .base import SimSootExpr
|
|
@@ -56,7 +55,7 @@ class SimSootExpr_VirtualInvoke(InvokeBase):
|
|
|
56
55
|
|
|
57
56
|
def _resolve_invoke_target(self, expr, state):
|
|
58
57
|
# get the type of the base object
|
|
59
|
-
base =
|
|
58
|
+
base = self._translate_expr(self.expr.base).expr
|
|
60
59
|
# if the base is not set, for example if we process an invocation of an
|
|
61
60
|
# unloaded library function
|
|
62
61
|
# => fallback: use the statically retrieved type
|
|
@@ -2,6 +2,15 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
|
|
5
|
+
from .assign import SimSootStmt_Assign
|
|
6
|
+
from .return_ import SimSootStmt_Return, SimSootStmt_ReturnVoid
|
|
7
|
+
from .identity import SimSootStmt_Identity
|
|
8
|
+
from .goto import SimSootStmt_Goto
|
|
9
|
+
from .invoke import SimSootStmt_Invoke
|
|
10
|
+
from .if_ import SimSootStmt_If
|
|
11
|
+
from .switch import SimSootStmt_TableSwitch, SimSootStmt_LookupSwitch
|
|
12
|
+
from .throw import SimSootStmt_Throw
|
|
13
|
+
|
|
5
14
|
l = logging.getLogger("angr.engines.soot.statements")
|
|
6
15
|
|
|
7
16
|
|
|
@@ -21,16 +30,6 @@ def translate_stmt(stmt, state):
|
|
|
21
30
|
return None
|
|
22
31
|
|
|
23
32
|
|
|
24
|
-
from .assign import SimSootStmt_Assign
|
|
25
|
-
from .return_ import SimSootStmt_Return, SimSootStmt_ReturnVoid
|
|
26
|
-
from .identity import SimSootStmt_Identity
|
|
27
|
-
from .goto import SimSootStmt_Goto
|
|
28
|
-
from .invoke import SimSootStmt_Invoke
|
|
29
|
-
from .if_ import SimSootStmt_If
|
|
30
|
-
from .switch import SimSootStmt_TableSwitch, SimSootStmt_LookupSwitch
|
|
31
|
-
from .throw import SimSootStmt_Throw
|
|
32
|
-
|
|
33
|
-
|
|
34
33
|
__all__ = (
|
|
35
34
|
"SimSootStmt_Assign",
|
|
36
35
|
"SimSootStmt_Goto",
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from .local import SimSootValue_Local
|
|
4
|
+
from .paramref import SimSootValue_ParamRef
|
|
5
|
+
from .arrayref import SimSootValue_ArrayRef, SimSootValue_ArrayBaseRef
|
|
6
|
+
from .thisref import SimSootValue_ThisRef
|
|
7
|
+
from .staticfieldref import SimSootValue_StaticFieldRef
|
|
8
|
+
from .instancefieldref import SimSootValue_InstanceFieldRef
|
|
9
|
+
from .constants import SimSootValue_IntConstant
|
|
10
|
+
from .strref import SimSootValue_StringRef
|
|
11
|
+
|
|
3
12
|
|
|
4
13
|
def translate_value(value, state):
|
|
5
14
|
value_name = value.__class__.__name__
|
|
@@ -16,16 +25,6 @@ def translate_value(value, state):
|
|
|
16
25
|
return value_cls.from_sootvalue(value, state)
|
|
17
26
|
|
|
18
27
|
|
|
19
|
-
from .local import SimSootValue_Local
|
|
20
|
-
from .paramref import SimSootValue_ParamRef
|
|
21
|
-
from .arrayref import SimSootValue_ArrayRef, SimSootValue_ArrayBaseRef
|
|
22
|
-
from .thisref import SimSootValue_ThisRef
|
|
23
|
-
from .staticfieldref import SimSootValue_StaticFieldRef
|
|
24
|
-
from .instancefieldref import SimSootValue_InstanceFieldRef
|
|
25
|
-
from .constants import SimSootValue_IntConstant
|
|
26
|
-
from .strref import SimSootValue_StringRef
|
|
27
|
-
|
|
28
|
-
|
|
29
28
|
__all__ = (
|
|
30
29
|
"SimSootValue_ArrayBaseRef",
|
|
31
30
|
"SimSootValue_ArrayRef",
|
|
@@ -3,7 +3,7 @@ import logging
|
|
|
3
3
|
|
|
4
4
|
import claripy
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import angr
|
|
7
7
|
from angr.errors import SimEngineError
|
|
8
8
|
from .base import SimSootValue
|
|
9
9
|
from .constants import SimSootValue_IntConstant
|
|
@@ -60,7 +60,7 @@ class SimSootValue_ArrayRef(SimSootValue):
|
|
|
60
60
|
|
|
61
61
|
@classmethod
|
|
62
62
|
def from_sootvalue(cls, soot_value, state):
|
|
63
|
-
base_local = translate_value(soot_value.base, state)
|
|
63
|
+
base_local = angr.engines.soot.values.translate_value(soot_value.base, state)
|
|
64
64
|
base = state.memory.load(base_local)
|
|
65
65
|
idx = cls.translate_array_index(soot_value.index, state)
|
|
66
66
|
cls.check_array_bounds(idx, base, state)
|
|
@@ -68,7 +68,7 @@ class SimSootValue_ArrayRef(SimSootValue):
|
|
|
68
68
|
|
|
69
69
|
@staticmethod
|
|
70
70
|
def translate_array_index(idx, state):
|
|
71
|
-
idx_value = translate_value(idx, state)
|
|
71
|
+
idx_value = angr.engines.soot.values.translate_value(idx, state)
|
|
72
72
|
if isinstance(idx_value, SimSootValue_IntConstant):
|
|
73
73
|
# idx is a constant
|
|
74
74
|
return idx_value.value
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import angr
|
|
3
4
|
from .base import SimSootValue
|
|
4
5
|
from angr.engines.soot.field_dispatcher import resolve_field
|
|
5
6
|
|
|
@@ -25,7 +26,7 @@ class SimSootValue_InstanceFieldRef(SimSootValue):
|
|
|
25
26
|
field_name, field_class_name = soot_value.field
|
|
26
27
|
field_type = soot_value.type
|
|
27
28
|
# get heap allocation id from base object
|
|
28
|
-
fixed_base = translate_value(soot_value.base, state)
|
|
29
|
+
fixed_base = angr.engines.soot.values.translate_value(soot_value.base, state)
|
|
29
30
|
field_ref_base = state.memory.load(fixed_base)
|
|
30
31
|
obj_alloc_id = field_ref_base.heap_alloc_id
|
|
31
32
|
# return field reference
|
angr/engines/successors.py
CHANGED
|
@@ -6,6 +6,13 @@ import claripy
|
|
|
6
6
|
|
|
7
7
|
from archinfo.arch_soot import ArchSoot, SootAddressDescriptor
|
|
8
8
|
|
|
9
|
+
from angr import sim_options as o
|
|
10
|
+
from angr.errors import SimSolverModeError, AngrUnsupportedSyscallError, AngrSyscallError, SimValueError, SimUnsatError
|
|
11
|
+
from angr.storage import DUMMY_SYMBOLIC_READ_VALUE
|
|
12
|
+
from angr.state_plugins.inspect import BP_BEFORE, BP_AFTER
|
|
13
|
+
from angr.state_plugins.callstack import CallStack
|
|
14
|
+
from angr.state_plugins.sim_action_object import _raw_ast
|
|
15
|
+
|
|
9
16
|
|
|
10
17
|
if TYPE_CHECKING:
|
|
11
18
|
from angr import SimState
|
|
@@ -533,10 +540,4 @@ class SimSuccessors:
|
|
|
533
540
|
|
|
534
541
|
|
|
535
542
|
# pylint: disable=wrong-import-position
|
|
536
|
-
from angr.state_plugins.inspect import BP_BEFORE, BP_AFTER
|
|
537
|
-
from angr.errors import SimSolverModeError, AngrUnsupportedSyscallError, AngrSyscallError, SimValueError, SimUnsatError
|
|
538
543
|
from angr.calling_conventions import SYSCALL_CC
|
|
539
|
-
from angr.state_plugins.sim_action_object import _raw_ast
|
|
540
|
-
from angr.state_plugins.callstack import CallStack
|
|
541
|
-
from angr.storage import DUMMY_SYMBOLIC_READ_VALUE
|
|
542
|
-
from angr import sim_options as o
|
angr/engines/syscall.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
import angr
|
|
3
2
|
import logging
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import angr
|
|
5
|
+
from angr.errors import AngrUnsupportedSyscallError
|
|
7
6
|
from .engine import SuccessorsMixin
|
|
8
7
|
from .procedure import ProcedureMixin
|
|
9
8
|
|
|
9
|
+
l = logging.getLogger(name=__name__)
|
|
10
|
+
|
|
10
11
|
|
|
11
12
|
# pylint:disable=abstract-method,arguments-differ
|
|
12
13
|
class SimEngineSyscall(SuccessorsMixin, ProcedureMixin):
|
|
@@ -48,6 +49,3 @@ class SimEngineSyscall(SuccessorsMixin, ProcedureMixin):
|
|
|
48
49
|
sys_procedure = angr.SIM_PROCEDURES["stubs"]["syscall"](cc=cc)
|
|
49
50
|
|
|
50
51
|
return self.process_procedure(state, successors, sys_procedure, **kwargs)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
from angr.errors import AngrUnsupportedSyscallError
|
angr/engines/unicorn.py
CHANGED
|
@@ -6,6 +6,7 @@ import logging
|
|
|
6
6
|
import archinfo
|
|
7
7
|
import claripy
|
|
8
8
|
|
|
9
|
+
import angr
|
|
9
10
|
from angr.errors import SimIRSBError, SimIRSBNoDecodeError, SimValueError
|
|
10
11
|
from .engine import SuccessorsMixin
|
|
11
12
|
from .vex.heavy.heavy import VEXEarlyExit
|
|
@@ -30,8 +31,8 @@ class SimEngineUnicorn(SuccessorsMixin):
|
|
|
30
31
|
- extra_stop_points: A collection of addresses at which execution should halt
|
|
31
32
|
"""
|
|
32
33
|
|
|
33
|
-
def __init__(self,
|
|
34
|
-
super().__init__(
|
|
34
|
+
def __init__(self, project: angr.Project):
|
|
35
|
+
super().__init__(project)
|
|
35
36
|
# Cache of details of basic blocks containing statements that need to re-executed
|
|
36
37
|
self._block_details_cache = {}
|
|
37
38
|
# Addresses of basic blocks which native interface will not execute
|
|
@@ -3,8 +3,11 @@ import logging
|
|
|
3
3
|
|
|
4
4
|
import claripy
|
|
5
5
|
from archinfo.arch_arm import is_arm_arch
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
from angr import errors
|
|
8
|
+
from angr.errors import SimError, SimCCallError
|
|
9
|
+
from angr.sim_options import USE_SIMPLIFIED_CCALLS
|
|
10
|
+
from angr.state_plugins.sim_action_object import _raw_ast, SimActionObject
|
|
8
11
|
|
|
9
12
|
l = logging.getLogger(name=__name__)
|
|
10
13
|
|
|
@@ -2020,11 +2023,10 @@ def _get_flags(state) -> claripy.ast.bv.BV:
|
|
|
2020
2023
|
except CCallMultivaluedException as e:
|
|
2021
2024
|
cases, to_replace = e.args
|
|
2022
2025
|
args = [cc_op, cc_dep1, cc_dep2, cc_ndep]
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
raise errors.UnsupportedCCallError("Trying to concretize a value which is not an argument")
|
|
2026
|
+
try:
|
|
2027
|
+
i = args.index(to_replace)
|
|
2028
|
+
except ValueError as ve:
|
|
2029
|
+
raise errors.UnsupportedCCallError("Trying to concretize a value which is not an argument") from ve
|
|
2028
2030
|
return claripy.ite_cases([(case, func(state, *args[:i], value_, *args[i + 1 :])) for case, value_ in cases], 0)
|
|
2029
2031
|
|
|
2030
2032
|
|
|
@@ -2064,7 +2066,3 @@ def _get_nbits(cc_str):
|
|
|
2064
2066
|
elif cc_str.endswith("64"):
|
|
2065
2067
|
nbits = 64
|
|
2066
2068
|
return nbits
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
from angr.errors import SimError, SimCCallError
|
|
2070
|
-
from angr.sim_options import USE_SIMPLIFIED_CCALLS
|
|
@@ -130,11 +130,10 @@ class ClaripyDataMixin(VEXMixin):
|
|
|
130
130
|
except ccall.CCallMultivaluedException as e:
|
|
131
131
|
cases, to_replace = e.args
|
|
132
132
|
# pylint: disable=undefined-loop-variable
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
raise errors.UnsupportedCCallError("Trying to concretize a value which is not an argument")
|
|
133
|
+
try:
|
|
134
|
+
i = args.index(to_replace)
|
|
135
|
+
except ValueError as ve:
|
|
136
|
+
raise errors.UnsupportedCCallError("Trying to concretize a value which is not an argument") from ve
|
|
138
137
|
evaluated_cases = [(case, func(self.state, *args[:i], value_, *args[i + 1 :])) for case, value_ in cases]
|
|
139
138
|
try:
|
|
140
139
|
return claripy.ite_cases(evaluated_cases, value(ty, 0))
|
|
@@ -17,7 +17,6 @@ from .manual_mergepoint import ManualMergepoint
|
|
|
17
17
|
from .tech_builder import TechniqueBuilder
|
|
18
18
|
from .stochastic import StochasticSearch
|
|
19
19
|
from .unique import UniqueSearch
|
|
20
|
-
from .symbion import Symbion
|
|
21
20
|
from .memory_watcher import MemoryWatcher
|
|
22
21
|
from .bucketizer import Bucketizer
|
|
23
22
|
from .local_loop_seer import LocalLoopSeer
|
|
@@ -45,7 +44,6 @@ __all__ = (
|
|
|
45
44
|
"StochasticSearch",
|
|
46
45
|
"StubStasher",
|
|
47
46
|
"Suggestions",
|
|
48
|
-
"Symbion",
|
|
49
47
|
"TechniqueBuilder",
|
|
50
48
|
"Threading",
|
|
51
49
|
"Timeout",
|
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
import contextlib
|
|
5
5
|
import logging
|
|
6
6
|
|
|
7
|
+
from angr import vaults
|
|
7
8
|
from .base import ExplorationTechnique
|
|
8
9
|
|
|
9
10
|
|
|
@@ -277,6 +278,3 @@ class Spiller(ExplorationTechnique):
|
|
|
277
278
|
@staticmethod
|
|
278
279
|
def state_priority(state):
|
|
279
280
|
return id(state)
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
from angr import vaults
|
|
@@ -44,13 +44,12 @@ class StochasticSearch(ExplorationTechnique):
|
|
|
44
44
|
assert len(states) >= 2
|
|
45
45
|
total_weight = sum(self.affinity[s.addr] for s in states)
|
|
46
46
|
selected = self._random.uniform(0, total_weight)
|
|
47
|
-
i = 0
|
|
48
47
|
for i, state in enumerate(states):
|
|
49
48
|
weight = self.affinity[state.addr]
|
|
50
49
|
if selected < weight:
|
|
51
|
-
|
|
50
|
+
return states[i]
|
|
52
51
|
selected -= weight
|
|
53
|
-
return states[
|
|
52
|
+
return states[len(states) - 1]
|
|
54
53
|
|
|
55
54
|
simgr.stashes[stash] = [weighted_pick(simgr.stashes[stash])]
|
|
56
55
|
|
angr/factory.py
CHANGED
|
@@ -11,7 +11,7 @@ from .sim_state import SimState
|
|
|
11
11
|
from .calling_conventions import default_cc, SimRegArg, SimStackArg, PointerWrapper, SimCCUnknown
|
|
12
12
|
from .callable import Callable
|
|
13
13
|
from .errors import AngrAssemblyError, AngrError
|
|
14
|
-
from .engines import UberEngine, ProcedureEngine
|
|
14
|
+
from .engines import UberEngine, ProcedureEngine
|
|
15
15
|
from .sim_type import SimTypeFunction, SimTypeInt
|
|
16
16
|
from .codenode import HookNode, SyscallNode
|
|
17
17
|
from .block import Block, SootBlock
|
|
@@ -39,7 +39,6 @@ class AngrObjectFactory:
|
|
|
39
39
|
project: Project
|
|
40
40
|
default_engine_factory: type[SimEngine]
|
|
41
41
|
procedure_engine: ProcedureEngine
|
|
42
|
-
concrete_engine: SimEngineConcrete | None
|
|
43
42
|
_default_cc: type[SimCC] | None
|
|
44
43
|
|
|
45
44
|
# We use thread local storage to cache engines on a per-thread basis
|
|
@@ -66,16 +65,11 @@ class AngrObjectFactory:
|
|
|
66
65
|
)
|
|
67
66
|
self.procedure_engine = ProcedureEngine(project)
|
|
68
67
|
|
|
69
|
-
if project.concrete_target:
|
|
70
|
-
self.concrete_engine = SimEngineConcrete(project)
|
|
71
|
-
else:
|
|
72
|
-
self.concrete_engine = None
|
|
73
|
-
|
|
74
68
|
def __getstate__(self):
|
|
75
|
-
return self.project, self.default_engine_factory, self.procedure_engine, self.
|
|
69
|
+
return self.project, self.default_engine_factory, self.procedure_engine, self._default_cc
|
|
76
70
|
|
|
77
71
|
def __setstate__(self, state):
|
|
78
|
-
self.project, self.default_engine_factory, self.procedure_engine, self.
|
|
72
|
+
self.project, self.default_engine_factory, self.procedure_engine, self._default_cc = state
|
|
79
73
|
self._tls = threading.local()
|
|
80
74
|
|
|
81
75
|
@property
|
|
@@ -6,10 +6,10 @@ import logging
|
|
|
6
6
|
from typing import TYPE_CHECKING
|
|
7
7
|
from collections.abc import Callable
|
|
8
8
|
from collections import defaultdict
|
|
9
|
-
import bisect
|
|
10
9
|
import string
|
|
11
10
|
|
|
12
11
|
import networkx
|
|
12
|
+
from sortedcontainers import SortedList
|
|
13
13
|
|
|
14
14
|
import cle
|
|
15
15
|
|
|
@@ -81,7 +81,7 @@ class CFGModel(Serializable):
|
|
|
81
81
|
# CFGNodes dict indexed by block ID. Don't serialize
|
|
82
82
|
self._nodes: dict[int, CFGNode] = {}
|
|
83
83
|
# addresses of CFGNodes to speed up get_any_node(..., anyaddr=True). Don't serialize
|
|
84
|
-
self._node_addrs:
|
|
84
|
+
self._node_addrs: SortedList[int] | None = None
|
|
85
85
|
|
|
86
86
|
self.normalized = False
|
|
87
87
|
|
|
@@ -137,7 +137,8 @@ class CFGModel(Serializable):
|
|
|
137
137
|
edge.dst_ea = dst.addr
|
|
138
138
|
for k, v in data.items():
|
|
139
139
|
if k == "jumpkind":
|
|
140
|
-
|
|
140
|
+
jk = cfg_jumpkind_to_pb(v)
|
|
141
|
+
edge.jumpkind = primitives_pb2.Edge.UnknownJumpkind if jk is None else jk
|
|
141
142
|
elif k == "ins_addr":
|
|
142
143
|
edge.ins_addr = v if v is not None else 0xFFFF_FFFF_FFFF_FFFF
|
|
143
144
|
elif k == "stmt_idx":
|
|
@@ -176,7 +177,7 @@ class CFGModel(Serializable):
|
|
|
176
177
|
"The resulting graph may be broken."
|
|
177
178
|
)
|
|
178
179
|
|
|
179
|
-
model._node_addrs =
|
|
180
|
+
model._node_addrs = None
|
|
180
181
|
|
|
181
182
|
# edges
|
|
182
183
|
for edge_pb2 in cmsg.edges:
|
|
@@ -219,6 +220,9 @@ class CFGModel(Serializable):
|
|
|
219
220
|
|
|
220
221
|
return model
|
|
221
222
|
|
|
223
|
+
def _build_node_addr_index(self):
|
|
224
|
+
self._node_addrs = SortedList(iter(k for k, lst in self._nodes_by_addr.items() if lst))
|
|
225
|
+
|
|
222
226
|
#
|
|
223
227
|
# Node insertion and removal
|
|
224
228
|
#
|
|
@@ -227,12 +231,8 @@ class CFGModel(Serializable):
|
|
|
227
231
|
self._nodes[block_id] = node
|
|
228
232
|
self._nodes_by_addr[node.addr].append(node)
|
|
229
233
|
|
|
230
|
-
if isinstance(node.addr, int):
|
|
231
|
-
|
|
232
|
-
if pos >= len(self._node_addrs):
|
|
233
|
-
self._node_addrs.append(node.addr)
|
|
234
|
-
elif self._node_addrs[pos] != node.addr:
|
|
235
|
-
self._node_addrs.insert(pos, node.addr)
|
|
234
|
+
if self._node_addrs is not None and isinstance(node.addr, int) and node.addr not in self._node_addrs:
|
|
235
|
+
self._node_addrs.add(node.addr)
|
|
236
236
|
|
|
237
237
|
def remove_node(self, block_id: int, node: CFGNode) -> None:
|
|
238
238
|
"""
|
|
@@ -250,10 +250,8 @@ class CFGModel(Serializable):
|
|
|
250
250
|
if not self._nodes_by_addr[node.addr]:
|
|
251
251
|
del self._nodes_by_addr[node.addr]
|
|
252
252
|
|
|
253
|
-
if isinstance(node.addr, int):
|
|
254
|
-
|
|
255
|
-
if pos < len(self._node_addrs) and self._node_addrs[pos] == node.addr:
|
|
256
|
-
self._node_addrs.pop(pos)
|
|
253
|
+
if self._node_addrs is not None and isinstance(node.addr, int) and node.addr in self._node_addrs:
|
|
254
|
+
self._node_addrs.remove(node.addr)
|
|
257
255
|
|
|
258
256
|
#
|
|
259
257
|
# CFG View
|
|
@@ -294,17 +292,22 @@ class CFGModel(Serializable):
|
|
|
294
292
|
# fastpath: directly look in the nodes list
|
|
295
293
|
if not anyaddr or addr in self._nodes_by_addr:
|
|
296
294
|
try:
|
|
297
|
-
|
|
298
|
-
|
|
295
|
+
if is_syscall is None:
|
|
296
|
+
return self._nodes_by_addr[addr][0]
|
|
297
|
+
return next(iter(node for node in self._nodes_by_addr[addr] if node.is_syscall == is_syscall))
|
|
298
|
+
except (KeyError, IndexError, StopIteration):
|
|
299
299
|
pass
|
|
300
300
|
|
|
301
301
|
if force_fastpath:
|
|
302
302
|
return None
|
|
303
303
|
|
|
304
304
|
if isinstance(addr, int):
|
|
305
|
+
if self._node_addrs is None:
|
|
306
|
+
self._build_node_addr_index()
|
|
307
|
+
|
|
305
308
|
# slower path
|
|
306
309
|
# find all potential addresses that the block may cover
|
|
307
|
-
pos =
|
|
310
|
+
pos = self._node_addrs.bisect_left(max(addr - VEX_IRSB_MAX_SIZE, 0))
|
|
308
311
|
|
|
309
312
|
is_cfgemulated = self.ident == "CFGEmulated"
|
|
310
313
|
|