angr 9.2.132__py3-none-manylinux2014_aarch64.whl → 9.2.134__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 +128 -128
- angr/analyses/__init__.py +38 -38
- angr/analyses/backward_slice.py +3 -4
- angr/analyses/binary_optimizer.py +5 -12
- angr/analyses/bindiff.py +3 -6
- angr/analyses/calling_convention.py +3 -4
- angr/analyses/cfg/__init__.py +3 -3
- angr/analyses/cfg/cfg_base.py +1 -1
- angr/analyses/cfg/cfg_fast.py +17 -15
- angr/analyses/cfg/indirect_jump_resolvers/__init__.py +5 -5
- angr/analyses/cfg/indirect_jump_resolvers/amd64_elf_got.py +1 -1
- angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +15 -13
- angr/analyses/data_dep/__init__.py +4 -4
- angr/analyses/datagraph_meta.py +1 -1
- angr/analyses/ddg.py +2 -6
- angr/analyses/decompiler/__init__.py +12 -12
- angr/analyses/decompiler/ail_simplifier.py +21 -10
- angr/analyses/decompiler/block_similarity.py +2 -4
- angr/analyses/decompiler/callsite_maker.py +1 -1
- angr/analyses/decompiler/ccall_rewriters/rewriter_base.py +1 -1
- angr/analyses/decompiler/clinic.py +14 -7
- angr/analyses/decompiler/condition_processor.py +45 -29
- angr/analyses/decompiler/counters/__init__.py +3 -3
- angr/analyses/decompiler/decompilation_cache.py +7 -7
- angr/analyses/decompiler/dephication/__init__.py +1 -1
- angr/analyses/decompiler/dephication/graph_vvar_mapping.py +11 -3
- angr/analyses/decompiler/expression_narrower.py +1 -1
- angr/analyses/decompiler/graph_region.py +8 -8
- angr/analyses/decompiler/optimization_passes/__init__.py +20 -20
- angr/analyses/decompiler/optimization_passes/deadblock_remover.py +1 -2
- angr/analyses/decompiler/optimization_passes/duplication_reverter/duplication_reverter.py +8 -7
- angr/analyses/decompiler/optimization_passes/duplication_reverter/utils.py +1 -3
- angr/analyses/decompiler/optimization_passes/engine_base.py +1 -1
- angr/analyses/decompiler/optimization_passes/inlined_string_transformation_simplifier.py +2 -4
- angr/analyses/decompiler/optimization_passes/ite_region_converter.py +2 -5
- angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +5 -5
- angr/analyses/decompiler/optimization_passes/mod_simplifier.py +9 -3
- angr/analyses/decompiler/optimization_passes/optimization_pass.py +3 -0
- angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +9 -5
- angr/analyses/decompiler/peephole_optimizations/__init__.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/base.py +6 -6
- angr/analyses/decompiler/peephole_optimizations/rewrite_bit_extractions.py +1 -1
- angr/analyses/decompiler/presets/__init__.py +1 -1
- angr/analyses/decompiler/region_simplifiers/expr_folding.py +3 -3
- angr/analyses/decompiler/region_simplifiers/switch_cluster_simplifier.py +8 -12
- angr/analyses/decompiler/ssailification/rewriting_engine.py +1 -1
- angr/analyses/decompiler/structured_codegen/__init__.py +5 -5
- angr/analyses/decompiler/structured_codegen/base.py +3 -3
- angr/analyses/decompiler/structured_codegen/c.py +49 -42
- angr/analyses/decompiler/structuring/__init__.py +3 -3
- angr/analyses/decompiler/structuring/phoenix.py +19 -20
- angr/analyses/decompiler/structuring/structurer_base.py +2 -2
- angr/analyses/decompiler/structuring/structurer_nodes.py +14 -14
- angr/analyses/deobfuscator/__init__.py +3 -3
- angr/analyses/deobfuscator/string_obf_opt_passes.py +1 -1
- angr/analyses/disassembly.py +4 -4
- angr/analyses/forward_analysis/__init__.py +1 -1
- angr/analyses/forward_analysis/visitors/graph.py +6 -6
- angr/analyses/loop_analysis.py +1 -1
- angr/analyses/loopfinder.py +1 -1
- angr/analyses/propagator/outdated_definition_walker.py +12 -6
- angr/analyses/propagator/vex_vars.py +3 -3
- angr/analyses/reaching_definitions/__init__.py +9 -9
- angr/analyses/reaching_definitions/call_trace.py +2 -2
- angr/analyses/reaching_definitions/function_handler_library/__init__.py +1 -1
- angr/analyses/reaching_definitions/rd_state.py +10 -10
- angr/analyses/reassembler.py +26 -31
- angr/analyses/s_liveness.py +8 -0
- angr/analyses/s_reaching_definitions/s_rda_view.py +2 -5
- angr/analyses/stack_pointer_tracker.py +4 -4
- angr/analyses/typehoon/simple_solver.py +7 -9
- angr/analyses/typehoon/translator.py +2 -2
- angr/analyses/typehoon/typeconsts.py +1 -1
- angr/analyses/typehoon/typevars.py +17 -19
- angr/analyses/unpacker/__init__.py +1 -1
- angr/analyses/variable_recovery/engine_base.py +3 -4
- angr/analyses/variable_recovery/variable_recovery_base.py +1 -1
- angr/analyses/variable_recovery/variable_recovery_fast.py +2 -6
- angr/analyses/veritesting.py +2 -2
- angr/analyses/vfg.py +5 -5
- angr/angrdb/serializers/__init__.py +1 -1
- angr/annocfg.py +1 -1
- angr/blade.py +2 -2
- angr/block.py +16 -16
- angr/calling_conventions.py +11 -13
- angr/code_location.py +6 -10
- angr/codenode.py +3 -3
- angr/engines/__init__.py +12 -14
- angr/engines/engine.py +1 -54
- angr/engines/light/__init__.py +4 -4
- angr/engines/light/data.py +1 -1
- angr/engines/pcode/__init__.py +1 -1
- angr/engines/pcode/behavior.py +1 -1
- angr/engines/pcode/lifter.py +13 -15
- angr/engines/soot/expressions/__init__.py +12 -12
- angr/engines/soot/statements/__init__.py +6 -6
- angr/engines/soot/values/__init__.py +6 -6
- angr/engines/soot/values/arrayref.py +2 -2
- angr/engines/soot/values/constants.py +1 -1
- angr/engines/soot/values/instancefieldref.py +1 -1
- angr/engines/soot/values/paramref.py +1 -1
- angr/engines/soot/values/staticfieldref.py +1 -1
- angr/engines/successors.py +2 -5
- angr/engines/vex/__init__.py +5 -5
- angr/engines/vex/claripy/ccall.py +2 -2
- angr/engines/vex/claripy/irop.py +18 -18
- angr/engines/vex/heavy/__init__.py +2 -2
- angr/engines/vex/heavy/actions.py +1 -3
- angr/engines/vex/heavy/heavy.py +4 -6
- angr/engines/vex/lifter.py +2 -4
- angr/engines/vex/light/light.py +0 -2
- angr/engines/vex/light/slicing.py +3 -3
- angr/exploration_techniques/__init__.py +18 -18
- angr/exploration_techniques/threading.py +0 -6
- angr/factory.py +36 -6
- angr/keyed_region.py +4 -4
- angr/knowledge_base.py +1 -1
- angr/knowledge_plugins/__init__.py +11 -11
- angr/knowledge_plugins/cfg/__init__.py +5 -5
- angr/knowledge_plugins/cfg/cfg_manager.py +2 -2
- angr/knowledge_plugins/cfg/cfg_model.py +8 -8
- angr/knowledge_plugins/cfg/cfg_node.py +19 -19
- angr/knowledge_plugins/cfg/indirect_jump.py +6 -6
- angr/knowledge_plugins/cfg/memory_data.py +5 -7
- angr/knowledge_plugins/functions/function.py +48 -52
- angr/knowledge_plugins/functions/function_parser.py +4 -4
- angr/knowledge_plugins/key_definitions/__init__.py +3 -3
- angr/knowledge_plugins/key_definitions/atoms.py +6 -6
- angr/knowledge_plugins/key_definitions/definition.py +1 -1
- angr/knowledge_plugins/key_definitions/live_definitions.py +14 -14
- angr/knowledge_plugins/labels.py +1 -1
- angr/knowledge_plugins/propagations/__init__.py +1 -1
- angr/knowledge_plugins/propagations/prop_value.py +2 -2
- angr/knowledge_plugins/propagations/propagation_model.py +7 -8
- angr/knowledge_plugins/propagations/states.py +31 -31
- angr/knowledge_plugins/variables/variable_access.py +2 -2
- angr/knowledge_plugins/variables/variable_manager.py +1 -1
- angr/knowledge_plugins/xrefs/xref.py +5 -8
- angr/misc/__init__.py +4 -4
- angr/misc/hookset.py +4 -5
- angr/misc/loggers.py +2 -2
- angr/misc/telemetry.py +1 -1
- angr/procedures/__init__.py +1 -1
- angr/procedures/cgc/fdwait.py +2 -2
- angr/procedures/definitions/__init__.py +2 -2
- angr/procedures/definitions/linux_kernel.py +0 -1
- angr/procedures/definitions/parse_syscalls_from_local_system.py +1 -1
- angr/procedures/definitions/parse_win32json.py +0 -1
- angr/procedures/ntdll/exceptions.py +1 -1
- angr/procedures/stubs/format_parser.py +3 -3
- angr/procedures/win32/dynamic_loading.py +1 -1
- angr/protos/__init__.py +3 -3
- angr/sim_manager.py +2 -2
- angr/sim_state.py +1 -1
- angr/sim_state_options.py +3 -3
- angr/sim_type.py +10 -14
- angr/sim_variable.py +13 -17
- angr/simos/__init__.py +4 -4
- angr/simos/cgc.py +1 -1
- angr/simos/simos.py +1 -1
- angr/simos/userland.py +1 -1
- angr/slicer.py +4 -7
- angr/state_plugins/__init__.py +34 -34
- angr/state_plugins/callstack.py +5 -12
- angr/state_plugins/heap/__init__.py +2 -2
- angr/state_plugins/heap/heap_brk.py +2 -4
- angr/state_plugins/heap/heap_ptmalloc.py +1 -1
- angr/state_plugins/jni_references.py +3 -2
- angr/state_plugins/scratch.py +1 -1
- angr/state_plugins/sim_action.py +1 -4
- angr/state_plugins/sim_event.py +1 -1
- angr/state_plugins/solver.py +7 -9
- angr/state_plugins/uc_manager.py +1 -1
- angr/state_plugins/view.py +2 -2
- angr/storage/__init__.py +1 -1
- angr/storage/file.py +10 -10
- angr/storage/memory_mixins/__init__.py +46 -46
- angr/storage/memory_mixins/default_filler_mixin.py +1 -3
- angr/storage/memory_mixins/javavm_memory_mixin.py +2 -2
- angr/storage/memory_mixins/name_resolution_mixin.py +3 -3
- angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +1 -3
- angr/storage/memory_mixins/paged_memory/pages/__init__.py +6 -6
- angr/storage/memory_mixins/paged_memory/pages/list_page.py +1 -1
- angr/storage/memory_mixins/paged_memory/pages/multi_values.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/regioned_memory/__init__.py +3 -3
- angr/storage/memory_mixins/regioned_memory/region_data.py +5 -5
- angr/storage/memory_mixins/regioned_memory/region_meta_mixin.py +7 -9
- angr/storage/memory_mixins/regioned_memory/regioned_memory_mixin.py +4 -4
- angr/storage/memory_object.py +4 -4
- angr/utils/__init__.py +3 -3
- angr/utils/dynamic_dictlist.py +1 -1
- angr/utils/graph.py +1 -1
- angr/utils/segment_list.py +2 -2
- angr/utils/ssa/__init__.py +12 -5
- {angr-9.2.132.dist-info → angr-9.2.134.dist-info}/METADATA +6 -6
- {angr-9.2.132.dist-info → angr-9.2.134.dist-info}/RECORD +202 -202
- {angr-9.2.132.dist-info → angr-9.2.134.dist-info}/LICENSE +0 -0
- {angr-9.2.132.dist-info → angr-9.2.134.dist-info}/WHEEL +0 -0
- {angr-9.2.132.dist-info → angr-9.2.134.dist-info}/entry_points.txt +0 -0
- {angr-9.2.132.dist-info → angr-9.2.134.dist-info}/top_level.txt +0 -0
|
@@ -56,21 +56,21 @@ class ReachingDefinitionsState:
|
|
|
56
56
|
"""
|
|
57
57
|
|
|
58
58
|
__slots__ = (
|
|
59
|
-
"
|
|
59
|
+
"_canonical_size",
|
|
60
|
+
"_element_limit",
|
|
61
|
+
"_environment",
|
|
62
|
+
"_sp_adjusted",
|
|
60
63
|
"_subject",
|
|
64
|
+
"_track_consts",
|
|
61
65
|
"_track_tmps",
|
|
66
|
+
"all_definitions",
|
|
62
67
|
"analysis",
|
|
68
|
+
"arch",
|
|
63
69
|
"codeloc",
|
|
64
70
|
"codeloc_uses",
|
|
65
|
-
"live_definitions",
|
|
66
|
-
"all_definitions",
|
|
67
|
-
"_canonical_size",
|
|
68
|
-
"heap_allocator",
|
|
69
|
-
"_environment",
|
|
70
|
-
"_track_consts",
|
|
71
|
-
"_sp_adjusted",
|
|
72
71
|
"exit_observed",
|
|
73
|
-
"
|
|
72
|
+
"heap_allocator",
|
|
73
|
+
"live_definitions",
|
|
74
74
|
)
|
|
75
75
|
|
|
76
76
|
def __init__(
|
|
@@ -177,7 +177,7 @@ class ReachingDefinitionsState:
|
|
|
177
177
|
return claripy.BVS("stack_base", 32, explicit_name=True)
|
|
178
178
|
if self.arch.bits == 64:
|
|
179
179
|
return claripy.BVS("stack_base", 64, explicit_name=True)
|
|
180
|
-
raise ValueError("Unsupported architecture word size
|
|
180
|
+
raise ValueError(f"Unsupported architecture word size {self.arch.bits}")
|
|
181
181
|
|
|
182
182
|
def _to_signed(self, n):
|
|
183
183
|
if n >= 2 ** (self.arch.bits - 1):
|
angr/analyses/reassembler.py
CHANGED
|
@@ -152,7 +152,7 @@ class Label:
|
|
|
152
152
|
self.var_size = None
|
|
153
153
|
|
|
154
154
|
if self.name is None:
|
|
155
|
-
self.name = "label_
|
|
155
|
+
self.name = f"label_{next(Label.g_label_ctr)}"
|
|
156
156
|
|
|
157
157
|
self.original_addr = original_addr
|
|
158
158
|
self.base_addr = None
|
|
@@ -189,7 +189,7 @@ class Label:
|
|
|
189
189
|
offset = self.offset
|
|
190
190
|
sign = "+" if offset >= 0 else "-"
|
|
191
191
|
offset = abs(offset)
|
|
192
|
-
return "
|
|
192
|
+
return f".{self.name}{sign}{offset}"
|
|
193
193
|
|
|
194
194
|
@property
|
|
195
195
|
def offset(self):
|
|
@@ -318,7 +318,7 @@ class SymbolManager:
|
|
|
318
318
|
|
|
319
319
|
i = 0
|
|
320
320
|
while True:
|
|
321
|
-
name = "
|
|
321
|
+
name = f"{symbol_name}_{i}"
|
|
322
322
|
if name not in self.symbol_names:
|
|
323
323
|
self.symbol_names.add(name)
|
|
324
324
|
return name
|
|
@@ -473,9 +473,9 @@ class Operand:
|
|
|
473
473
|
def assembly(self):
|
|
474
474
|
if self.type == OP_TYPE_IMM and self.label:
|
|
475
475
|
if self.label_offset > 0:
|
|
476
|
-
return "
|
|
476
|
+
return f"{self.label.operand_str} + {self.label_offset}"
|
|
477
477
|
if self.label_offset < 0:
|
|
478
|
-
return "
|
|
478
|
+
return f"{self.label.operand_str} - {abs(self.label_offset)}"
|
|
479
479
|
return self.label.operand_str
|
|
480
480
|
|
|
481
481
|
if self.type == OP_TYPE_MEM:
|
|
@@ -483,13 +483,13 @@ class Operand:
|
|
|
483
483
|
if self.disp:
|
|
484
484
|
if self.disp_label:
|
|
485
485
|
if self.disp_label_offset > 0:
|
|
486
|
-
disp = "
|
|
486
|
+
disp = f"{self.disp_label.operand_str} + {self.disp_label_offset}"
|
|
487
487
|
elif self.disp_label_offset < 0:
|
|
488
|
-
disp = "
|
|
488
|
+
disp = f"{self.disp_label.operand_str} - {abs(self.disp_label_offset)}"
|
|
489
489
|
else:
|
|
490
490
|
disp = self.disp_label.operand_str
|
|
491
491
|
else:
|
|
492
|
-
disp = "
|
|
492
|
+
disp = f"{self.disp}"
|
|
493
493
|
|
|
494
494
|
base = ""
|
|
495
495
|
if self.base:
|
|
@@ -504,12 +504,7 @@ class Operand:
|
|
|
504
504
|
disp = "*" + disp
|
|
505
505
|
|
|
506
506
|
if self.index:
|
|
507
|
-
s = "
|
|
508
|
-
disp,
|
|
509
|
-
base,
|
|
510
|
-
CAPSTONE_REG_MAP[self.project.arch.name][self.index],
|
|
511
|
-
self.scale,
|
|
512
|
-
)
|
|
507
|
+
s = f"{disp}({base}, %{CAPSTONE_REG_MAP[self.project.arch.name][self.index]}, {self.scale})"
|
|
513
508
|
elif self.base: # not self.index
|
|
514
509
|
s = f"{disp}({base})"
|
|
515
510
|
else:
|
|
@@ -524,7 +519,7 @@ class Operand:
|
|
|
524
519
|
if self.index and self.scale:
|
|
525
520
|
if s:
|
|
526
521
|
s.append("+")
|
|
527
|
-
s.append("(
|
|
522
|
+
s.append(f"({CAPSTONE_REG_MAP[self.project.arch.name][self.index]} * {self.scale})")
|
|
528
523
|
|
|
529
524
|
if disp:
|
|
530
525
|
if disp.startswith("-"):
|
|
@@ -807,7 +802,7 @@ class Instruction:
|
|
|
807
802
|
if op.type in (OP_TYPE_IMM, OP_TYPE_MEM, OP_TYPE_RAW):
|
|
808
803
|
all_operands[i] = op_asm
|
|
809
804
|
else:
|
|
810
|
-
raise BinaryError("Unsupported operand type
|
|
805
|
+
raise BinaryError(f"Unsupported operand type {op.type}.")
|
|
811
806
|
|
|
812
807
|
if op.type != OP_TYPE_RAW and self.capstone_operand_types[i] == capstone.CS_OP_IMM:
|
|
813
808
|
if mnemonic.startswith(("j", "call", "loop")):
|
|
@@ -1247,7 +1242,7 @@ class Data:
|
|
|
1247
1242
|
self._initialize()
|
|
1248
1243
|
|
|
1249
1244
|
def __repr__(self):
|
|
1250
|
-
return "<DataItem
|
|
1245
|
+
return f"<DataItem {self.sort}@{self.addr:#08x}, {self.size} bytes>"
|
|
1251
1246
|
|
|
1252
1247
|
@property
|
|
1253
1248
|
def content(self):
|
|
@@ -1399,7 +1394,7 @@ class Data:
|
|
|
1399
1394
|
i += self.project.arch.bytes
|
|
1400
1395
|
|
|
1401
1396
|
if isinstance(symbolized_label, int):
|
|
1402
|
-
s += "\t
|
|
1397
|
+
s += f"\t{directive} {symbolized_label}\n"
|
|
1403
1398
|
else:
|
|
1404
1399
|
s += f"\t{directive} {symbolized_label.operand_str}\n"
|
|
1405
1400
|
|
|
@@ -1442,11 +1437,12 @@ class Data:
|
|
|
1442
1437
|
|
|
1443
1438
|
show_integer = False
|
|
1444
1439
|
if len(addr_to_labels) == 0 or (
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1440
|
+
(
|
|
1441
|
+
len(addr_to_labels) == 1
|
|
1442
|
+
and self.addr is not None
|
|
1443
|
+
and next(iter(addr_to_labels.keys())) == self.addr
|
|
1444
|
+
)
|
|
1445
|
+
or (self.addr is None and next(iter(addr_to_labels.keys())) == 0)
|
|
1450
1446
|
):
|
|
1451
1447
|
show_integer = True
|
|
1452
1448
|
|
|
@@ -1474,7 +1470,7 @@ class Data:
|
|
|
1474
1470
|
content += [f"{label!s}"]
|
|
1475
1471
|
addr += 1
|
|
1476
1472
|
|
|
1477
|
-
content += ["\t.byte
|
|
1473
|
+
content += [f"\t.byte {c}"]
|
|
1478
1474
|
|
|
1479
1475
|
else:
|
|
1480
1476
|
integer = struct.unpack(fmt_str, self.content[0])[0]
|
|
@@ -1508,10 +1504,10 @@ class Data:
|
|
|
1508
1504
|
content += [f"{label!s}"]
|
|
1509
1505
|
addr += 1
|
|
1510
1506
|
|
|
1511
|
-
content += ["\t.byte
|
|
1507
|
+
content += [f"\t.byte {c}"]
|
|
1512
1508
|
else:
|
|
1513
1509
|
for piece in self.content:
|
|
1514
|
-
content += ["\t.byte
|
|
1510
|
+
content += [f"\t.byte {c}" for c in piece]
|
|
1515
1511
|
|
|
1516
1512
|
s += "\n".join(content)
|
|
1517
1513
|
s += "\n"
|
|
@@ -1534,10 +1530,10 @@ class Data:
|
|
|
1534
1530
|
content += [f"{label!s}"]
|
|
1535
1531
|
addr += 1
|
|
1536
1532
|
|
|
1537
|
-
content += ["\t.byte
|
|
1533
|
+
content += [f"\t.byte {c}"]
|
|
1538
1534
|
else:
|
|
1539
1535
|
for piece in self.content:
|
|
1540
|
-
content += ["\t.byte
|
|
1536
|
+
content += [f"\t.byte {c}" for c in piece]
|
|
1541
1537
|
|
|
1542
1538
|
s += "\n".join(content)
|
|
1543
1539
|
s += "\n"
|
|
@@ -1554,7 +1550,7 @@ class Data:
|
|
|
1554
1550
|
|
|
1555
1551
|
def _initialize(self):
|
|
1556
1552
|
if self.memory_data is None:
|
|
1557
|
-
if self.size is None or self._initial_content is None and self.sort is None:
|
|
1553
|
+
if self.size is None or (self._initial_content is None and self.sort is None):
|
|
1558
1554
|
raise BinaryError("You must at least specify size, initial_content, and sort.")
|
|
1559
1555
|
|
|
1560
1556
|
if self.sort == MemoryDataSort.PointerArray:
|
|
@@ -2647,8 +2643,7 @@ class Reassembler(Analysis):
|
|
|
2647
2643
|
return bool(
|
|
2648
2644
|
cfg.project.loader.find_section_containing(ptr) is not None
|
|
2649
2645
|
or cfg.project.loader.find_segment_containing(ptr) is not None
|
|
2650
|
-
or self._extra_memory_regions
|
|
2651
|
-
and next((a < ptr < b for a, b in self._extra_memory_regions), None)
|
|
2646
|
+
or (self._extra_memory_regions and next((a < ptr < b for a, b in self._extra_memory_regions), None))
|
|
2652
2647
|
)
|
|
2653
2648
|
|
|
2654
2649
|
def _sequence_handler(self, cfg, irsb, irsb_addr, stmt_idx, data_addr, max_size): # pylint:disable=unused-argument
|
angr/analyses/s_liveness.py
CHANGED
|
@@ -29,6 +29,7 @@ class SLivenessAnalysis(Analysis):
|
|
|
29
29
|
func_graph=None,
|
|
30
30
|
entry=None,
|
|
31
31
|
func_addr: int | None = None,
|
|
32
|
+
arg_vvars: list[VirtualVariable] | None = None,
|
|
32
33
|
):
|
|
33
34
|
self.func = func
|
|
34
35
|
self.func_addr = func_addr if func_addr is not None else func.addr
|
|
@@ -38,6 +39,7 @@ class SLivenessAnalysis(Analysis):
|
|
|
38
39
|
if entry is not None
|
|
39
40
|
else next(iter(bb for bb in self.func_graph if bb.addr == self.func_addr and bb.idx is None))
|
|
40
41
|
)
|
|
42
|
+
self.arg_vvars = arg_vvars or []
|
|
41
43
|
|
|
42
44
|
self.model = SLivenessModel()
|
|
43
45
|
|
|
@@ -147,6 +149,12 @@ class SLivenessAnalysis(Analysis):
|
|
|
147
149
|
live.discard(def_vvar)
|
|
148
150
|
live |= vvar_use_collector.vvars
|
|
149
151
|
|
|
152
|
+
if block.addr == self.func_addr:
|
|
153
|
+
# deal with function arguments
|
|
154
|
+
for arg_vvar in self.arg_vvars:
|
|
155
|
+
for live_vvar in live:
|
|
156
|
+
graph.add_edge(arg_vvar.varid, live_vvar)
|
|
157
|
+
|
|
150
158
|
return graph
|
|
151
159
|
|
|
152
160
|
|
|
@@ -171,11 +171,8 @@ class SRDAView:
|
|
|
171
171
|
starting_stmt_idx = stmt_idx
|
|
172
172
|
continue
|
|
173
173
|
|
|
174
|
-
if (
|
|
175
|
-
op_type == ObservationPointType.
|
|
176
|
-
and stmt.ins_addr == addr
|
|
177
|
-
or op_type == ObservationPointType.OP_AFTER
|
|
178
|
-
and stmt.ins_addr > addr
|
|
174
|
+
if (op_type == ObservationPointType.OP_BEFORE and stmt.ins_addr == addr) or (
|
|
175
|
+
op_type == ObservationPointType.OP_AFTER and stmt.ins_addr > addr
|
|
179
176
|
):
|
|
180
177
|
starting_stmt_idx = stmt_idx
|
|
181
178
|
break
|
|
@@ -79,7 +79,7 @@ class Register:
|
|
|
79
79
|
Represent a register.
|
|
80
80
|
"""
|
|
81
81
|
|
|
82
|
-
__slots__ = ("
|
|
82
|
+
__slots__ = ("bitlen", "offset")
|
|
83
83
|
|
|
84
84
|
def __init__(self, offset, bitlen):
|
|
85
85
|
self.offset = offset
|
|
@@ -103,8 +103,8 @@ class OffsetVal:
|
|
|
103
103
|
"""
|
|
104
104
|
|
|
105
105
|
__slots__ = (
|
|
106
|
-
"_reg",
|
|
107
106
|
"_offset",
|
|
107
|
+
"_reg",
|
|
108
108
|
)
|
|
109
109
|
|
|
110
110
|
def __init__(self, reg, offset):
|
|
@@ -177,7 +177,7 @@ class FrozenStackPointerTrackerState:
|
|
|
177
177
|
Abstract state for StackPointerTracker analysis with registers and memory values being in frozensets.
|
|
178
178
|
"""
|
|
179
179
|
|
|
180
|
-
__slots__ = "
|
|
180
|
+
__slots__ = "is_tracking_memory", "memory", "regs", "resilient"
|
|
181
181
|
|
|
182
182
|
def __init__(
|
|
183
183
|
self,
|
|
@@ -218,7 +218,7 @@ class StackPointerTrackerState:
|
|
|
218
218
|
Abstract state for StackPointerTracker analysis.
|
|
219
219
|
"""
|
|
220
220
|
|
|
221
|
-
__slots__ = "
|
|
221
|
+
__slots__ = "is_tracking_memory", "memory", "regs", "resilient"
|
|
222
222
|
|
|
223
223
|
def __init__(self, regs, memory, is_tracking_memory, resilient: bool):
|
|
224
224
|
self.regs = regs
|
|
@@ -123,7 +123,7 @@ class SketchNode(SketchNodeBase):
|
|
|
123
123
|
Represents a node in a sketch graph.
|
|
124
124
|
"""
|
|
125
125
|
|
|
126
|
-
__slots__ = ("
|
|
126
|
+
__slots__ = ("lower_bound", "typevar", "upper_bound")
|
|
127
127
|
|
|
128
128
|
def __init__(self, typevar: TypeVariable | DerivedTypeVariable):
|
|
129
129
|
self.typevar: TypeVariable | DerivedTypeVariable = typevar
|
|
@@ -164,8 +164,8 @@ class Sketch:
|
|
|
164
164
|
|
|
165
165
|
__slots__ = (
|
|
166
166
|
"graph",
|
|
167
|
-
"root",
|
|
168
167
|
"node_mapping",
|
|
168
|
+
"root",
|
|
169
169
|
"solver",
|
|
170
170
|
)
|
|
171
171
|
|
|
@@ -263,7 +263,7 @@ class FORGOTTEN(enum.Enum):
|
|
|
263
263
|
|
|
264
264
|
|
|
265
265
|
class ConstraintGraphNode:
|
|
266
|
-
__slots__ = ("
|
|
266
|
+
__slots__ = ("forgotten", "tag", "typevar", "variance")
|
|
267
267
|
|
|
268
268
|
def __init__(
|
|
269
269
|
self,
|
|
@@ -367,7 +367,7 @@ class SimpleSolver:
|
|
|
367
367
|
|
|
368
368
|
def __init__(self, bits: int, constraints, typevars):
|
|
369
369
|
if bits not in (32, 64):
|
|
370
|
-
raise ValueError("Pointer size
|
|
370
|
+
raise ValueError(f"Pointer size {bits} is not supported. Expect 32 or 64.")
|
|
371
371
|
|
|
372
372
|
self.bits = bits
|
|
373
373
|
self._constraints: dict[TypeVariable, set[TypeConstraint]] = constraints
|
|
@@ -627,10 +627,8 @@ class SimpleSolver:
|
|
|
627
627
|
for _, dst0, data0 in graph.out_edges(cls0, data=True):
|
|
628
628
|
if "label" in data0 and data0["label"] is not None:
|
|
629
629
|
for _, dst1, data1 in graph.out_edges(cls1, data=True):
|
|
630
|
-
if (
|
|
631
|
-
data0["label"]
|
|
632
|
-
or isinstance(data0["label"], Load)
|
|
633
|
-
and isinstance(data1["label"], Store)
|
|
630
|
+
if data0["label"] == data1["label"] or (
|
|
631
|
+
isinstance(data0["label"], Load) and isinstance(data1["label"], Store)
|
|
634
632
|
):
|
|
635
633
|
SimpleSolver._unify(
|
|
636
634
|
equivalence_classes, equivalence_classes[dst0], equivalence_classes[dst1], graph
|
|
@@ -1280,4 +1278,4 @@ class SimpleSolver:
|
|
|
1280
1278
|
return Pointer32
|
|
1281
1279
|
if self.bits == 64:
|
|
1282
1280
|
return Pointer64
|
|
1283
|
-
raise NotImplementedError("Unsupported bits
|
|
1281
|
+
raise NotImplementedError(f"Unsupported bits {self.bits}")
|
|
@@ -42,7 +42,7 @@ class TypeTranslator:
|
|
|
42
42
|
#
|
|
43
43
|
|
|
44
44
|
def struct_name(self):
|
|
45
|
-
return "struct_
|
|
45
|
+
return f"struct_{next(self._struct_ctr)}"
|
|
46
46
|
|
|
47
47
|
#
|
|
48
48
|
# Type translation
|
|
@@ -227,7 +227,7 @@ class TypeTranslator:
|
|
|
227
227
|
return typeconsts.Pointer32(base)
|
|
228
228
|
if self.arch.bits == 64:
|
|
229
229
|
return typeconsts.Pointer64(base)
|
|
230
|
-
raise TypeError("Unsupported pointer size
|
|
230
|
+
raise TypeError(f"Unsupported pointer size {self.arch.bits}")
|
|
231
231
|
|
|
232
232
|
|
|
233
233
|
TypeConstHandlers = {
|
|
@@ -189,7 +189,7 @@ class Array(TypeConstant):
|
|
|
189
189
|
def __repr__(self, memo=None):
|
|
190
190
|
if self.count is None:
|
|
191
191
|
return f"{self.element!r}[?]"
|
|
192
|
-
return "
|
|
192
|
+
return f"{self.element!r}[{self.count}]"
|
|
193
193
|
|
|
194
194
|
def __eq__(self, other):
|
|
195
195
|
return type(other) is type(self) and self.element == other.element and self.count == other.count
|
|
@@ -26,9 +26,9 @@ class TypeConstraint:
|
|
|
26
26
|
|
|
27
27
|
class Equivalence(TypeConstraint):
|
|
28
28
|
__slots__ = (
|
|
29
|
+
"_cached_hash",
|
|
29
30
|
"type_a",
|
|
30
31
|
"type_b",
|
|
31
|
-
"_cached_hash",
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
def __init__(self, type_a, type_b):
|
|
@@ -44,10 +44,8 @@ class Equivalence(TypeConstraint):
|
|
|
44
44
|
|
|
45
45
|
def __eq__(self, other):
|
|
46
46
|
return type(other) is Equivalence and (
|
|
47
|
-
self.type_a == other.type_a
|
|
48
|
-
|
|
49
|
-
or self.type_b == other.type_a
|
|
50
|
-
and self.type_a == other.type_b
|
|
47
|
+
(self.type_a == other.type_a and self.type_b == other.type_b)
|
|
48
|
+
or (self.type_b == other.type_a and self.type_a == other.type_b)
|
|
51
49
|
)
|
|
52
50
|
|
|
53
51
|
def __hash__(self):
|
|
@@ -55,7 +53,7 @@ class Equivalence(TypeConstraint):
|
|
|
55
53
|
|
|
56
54
|
|
|
57
55
|
class Existence(TypeConstraint):
|
|
58
|
-
__slots__ = ("
|
|
56
|
+
__slots__ = ("_cached_hash", "type_")
|
|
59
57
|
|
|
60
58
|
def __init__(self, type_):
|
|
61
59
|
self.type_ = type_
|
|
@@ -85,9 +83,9 @@ class Existence(TypeConstraint):
|
|
|
85
83
|
|
|
86
84
|
class Subtype(TypeConstraint):
|
|
87
85
|
__slots__ = (
|
|
88
|
-
"super_type",
|
|
89
|
-
"sub_type",
|
|
90
86
|
"_cached_hash",
|
|
87
|
+
"sub_type",
|
|
88
|
+
"super_type",
|
|
91
89
|
)
|
|
92
90
|
|
|
93
91
|
def __init__(self, sub_type: TypeType, super_type: TypeType):
|
|
@@ -141,10 +139,10 @@ class Add(TypeConstraint):
|
|
|
141
139
|
"""
|
|
142
140
|
|
|
143
141
|
__slots__ = (
|
|
142
|
+
"_cached_hash",
|
|
144
143
|
"type_0",
|
|
145
144
|
"type_1",
|
|
146
145
|
"type_r",
|
|
147
|
-
"_cached_hash",
|
|
148
146
|
)
|
|
149
147
|
|
|
150
148
|
def __init__(self, type_0, type_1, type_r):
|
|
@@ -210,10 +208,10 @@ class Sub(TypeConstraint):
|
|
|
210
208
|
"""
|
|
211
209
|
|
|
212
210
|
__slots__ = (
|
|
211
|
+
"_cached_hash",
|
|
213
212
|
"type_0",
|
|
214
213
|
"type_1",
|
|
215
214
|
"type_r",
|
|
216
|
-
"_cached_hash",
|
|
217
215
|
)
|
|
218
216
|
|
|
219
217
|
def __init__(self, type_0, type_1, type_r):
|
|
@@ -277,7 +275,7 @@ _typevariable_counter = count()
|
|
|
277
275
|
|
|
278
276
|
|
|
279
277
|
class TypeVariable:
|
|
280
|
-
__slots__ = ("
|
|
278
|
+
__slots__ = ("_cached_hash", "idx", "name")
|
|
281
279
|
|
|
282
280
|
def __init__(self, idx: int | None = None, name: str | None = None):
|
|
283
281
|
if idx is None:
|
|
@@ -310,11 +308,11 @@ class TypeVariable:
|
|
|
310
308
|
def __repr__(self):
|
|
311
309
|
if self.name:
|
|
312
310
|
return f"{self.name}|tv_{self.idx:02d}"
|
|
313
|
-
return "tv_
|
|
311
|
+
return f"tv_{self.idx:02d}"
|
|
314
312
|
|
|
315
313
|
|
|
316
314
|
class DerivedTypeVariable(TypeVariable):
|
|
317
|
-
__slots__ = ("
|
|
315
|
+
__slots__ = ("labels", "type_var")
|
|
318
316
|
|
|
319
317
|
labels: tuple[BaseLabel, ...]
|
|
320
318
|
|
|
@@ -398,8 +396,8 @@ class DerivedTypeVariable(TypeVariable):
|
|
|
398
396
|
|
|
399
397
|
class TypeVariables:
|
|
400
398
|
__slots__ = (
|
|
401
|
-
"_typevars",
|
|
402
399
|
"_last_typevars",
|
|
400
|
+
"_typevars",
|
|
403
401
|
)
|
|
404
402
|
|
|
405
403
|
def __init__(self):
|
|
@@ -418,7 +416,7 @@ class TypeVariables:
|
|
|
418
416
|
# sum(len(v) for v in self._typevars.items()),
|
|
419
417
|
# len(self._typevars),
|
|
420
418
|
# )
|
|
421
|
-
return "{TypeVars:
|
|
419
|
+
return f"{{TypeVars: {len(self._typevars)} items}}"
|
|
422
420
|
|
|
423
421
|
def add_type_variable(self, var: SimVariable, codeloc, typevar: TypeType): # pylint:disable=unused-argument
|
|
424
422
|
if var not in self._typevars:
|
|
@@ -514,7 +512,7 @@ class AddN(BaseLabel):
|
|
|
514
512
|
super().__init__()
|
|
515
513
|
|
|
516
514
|
def __repr__(self):
|
|
517
|
-
return "
|
|
515
|
+
return f"+{self.n}"
|
|
518
516
|
|
|
519
517
|
|
|
520
518
|
class SubN(BaseLabel):
|
|
@@ -525,7 +523,7 @@ class SubN(BaseLabel):
|
|
|
525
523
|
super().__init__()
|
|
526
524
|
|
|
527
525
|
def __repr__(self):
|
|
528
|
-
return "
|
|
526
|
+
return f"-{self.n}"
|
|
529
527
|
|
|
530
528
|
|
|
531
529
|
class ConvertTo(BaseLabel):
|
|
@@ -536,13 +534,13 @@ class ConvertTo(BaseLabel):
|
|
|
536
534
|
super().__init__()
|
|
537
535
|
|
|
538
536
|
def __repr__(self):
|
|
539
|
-
return "conv(
|
|
537
|
+
return f"conv({self.to_bits})"
|
|
540
538
|
|
|
541
539
|
|
|
542
540
|
class ReinterpretAs(BaseLabel):
|
|
543
541
|
__slots__ = (
|
|
544
|
-
"to_type",
|
|
545
542
|
"to_bits",
|
|
543
|
+
"to_type",
|
|
546
544
|
)
|
|
547
545
|
|
|
548
546
|
def __init__(self, to_type, to_bits):
|
|
@@ -35,9 +35,9 @@ class RichR(Generic[RichRT_co]):
|
|
|
35
35
|
|
|
36
36
|
__slots__ = (
|
|
37
37
|
"data",
|
|
38
|
-
"variable",
|
|
39
|
-
"typevar",
|
|
40
38
|
"type_constraints",
|
|
39
|
+
"typevar",
|
|
40
|
+
"variable",
|
|
41
41
|
)
|
|
42
42
|
|
|
43
43
|
def __init__(
|
|
@@ -384,8 +384,7 @@ class SimEngineVRBase(
|
|
|
384
384
|
if (
|
|
385
385
|
vvar.category == ailment.expression.VirtualVariableCategory.REGISTER
|
|
386
386
|
and vvar.oident in (self.project.arch.ip_offset, self.project.arch.sp_offset, self.project.arch.lr_offset)
|
|
387
|
-
|
|
388
|
-
):
|
|
387
|
+
) or not create_variable:
|
|
389
388
|
# only store the value. don't worry about variables.
|
|
390
389
|
self.vvar_region[vvar_id] = richr.data
|
|
391
390
|
return
|
|
@@ -327,7 +327,7 @@ class VariableRecoveryStateBase:
|
|
|
327
327
|
base = 0x7F_FFFF_FFFE_0000
|
|
328
328
|
mask = 0xFFFF_FFFF_FFFF_FFFF
|
|
329
329
|
else:
|
|
330
|
-
raise AngrRuntimeError("Unsupported bits
|
|
330
|
+
raise AngrRuntimeError(f"Unsupported bits {self.arch.bits}")
|
|
331
331
|
return (offset + base) & mask
|
|
332
332
|
|
|
333
333
|
@property
|
|
@@ -74,11 +74,7 @@ class VariableRecoveryFastState(VariableRecoveryStateBase):
|
|
|
74
74
|
self.ret_val_size = ret_val_size
|
|
75
75
|
|
|
76
76
|
def __repr__(self):
|
|
77
|
-
return "<VRAbstractState
|
|
78
|
-
self.block_addr,
|
|
79
|
-
len(self.register_region),
|
|
80
|
-
len(self.stack_region),
|
|
81
|
-
)
|
|
77
|
+
return f"<VRAbstractState@{self.block_addr:#x}: {len(self.register_region)} register variables, {len(self.stack_region)} stack variables>"
|
|
82
78
|
|
|
83
79
|
def __eq__(self, other):
|
|
84
80
|
if type(other) is not VariableRecoveryFastState:
|
|
@@ -523,7 +519,7 @@ class VariableRecoveryFast(ForwardAnalysis, VariableRecoveryBase): # pylint:dis
|
|
|
523
519
|
256: pyvex.const.V256,
|
|
524
520
|
}
|
|
525
521
|
if size not in mapping:
|
|
526
|
-
raise TypeError("Unsupported size
|
|
522
|
+
raise TypeError(f"Unsupported size {size}.")
|
|
527
523
|
return mapping.get(size)(value)
|
|
528
524
|
|
|
529
525
|
def _peephole_optimize(self, block: Block):
|
angr/analyses/veritesting.py
CHANGED
|
@@ -339,7 +339,7 @@ class Veritesting(Analysis):
|
|
|
339
339
|
for merge_point_addr, merge_point_looping_times in merge_points:
|
|
340
340
|
manager.stash(
|
|
341
341
|
lambda s, merge_point_addr=merge_point_addr: s.addr == merge_point_addr,
|
|
342
|
-
to_stash="_merge_
|
|
342
|
+
to_stash=f"_merge_{merge_point_addr:x}_{merge_point_looping_times}",
|
|
343
343
|
)
|
|
344
344
|
|
|
345
345
|
# Try to merge a set of previously stashed paths, and then unstash them
|
|
@@ -370,7 +370,7 @@ class Veritesting(Analysis):
|
|
|
370
370
|
if merged_anything:
|
|
371
371
|
break
|
|
372
372
|
|
|
373
|
-
stash_name = "_merge_
|
|
373
|
+
stash_name = f"_merge_{merge_point_addr:x}_{merge_point_looping_times}"
|
|
374
374
|
if stash_name not in manager.stashes:
|
|
375
375
|
continue
|
|
376
376
|
|
angr/analyses/vfg.py
CHANGED
|
@@ -93,11 +93,11 @@ class PendingJob:
|
|
|
93
93
|
|
|
94
94
|
__slots__ = (
|
|
95
95
|
"block_id",
|
|
96
|
-
"state",
|
|
97
96
|
"call_stack",
|
|
98
97
|
"src_block_id",
|
|
99
|
-
"src_stmt_idx",
|
|
100
98
|
"src_ins_addr",
|
|
99
|
+
"src_stmt_idx",
|
|
100
|
+
"state",
|
|
101
101
|
)
|
|
102
102
|
|
|
103
103
|
def __init__(
|
|
@@ -147,7 +147,7 @@ class FunctionAnalysis(AnalysisTask):
|
|
|
147
147
|
self.jobs = []
|
|
148
148
|
|
|
149
149
|
def __repr__(self):
|
|
150
|
-
return "<Function @
|
|
150
|
+
return f"<Function @ {self.function_address:#08x} with {len(self.jobs)} jobs>"
|
|
151
151
|
|
|
152
152
|
#
|
|
153
153
|
# Properties
|
|
@@ -182,7 +182,7 @@ class CallAnalysis(AnalysisTask):
|
|
|
182
182
|
self._final_jobs = []
|
|
183
183
|
|
|
184
184
|
def __repr__(self):
|
|
185
|
-
return "<Call @
|
|
185
|
+
return f"<Call @ {self.address:#08x} with {len(self.function_analysis_tasks)} function tasks>"
|
|
186
186
|
|
|
187
187
|
#
|
|
188
188
|
# Properties
|
|
@@ -1668,7 +1668,7 @@ class VFG(ForwardAnalysis[SimState, VFGNode, VFGJob, BlockID], Analysis): # pyl
|
|
|
1668
1668
|
except SimValueError:
|
|
1669
1669
|
l.debug("- target cannot be concretized. %s [%s]", job.dbg_exit_status[suc], suc.history.jumpkind)
|
|
1670
1670
|
l.debug("Remaining/pending jobs: %d/%d", len(self._job_info_queue), len(self._pending_returns))
|
|
1671
|
-
l.debug("Remaining jobs: %s", ["
|
|
1671
|
+
l.debug("Remaining jobs: %s", [f"{ent.job} {id(ent.job)}" for ent in self._job_info_queue])
|
|
1672
1672
|
l.debug("Task stack: %s", self._task_stack)
|
|
1673
1673
|
|
|
1674
1674
|
@staticmethod
|
angr/annocfg.py
CHANGED
|
@@ -229,7 +229,7 @@ class AnnotatedCFG:
|
|
|
229
229
|
whitelist = self.get_whitelisted_statements(irsb_addr)
|
|
230
230
|
for i in range(len(statements)):
|
|
231
231
|
line = "+" if whitelist is None or i in whitelist else "-"
|
|
232
|
-
line += "[
|
|
232
|
+
line += f"[{i: 3d}] "
|
|
233
233
|
# We cannot get data returned by pp(). WTF?
|
|
234
234
|
print(line, end="")
|
|
235
235
|
statements[i].pp()
|