angr 9.2.158__cp310-abi3-macosx_11_0_arm64.whl → 9.2.159__cp310-abi3-macosx_11_0_arm64.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/ailment/__init__.py +81 -0
- angr/ailment/block.py +81 -0
- angr/ailment/block_walker.py +845 -0
- angr/ailment/constant.py +3 -0
- angr/ailment/converter_common.py +11 -0
- angr/ailment/converter_pcode.py +623 -0
- angr/ailment/converter_vex.py +798 -0
- angr/ailment/expression.py +1639 -0
- angr/ailment/manager.py +33 -0
- angr/ailment/statement.py +978 -0
- angr/ailment/tagged_object.py +61 -0
- angr/ailment/utils.py +114 -0
- angr/analyses/calling_convention/calling_convention.py +6 -2
- angr/analyses/decompiler/ail_simplifier.py +5 -5
- angr/analyses/decompiler/block_io_finder.py +4 -4
- angr/analyses/decompiler/block_similarity.py +2 -2
- angr/analyses/decompiler/block_simplifier.py +4 -4
- angr/analyses/decompiler/callsite_maker.py +2 -2
- angr/analyses/decompiler/ccall_rewriters/amd64_ccalls.py +1 -1
- angr/analyses/decompiler/ccall_rewriters/rewriter_base.py +1 -1
- angr/analyses/decompiler/ccall_rewriters/x86_ccalls.py +1 -1
- angr/analyses/decompiler/clinic.py +1 -1
- angr/analyses/decompiler/condition_processor.py +1 -1
- angr/analyses/decompiler/counters/boolean_counter.py +4 -4
- angr/analyses/decompiler/counters/call_counter.py +4 -4
- angr/analyses/decompiler/counters/expression_counters.py +5 -5
- angr/analyses/decompiler/counters/seq_cf_structure_counter.py +1 -1
- angr/analyses/decompiler/decompiler.py +5 -3
- angr/analyses/decompiler/dephication/dephication_base.py +12 -1
- angr/analyses/decompiler/dephication/graph_dephication.py +12 -5
- angr/analyses/decompiler/dephication/graph_rewriting.py +6 -10
- angr/analyses/decompiler/dephication/graph_vvar_mapping.py +109 -72
- angr/analyses/decompiler/dephication/rewriting_engine.py +32 -9
- angr/analyses/decompiler/dephication/seqnode_dephication.py +32 -10
- angr/analyses/decompiler/empty_node_remover.py +2 -2
- angr/analyses/decompiler/expression_narrower.py +6 -6
- angr/analyses/decompiler/goto_manager.py +2 -2
- angr/analyses/decompiler/jump_target_collector.py +1 -1
- angr/analyses/decompiler/label_collector.py +1 -1
- angr/analyses/decompiler/optimization_passes/base_ptr_save_simplifier.py +25 -25
- angr/analyses/decompiler/optimization_passes/call_stmt_rewriter.py +1 -1
- angr/analyses/decompiler/optimization_passes/code_motion.py +2 -2
- angr/analyses/decompiler/optimization_passes/condition_constprop.py +3 -3
- angr/analyses/decompiler/optimization_passes/const_derefs.py +3 -3
- angr/analyses/decompiler/optimization_passes/const_prop_reverter.py +4 -4
- angr/analyses/decompiler/optimization_passes/deadblock_remover.py +2 -2
- angr/analyses/decompiler/optimization_passes/determine_load_sizes.py +3 -3
- angr/analyses/decompiler/optimization_passes/div_simplifier.py +1 -1
- angr/analyses/decompiler/optimization_passes/duplication_reverter/ail_merge_graph.py +2 -2
- angr/analyses/decompiler/optimization_passes/duplication_reverter/duplication_reverter.py +4 -4
- angr/analyses/decompiler/optimization_passes/duplication_reverter/similarity.py +1 -1
- angr/analyses/decompiler/optimization_passes/duplication_reverter/utils.py +4 -4
- angr/analyses/decompiler/optimization_passes/eager_std_string_concatenation.py +3 -3
- angr/analyses/decompiler/optimization_passes/engine_base.py +1 -1
- angr/analyses/decompiler/optimization_passes/expr_op_swapper.py +3 -3
- angr/analyses/decompiler/optimization_passes/flip_boolean_cmp.py +2 -2
- angr/analyses/decompiler/optimization_passes/inlined_string_transformation_simplifier.py +2 -2
- angr/analyses/decompiler/optimization_passes/ite_expr_converter.py +3 -3
- angr/analyses/decompiler/optimization_passes/ite_region_converter.py +3 -3
- angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +4 -4
- angr/analyses/decompiler/optimization_passes/mod_simplifier.py +1 -1
- angr/analyses/decompiler/optimization_passes/optimization_pass.py +25 -1
- angr/analyses/decompiler/optimization_passes/register_save_area_simplifier.py +1 -1
- angr/analyses/decompiler/optimization_passes/ret_addr_save_simplifier.py +1 -1
- angr/analyses/decompiler/optimization_passes/ret_deduplicator.py +2 -2
- angr/analyses/decompiler/optimization_passes/return_duplicator_base.py +4 -4
- angr/analyses/decompiler/optimization_passes/return_duplicator_low.py +2 -2
- angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +1 -1
- angr/analyses/decompiler/optimization_passes/switch_default_case_duplicator.py +3 -3
- angr/analyses/decompiler/optimization_passes/switch_reused_entry_rewriter.py +3 -3
- angr/analyses/decompiler/optimization_passes/tag_slicer.py +1 -1
- angr/analyses/decompiler/optimization_passes/win_stack_canary_simplifier.py +1 -1
- angr/analyses/decompiler/optimization_passes/x86_gcc_getpc_simplifier.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/a_div_const_add_a_mul_n_div_const.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/a_mul_const_div_shr_const.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/a_mul_const_sub_a.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/a_shl_const_sub_a.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/a_sub_a_div.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/a_sub_a_div_const_mul_const.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/a_sub_a_shr_const_shr_const.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/a_sub_a_sub_n.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/arm_cmpf.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/base.py +3 -3
- angr/analyses/decompiler/peephole_optimizations/basepointeroffset_add_n.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/basepointeroffset_and_mask.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/bitwise_or_to_logical_or.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/bool_expr_xor_1.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/bswap.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/cas_intrinsics.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/cmpord_rewriter.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/coalesce_adjacent_shrs.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/coalesce_same_cascading_ifs.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/const_mull_a_shift.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/constant_derefs.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/conv_a_sub0_shr_and.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/conv_shl_shr.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/eager_eval.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/extended_byte_and_mask.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/inlined_strcpy.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/inlined_strcpy_consolidation.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/inlined_wstrcpy.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/invert_negated_logical_conjuction_disjunction.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/one_sub_bool.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/remove_cascading_conversions.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/remove_cxx_destructor_calls.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/remove_empty_if_body.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/remove_noop_conversions.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_bitmasks.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_conversions.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_ite_branch.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_ite_comparisons.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_nots.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_reinterprets.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_shifts.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_shifts_around_comparators.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/rewrite_bit_extractions.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/rewrite_conv_mul.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/rewrite_cxx_operator_calls.py +3 -3
- angr/analyses/decompiler/peephole_optimizations/rewrite_mips_gp_loads.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/rol_ror.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/sar_to_signed_div.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/shl_to_mul.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/simplify_pc_relative_loads.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/single_bit_cond_to_boolexpr.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/single_bit_xor.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/tidy_stack_addr.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/utils.py +1 -1
- angr/analyses/decompiler/redundant_label_remover.py +1 -1
- angr/analyses/decompiler/region_identifier.py +4 -4
- angr/analyses/decompiler/region_simplifiers/cascading_cond_transformer.py +1 -1
- angr/analyses/decompiler/region_simplifiers/cascading_ifs.py +1 -1
- angr/analyses/decompiler/region_simplifiers/expr_folding.py +37 -8
- angr/analyses/decompiler/region_simplifiers/goto.py +1 -1
- angr/analyses/decompiler/region_simplifiers/if_.py +1 -1
- angr/analyses/decompiler/region_simplifiers/loop.py +1 -1
- angr/analyses/decompiler/region_simplifiers/node_address_finder.py +1 -1
- angr/analyses/decompiler/region_simplifiers/region_simplifier.py +14 -2
- angr/analyses/decompiler/region_simplifiers/switch_cluster_simplifier.py +3 -3
- angr/analyses/decompiler/region_simplifiers/switch_expr_simplifier.py +1 -1
- angr/analyses/decompiler/return_maker.py +1 -1
- angr/analyses/decompiler/seq_to_blocks.py +1 -1
- angr/analyses/decompiler/sequence_walker.py +2 -2
- angr/analyses/decompiler/ssailification/rewriting.py +4 -4
- angr/analyses/decompiler/ssailification/rewriting_engine.py +4 -4
- angr/analyses/decompiler/ssailification/rewriting_state.py +3 -3
- angr/analyses/decompiler/ssailification/ssailification.py +2 -2
- angr/analyses/decompiler/ssailification/traversal.py +1 -1
- angr/analyses/decompiler/ssailification/traversal_engine.py +11 -2
- angr/analyses/decompiler/structured_codegen/c.py +3 -3
- angr/analyses/decompiler/structuring/dream.py +1 -1
- angr/analyses/decompiler/structuring/phoenix.py +3 -3
- angr/analyses/decompiler/structuring/structurer_base.py +1 -1
- angr/analyses/decompiler/structuring/structurer_nodes.py +1 -2
- angr/analyses/decompiler/utils.py +1 -1
- angr/analyses/deobfuscator/api_obf_peephole_optimizer.py +1 -1
- angr/analyses/deobfuscator/string_obf_opt_passes.py +3 -3
- angr/analyses/deobfuscator/string_obf_peephole_optimizer.py +2 -2
- angr/analyses/propagator/propagator.py +1 -1
- angr/analyses/proximity_graph.py +2 -2
- angr/analyses/reaching_definitions/engine_ail.py +1 -1
- angr/analyses/reaching_definitions/reaching_definitions.py +1 -1
- angr/analyses/reaching_definitions/subject.py +1 -1
- angr/analyses/s_liveness.py +2 -2
- angr/analyses/s_propagator.py +3 -3
- angr/analyses/s_reaching_definitions/s_rda_model.py +1 -1
- angr/analyses/s_reaching_definitions/s_rda_view.py +3 -3
- angr/analyses/s_reaching_definitions/s_reaching_definitions.py +3 -3
- angr/analyses/variable_recovery/engine_ail.py +2 -2
- angr/analyses/variable_recovery/engine_base.py +1 -1
- angr/analyses/variable_recovery/variable_recovery_base.py +1 -1
- angr/analyses/variable_recovery/variable_recovery_fast.py +2 -2
- angr/engines/light/data.py +1 -1
- angr/engines/light/engine.py +1 -1
- angr/knowledge_plugins/key_definitions/atoms.py +1 -1
- angr/knowledge_plugins/propagations/prop_value.py +1 -1
- angr/knowledge_plugins/propagations/propagation_model.py +1 -1
- angr/knowledge_plugins/propagations/states.py +1 -1
- angr/knowledge_plugins/variables/variable_manager.py +1 -1
- angr/lib/angr_native.dylib +0 -0
- angr/rustylib.abi3.so +0 -0
- angr/utils/ail.py +4 -4
- angr/utils/endness.py +1 -1
- angr/utils/ssa/__init__.py +14 -4
- angr/utils/ssa/tmp_uses_collector.py +4 -4
- angr/utils/ssa/vvar_uses_collector.py +4 -4
- {angr-9.2.158.dist-info → angr-9.2.159.dist-info}/METADATA +6 -6
- {angr-9.2.158.dist-info → angr-9.2.159.dist-info}/RECORD +192 -180
- {angr-9.2.158.dist-info → angr-9.2.159.dist-info}/WHEEL +0 -0
- {angr-9.2.158.dist-info → angr-9.2.159.dist-info}/entry_points.txt +0 -0
- {angr-9.2.158.dist-info → angr-9.2.159.dist-info}/licenses/LICENSE +0 -0
- {angr-9.2.158.dist-info → angr-9.2.159.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# pylint:disable=arguments-differ
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
-
from ailment.expression import Const
|
|
5
|
-
from ailment.statement import Call
|
|
4
|
+
from angr.ailment.expression import Const
|
|
5
|
+
from angr.ailment.statement import Call
|
|
6
6
|
|
|
7
7
|
from .base import PeepholeOptimizationStmtBase
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
from ailment.statement import ConditionalJump
|
|
3
|
-
from ailment.expression import ITE, UnaryOp
|
|
2
|
+
from angr.ailment.statement import ConditionalJump
|
|
3
|
+
from angr.ailment.expression import ITE, UnaryOp
|
|
4
4
|
|
|
5
5
|
from .base import PeepholeOptimizationStmtBase
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pylint: disable=missing-class-docstring,too-many-boolean-expressions
|
|
2
2
|
from __future__ import annotations
|
|
3
|
-
from ailment.expression import BinaryOp, Convert, Const
|
|
3
|
+
from angr.ailment.expression import BinaryOp, Convert, Const
|
|
4
4
|
|
|
5
5
|
from .base import PeepholeOptimizationExprBase
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pylint:disable=no-self-use,too-many-boolean-expressions
|
|
2
2
|
from __future__ import annotations
|
|
3
|
-
from ailment.expression import BinaryOp, Const, Convert
|
|
3
|
+
from angr.ailment.expression import BinaryOp, Const, Convert
|
|
4
4
|
|
|
5
5
|
from .base import PeepholeOptimizationExprBase
|
|
6
6
|
from .utils import get_expr_shift_left_amount
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pylint:disable=too-many-boolean-expressions
|
|
2
2
|
from __future__ import annotations
|
|
3
|
-
from ailment.expression import Expression, BinaryOp, Const, Convert, ITE
|
|
3
|
+
from angr.ailment.expression import Expression, BinaryOp, Const, Convert, ITE
|
|
4
4
|
|
|
5
5
|
from .base import PeepholeOptimizationExprBase
|
|
6
6
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
from archinfo import Endness
|
|
5
|
-
from ailment.constant import UNDETERMINED_SIZE
|
|
6
|
-
from ailment.expression import Const, VirtualVariable, BinaryOp, UnaryOp, Load
|
|
7
|
-
from ailment.statement import Call, WeakAssignment
|
|
5
|
+
from angr.ailment.constant import UNDETERMINED_SIZE
|
|
6
|
+
from angr.ailment.expression import Const, VirtualVariable, BinaryOp, UnaryOp, Load
|
|
7
|
+
from angr.ailment.statement import Call, WeakAssignment
|
|
8
8
|
|
|
9
9
|
from angr.sim_type import SimTypeReference, SimCppClass
|
|
10
10
|
from angr.knowledge_plugins.key_definitions import atoms
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pylint:disable=too-many-boolean-expressions
|
|
2
2
|
from __future__ import annotations
|
|
3
|
-
from ailment.expression import Load, BinaryOp, VirtualVariable, Const
|
|
3
|
+
from angr.ailment.expression import Load, BinaryOp, VirtualVariable, Const
|
|
4
4
|
|
|
5
5
|
from .base import PeepholeOptimizationExprBase
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
from ailment.statement import Assignment
|
|
3
|
-
from ailment.expression import BinaryOp, Const, Tmp
|
|
2
|
+
from angr.ailment.statement import Assignment
|
|
3
|
+
from angr.ailment.expression import BinaryOp, Const, Tmp
|
|
4
4
|
|
|
5
5
|
from .base import PeepholeOptimizationStmtBase
|
|
6
6
|
from .utils import get_expr_shift_left_amount
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
from ailment.expression import Convert, BinaryOp, Const, ITE, Expression, VirtualVariable
|
|
2
|
+
from angr.ailment.expression import Convert, BinaryOp, Const, ITE, Expression, VirtualVariable
|
|
3
3
|
|
|
4
4
|
from .base import PeepholeOptimizationExprBase
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pylint:disable=too-many-boolean-expressions
|
|
2
2
|
from __future__ import annotations
|
|
3
|
-
from ailment.expression import BinaryOp, Const, Load
|
|
3
|
+
from angr.ailment.expression import BinaryOp, Const, Load
|
|
4
4
|
|
|
5
5
|
from angr.utils.loader import is_pc, is_in_readonly_section, is_in_readonly_segment
|
|
6
6
|
from .base import PeepholeOptimizationExprBase
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from typing import TYPE_CHECKING
|
|
3
3
|
|
|
4
|
-
from ailment.expression import UnaryOp, BinaryOp, StackBaseOffset, Const
|
|
4
|
+
from angr.ailment.expression import UnaryOp, BinaryOp, StackBaseOffset, Const
|
|
5
5
|
|
|
6
6
|
from .base import PeepholeOptimizationExprBase
|
|
7
7
|
|
|
8
8
|
if TYPE_CHECKING:
|
|
9
|
-
from ailment.expression import Expression
|
|
9
|
+
from angr.ailment.expression import Expression
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class TidyStackAddr(PeepholeOptimizationExprBase):
|
|
@@ -6,10 +6,10 @@ import logging
|
|
|
6
6
|
|
|
7
7
|
import networkx
|
|
8
8
|
|
|
9
|
-
import ailment
|
|
10
|
-
from ailment import Block
|
|
11
|
-
from ailment.statement import ConditionalJump, Jump
|
|
12
|
-
from ailment.expression import Const
|
|
9
|
+
import angr.ailment as ailment
|
|
10
|
+
from angr.ailment import Block
|
|
11
|
+
from angr.ailment.statement import ConditionalJump, Jump
|
|
12
|
+
from angr.ailment.expression import Const
|
|
13
13
|
|
|
14
14
|
from angr.utils.graph import GraphUtils
|
|
15
15
|
from angr.utils.graph import dfs_back_edges, subgraph_between_nodes, dominates
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# pylint:disable=no-self-use,arguments-renamed,isinstance-second-argument-not-valid-type
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
-
import ailment
|
|
4
|
+
import angr.ailment as ailment
|
|
5
5
|
import claripy
|
|
6
6
|
|
|
7
7
|
from angr.analyses.decompiler.structuring.structurer_nodes import ConditionNode, CascadingConditionNode
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pylint:disable=unused-argument,arguments-differ
|
|
2
2
|
from __future__ import annotations
|
|
3
|
-
import ailment
|
|
3
|
+
import angr.ailment as ailment
|
|
4
4
|
|
|
5
5
|
from angr.analyses.decompiler.sequence_walker import SequenceWalker
|
|
6
6
|
from angr.analyses.decompiler.structuring.structurer_nodes import (
|
|
@@ -4,10 +4,10 @@ from collections import defaultdict
|
|
|
4
4
|
from collections.abc import Iterable
|
|
5
5
|
from typing import Any, TYPE_CHECKING
|
|
6
6
|
|
|
7
|
-
import ailment
|
|
8
|
-
from ailment import Expression, Block, AILBlockWalker
|
|
9
|
-
from ailment.expression import ITE, Load
|
|
10
|
-
from ailment.statement import Statement, Assignment, Call, Return
|
|
7
|
+
from angr import ailment
|
|
8
|
+
from angr.ailment import Expression, Block, AILBlockWalker
|
|
9
|
+
from angr.ailment.expression import ITE, Load
|
|
10
|
+
from angr.ailment.statement import Statement, Assignment, Call, Return
|
|
11
11
|
|
|
12
12
|
from angr.utils.ail import is_phi_assignment
|
|
13
13
|
from angr.utils.ssa import VVarUsesCollector
|
|
@@ -17,11 +17,12 @@ from angr.analyses.decompiler.structuring.structurer_nodes import (
|
|
|
17
17
|
ConditionalBreakNode,
|
|
18
18
|
LoopNode,
|
|
19
19
|
CascadingConditionNode,
|
|
20
|
+
SequenceNode,
|
|
20
21
|
SwitchCaseNode,
|
|
21
22
|
)
|
|
22
23
|
|
|
23
24
|
if TYPE_CHECKING:
|
|
24
|
-
from ailment.expression import MultiStatementExpression
|
|
25
|
+
from angr.ailment.expression import MultiStatementExpression
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
class LocationBase:
|
|
@@ -156,6 +157,26 @@ class ConditionalBreakLocation(LocationBase):
|
|
|
156
157
|
return isinstance(other, ConditionalBreakLocation) and self.node_addr == other.node_addr
|
|
157
158
|
|
|
158
159
|
|
|
160
|
+
class LoopNodeFinder(SequenceWalker):
|
|
161
|
+
"""
|
|
162
|
+
Returns all loops in a given region.
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
def __init__(self, node: SequenceNode):
|
|
166
|
+
handlers = {
|
|
167
|
+
LoopNode: self._handle_Loop,
|
|
168
|
+
}
|
|
169
|
+
super().__init__(handlers, update_seqnode_in_place=False, force_forward_scan=True)
|
|
170
|
+
self.loop_nodes: list[LoopNode] = []
|
|
171
|
+
|
|
172
|
+
self.walk(node)
|
|
173
|
+
|
|
174
|
+
def _handle_Loop(self, node: LoopNode, **kwargs):
|
|
175
|
+
super()._handle_Loop(node, **kwargs)
|
|
176
|
+
self.loop_nodes.append(node)
|
|
177
|
+
return None
|
|
178
|
+
|
|
179
|
+
|
|
159
180
|
class MultiStatementExpressionAssignmentFinder(AILBlockWalker):
|
|
160
181
|
"""
|
|
161
182
|
Process statements in MultiStatementExpression objects and find assignments.
|
|
@@ -345,7 +366,8 @@ class ExpressionCounter(SequenceWalker):
|
|
|
345
366
|
if node.condition is not None:
|
|
346
367
|
self._collect_assignments(node.condition, node)
|
|
347
368
|
self._collect_uses(node.condition, ConditionLocation(node.addr))
|
|
348
|
-
|
|
369
|
+
# we do not go ahead and collect into the loop body
|
|
370
|
+
return None
|
|
349
371
|
|
|
350
372
|
def _handle_SwitchCase(self, node: SwitchCaseNode, **kwargs):
|
|
351
373
|
self._collect_uses(node.switch_expr, ConditionLocation(node.addr))
|
|
@@ -419,11 +441,16 @@ class InterferenceChecker(SequenceWalker):
|
|
|
419
441
|
# special case: we process the call arguments first, then the call itself. this is to allow more expression
|
|
420
442
|
# folding opportunities.
|
|
421
443
|
the_call = None
|
|
422
|
-
if
|
|
444
|
+
if (
|
|
445
|
+
isinstance(stmt, Assignment)
|
|
446
|
+
and isinstance(stmt.src, ailment.Stmt.Call)
|
|
447
|
+
and not isinstance(stmt.src.target, str)
|
|
448
|
+
):
|
|
423
449
|
the_call = stmt.src
|
|
424
450
|
elif isinstance(stmt, ailment.Stmt.Call) and not isinstance(stmt.target, str):
|
|
425
451
|
the_call = stmt
|
|
426
452
|
if the_call is not None:
|
|
453
|
+
assert isinstance(the_call.target, ailment.Stmt.Expression)
|
|
427
454
|
spotter.walk_expression(the_call.target)
|
|
428
455
|
if the_call.args:
|
|
429
456
|
for arg in the_call.args:
|
|
@@ -614,6 +641,7 @@ class ExpressionFolder(SequenceWalker):
|
|
|
614
641
|
ConditionNode: self._handle_Condition,
|
|
615
642
|
ConditionalBreakNode: self._handle_ConditionalBreak,
|
|
616
643
|
SwitchCaseNode: self._handle_SwitchCase,
|
|
644
|
+
LoopNode: self._handle_Loop,
|
|
617
645
|
}
|
|
618
646
|
|
|
619
647
|
super().__init__(handlers)
|
|
@@ -693,7 +721,8 @@ class ExpressionFolder(SequenceWalker):
|
|
|
693
721
|
if r is not None and r is not node.condition:
|
|
694
722
|
node.condition = r
|
|
695
723
|
|
|
696
|
-
|
|
724
|
+
# again, do not replace into the loop body
|
|
725
|
+
return None
|
|
697
726
|
|
|
698
727
|
def _handle_SwitchCase(self, node: SwitchCaseNode, **kwargs):
|
|
699
728
|
replacer = ExpressionReplacer(self._assignments, self._uses)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
from collections import defaultdict
|
|
4
4
|
|
|
5
|
-
import ailment
|
|
5
|
+
import angr.ailment as ailment
|
|
6
6
|
|
|
7
7
|
from angr.analyses.decompiler.condition_processor import ConditionProcessor, EmptyBlockNotice
|
|
8
8
|
from angr.analyses.decompiler.sequence_walker import SequenceWalker
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
import ailment
|
|
2
|
+
import angr.ailment as ailment
|
|
3
3
|
|
|
4
4
|
from angr.analyses.decompiler.goto_manager import GotoManager
|
|
5
5
|
from angr.analyses import AnalysesHub
|
|
@@ -7,6 +7,7 @@ from angr.analyses.analysis import Analysis
|
|
|
7
7
|
from angr.analyses.decompiler.empty_node_remover import EmptyNodeRemover
|
|
8
8
|
from angr.analyses.decompiler.jump_target_collector import JumpTargetCollector
|
|
9
9
|
from angr.analyses.decompiler.redundant_label_remover import RedundantLabelRemover
|
|
10
|
+
from angr.analyses.decompiler.structuring.structurer_nodes import LoopNode
|
|
10
11
|
from .goto import GotoSimplifier
|
|
11
12
|
from .if_ import IfSimplifier
|
|
12
13
|
from .cascading_ifs import CascadingIfsRemover
|
|
@@ -18,6 +19,7 @@ from .expr_folding import (
|
|
|
18
19
|
StoreStatementFinder,
|
|
19
20
|
ExpressionLocation,
|
|
20
21
|
InterferenceChecker,
|
|
22
|
+
LoopNodeFinder,
|
|
21
23
|
)
|
|
22
24
|
from .cascading_cond_transformer import CascadingConditionTransformer
|
|
23
25
|
from .switch_expr_simplifier import SwitchExpressionSimplifier
|
|
@@ -44,7 +46,7 @@ class RegionSimplifier(Analysis):
|
|
|
44
46
|
self._should_simplify_ifelses = simplify_ifelse
|
|
45
47
|
|
|
46
48
|
self.goto_manager: GotoManager | None = None
|
|
47
|
-
self.result =
|
|
49
|
+
self.result = self.region
|
|
48
50
|
|
|
49
51
|
self._simplify()
|
|
50
52
|
|
|
@@ -101,6 +103,16 @@ class RegionSimplifier(Analysis):
|
|
|
101
103
|
#
|
|
102
104
|
|
|
103
105
|
def _fold_oneuse_expressions(self, region):
|
|
106
|
+
loop_nodes = LoopNodeFinder(region).loop_nodes
|
|
107
|
+
for sub_region in [*loop_nodes, region]:
|
|
108
|
+
# fold one-use expressions in each sub-region
|
|
109
|
+
if isinstance(sub_region, LoopNode):
|
|
110
|
+
self._fold_oneuse_expressions_in_region(sub_region.sequence_node)
|
|
111
|
+
else:
|
|
112
|
+
self._fold_oneuse_expressions_in_region(sub_region)
|
|
113
|
+
return region
|
|
114
|
+
|
|
115
|
+
def _fold_oneuse_expressions_in_region(self, region):
|
|
104
116
|
# pylint:disable=unreachable
|
|
105
117
|
expr_counter = ExpressionCounter(region)
|
|
106
118
|
|
|
@@ -4,9 +4,9 @@ import enum
|
|
|
4
4
|
from typing import Any
|
|
5
5
|
from collections import OrderedDict, defaultdict
|
|
6
6
|
|
|
7
|
-
import ailment
|
|
8
|
-
from ailment import UnaryOp
|
|
9
|
-
from ailment.expression import negate
|
|
7
|
+
import angr.ailment as ailment
|
|
8
|
+
from angr.ailment import UnaryOp
|
|
9
|
+
from angr.ailment.expression import negate
|
|
10
10
|
|
|
11
11
|
from angr.utils.constants import SWITCH_MISSING_DEFAULT_NODE_ADDR
|
|
12
12
|
from angr.analyses.decompiler.structuring.structurer_nodes import (
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
from collections import OrderedDict
|
|
4
4
|
|
|
5
|
-
import ailment
|
|
5
|
+
import angr.ailment as ailment
|
|
6
6
|
|
|
7
7
|
from angr.analyses.decompiler.structuring.structurer_nodes import SwitchCaseNode
|
|
8
8
|
from angr.analyses.decompiler.sequence_walker import SequenceWalker
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
from collections import OrderedDict
|
|
4
4
|
|
|
5
|
-
import ailment
|
|
5
|
+
import angr.ailment as ailment
|
|
6
6
|
|
|
7
7
|
from angr.errors import UnsupportedNodeTypeError
|
|
8
8
|
from .structuring.structurer_nodes import (
|
|
@@ -180,7 +180,7 @@ class SequenceWalker:
|
|
|
180
180
|
|
|
181
181
|
return None
|
|
182
182
|
|
|
183
|
-
def _handle_Loop(self, node: LoopNode, **kwargs):
|
|
183
|
+
def _handle_Loop(self, node: LoopNode, **kwargs) -> LoopNode | None:
|
|
184
184
|
new_initializer = self._handle(node.initializer) if node.initializer is not None else None
|
|
185
185
|
new_iterator = self._handle(node.iterator) if node.iterator is not None else None
|
|
186
186
|
new_condition = (
|
|
@@ -6,10 +6,10 @@ import logging
|
|
|
6
6
|
|
|
7
7
|
import networkx
|
|
8
8
|
|
|
9
|
-
import ailment
|
|
10
|
-
from ailment import Block
|
|
11
|
-
from ailment.expression import Phi, VirtualVariable, VirtualVariableCategory
|
|
12
|
-
from ailment.statement import Assignment, Label
|
|
9
|
+
import angr.ailment as ailment
|
|
10
|
+
from angr.ailment import Block
|
|
11
|
+
from angr.ailment.expression import Phi, VirtualVariable, VirtualVariableCategory
|
|
12
|
+
from angr.ailment.statement import Assignment, Label
|
|
13
13
|
|
|
14
14
|
from angr.code_location import CodeLocation
|
|
15
15
|
from angr.analyses import ForwardAnalysis
|
|
@@ -4,9 +4,9 @@ from typing import Literal
|
|
|
4
4
|
import logging
|
|
5
5
|
|
|
6
6
|
from archinfo import Endness
|
|
7
|
-
from ailment.block import Block
|
|
8
|
-
from ailment.manager import Manager
|
|
9
|
-
from ailment.statement import (
|
|
7
|
+
from angr.ailment.block import Block
|
|
8
|
+
from angr.ailment.manager import Manager
|
|
9
|
+
from angr.ailment.statement import (
|
|
10
10
|
Statement,
|
|
11
11
|
Assignment,
|
|
12
12
|
CAS,
|
|
@@ -18,7 +18,7 @@ from ailment.statement import (
|
|
|
18
18
|
Jump,
|
|
19
19
|
WeakAssignment,
|
|
20
20
|
)
|
|
21
|
-
from ailment.expression import (
|
|
21
|
+
from angr.ailment.expression import (
|
|
22
22
|
Atom,
|
|
23
23
|
Expression,
|
|
24
24
|
Register,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from collections import defaultdict
|
|
3
3
|
|
|
4
|
-
from ailment.statement import Statement
|
|
5
|
-
from ailment.expression import VirtualVariable
|
|
6
|
-
from ailment.block import Block
|
|
4
|
+
from angr.ailment.statement import Statement
|
|
5
|
+
from angr.ailment.expression import VirtualVariable
|
|
6
|
+
from angr.ailment.block import Block
|
|
7
7
|
|
|
8
8
|
from angr.code_location import CodeLocation
|
|
9
9
|
|
|
@@ -5,7 +5,7 @@ from collections import defaultdict
|
|
|
5
5
|
from itertools import count
|
|
6
6
|
from bisect import bisect_left
|
|
7
7
|
|
|
8
|
-
from ailment.expression import (
|
|
8
|
+
from angr.ailment.expression import (
|
|
9
9
|
Expression,
|
|
10
10
|
Register,
|
|
11
11
|
StackBaseOffset,
|
|
@@ -14,7 +14,7 @@ from ailment.expression import (
|
|
|
14
14
|
VirtualVariableCategory,
|
|
15
15
|
Load,
|
|
16
16
|
)
|
|
17
|
-
from ailment.statement import Statement, Store
|
|
17
|
+
from angr.ailment.statement import Statement, Store
|
|
18
18
|
|
|
19
19
|
from angr.knowledge_plugins.functions import Function
|
|
20
20
|
from angr.code_location import CodeLocation
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from collections import OrderedDict
|
|
3
3
|
|
|
4
|
-
from ailment.statement import Call, Store, ConditionalJump, CAS
|
|
5
|
-
from ailment.expression import
|
|
4
|
+
from angr.ailment.statement import Call, Store, ConditionalJump, CAS
|
|
5
|
+
from angr.ailment.expression import (
|
|
6
|
+
Register,
|
|
7
|
+
BinaryOp,
|
|
8
|
+
StackBaseOffset,
|
|
9
|
+
ITE,
|
|
10
|
+
VEXCCallExpression,
|
|
11
|
+
Tmp,
|
|
12
|
+
DirtyExpression,
|
|
13
|
+
Load,
|
|
14
|
+
)
|
|
6
15
|
|
|
7
16
|
from angr.engines.light import SimEngineLightAIL
|
|
8
17
|
from angr.project import Project
|
|
@@ -7,9 +7,9 @@ import logging
|
|
|
7
7
|
import struct
|
|
8
8
|
import re
|
|
9
9
|
|
|
10
|
-
from ailment import Block, Expr, Stmt, Tmp
|
|
11
|
-
from ailment.constant import UNDETERMINED_SIZE
|
|
12
|
-
from ailment.expression import StackBaseOffset, BinaryOp
|
|
10
|
+
from angr.ailment import Block, Expr, Stmt, Tmp
|
|
11
|
+
from angr.ailment.constant import UNDETERMINED_SIZE
|
|
12
|
+
from angr.ailment.expression import StackBaseOffset, BinaryOp
|
|
13
13
|
from unique_log_filter import UniqueLogFilter
|
|
14
14
|
|
|
15
15
|
from angr.sim_type import (
|