angr 9.2.101__py3-none-manylinux2014_x86_64.whl → 9.2.103__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/analysis.py +7 -6
- angr/analyses/calling_convention.py +33 -35
- angr/analyses/cdg.py +2 -4
- angr/analyses/cfg/cfb.py +4 -3
- angr/analyses/cfg/cfg_base.py +14 -14
- angr/analyses/cfg/cfg_emulated.py +3 -4
- angr/analyses/cfg/cfg_fast.py +46 -46
- angr/analyses/cfg/cfg_fast_soot.py +1 -2
- angr/analyses/cfg/cfg_job_base.py +2 -2
- angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +14 -13
- angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py +5 -5
- angr/analyses/cfg_slice_to_sink/cfg_slice_to_sink.py +3 -3
- angr/analyses/complete_calling_conventions.py +13 -12
- angr/analyses/data_dep/data_dependency_analysis.py +24 -24
- angr/analyses/data_dep/dep_nodes.py +3 -3
- angr/analyses/ddg.py +1 -2
- angr/analyses/decompiler/ail_simplifier.py +35 -34
- angr/analyses/decompiler/block_io_finder.py +20 -20
- angr/analyses/decompiler/block_similarity.py +4 -6
- angr/analyses/decompiler/block_simplifier.py +17 -16
- angr/analyses/decompiler/callsite_maker.py +25 -10
- angr/analyses/decompiler/ccall_rewriters/amd64_ccalls.py +1 -3
- angr/analyses/decompiler/ccall_rewriters/rewriter_base.py +2 -4
- angr/analyses/decompiler/clinic.py +250 -45
- angr/analyses/decompiler/condition_processor.py +15 -8
- angr/analyses/decompiler/decompilation_cache.py +7 -7
- angr/analyses/decompiler/decompilation_options.py +4 -4
- angr/analyses/decompiler/decompiler.py +19 -15
- angr/analyses/decompiler/expression_counters.py +10 -9
- angr/analyses/decompiler/goto_manager.py +2 -4
- angr/analyses/decompiler/graph_region.py +9 -9
- angr/analyses/decompiler/jump_target_collector.py +1 -2
- angr/analyses/decompiler/optimization_passes/__init__.py +4 -3
- angr/analyses/decompiler/optimization_passes/code_motion.py +5 -6
- angr/analyses/decompiler/optimization_passes/const_derefs.py +4 -4
- angr/analyses/decompiler/optimization_passes/deadblock_remover.py +73 -0
- angr/analyses/decompiler/optimization_passes/engine_base.py +25 -3
- angr/analyses/decompiler/optimization_passes/expr_op_swapper.py +6 -5
- angr/analyses/decompiler/optimization_passes/flip_boolean_cmp.py +2 -2
- angr/analyses/decompiler/optimization_passes/inlined_string_transformation_simplifier.py +3 -0
- angr/analyses/decompiler/optimization_passes/ite_expr_converter.py +2 -2
- angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +17 -17
- angr/analyses/decompiler/optimization_passes/optimization_pass.py +12 -13
- angr/analyses/decompiler/optimization_passes/register_save_area_simplifier.py +25 -21
- angr/analyses/decompiler/optimization_passes/ret_addr_save_simplifier.py +3 -3
- angr/analyses/decompiler/optimization_passes/ret_deduplicator.py +1 -2
- angr/analyses/decompiler/optimization_passes/return_duplicator_base.py +7 -7
- angr/analyses/decompiler/optimization_passes/spilled_register_finder.py +18 -0
- angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +2 -3
- angr/analyses/decompiler/optimization_passes/win_stack_canary_simplifier.py +1 -2
- angr/analyses/decompiler/optimization_passes/x86_gcc_getpc_simplifier.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/__init__.py +4 -3
- angr/analyses/decompiler/peephole_optimizations/base.py +13 -15
- angr/analyses/decompiler/peephole_optimizations/bswap.py +1 -3
- angr/analyses/decompiler/peephole_optimizations/cmpord_rewriter.py +72 -0
- angr/analyses/decompiler/peephole_optimizations/const_mull_a_shift.py +1 -2
- angr/analyses/decompiler/peephole_optimizations/eager_eval.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/inlined_strcpy.py +5 -10
- angr/analyses/decompiler/peephole_optimizations/inlined_strcpy_consolidation.py +3 -4
- angr/analyses/decompiler/peephole_optimizations/inlined_wstrcpy.py +7 -10
- angr/analyses/decompiler/peephole_optimizations/rewrite_bit_extractions.py +2 -3
- angr/analyses/decompiler/peephole_optimizations/sar_to_signed_div.py +1 -2
- angr/analyses/decompiler/peephole_optimizations/tidy_stack_addr.py +4 -4
- angr/analyses/decompiler/redundant_label_remover.py +4 -5
- angr/analyses/decompiler/region_identifier.py +4 -5
- angr/analyses/decompiler/region_simplifiers/cascading_cond_transformer.py +1 -2
- angr/analyses/decompiler/region_simplifiers/expr_folding.py +19 -20
- angr/analyses/decompiler/region_simplifiers/goto.py +2 -3
- angr/analyses/decompiler/region_simplifiers/loop.py +1 -2
- angr/analyses/decompiler/region_simplifiers/node_address_finder.py +1 -2
- angr/analyses/decompiler/region_simplifiers/region_simplifier.py +1 -3
- angr/analyses/decompiler/region_simplifiers/switch_cluster_simplifier.py +19 -19
- angr/analyses/decompiler/return_maker.py +1 -2
- angr/analyses/decompiler/structured_codegen/base.py +5 -6
- angr/analyses/decompiler/structured_codegen/c.py +39 -38
- angr/analyses/decompiler/structuring/__init__.py +1 -1
- angr/analyses/decompiler/structuring/dream.py +17 -16
- angr/analyses/decompiler/structuring/phoenix.py +45 -46
- angr/analyses/decompiler/structuring/recursive_structurer.py +4 -4
- angr/analyses/decompiler/structuring/structurer_base.py +16 -15
- angr/analyses/decompiler/structuring/structurer_nodes.py +10 -9
- angr/analyses/decompiler/utils.py +17 -16
- angr/analyses/disassembly.py +7 -6
- angr/analyses/flirt.py +9 -9
- angr/analyses/forward_analysis/forward_analysis.py +15 -14
- angr/analyses/forward_analysis/visitors/function_graph.py +1 -2
- angr/analyses/forward_analysis/visitors/graph.py +16 -15
- angr/analyses/propagator/engine_ail.py +30 -26
- angr/analyses/propagator/outdated_definition_walker.py +8 -7
- angr/analyses/propagator/propagator.py +11 -13
- angr/analyses/proximity_graph.py +21 -21
- angr/analyses/reaching_definitions/__init__.py +3 -3
- angr/analyses/reaching_definitions/call_trace.py +3 -6
- angr/analyses/reaching_definitions/dep_graph.py +41 -48
- angr/analyses/reaching_definitions/engine_ail.py +11 -5
- angr/analyses/reaching_definitions/engine_vex.py +9 -8
- angr/analyses/reaching_definitions/function_handler.py +51 -34
- angr/analyses/reaching_definitions/heap_allocator.py +3 -4
- angr/analyses/reaching_definitions/rd_initializer.py +8 -8
- angr/analyses/reaching_definitions/rd_state.py +57 -58
- angr/analyses/reaching_definitions/reaching_definitions.py +18 -17
- angr/analyses/reaching_definitions/subject.py +2 -3
- angr/analyses/stack_pointer_tracker.py +15 -6
- angr/analyses/typehoon/dfa.py +4 -4
- angr/analyses/typehoon/simple_solver.py +48 -52
- angr/analyses/typehoon/translator.py +3 -6
- angr/analyses/typehoon/typeconsts.py +13 -14
- angr/analyses/typehoon/typehoon.py +9 -9
- angr/analyses/typehoon/typevars.py +18 -17
- angr/analyses/variable_recovery/engine_ail.py +5 -5
- angr/analyses/variable_recovery/engine_base.py +25 -21
- angr/analyses/variable_recovery/irsb_scanner.py +8 -9
- angr/analyses/variable_recovery/variable_recovery.py +1 -2
- angr/analyses/variable_recovery/variable_recovery_base.py +14 -13
- angr/analyses/variable_recovery/variable_recovery_fast.py +8 -8
- angr/analyses/veritesting.py +1 -2
- angr/analyses/vfg.py +57 -56
- angr/analyses/xrefs.py +1 -2
- angr/angrdb/db.py +7 -7
- angr/angrdb/serializers/kb.py +16 -13
- angr/angrdb/serializers/loader.py +1 -2
- angr/angrdb/serializers/structured_code.py +2 -2
- angr/annocfg.py +1 -2
- angr/block.py +16 -6
- angr/calling_conventions.py +27 -27
- angr/code_location.py +8 -8
- angr/codenode.py +1 -2
- angr/concretization_strategies/max.py +1 -3
- angr/distributed/server.py +1 -3
- angr/distributed/worker.py +1 -2
- angr/engines/engine.py +2 -3
- angr/engines/light/engine.py +4 -4
- angr/engines/pcode/behavior.py +20 -2
- angr/engines/pcode/emulate.py +1 -1
- angr/engines/pcode/engine.py +7 -7
- angr/engines/pcode/lifter.py +78 -77
- angr/engines/vex/claripy/ccall.py +1 -2
- angr/engines/vex/claripy/datalayer.py +1 -2
- angr/engines/vex/light/light.py +1 -2
- angr/exploration_techniques/tracer.py +4 -4
- angr/factory.py +12 -15
- angr/flirt/__init__.py +8 -8
- angr/flirt/build_sig.py +2 -3
- angr/keyed_region.py +2 -2
- angr/knowledge_base/knowledge_base.py +3 -3
- angr/knowledge_plugins/callsite_prototypes.py +4 -6
- angr/knowledge_plugins/cfg/cfg_manager.py +19 -6
- angr/knowledge_plugins/cfg/cfg_model.py +26 -27
- angr/knowledge_plugins/cfg/cfg_node.py +2 -2
- angr/knowledge_plugins/cfg/indirect_jump.py +6 -8
- angr/knowledge_plugins/cfg/memory_data.py +8 -9
- angr/knowledge_plugins/custom_strings.py +1 -3
- angr/knowledge_plugins/debug_variables.py +2 -2
- angr/knowledge_plugins/functions/function.py +21 -22
- angr/knowledge_plugins/functions/function_manager.py +5 -5
- angr/knowledge_plugins/indirect_jumps.py +1 -3
- angr/knowledge_plugins/key_definitions/atoms.py +7 -7
- angr/knowledge_plugins/key_definitions/definition.py +14 -14
- angr/knowledge_plugins/key_definitions/environment.py +5 -7
- angr/knowledge_plugins/key_definitions/heap_address.py +1 -3
- angr/knowledge_plugins/key_definitions/key_definition_manager.py +3 -2
- angr/knowledge_plugins/key_definitions/live_definitions.py +60 -59
- angr/knowledge_plugins/key_definitions/liveness.py +16 -16
- angr/knowledge_plugins/key_definitions/rd_model.py +15 -15
- angr/knowledge_plugins/key_definitions/uses.py +11 -11
- angr/knowledge_plugins/patches.py +4 -8
- angr/knowledge_plugins/propagations/prop_value.py +10 -9
- angr/knowledge_plugins/propagations/propagation_manager.py +3 -5
- angr/knowledge_plugins/propagations/propagation_model.py +9 -9
- angr/knowledge_plugins/propagations/states.py +52 -22
- angr/knowledge_plugins/structured_code/manager.py +2 -2
- angr/knowledge_plugins/sync/sync_controller.py +3 -3
- angr/knowledge_plugins/variables/variable_access.py +4 -4
- angr/knowledge_plugins/variables/variable_manager.py +56 -39
- angr/knowledge_plugins/xrefs/xref.py +9 -11
- angr/knowledge_plugins/xrefs/xref_manager.py +3 -4
- angr/misc/ansi.py +1 -2
- angr/misc/autoimport.py +3 -3
- angr/misc/plugins.py +9 -9
- angr/procedures/definitions/__init__.py +16 -16
- angr/procedures/definitions/linux_kernel.py +1 -1
- angr/procedures/definitions/parse_win32json.py +1 -1
- angr/procedures/java_jni/__init__.py +1 -1
- angr/procedures/java_jni/array_operations.py +1 -2
- angr/procedures/java_jni/method_calls.py +1 -2
- angr/procedures/posix/inet_ntoa.py +1 -2
- angr/procedures/stubs/format_parser.py +3 -3
- angr/project.py +13 -11
- angr/sim_manager.py +12 -12
- angr/sim_procedure.py +7 -3
- angr/sim_state.py +2 -2
- angr/sim_type.py +60 -45
- angr/sim_variable.py +5 -5
- angr/simos/simos.py +1 -2
- angr/simos/userland.py +1 -2
- angr/state_plugins/callstack.py +3 -2
- angr/state_plugins/history.py +1 -2
- angr/state_plugins/solver.py +34 -34
- angr/storage/memory_mixins/__init__.py +4 -3
- angr/storage/memory_mixins/actions_mixin.py +1 -3
- angr/storage/memory_mixins/address_concretization_mixin.py +1 -3
- angr/storage/memory_mixins/convenient_mappings_mixin.py +3 -4
- angr/storage/memory_mixins/default_filler_mixin.py +1 -1
- angr/storage/memory_mixins/label_merger_mixin.py +2 -2
- angr/storage/memory_mixins/multi_value_merger_mixin.py +4 -3
- angr/storage/memory_mixins/paged_memory/page_backer_mixins.py +9 -8
- angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +12 -11
- angr/storage/memory_mixins/paged_memory/pages/cooperation.py +8 -8
- angr/storage/memory_mixins/paged_memory/pages/history_tracking_mixin.py +2 -3
- angr/storage/memory_mixins/paged_memory/pages/list_page.py +10 -11
- angr/storage/memory_mixins/paged_memory/pages/multi_values.py +11 -10
- angr/storage/memory_mixins/paged_memory/pages/mv_list_page.py +18 -17
- angr/storage/memory_mixins/paged_memory/pages/ultra_page.py +12 -11
- angr/storage/memory_mixins/regioned_memory/abstract_address_descriptor.py +3 -3
- angr/storage/memory_mixins/regioned_memory/abstract_merger_mixin.py +3 -2
- angr/storage/memory_mixins/regioned_memory/region_data.py +1 -2
- angr/storage/memory_mixins/regioned_memory/region_meta_mixin.py +2 -2
- angr/storage/memory_mixins/regioned_memory/regioned_address_concretization_mixin.py +3 -3
- angr/storage/memory_mixins/regioned_memory/regioned_memory_mixin.py +18 -21
- angr/storage/memory_mixins/size_resolution_mixin.py +1 -2
- angr/storage/memory_mixins/symbolic_merger_mixin.py +3 -2
- angr/storage/memory_mixins/top_merger_mixin.py +3 -2
- angr/storage/memory_object.py +2 -4
- angr/utils/algo.py +3 -2
- angr/utils/dynamic_dictlist.py +5 -5
- angr/utils/formatting.py +4 -4
- angr/utils/funcid.py +1 -2
- angr/utils/graph.py +5 -6
- angr/utils/library.py +5 -5
- angr/utils/mp.py +5 -4
- angr/utils/segment_list.py +3 -4
- angr/utils/typing.py +3 -2
- {angr-9.2.101.dist-info → angr-9.2.103.dist-info}/METADATA +9 -11
- {angr-9.2.101.dist-info → angr-9.2.103.dist-info}/RECORD +239 -236
- {angr-9.2.101.dist-info → angr-9.2.103.dist-info}/LICENSE +0 -0
- {angr-9.2.101.dist-info → angr-9.2.103.dist-info}/WHEEL +0 -0
- {angr-9.2.101.dist-info → angr-9.2.103.dist-info}/entry_points.txt +0 -0
- {angr-9.2.101.dist-info → angr-9.2.103.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Literal, TYPE_CHECKING
|
|
2
2
|
import logging
|
|
3
3
|
from collections import defaultdict
|
|
4
4
|
from itertools import count, chain
|
|
@@ -74,22 +74,22 @@ class VariableManagerInternal(Serializable):
|
|
|
74
74
|
|
|
75
75
|
self.func_addr = func_addr
|
|
76
76
|
|
|
77
|
-
self._variables:
|
|
77
|
+
self._variables: set[SimVariable] = OrderedSet() # all variables that are added to any region
|
|
78
78
|
self._global_region = KeyedRegion()
|
|
79
79
|
self._stack_region = KeyedRegion()
|
|
80
80
|
self._register_region = KeyedRegion()
|
|
81
81
|
self._live_variables = {} # a mapping between addresses of program points and live variable collections
|
|
82
82
|
|
|
83
|
-
self._variable_accesses:
|
|
84
|
-
self._insn_to_variable:
|
|
85
|
-
self._stmt_to_variable:
|
|
83
|
+
self._variable_accesses: dict[SimVariable, set[VariableAccess]] = defaultdict(set)
|
|
84
|
+
self._insn_to_variable: dict[int, set[tuple[SimVariable, int]]] = defaultdict(set)
|
|
85
|
+
self._stmt_to_variable: dict[tuple[int, int] | tuple[int, int, int], set[tuple[SimVariable, int]]] = (
|
|
86
86
|
defaultdict(set)
|
|
87
87
|
)
|
|
88
|
-
self._variable_to_stmt:
|
|
89
|
-
self._atom_to_variable:
|
|
90
|
-
|
|
88
|
+
self._variable_to_stmt: dict[SimVariable, set[tuple[int, int] | tuple[int, int, int]]] = defaultdict(set)
|
|
89
|
+
self._atom_to_variable: dict[
|
|
90
|
+
tuple[int, int] | tuple[int, int, int], dict[int, set[tuple[SimVariable, int]]]
|
|
91
91
|
] = defaultdict(_defaultdict_set)
|
|
92
|
-
self._ident_to_variable:
|
|
92
|
+
self._ident_to_variable: dict[str, SimVariable] = {}
|
|
93
93
|
self._variable_counters = {
|
|
94
94
|
"register": count(),
|
|
95
95
|
"stack": count(),
|
|
@@ -98,15 +98,15 @@ class VariableManagerInternal(Serializable):
|
|
|
98
98
|
"global": count(),
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
self._unified_variables:
|
|
102
|
-
self._variables_to_unified_variables:
|
|
101
|
+
self._unified_variables: set[SimVariable] = set()
|
|
102
|
+
self._variables_to_unified_variables: dict[SimVariable, SimVariable] = {}
|
|
103
103
|
|
|
104
104
|
self._phi_variables = {}
|
|
105
105
|
self._variables_to_phivars = defaultdict(set)
|
|
106
106
|
self._phi_variables_by_block = defaultdict(set)
|
|
107
107
|
|
|
108
108
|
self.types = TypesStore(self.manager._kb)
|
|
109
|
-
self.variable_to_types:
|
|
109
|
+
self.variable_to_types: dict[SimVariable, SimType] = {}
|
|
110
110
|
self.variables_with_manual_types = set()
|
|
111
111
|
|
|
112
112
|
# optimization
|
|
@@ -207,7 +207,9 @@ class VariableManagerInternal(Serializable):
|
|
|
207
207
|
unified_stack_variables = []
|
|
208
208
|
unified_memory_variables = []
|
|
209
209
|
|
|
210
|
+
unified_variable_idents: set[str] = set()
|
|
210
211
|
for variable in self._unified_variables:
|
|
212
|
+
unified_variable_idents.add(variable.ident)
|
|
211
213
|
if isinstance(variable, SimRegisterVariable):
|
|
212
214
|
unified_register_variables.append(variable.serialize_to_cmessage())
|
|
213
215
|
elif isinstance(variable, SimStackVariable):
|
|
@@ -223,6 +225,14 @@ class VariableManagerInternal(Serializable):
|
|
|
223
225
|
|
|
224
226
|
relations = []
|
|
225
227
|
for variable, unified in self._variables_to_unified_variables.items():
|
|
228
|
+
if unified.ident not in unified_variable_idents:
|
|
229
|
+
l.error(
|
|
230
|
+
"The unified variable %s is missing from the unified variables of function %#x. Please "
|
|
231
|
+
"report it on GitHub.",
|
|
232
|
+
unified.ident,
|
|
233
|
+
self.func_addr,
|
|
234
|
+
)
|
|
235
|
+
continue
|
|
226
236
|
relation = variables_pb2.Var2Unified()
|
|
227
237
|
relation.var_ident = variable.ident
|
|
228
238
|
relation.unified_var_ident = unified.ident
|
|
@@ -311,7 +321,14 @@ class VariableManagerInternal(Serializable):
|
|
|
311
321
|
|
|
312
322
|
for var2unified in cmsg.var2unified:
|
|
313
323
|
variable = variable_by_ident[var2unified.var_ident]
|
|
314
|
-
unified = unified_variable_by_ident
|
|
324
|
+
unified = unified_variable_by_ident.get(var2unified.unified_var_ident, None)
|
|
325
|
+
if unified is None:
|
|
326
|
+
l.warning(
|
|
327
|
+
"Unified variable %s is not found in unified_variable_by_ident.", var2unified.unified_var_ident
|
|
328
|
+
)
|
|
329
|
+
# as a stop gap, we make the variable unify to itself
|
|
330
|
+
model._variables_to_unified_variables[variable] = variable
|
|
331
|
+
continue
|
|
315
332
|
model._variables_to_unified_variables[variable] = unified
|
|
316
333
|
|
|
317
334
|
for phi2var in cmsg.phi2var:
|
|
@@ -569,15 +586,15 @@ class VariableManagerInternal(Serializable):
|
|
|
569
586
|
|
|
570
587
|
return vars_and_offset
|
|
571
588
|
|
|
572
|
-
def is_variable_used_at(self, variable: SimVariable, loc:
|
|
589
|
+
def is_variable_used_at(self, variable: SimVariable, loc: tuple[int, int]) -> bool:
|
|
573
590
|
return loc in self._variable_to_stmt[variable]
|
|
574
591
|
|
|
575
|
-
def find_variable_by_stmt(self, block_addr, stmt_idx, sort, block_idx:
|
|
592
|
+
def find_variable_by_stmt(self, block_addr, stmt_idx, sort, block_idx: int | None = None):
|
|
576
593
|
return next(iter(self.find_variables_by_stmt(block_addr, stmt_idx, sort, block_idx=block_idx)), None)
|
|
577
594
|
|
|
578
595
|
def find_variables_by_stmt(
|
|
579
|
-
self, block_addr: int, stmt_idx: int, sort: str, block_idx:
|
|
580
|
-
) ->
|
|
596
|
+
self, block_addr: int, stmt_idx: int, sort: str, block_idx: int | None = None
|
|
597
|
+
) -> list[tuple[SimVariable, int]]:
|
|
581
598
|
key = (block_addr, stmt_idx) if block_idx is None else (block_addr, block_idx, stmt_idx)
|
|
582
599
|
|
|
583
600
|
if key not in self._stmt_to_variable:
|
|
@@ -603,12 +620,12 @@ class VariableManagerInternal(Serializable):
|
|
|
603
620
|
|
|
604
621
|
return var_and_offsets
|
|
605
622
|
|
|
606
|
-
def find_variable_by_atom(self, block_addr, stmt_idx, atom, block_idx:
|
|
623
|
+
def find_variable_by_atom(self, block_addr, stmt_idx, atom, block_idx: int | None = None):
|
|
607
624
|
return next(iter(self.find_variables_by_atom(block_addr, stmt_idx, atom, block_idx=block_idx)), None)
|
|
608
625
|
|
|
609
626
|
def find_variables_by_atom(
|
|
610
|
-
self, block_addr, stmt_idx, atom, block_idx:
|
|
611
|
-
) ->
|
|
627
|
+
self, block_addr, stmt_idx, atom, block_idx: int | None = None
|
|
628
|
+
) -> set[tuple[SimVariable, int]]:
|
|
612
629
|
if block_idx is None:
|
|
613
630
|
key = block_addr, stmt_idx
|
|
614
631
|
else:
|
|
@@ -623,15 +640,15 @@ class VariableManagerInternal(Serializable):
|
|
|
623
640
|
|
|
624
641
|
return self._atom_to_variable[key][atom_hash]
|
|
625
642
|
|
|
626
|
-
def find_variables_by_stack_offset(self, offset: int) ->
|
|
643
|
+
def find_variables_by_stack_offset(self, offset: int) -> set[SimVariable]:
|
|
627
644
|
return self._stack_region.get_variables_by_offset(offset)
|
|
628
645
|
|
|
629
|
-
def find_variables_by_register(self, reg:
|
|
646
|
+
def find_variables_by_register(self, reg: str | int) -> set[SimVariable]:
|
|
630
647
|
if type(reg) is str:
|
|
631
648
|
reg = self.manager._kb._project.arch.registers.get(reg)[0]
|
|
632
649
|
return self._register_region.get_variables_by_offset(reg)
|
|
633
650
|
|
|
634
|
-
def get_variable_accesses(self, variable: SimVariable, same_name: bool = False) ->
|
|
651
|
+
def get_variable_accesses(self, variable: SimVariable, same_name: bool = False) -> list[VariableAccess]:
|
|
635
652
|
if not same_name:
|
|
636
653
|
if variable in self._variable_accesses:
|
|
637
654
|
return list(self._variable_accesses[variable])
|
|
@@ -653,8 +670,8 @@ class VariableManagerInternal(Serializable):
|
|
|
653
670
|
return accesses
|
|
654
671
|
|
|
655
672
|
def get_variables(
|
|
656
|
-
self, sort:
|
|
657
|
-
) ->
|
|
673
|
+
self, sort: Literal["stack", "reg"] | None = None, collapse_same_ident=False
|
|
674
|
+
) -> list[SimStackVariable | SimRegisterVariable]:
|
|
658
675
|
"""
|
|
659
676
|
Get a list of variables.
|
|
660
677
|
|
|
@@ -678,8 +695,8 @@ class VariableManagerInternal(Serializable):
|
|
|
678
695
|
return variables
|
|
679
696
|
|
|
680
697
|
def get_unified_variables(
|
|
681
|
-
self, sort:
|
|
682
|
-
) ->
|
|
698
|
+
self, sort: Literal["stack", "reg"] | None = None
|
|
699
|
+
) -> list[SimStackVariable | SimRegisterVariable]:
|
|
683
700
|
"""
|
|
684
701
|
Get a list of unified variables.
|
|
685
702
|
|
|
@@ -747,7 +764,7 @@ class VariableManagerInternal(Serializable):
|
|
|
747
764
|
variables[phi] = self._phi_variables[phi]
|
|
748
765
|
return variables
|
|
749
766
|
|
|
750
|
-
def get_variables_without_writes(self) ->
|
|
767
|
+
def get_variables_without_writes(self) -> list[SimVariable]:
|
|
751
768
|
"""
|
|
752
769
|
Get all variables that have never been written to.
|
|
753
770
|
|
|
@@ -828,7 +845,7 @@ class VariableManagerInternal(Serializable):
|
|
|
828
845
|
var.name = "g_%s" % var.addr
|
|
829
846
|
|
|
830
847
|
def assign_unified_variable_names(
|
|
831
|
-
self, labels=None, arg_names:
|
|
848
|
+
self, labels=None, arg_names: list[str] | None = None, reset: bool = False
|
|
832
849
|
) -> None:
|
|
833
850
|
"""
|
|
834
851
|
Assign default names to all unified variables.
|
|
@@ -901,7 +918,7 @@ class VariableManagerInternal(Serializable):
|
|
|
901
918
|
var.name = arg_names[idx] if arg_names else f"a{idx}"
|
|
902
919
|
var._hash = None
|
|
903
920
|
|
|
904
|
-
def _register_struct_type(self, ty: SimStruct, name:
|
|
921
|
+
def _register_struct_type(self, ty: SimStruct, name: str | None = None) -> TypeRef:
|
|
905
922
|
if not name:
|
|
906
923
|
name = ty.name
|
|
907
924
|
if not name:
|
|
@@ -916,7 +933,7 @@ class VariableManagerInternal(Serializable):
|
|
|
916
933
|
self,
|
|
917
934
|
var: SimVariable,
|
|
918
935
|
ty: SimType,
|
|
919
|
-
name:
|
|
936
|
+
name: str | None = None,
|
|
920
937
|
override_bot: bool = True,
|
|
921
938
|
all_unified: bool = False,
|
|
922
939
|
mark_manual: bool = False,
|
|
@@ -956,7 +973,7 @@ class VariableManagerInternal(Serializable):
|
|
|
956
973
|
if mark_manual:
|
|
957
974
|
self.variables_with_manual_types.add(other_var)
|
|
958
975
|
|
|
959
|
-
def get_variable_type(self, var) ->
|
|
976
|
+
def get_variable_type(self, var) -> SimType | None:
|
|
960
977
|
return self.variable_to_types.get(var, None)
|
|
961
978
|
|
|
962
979
|
def remove_types(self):
|
|
@@ -968,8 +985,8 @@ class VariableManagerInternal(Serializable):
|
|
|
968
985
|
Map SSA variables to a unified variable. Fill in self._unified_variables.
|
|
969
986
|
"""
|
|
970
987
|
|
|
971
|
-
stack_vars:
|
|
972
|
-
reg_vars:
|
|
988
|
+
stack_vars: dict[int, list[SimStackVariable]] = defaultdict(list)
|
|
989
|
+
reg_vars: set[SimRegisterVariable] = set()
|
|
973
990
|
|
|
974
991
|
# unify stack variables based on their locations
|
|
975
992
|
for v in self.get_variables():
|
|
@@ -1043,7 +1060,7 @@ class VariableManagerInternal(Serializable):
|
|
|
1043
1060
|
self._unified_variables.add(unified)
|
|
1044
1061
|
self._variables_to_unified_variables[variable] = unified
|
|
1045
1062
|
|
|
1046
|
-
def unified_variable(self, variable: SimVariable) ->
|
|
1063
|
+
def unified_variable(self, variable: SimVariable) -> SimVariable | None:
|
|
1047
1064
|
"""
|
|
1048
1065
|
Return the unified variable for a given SSA variable,
|
|
1049
1066
|
|
|
@@ -1062,7 +1079,7 @@ class VariableManager(KnowledgeBasePlugin):
|
|
|
1062
1079
|
def __init__(self, kb):
|
|
1063
1080
|
super().__init__(kb=kb)
|
|
1064
1081
|
self.global_manager = VariableManagerInternal(self)
|
|
1065
|
-
self.function_managers:
|
|
1082
|
+
self.function_managers: dict[int, VariableManagerInternal] = {}
|
|
1066
1083
|
|
|
1067
1084
|
def __contains__(self, key) -> bool:
|
|
1068
1085
|
if key == "global":
|
|
@@ -1118,7 +1135,7 @@ class VariableManager(KnowledgeBasePlugin):
|
|
|
1118
1135
|
for manager in self.function_managers.values():
|
|
1119
1136
|
manager.assign_variable_names()
|
|
1120
1137
|
|
|
1121
|
-
def get_variable_accesses(self, variable: SimVariable, same_name: bool = False) ->
|
|
1138
|
+
def get_variable_accesses(self, variable: SimVariable, same_name: bool = False) -> list[VariableAccess]:
|
|
1122
1139
|
"""
|
|
1123
1140
|
Get a list of all references to the given variable.
|
|
1124
1141
|
|
|
@@ -1141,7 +1158,7 @@ class VariableManager(KnowledgeBasePlugin):
|
|
|
1141
1158
|
raise NotImplementedError
|
|
1142
1159
|
|
|
1143
1160
|
@staticmethod
|
|
1144
|
-
def convert_variable_list(vlist:
|
|
1161
|
+
def convert_variable_list(vlist: list[Variable], manager: VariableManagerInternal):
|
|
1145
1162
|
for v in vlist:
|
|
1146
1163
|
simv = None
|
|
1147
1164
|
if v.type is None:
|
|
@@ -1159,7 +1176,7 @@ class VariableManager(KnowledgeBasePlugin):
|
|
|
1159
1176
|
simv.name = v.name
|
|
1160
1177
|
manager.add_variable(v.sort, v.addr, simv)
|
|
1161
1178
|
|
|
1162
|
-
def load_from_dwarf(self, cu_list:
|
|
1179
|
+
def load_from_dwarf(self, cu_list: list[CompilationUnit] = None):
|
|
1163
1180
|
cu_list = cu_list or self._kb._project.loader.main_object.compilation_units
|
|
1164
1181
|
if cu_list is None:
|
|
1165
1182
|
l.warning("no CompilationUnit found")
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
1
|
from ...serializable import Serializable
|
|
4
2
|
from ...protos import primitives_pb2
|
|
5
3
|
from .xref_types import XRefType
|
|
@@ -23,22 +21,22 @@ class XRef(Serializable):
|
|
|
23
21
|
|
|
24
22
|
def __init__(
|
|
25
23
|
self,
|
|
26
|
-
ins_addr:
|
|
27
|
-
block_addr:
|
|
28
|
-
stmt_idx:
|
|
29
|
-
insn_op_idx:
|
|
24
|
+
ins_addr: int | None = None,
|
|
25
|
+
block_addr: int | None = None,
|
|
26
|
+
stmt_idx: int | None = None,
|
|
27
|
+
insn_op_idx: int | None = None,
|
|
30
28
|
memory_data=None,
|
|
31
|
-
dst:
|
|
29
|
+
dst: int | None = None,
|
|
32
30
|
xref_type=None,
|
|
33
31
|
):
|
|
34
32
|
if dst is not None and not isinstance(dst, int):
|
|
35
33
|
raise TypeError("XRefs must be pointing to a constant target. Target %r is not supported." % dst)
|
|
36
34
|
|
|
37
35
|
# src
|
|
38
|
-
self.ins_addr:
|
|
39
|
-
self.insn_op_idx:
|
|
40
|
-
self.block_addr:
|
|
41
|
-
self.stmt_idx:
|
|
36
|
+
self.ins_addr: int | None = ins_addr
|
|
37
|
+
self.insn_op_idx: int | None = insn_op_idx
|
|
38
|
+
self.block_addr: int | None = block_addr
|
|
39
|
+
self.stmt_idx: int | None = stmt_idx
|
|
42
40
|
|
|
43
41
|
# dst
|
|
44
42
|
self.memory_data = memory_data # optional
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from typing import Set, Dict
|
|
2
1
|
import logging
|
|
3
2
|
from collections import defaultdict
|
|
4
3
|
|
|
@@ -15,8 +14,8 @@ class XRefManager(KnowledgeBasePlugin, Serializable):
|
|
|
15
14
|
def __init__(self, kb):
|
|
16
15
|
super().__init__(kb=kb)
|
|
17
16
|
|
|
18
|
-
self.xrefs_by_ins_addr:
|
|
19
|
-
self.xrefs_by_dst:
|
|
17
|
+
self.xrefs_by_ins_addr: dict[int, set[XRef]] = defaultdict(set)
|
|
18
|
+
self.xrefs_by_dst: dict[int, set[XRef]] = defaultdict(set)
|
|
20
19
|
|
|
21
20
|
def copy(self):
|
|
22
21
|
xm = XRefManager(self._kb)
|
|
@@ -70,7 +69,7 @@ class XRefManager(KnowledgeBasePlugin, Serializable):
|
|
|
70
69
|
refs = refs.union(self.xrefs_by_dst[addr])
|
|
71
70
|
return refs
|
|
72
71
|
|
|
73
|
-
def get_xrefs_by_ins_addr_region(self, start, end) ->
|
|
72
|
+
def get_xrefs_by_ins_addr_region(self, start, end) -> set[XRef]:
|
|
74
73
|
"""
|
|
75
74
|
Get a set of XRef objects that originate at a given address region
|
|
76
75
|
bounded by start and end. Useful for finding references from a basic block or function.
|
angr/misc/ansi.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from typing import Union
|
|
2
1
|
from enum import Enum, unique
|
|
3
2
|
|
|
4
3
|
|
|
@@ -37,7 +36,7 @@ BackgroundColor = unique(Enum("BackgroundColor", {i.name: (i.value + 10) for i i
|
|
|
37
36
|
#
|
|
38
37
|
|
|
39
38
|
|
|
40
|
-
def color(c:
|
|
39
|
+
def color(c: Color | BackgroundColor, bright: bool):
|
|
41
40
|
"""
|
|
42
41
|
Return the ansi prefix using the given code
|
|
43
42
|
Bright may not be used with a BackgroundColor
|
angr/misc/autoimport.py
CHANGED
|
@@ -3,7 +3,7 @@ import importlib
|
|
|
3
3
|
import importlib.machinery
|
|
4
4
|
import importlib.util
|
|
5
5
|
import logging
|
|
6
|
-
from
|
|
6
|
+
from collections.abc import Callable
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
l = logging.getLogger(name=__name__)
|
|
@@ -36,7 +36,7 @@ def auto_import_packages(base_module, base_path, ignore_dirs=(), ignore_files=()
|
|
|
36
36
|
yield lib_module_name, package
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
def auto_import_modules(base_module, base_path, ignore_files=(), filter_func:
|
|
39
|
+
def auto_import_modules(base_module, base_path, ignore_files=(), filter_func: Callable | None = None):
|
|
40
40
|
for proc_file_name in os.listdir(base_path):
|
|
41
41
|
if not proc_file_name.endswith(".py"):
|
|
42
42
|
continue
|
|
@@ -65,7 +65,7 @@ def filter_module(mod, type_req=None, subclass_req=None):
|
|
|
65
65
|
yield name, val
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
def auto_import_source_files(base_path, ignore_files=(), filter_func:
|
|
68
|
+
def auto_import_source_files(base_path, ignore_files=(), filter_func: Callable | None = None):
|
|
69
69
|
for proc_file_name in os.listdir(base_path):
|
|
70
70
|
if not proc_file_name.endswith(".py"):
|
|
71
71
|
continue
|
angr/misc/plugins.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import TypeVar, Generic
|
|
2
2
|
|
|
3
3
|
from angr.errors import AngrNoPluginError
|
|
4
4
|
|
|
@@ -26,15 +26,15 @@ class PluginHub(Generic[P]):
|
|
|
26
26
|
|
|
27
27
|
def __init__(self):
|
|
28
28
|
super().__init__()
|
|
29
|
-
self._active_plugins:
|
|
30
|
-
self._active_preset:
|
|
31
|
-
self._provided_by_preset:
|
|
29
|
+
self._active_plugins: dict[str, P] = {}
|
|
30
|
+
self._active_preset: PluginPreset | None = None
|
|
31
|
+
self._provided_by_preset: list[int] = []
|
|
32
32
|
|
|
33
33
|
#
|
|
34
34
|
# Class methods for registration
|
|
35
35
|
#
|
|
36
36
|
|
|
37
|
-
_presets:
|
|
37
|
+
_presets: dict[str, type[P]]
|
|
38
38
|
|
|
39
39
|
@classmethod
|
|
40
40
|
def register_default(cls, name, plugin_cls, preset="default"):
|
|
@@ -157,7 +157,7 @@ class PluginHub(Generic[P]):
|
|
|
157
157
|
return self._active_plugins[name]
|
|
158
158
|
|
|
159
159
|
elif self._active_preset is not None:
|
|
160
|
-
plugin_cls:
|
|
160
|
+
plugin_cls: type[P] = self._active_preset.request_plugin(name)
|
|
161
161
|
plugin = self._init_plugin(plugin_cls)
|
|
162
162
|
|
|
163
163
|
# Remember that this plugin was provided by preset.
|
|
@@ -169,7 +169,7 @@ class PluginHub(Generic[P]):
|
|
|
169
169
|
else:
|
|
170
170
|
raise AngrNoPluginError("No such plugin: %s" % name)
|
|
171
171
|
|
|
172
|
-
def _init_plugin(self, plugin_cls:
|
|
172
|
+
def _init_plugin(self, plugin_cls: type[P]) -> P: # pylint: disable=no-self-use
|
|
173
173
|
"""
|
|
174
174
|
Perform any initialization actions on plugin before it is added to the list of active plugins.
|
|
175
175
|
|
|
@@ -217,7 +217,7 @@ class PluginPreset:
|
|
|
217
217
|
"""
|
|
218
218
|
|
|
219
219
|
def __init__(self):
|
|
220
|
-
self._default_plugins:
|
|
220
|
+
self._default_plugins: dict[str, type[P]] = {}
|
|
221
221
|
|
|
222
222
|
def activate(self, hub): # pylint:disable=no-self-use,unused-argument
|
|
223
223
|
"""
|
|
@@ -243,7 +243,7 @@ class PluginPreset:
|
|
|
243
243
|
"""
|
|
244
244
|
return self._default_plugins.keys()
|
|
245
245
|
|
|
246
|
-
def request_plugin(self, name: str) ->
|
|
246
|
+
def request_plugin(self, name: str) -> type[P]:
|
|
247
247
|
"""
|
|
248
248
|
Return the plugin class which is registered under the name ``name``, or raise NoPlugin if
|
|
249
249
|
the name isn't available.
|
|
@@ -25,8 +25,8 @@ if TYPE_CHECKING:
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
l = logging.getLogger(name=__name__)
|
|
28
|
-
SIM_LIBRARIES:
|
|
29
|
-
SIM_TYPE_COLLECTIONS:
|
|
28
|
+
SIM_LIBRARIES: dict[str, "SimLibrary"] = {}
|
|
29
|
+
SIM_TYPE_COLLECTIONS: dict[str, "SimTypeCollection"] = {}
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
class SimTypeCollection:
|
|
@@ -35,8 +35,8 @@ class SimTypeCollection:
|
|
|
35
35
|
"""
|
|
36
36
|
|
|
37
37
|
def __init__(self):
|
|
38
|
-
self.names:
|
|
39
|
-
self.types:
|
|
38
|
+
self.names: list[str] | None = None
|
|
39
|
+
self.types: dict[str, "SimType"] = {}
|
|
40
40
|
|
|
41
41
|
def set_names(self, *names):
|
|
42
42
|
self.names = names
|
|
@@ -98,10 +98,10 @@ class SimLibrary:
|
|
|
98
98
|
"""
|
|
99
99
|
|
|
100
100
|
def __init__(self):
|
|
101
|
-
self.type_collection_names:
|
|
101
|
+
self.type_collection_names: list[str] = []
|
|
102
102
|
self.procedures = {}
|
|
103
103
|
self.non_returning = set()
|
|
104
|
-
self.prototypes:
|
|
104
|
+
self.prototypes: dict[str, SimTypeFunction] = {}
|
|
105
105
|
self.default_ccs = {}
|
|
106
106
|
self.names = []
|
|
107
107
|
self.fallback_cc = dict(DEFAULT_CC)
|
|
@@ -292,7 +292,7 @@ class SimLibrary:
|
|
|
292
292
|
self._apply_metadata(proc, arch)
|
|
293
293
|
return proc
|
|
294
294
|
|
|
295
|
-
def get_prototype(self, name: str, arch=None) ->
|
|
295
|
+
def get_prototype(self, name: str, arch=None) -> SimTypeFunction | None:
|
|
296
296
|
"""
|
|
297
297
|
Get a prototype of the given function name, optionally specialize the prototype to a given architecture.
|
|
298
298
|
|
|
@@ -355,7 +355,7 @@ class SimCppLibrary(SimLibrary):
|
|
|
355
355
|
return name
|
|
356
356
|
|
|
357
357
|
@staticmethod
|
|
358
|
-
def _proto_from_demangled_name(name: str) ->
|
|
358
|
+
def _proto_from_demangled_name(name: str) -> SimTypeFunction | None:
|
|
359
359
|
"""
|
|
360
360
|
Attempt to extract arguments and calling convention information for a C++ function whose name was mangled
|
|
361
361
|
according to the Itanium C++ ABI symbol mangling language.
|
|
@@ -411,7 +411,7 @@ class SimCppLibrary(SimLibrary):
|
|
|
411
411
|
stub.num_args = len(stub.prototype.args)
|
|
412
412
|
return stub
|
|
413
413
|
|
|
414
|
-
def get_prototype(self, name: str, arch=None) ->
|
|
414
|
+
def get_prototype(self, name: str, arch=None) -> SimTypeFunction | None:
|
|
415
415
|
"""
|
|
416
416
|
Get a prototype of the given function name, optionally specialize the prototype to a given architecture. The
|
|
417
417
|
function name will be demangled first.
|
|
@@ -468,10 +468,10 @@ class SimSyscallLibrary(SimLibrary):
|
|
|
468
468
|
|
|
469
469
|
def __init__(self):
|
|
470
470
|
super().__init__()
|
|
471
|
-
self.syscall_number_mapping:
|
|
472
|
-
self.syscall_name_mapping:
|
|
473
|
-
self.default_cc_mapping:
|
|
474
|
-
self.syscall_prototypes:
|
|
471
|
+
self.syscall_number_mapping: dict[str, dict[int, str]] = defaultdict(dict) # keyed by abi
|
|
472
|
+
self.syscall_name_mapping: dict[str, dict[str, int]] = defaultdict(dict) # keyed by abi
|
|
473
|
+
self.default_cc_mapping: dict[str, type["SimCCSyscall"]] = {} # keyed by abi
|
|
474
|
+
self.syscall_prototypes: dict[str, dict[str, SimTypeFunction]] = defaultdict(dict) # keyed by abi
|
|
475
475
|
self.fallback_proc = stub_syscall
|
|
476
476
|
|
|
477
477
|
def copy(self):
|
|
@@ -551,7 +551,7 @@ class SimSyscallLibrary(SimLibrary):
|
|
|
551
551
|
"""
|
|
552
552
|
self.syscall_prototypes[abi][name] = proto
|
|
553
553
|
|
|
554
|
-
def set_prototypes(self, abi: str, protos:
|
|
554
|
+
def set_prototypes(self, abi: str, protos: dict[str, SimTypeFunction]) -> None: # pylint: disable=arguments-differ
|
|
555
555
|
"""
|
|
556
556
|
Set the prototypes of many syscalls.
|
|
557
557
|
|
|
@@ -621,7 +621,7 @@ class SimSyscallLibrary(SimLibrary):
|
|
|
621
621
|
l.debug("unsupported syscall: %s", number)
|
|
622
622
|
return proc
|
|
623
623
|
|
|
624
|
-
def get_prototype(self, abi: str, name: str, arch=None) ->
|
|
624
|
+
def get_prototype(self, abi: str, name: str, arch=None) -> SimTypeFunction | None:
|
|
625
625
|
"""
|
|
626
626
|
Get a prototype of the given syscall name and its ABI, optionally specialize the prototype to a given
|
|
627
627
|
architecture.
|
|
@@ -686,7 +686,7 @@ class SimSyscallLibrary(SimLibrary):
|
|
|
686
686
|
# - We will load all APIs when load_all_definitions() is called.
|
|
687
687
|
|
|
688
688
|
_DEFINITIONS_BASEDIR = os.path.dirname(os.path.realpath(__file__))
|
|
689
|
-
_EXTERNAL_DEFINITIONS_DIRS:
|
|
689
|
+
_EXTERNAL_DEFINITIONS_DIRS: list[str] | None = None
|
|
690
690
|
|
|
691
691
|
|
|
692
692
|
def load_type_collections(skip=None) -> None:
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from typing import Optional
|
|
3
2
|
|
|
4
3
|
from . import JNISimProcedure
|
|
5
4
|
from ...engines.soot.expressions import SimSootExpr_NewArray
|
|
@@ -30,7 +29,7 @@ class GetArrayLength(JNISimProcedure):
|
|
|
30
29
|
|
|
31
30
|
|
|
32
31
|
class NewArray(JNISimProcedure):
|
|
33
|
-
element_type:
|
|
32
|
+
element_type: str | None = None
|
|
34
33
|
return_ty = "reference"
|
|
35
34
|
|
|
36
35
|
def run(self, ptr_env, length_):
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from typing import Optional
|
|
3
2
|
|
|
4
3
|
from archinfo.arch_soot import ArchSoot, SootAddressDescriptor, SootArgument, SootMethodDescriptor
|
|
5
4
|
|
|
@@ -38,7 +37,7 @@ class GetMethodID(JNISimProcedure):
|
|
|
38
37
|
|
|
39
38
|
|
|
40
39
|
class CallMethodBase(JNISimProcedure):
|
|
41
|
-
return_ty:
|
|
40
|
+
return_ty: str | None = None
|
|
42
41
|
|
|
43
42
|
def _invoke(self, method_id, obj=None, dynamic_dispatch=True, args_in_array=None):
|
|
44
43
|
# get invoke target
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from socket import inet_ntoa as _inet_ntoa
|
|
2
|
-
from typing import List
|
|
3
2
|
|
|
4
3
|
from claripy import BVS, BVV, Concat
|
|
5
4
|
from claripy.ast import BV
|
|
@@ -28,7 +27,7 @@ class inet_ntoa(angr.SimProcedure):
|
|
|
28
27
|
size=self.INET_INADDRSTRLEN,
|
|
29
28
|
).rebased_addr
|
|
30
29
|
|
|
31
|
-
rv_exprs:
|
|
30
|
+
rv_exprs: list[BV] = []
|
|
32
31
|
addr_s_in = addr_in["s_addr"]
|
|
33
32
|
|
|
34
33
|
if addr_s_in.concrete:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
2
|
from string import digits as ascii_digits
|
|
3
3
|
import logging
|
|
4
4
|
import math
|
|
@@ -434,7 +434,7 @@ class FormatParser(SimProcedure):
|
|
|
434
434
|
return FormatParser._MOD_SPEC
|
|
435
435
|
|
|
436
436
|
@property
|
|
437
|
-
def _all_spec(self) ->
|
|
437
|
+
def _all_spec(self) -> dict[bytes, "SimType"]:
|
|
438
438
|
"""
|
|
439
439
|
All specifiers and their lengths.
|
|
440
440
|
"""
|
|
@@ -506,7 +506,7 @@ class FormatParser(SimProcedure):
|
|
|
506
506
|
|
|
507
507
|
return None
|
|
508
508
|
|
|
509
|
-
def extract_components(self, fmt:
|
|
509
|
+
def extract_components(self, fmt: list) -> list:
|
|
510
510
|
"""
|
|
511
511
|
Extract the actual formats from the format string `fmt`.
|
|
512
512
|
|