angr 9.2.64__py3-none-manylinux2014_x86_64.whl → 9.2.66__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 +55 -2
- angr/analyses/calling_convention.py +4 -3
- angr/analyses/cfg/cfg_base.py +2 -2
- angr/analyses/cfg/cfg_fast.py +128 -60
- angr/analyses/decompiler/ail_simplifier.py +1 -2
- angr/analyses/decompiler/block_simplifier.py +4 -3
- angr/analyses/decompiler/callsite_maker.py +1 -1
- angr/analyses/decompiler/condition_processor.py +5 -3
- angr/analyses/decompiler/optimization_passes/flip_boolean_cmp.py +51 -8
- angr/analyses/decompiler/peephole_optimizations/__init__.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/const_mull_a_shift.py +92 -0
- angr/analyses/decompiler/structured_codegen/c.py +59 -6
- angr/analyses/decompiler/utils.py +1 -1
- angr/analyses/find_objects_static.py +4 -4
- angr/analyses/propagator/engine_ail.py +2 -1
- angr/analyses/reaching_definitions/__init__.py +1 -3
- angr/analyses/reaching_definitions/dep_graph.py +33 -4
- angr/analyses/reaching_definitions/engine_ail.py +5 -6
- angr/analyses/reaching_definitions/engine_vex.py +6 -7
- angr/analyses/reaching_definitions/external_codeloc.py +0 -27
- angr/analyses/reaching_definitions/function_handler.py +145 -23
- angr/analyses/reaching_definitions/rd_initializer.py +221 -0
- angr/analyses/reaching_definitions/rd_state.py +95 -153
- angr/analyses/reaching_definitions/reaching_definitions.py +15 -3
- angr/calling_conventions.py +2 -2
- angr/code_location.py +24 -0
- angr/exploration_techniques/__init__.py +28 -0
- angr/knowledge_plugins/cfg/cfg_model.py +1 -1
- angr/knowledge_plugins/key_definitions/__init__.py +12 -1
- angr/knowledge_plugins/key_definitions/atoms.py +9 -0
- angr/knowledge_plugins/key_definitions/definition.py +13 -18
- angr/knowledge_plugins/key_definitions/live_definitions.py +350 -106
- angr/project.py +1 -1
- angr/sim_manager.py +15 -0
- angr/sim_state.py +3 -3
- angr/storage/memory_mixins/paged_memory/pages/multi_values.py +56 -8
- angr/storage/memory_object.py +3 -1
- angr/utils/typing.py +16 -0
- {angr-9.2.64.dist-info → angr-9.2.66.dist-info}/METADATA +8 -8
- {angr-9.2.64.dist-info → angr-9.2.66.dist-info}/RECORD +43 -41
- {angr-9.2.64.dist-info → angr-9.2.66.dist-info}/WHEEL +1 -1
- angr/analyses/decompiler/peephole_optimizations/conv_const_mull_a_shift.py +0 -75
- {angr-9.2.64.dist-info → angr-9.2.66.dist-info}/LICENSE +0 -0
- {angr-9.2.64.dist-info → angr-9.2.66.dist-info}/top_level.txt +0 -0
angr/calling_conventions.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pylint:disable=line-too-long,missing-class-docstring,no-self-use
|
|
2
2
|
import logging
|
|
3
|
-
from typing import Optional, List, Dict, Type
|
|
3
|
+
from typing import Optional, List, Dict, Type, Union
|
|
4
4
|
from collections import defaultdict
|
|
5
5
|
|
|
6
6
|
import claripy
|
|
@@ -263,7 +263,7 @@ class SimFunctionArgument:
|
|
|
263
263
|
def refine(self, size, arch=None, offset=None, is_fp=None):
|
|
264
264
|
raise NotImplementedError
|
|
265
265
|
|
|
266
|
-
def get_footprint(self):
|
|
266
|
+
def get_footprint(self) -> List[Union["SimRegArg", "SimStackArg"]]:
|
|
267
267
|
"""
|
|
268
268
|
Return a list of SimRegArg and SimStackArgs that are the base components used for this location
|
|
269
269
|
"""
|
angr/code_location.py
CHANGED
|
@@ -142,3 +142,27 @@ class CodeLocation:
|
|
|
142
142
|
self.info = {}
|
|
143
143
|
for k, v in kwargs.items():
|
|
144
144
|
self.info[k] = v
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class ExternalCodeLocation(CodeLocation):
|
|
148
|
+
"""
|
|
149
|
+
Stands for a program point that originates from outside an analysis' scope.
|
|
150
|
+
i.e. a value loaded from rdi in a callee where the caller has not been analyzed.
|
|
151
|
+
"""
|
|
152
|
+
|
|
153
|
+
__slots__ = ("call_string",)
|
|
154
|
+
|
|
155
|
+
def __init__(self, call_string: Optional[Tuple[int, ...]] = None):
|
|
156
|
+
super().__init__(0, None)
|
|
157
|
+
self.call_string = call_string if call_string is not None else ()
|
|
158
|
+
|
|
159
|
+
def __repr__(self):
|
|
160
|
+
return f"[External {[hex(x) if isinstance(x, int) else x for x in self.call_string]}]"
|
|
161
|
+
|
|
162
|
+
def __hash__(self):
|
|
163
|
+
"""
|
|
164
|
+
returns the hash value of self.
|
|
165
|
+
"""
|
|
166
|
+
if self._hash is None:
|
|
167
|
+
self._hash = hash((self.call_string,))
|
|
168
|
+
return self._hash
|
|
@@ -146,3 +146,31 @@ from .bucketizer import Bucketizer
|
|
|
146
146
|
from .local_loop_seer import LocalLoopSeer
|
|
147
147
|
from .timeout import Timeout
|
|
148
148
|
from .suggestions import Suggestions
|
|
149
|
+
|
|
150
|
+
__all__ = (
|
|
151
|
+
"ExplorationTechnique",
|
|
152
|
+
"Slicecutor",
|
|
153
|
+
"DrillerCore",
|
|
154
|
+
"LoopSeer",
|
|
155
|
+
"Tracer",
|
|
156
|
+
"Explorer",
|
|
157
|
+
"Threading",
|
|
158
|
+
"DFS",
|
|
159
|
+
"LengthLimiter",
|
|
160
|
+
"Veritesting",
|
|
161
|
+
"Oppologist",
|
|
162
|
+
"Director",
|
|
163
|
+
"ExecuteAddressGoal",
|
|
164
|
+
"CallFunctionGoal",
|
|
165
|
+
"Spiller",
|
|
166
|
+
"ManualMergepoint",
|
|
167
|
+
"TechniqueBuilder",
|
|
168
|
+
"StochasticSearch",
|
|
169
|
+
"UniqueSearch",
|
|
170
|
+
"Symbion",
|
|
171
|
+
"MemoryWatcher",
|
|
172
|
+
"Bucketizer",
|
|
173
|
+
"LocalLoopSeer",
|
|
174
|
+
"Timeout",
|
|
175
|
+
"Suggestions",
|
|
176
|
+
)
|
|
@@ -660,7 +660,7 @@ class CFGModel(Serializable):
|
|
|
660
660
|
|
|
661
661
|
# let's see what sort of data it is
|
|
662
662
|
if memory_data.sort in (MemoryDataSort.Unknown, MemoryDataSort.Unspecified) or (
|
|
663
|
-
memory_data.sort == MemoryDataSort.Integer and memory_data.size
|
|
663
|
+
memory_data.sort == MemoryDataSort.Integer and memory_data.size in (0, self.project.arch.bytes)
|
|
664
664
|
):
|
|
665
665
|
data_type, data_size = self._guess_data_type(
|
|
666
666
|
data_addr,
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
from .rd_model import ReachingDefinitionsModel
|
|
2
2
|
from .key_definition_manager import KeyDefinitionManager
|
|
3
|
-
from .live_definitions import LiveDefinitions
|
|
3
|
+
from .live_definitions import LiveDefinitions, DerefSize
|
|
4
4
|
from .uses import Uses
|
|
5
|
+
from .definition import Definition
|
|
5
6
|
from . import atoms
|
|
7
|
+
|
|
8
|
+
__all__ = (
|
|
9
|
+
"ReachingDefinitionsModel",
|
|
10
|
+
"KeyDefinitionManager",
|
|
11
|
+
"LiveDefinitions",
|
|
12
|
+
"DerefSize",
|
|
13
|
+
"Uses",
|
|
14
|
+
"atoms",
|
|
15
|
+
"Definition",
|
|
16
|
+
)
|
|
@@ -301,3 +301,12 @@ class MemoryLocation(Atom):
|
|
|
301
301
|
|
|
302
302
|
def _identity(self):
|
|
303
303
|
return self.addr, self.size, self.endness
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
atom_kind_mapping = {
|
|
307
|
+
AtomKind.REGISTER: Register,
|
|
308
|
+
AtomKind.MEMORY: MemoryLocation,
|
|
309
|
+
AtomKind.TMP: Tmp,
|
|
310
|
+
AtomKind.GUARD: GuardUse,
|
|
311
|
+
AtomKind.CONSTANT: ConstantSrc,
|
|
312
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Set, Optional, Literal, TypeVar, Union, Generic
|
|
1
|
+
from typing import Set, Optional, Literal, Type, TypeVar, Union, Generic
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
import logging
|
|
4
4
|
|
|
@@ -10,8 +10,8 @@ from angr.sim_variable import SimRegisterVariable
|
|
|
10
10
|
from angr.misc.ux import once
|
|
11
11
|
|
|
12
12
|
from ...engines.light import SpOffset
|
|
13
|
-
from ...code_location import CodeLocation
|
|
14
|
-
from .atoms import Atom, MemoryLocation, Register, Tmp,
|
|
13
|
+
from ...code_location import CodeLocation, ExternalCodeLocation
|
|
14
|
+
from .atoms import Atom, MemoryLocation, Register, Tmp, AtomKind, atom_kind_mapping
|
|
15
15
|
from .tag import Tag
|
|
16
16
|
from ...sim_variable import SimVariable
|
|
17
17
|
|
|
@@ -25,7 +25,7 @@ class DefinitionMatchPredicate:
|
|
|
25
25
|
internal class; don't worry about this.
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
|
-
kind:
|
|
28
|
+
kind: Union[AtomKind, Type[Atom], None] = None
|
|
29
29
|
bbl_addr: Optional[int] = None
|
|
30
30
|
ins_addr: Optional[int] = None
|
|
31
31
|
variable: Optional[SimVariable] = None
|
|
@@ -36,6 +36,7 @@ class DefinitionMatchPredicate:
|
|
|
36
36
|
global_addr: Optional[int] = None
|
|
37
37
|
tmp_idx: Optional[int] = None
|
|
38
38
|
const_val: Optional[int] = None
|
|
39
|
+
extern: Optional[bool] = None
|
|
39
40
|
|
|
40
41
|
@staticmethod
|
|
41
42
|
def construct(predicate: Optional["DefinitionMatchPredicate"] = None, **kwargs) -> "DefinitionMatchPredicate":
|
|
@@ -96,10 +97,16 @@ class DefinitionMatchPredicate:
|
|
|
96
97
|
return False
|
|
97
98
|
if self.ins_addr is not None and defn.codeloc.ins_addr != self.ins_addr:
|
|
98
99
|
return False
|
|
100
|
+
if self.extern is not None and isinstance(defn.codeloc, ExternalCodeLocation) != self.extern:
|
|
101
|
+
return False
|
|
99
102
|
|
|
100
|
-
if
|
|
101
|
-
if self.kind
|
|
103
|
+
if self.kind is not None:
|
|
104
|
+
if not isinstance(self.kind, type):
|
|
105
|
+
self.kind = atom_kind_mapping[self.kind]
|
|
106
|
+
if not isinstance(defn.atom, self.kind):
|
|
102
107
|
return False
|
|
108
|
+
|
|
109
|
+
if isinstance(defn.atom, Register):
|
|
103
110
|
if self.reg_name is not None:
|
|
104
111
|
if isinstance(self.reg_name, int):
|
|
105
112
|
if not defn.atom.reg_offset <= self.reg_name < defn.atom.reg_offset + defn.atom.size:
|
|
@@ -116,8 +123,6 @@ class DefinitionMatchPredicate:
|
|
|
116
123
|
else:
|
|
117
124
|
raise TypeError(self.reg_name)
|
|
118
125
|
elif isinstance(defn.atom, MemoryLocation):
|
|
119
|
-
if self.kind not in (None, AtomKind.MEMORY):
|
|
120
|
-
return False
|
|
121
126
|
if self.stack_offset is not None:
|
|
122
127
|
if (
|
|
123
128
|
not isinstance(defn.atom.addr, SpOffset)
|
|
@@ -126,18 +131,8 @@ class DefinitionMatchPredicate:
|
|
|
126
131
|
):
|
|
127
132
|
return False
|
|
128
133
|
elif isinstance(defn.atom, Tmp):
|
|
129
|
-
if self.kind not in (None, AtomKind.TMP):
|
|
130
|
-
return False
|
|
131
134
|
if self.tmp_idx is not None and self.tmp_idx != defn.atom.tmp_idx:
|
|
132
135
|
return False
|
|
133
|
-
elif isinstance(defn.atom, GuardUse):
|
|
134
|
-
if self.kind not in (None, AtomKind.GUARD):
|
|
135
|
-
return False
|
|
136
|
-
elif isinstance(defn.atom, ConstantSrc):
|
|
137
|
-
if self.kind not in (None, AtomKind.CONSTANT):
|
|
138
|
-
return False
|
|
139
|
-
else:
|
|
140
|
-
raise TypeError(type(defn))
|
|
141
136
|
|
|
142
137
|
return True
|
|
143
138
|
|