angr 9.2.116__py3-none-manylinux2014_aarch64.whl → 9.2.117__py3-none-manylinux2014_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of angr might be problematic. Click here for more details.
- angr/__init__.py +1 -1
- angr/analyses/cfg/cfg_emulated.py +4 -4
- angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +7 -7
- angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py +3 -2
- angr/analyses/identifier/functions/free.py +3 -1
- angr/analyses/identifier/identify.py +13 -15
- angr/analyses/identifier/runner.py +2 -2
- angr/analyses/vfg.py +4 -4
- angr/calling_conventions.py +4 -2
- angr/concretization_strategies/any_named.py +3 -1
- angr/concretization_strategies/controlled_data.py +4 -2
- angr/concretization_strategies/signed_add.py +3 -1
- angr/engines/concrete.py +3 -1
- angr/engines/pcode/behavior.py +2 -0
- angr/engines/pcode/emulate.py +4 -4
- angr/engines/pcode/engine.py +3 -7
- angr/engines/soot/engine.py +7 -6
- angr/engines/soot/expressions/constants.py +6 -5
- angr/engines/soot/expressions/newArray.py +3 -1
- angr/engines/soot/expressions/newMultiArray.py +3 -1
- angr/engines/soot/statements/goto.py +3 -1
- angr/engines/soot/statements/if_.py +3 -1
- angr/engines/soot/statements/switch.py +3 -1
- angr/engines/soot/statements/throw.py +4 -2
- angr/engines/soot/values/arrayref.py +5 -5
- angr/engines/unicorn.py +8 -7
- angr/engines/vex/heavy/concretizers.py +6 -6
- angr/engines/vex/heavy/dirty.py +20 -22
- angr/engines/vex/heavy/heavy.py +4 -8
- angr/exploration_techniques/director.py +1 -1
- angr/exploration_techniques/driller_core.py +3 -1
- angr/exploration_techniques/tracer.py +2 -1
- angr/procedures/cgc/allocate.py +8 -10
- angr/procedures/cgc/deallocate.py +10 -3
- angr/procedures/cgc/fdwait.py +15 -13
- angr/procedures/cgc/random.py +11 -5
- angr/procedures/cgc/receive.py +5 -3
- angr/procedures/cgc/transmit.py +5 -4
- angr/procedures/glibc/__libc_start_main.py +5 -4
- angr/procedures/java_jni/__init__.py +4 -4
- angr/procedures/java_jni/array_operations.py +3 -1
- angr/procedures/java_lang/string.py +1 -1
- angr/procedures/java_util/random.py +3 -1
- angr/procedures/libc/access.py +4 -2
- angr/procedures/libc/feof.py +4 -3
- angr/procedures/libc/fgetc.py +3 -1
- angr/procedures/libc/fgets.py +5 -5
- angr/procedures/libc/fopen.py +5 -4
- angr/procedures/libc/fread.py +4 -3
- angr/procedures/libc/fseek.py +4 -3
- angr/procedures/libc/getdelim.py +7 -4
- angr/procedures/libc/gets.py +4 -2
- angr/procedures/libc/memcmp.py +18 -15
- angr/procedures/libc/memset.py +9 -7
- angr/procedures/libc/puts.py +3 -1
- angr/procedures/libc/snprintf.py +4 -2
- angr/procedures/libc/sprintf.py +3 -1
- angr/procedures/libc/strchr.py +6 -3
- angr/procedures/libc/strcmp.py +5 -3
- angr/procedures/libc/strlen.py +3 -3
- angr/procedures/libc/strncmp.py +28 -28
- angr/procedures/libc/strncpy.py +5 -2
- angr/procedures/libc/strstr.py +10 -7
- angr/procedures/libc/strtol.py +32 -34
- angr/procedures/libc/tolower.py +3 -1
- angr/procedures/libc/toupper.py +3 -1
- angr/procedures/linux_kernel/fstat.py +13 -13
- angr/procedures/linux_kernel/fstat64.py +15 -15
- angr/procedures/linux_kernel/lseek.py +5 -3
- angr/procedures/linux_kernel/sigaction.py +4 -2
- angr/procedures/linux_kernel/sigprocmask.py +5 -3
- angr/procedures/linux_kernel/tgkill.py +3 -1
- angr/procedures/linux_kernel/time.py +7 -4
- angr/procedures/msvcr/fmode.py +3 -1
- angr/procedures/ntdll/exceptions.py +3 -1
- angr/procedures/posix/bzero.py +3 -1
- angr/procedures/posix/fdopen.py +6 -4
- angr/procedures/posix/fork.py +6 -4
- angr/procedures/posix/mmap.py +6 -3
- angr/procedures/posix/poll.py +6 -5
- angr/procedures/posix/readdir.py +10 -7
- angr/procedures/posix/select.py +4 -2
- angr/procedures/posix/send.py +4 -3
- angr/procedures/posix/sigaction.py +4 -2
- angr/procedures/posix/sim_time.py +3 -1
- angr/procedures/posix/strcasecmp.py +3 -1
- angr/procedures/posix/strtok_r.py +10 -7
- angr/procedures/stubs/Redirect.py +3 -1
- angr/procedures/stubs/ReturnChar.py +3 -3
- angr/procedures/stubs/UserHook.py +3 -1
- angr/procedures/stubs/b64_decode.py +3 -1
- angr/procedures/stubs/crazy_scanf.py +6 -4
- angr/procedures/stubs/format_parser.py +13 -15
- angr/procedures/tracer/receive.py +3 -1
- angr/procedures/tracer/transmit.py +3 -1
- angr/procedures/win32/GetLastInputInfo.py +4 -2
- angr/procedures/win32/GetProcessAffinityMask.py +4 -2
- angr/procedures/win32/gethostbyname.py +3 -1
- angr/procedures/win32/heap.py +3 -1
- angr/procedures/win32/local_storage.py +4 -2
- angr/procedures/win32/sim_time.py +7 -4
- angr/procedures/win_user32/chars.py +4 -2
- angr/procedures/win_user32/messagebox.py +3 -1
- angr/sim_procedure.py +7 -7
- angr/sim_state.py +10 -7
- angr/sim_type.py +3 -3
- angr/simos/cgc.py +2 -2
- angr/simos/simos.py +5 -4
- angr/simos/windows.py +5 -5
- angr/state_plugins/heap/heap_brk.py +5 -3
- angr/state_plugins/heap/heap_ptmalloc.py +5 -4
- angr/state_plugins/history.py +7 -5
- angr/state_plugins/light_registers.py +2 -2
- angr/state_plugins/plugin.py +2 -2
- angr/state_plugins/posix.py +28 -26
- angr/state_plugins/preconstrainer.py +2 -1
- angr/state_plugins/solver.py +11 -27
- angr/state_plugins/trace_additions.py +9 -13
- angr/state_plugins/uc_manager.py +4 -2
- angr/state_plugins/unicorn_engine.py +1 -1
- angr/state_plugins/view.py +1 -1
- angr/storage/file.py +21 -26
- angr/storage/memory_mixins/actions_mixin.py +4 -2
- angr/storage/memory_mixins/address_concretization_mixin.py +3 -3
- angr/storage/memory_mixins/default_filler_mixin.py +6 -4
- angr/storage/memory_mixins/javavm_memory/javavm_memory_mixin.py +7 -5
- angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +1 -1
- angr/storage/memory_mixins/regioned_memory/abstract_merger_mixin.py +1 -1
- angr/storage/memory_mixins/regioned_memory/region_data.py +3 -1
- angr/storage/memory_mixins/regioned_memory/region_meta_mixin.py +1 -1
- angr/storage/memory_mixins/regioned_memory/regioned_memory_mixin.py +5 -4
- angr/storage/memory_mixins/simple_interface_mixin.py +2 -2
- angr/storage/memory_mixins/size_resolution_mixin.py +3 -1
- angr/storage/memory_mixins/slotted_memory.py +1 -1
- angr/storage/memory_mixins/smart_find_mixin.py +2 -2
- angr/storage/memory_mixins/symbolic_merger_mixin.py +5 -3
- angr/tablespecs.py +3 -3
- {angr-9.2.116.dist-info → angr-9.2.117.dist-info}/METADATA +6 -6
- {angr-9.2.116.dist-info → angr-9.2.117.dist-info}/RECORD +143 -143
- {angr-9.2.116.dist-info → angr-9.2.117.dist-info}/WHEEL +1 -1
- {angr-9.2.116.dist-info → angr-9.2.117.dist-info}/LICENSE +0 -0
- {angr-9.2.116.dist-info → angr-9.2.117.dist-info}/entry_points.txt +0 -0
- {angr-9.2.116.dist-info → angr-9.2.117.dist-info}/top_level.txt +0 -0
angr/storage/file.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import claripy
|
|
2
1
|
import logging
|
|
3
2
|
import itertools
|
|
4
3
|
|
|
4
|
+
import claripy
|
|
5
|
+
|
|
5
6
|
from .memory_mixins import DefaultMemory
|
|
6
7
|
from ..state_plugins.plugin import SimStatePlugin
|
|
7
8
|
from ..state_plugins.sim_action_object import SimActionObject
|
|
@@ -291,19 +292,19 @@ class SimFile(SimFileBase, DefaultMemory): # TODO: pick a better base class omg
|
|
|
291
292
|
# If it's not possible to EOF (because there's no EOF), this is very simple!
|
|
292
293
|
if not self.has_end:
|
|
293
294
|
# bump the storage size as we read
|
|
294
|
-
self._size =
|
|
295
|
+
self._size = claripy.If(size + pos > self._size, size + pos, self._size)
|
|
295
296
|
return self.load(pos, passed_max_size, disable_actions=disable_actions, inspect=inspect), size, size + pos
|
|
296
297
|
|
|
297
298
|
# Step 2.2: check harder for the possibility of EOFs
|
|
298
299
|
# This is the size if we're reading to the end of the file
|
|
299
300
|
distance_to_eof = self._size - pos
|
|
300
|
-
distance_to_eof =
|
|
301
|
+
distance_to_eof = claripy.If(claripy.SLE(distance_to_eof, 0), 0, distance_to_eof)
|
|
301
302
|
|
|
302
303
|
# try to frontload some constraint solving to see if it's impossible for this read to EOF
|
|
303
304
|
if self.state.solver.satisfiable(extra_constraints=(size > distance_to_eof,)):
|
|
304
305
|
# it's possible to EOF
|
|
305
306
|
# final size = min(passed_size, max(distance_to_eof, 0))
|
|
306
|
-
real_size =
|
|
307
|
+
real_size = claripy.If(size >= distance_to_eof, distance_to_eof, size)
|
|
307
308
|
|
|
308
309
|
return (
|
|
309
310
|
self.load(pos, passed_max_size, disable_actions=disable_actions, inspect=inspect),
|
|
@@ -327,7 +328,7 @@ class SimFile(SimFileBase, DefaultMemory): # TODO: pick a better base class omg
|
|
|
327
328
|
# \(_^^)/
|
|
328
329
|
self.store(pos, data, size=size)
|
|
329
330
|
new_end = _deps_unpack(pos + size)[0] # decline to store SAO
|
|
330
|
-
self._size =
|
|
331
|
+
self._size = claripy.If(new_end > self._size, new_end, self._size)
|
|
331
332
|
return new_end
|
|
332
333
|
|
|
333
334
|
@SimStatePlugin.memo
|
|
@@ -349,7 +350,7 @@ class SimFile(SimFileBase, DefaultMemory): # TODO: pick a better base class omg
|
|
|
349
350
|
if any(o.has_end != self.has_end for o in others):
|
|
350
351
|
raise SimMergeError("Cannot merge files where some have ends and some don't")
|
|
351
352
|
|
|
352
|
-
self._size =
|
|
353
|
+
self._size = claripy.ite_cases(zip(merge_conditions[1:], (o._size for o in others)), self._size)
|
|
353
354
|
|
|
354
355
|
return super().merge(others, merge_conditions, common_ancestor=common_ancestor)
|
|
355
356
|
|
|
@@ -378,7 +379,7 @@ class SimFileStream(SimFile):
|
|
|
378
379
|
def set_state(self, state):
|
|
379
380
|
super().set_state(state)
|
|
380
381
|
if type(self.pos) is int:
|
|
381
|
-
self.pos =
|
|
382
|
+
self.pos = claripy.BVV(self.pos, state.arch.bits)
|
|
382
383
|
elif len(self.pos) != state.arch.bits:
|
|
383
384
|
raise TypeError("SimFileStream position must be a bitvector of size %d (arch.bits)" % state.arch.bits)
|
|
384
385
|
|
|
@@ -402,7 +403,7 @@ class SimFileStream(SimFile):
|
|
|
402
403
|
return c
|
|
403
404
|
|
|
404
405
|
def merge(self, others, merge_conditions, common_ancestor=None): # pylint: disable=unused-argument
|
|
405
|
-
self.pos =
|
|
406
|
+
self.pos = claripy.ite_cases(zip(merge_conditions[1:], [o.pos for o in others]), self.pos)
|
|
406
407
|
return super().merge(others, merge_conditions, common_ancestor=common_ancestor)
|
|
407
408
|
|
|
408
409
|
|
|
@@ -525,7 +526,7 @@ class SimPackets(SimFileBase):
|
|
|
525
526
|
|
|
526
527
|
# Type check
|
|
527
528
|
if type(size) is int:
|
|
528
|
-
size =
|
|
529
|
+
size = claripy.BVV(size, self.state.arch.bits)
|
|
529
530
|
|
|
530
531
|
# The read is on the frontier. let's generate a new packet.
|
|
531
532
|
orig_size = size
|
|
@@ -596,7 +597,7 @@ class SimPackets(SimFileBase):
|
|
|
596
597
|
if size is None:
|
|
597
598
|
size = len(data) // self.state.arch.byte_width if isinstance(data, claripy.Bits) else len(data)
|
|
598
599
|
if type(size) is int:
|
|
599
|
-
size =
|
|
600
|
+
size = claripy.BVV(size, self.state.arch.bits)
|
|
600
601
|
|
|
601
602
|
# sanity check on packet number and determine if data is already present
|
|
602
603
|
if pos is None:
|
|
@@ -641,16 +642,14 @@ class SimPackets(SimFileBase):
|
|
|
641
642
|
|
|
642
643
|
for i, default in enumerate(self.content):
|
|
643
644
|
max_data_length = max(len(default[0]), max(len(o.content[i][0]) for o in others))
|
|
644
|
-
merged_data =
|
|
645
|
+
merged_data = claripy.ite_cases(
|
|
645
646
|
zip(
|
|
646
647
|
merge_conditions[1:],
|
|
647
648
|
(o.content[i][0].concat(claripy.BVV(0, max_data_length - len(o.content[i][0]))) for o in others),
|
|
648
649
|
),
|
|
649
650
|
default[0],
|
|
650
651
|
)
|
|
651
|
-
merged_size =
|
|
652
|
-
zip(merge_conditions[1:], (o.content[i][1] for o in others)), default[1]
|
|
653
|
-
)
|
|
652
|
+
merged_size = claripy.ite_cases(zip(merge_conditions[1:], (o.content[i][1] for o in others)), default[1])
|
|
654
653
|
self.content[i] = (merged_data, merged_size)
|
|
655
654
|
|
|
656
655
|
return True
|
|
@@ -917,7 +916,7 @@ class SimFileDescriptor(SimFileDescriptorBase):
|
|
|
917
916
|
return claripy.false
|
|
918
917
|
|
|
919
918
|
if type(offset) is int:
|
|
920
|
-
offset =
|
|
919
|
+
offset = claripy.BVV(offset, self.state.arch.bits)
|
|
921
920
|
|
|
922
921
|
if whence == "start":
|
|
923
922
|
new_pos = offset
|
|
@@ -926,10 +925,8 @@ class SimFileDescriptor(SimFileDescriptorBase):
|
|
|
926
925
|
elif whence == "end":
|
|
927
926
|
new_pos = self.file.size + offset
|
|
928
927
|
|
|
929
|
-
success_condition =
|
|
930
|
-
|
|
931
|
-
)
|
|
932
|
-
self._pos = _deps_unpack(self.state.solver.If(success_condition, new_pos, self._pos))[0]
|
|
928
|
+
success_condition = claripy.And(claripy.SGE(new_pos, 0), claripy.SLE(new_pos, self.file.size))
|
|
929
|
+
self._pos = _deps_unpack(claripy.If(success_condition, new_pos, self._pos))[0]
|
|
933
930
|
return success_condition
|
|
934
931
|
|
|
935
932
|
def eof(self):
|
|
@@ -1006,7 +1003,7 @@ class SimFileDescriptor(SimFileDescriptorBase):
|
|
|
1006
1003
|
elif self._pos is None or any(o._pos is None for o in others):
|
|
1007
1004
|
raise SimMergeError("Cannot merge SimFileDescriptors with inconsistent None-position - please report this!")
|
|
1008
1005
|
else:
|
|
1009
|
-
self._pos =
|
|
1006
|
+
self._pos = claripy.ite_cases(zip(merge_conditions[1:], (o._pos for o in others)), self._pos)
|
|
1010
1007
|
|
|
1011
1008
|
return True
|
|
1012
1009
|
|
|
@@ -1113,9 +1110,7 @@ class SimFileDescriptorDuplex(SimFileDescriptorBase):
|
|
|
1113
1110
|
elif self._read_pos is None or any(o._read_pos is None for o in others):
|
|
1114
1111
|
raise SimMergeError("Cannot merge SimFileDescriptors with inconsistent None-position - please report this!")
|
|
1115
1112
|
else:
|
|
1116
|
-
self._read_pos =
|
|
1117
|
-
zip(merge_conditions[1:], (o._read_pos for o in others)), self._read_pos
|
|
1118
|
-
)
|
|
1113
|
+
self._read_pos = claripy.ite_cases(zip(merge_conditions[1:], (o._read_pos for o in others)), self._read_pos)
|
|
1119
1114
|
|
|
1120
1115
|
if type(self._write_pos) is int and all(type(o._write_pos) is int for o in others):
|
|
1121
1116
|
if any(o._write_pos != self._write_pos for o in others):
|
|
@@ -1125,7 +1120,7 @@ class SimFileDescriptorDuplex(SimFileDescriptorBase):
|
|
|
1125
1120
|
elif self._write_pos is None or any(o._write_pos is None for o in others):
|
|
1126
1121
|
raise SimMergeError("Cannot merge SimFileDescriptors with inconsistent None-position - please report this!")
|
|
1127
1122
|
else:
|
|
1128
|
-
self._write_pos =
|
|
1123
|
+
self._write_pos = claripy.ite_cases(
|
|
1129
1124
|
zip(merge_conditions[1:], (o._write_pos for o in others)), self._write_pos
|
|
1130
1125
|
)
|
|
1131
1126
|
|
|
@@ -1159,7 +1154,7 @@ class SimPacketsSlots(SimFileBase):
|
|
|
1159
1154
|
|
|
1160
1155
|
def read(self, pos, size, **kwargs):
|
|
1161
1156
|
if not self.read_sizes:
|
|
1162
|
-
return
|
|
1157
|
+
return claripy.BVV(0, 0), 0, None
|
|
1163
1158
|
|
|
1164
1159
|
try:
|
|
1165
1160
|
req_size = self.state.solver.eval_one(size)
|
|
@@ -1206,7 +1201,7 @@ class SimPacketsSlots(SimFileBase):
|
|
|
1206
1201
|
raise SimMergeError("Can't merge SimPacketsSlots with disparate reads")
|
|
1207
1202
|
|
|
1208
1203
|
for i, default_var in self.read_data:
|
|
1209
|
-
self.read_data[i] =
|
|
1204
|
+
self.read_data[i] = claripy.ite_cases(
|
|
1210
1205
|
zip(merge_conditions[1:], [o.read_data[i] for o in others]), default_var
|
|
1211
1206
|
)
|
|
1212
1207
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import claripy
|
|
2
|
+
|
|
1
3
|
from ...state_plugins.sim_action import SimActionData, SimActionObject
|
|
2
4
|
from ... import sim_options as o
|
|
3
5
|
from . import MemoryMixin
|
|
@@ -43,12 +45,12 @@ class ActionsMixinHigh(MemoryMixin):
|
|
|
43
45
|
self.state, region_type, kind, addr=addr, data=data, size=ref_size, condition=condition, fallback=fallback
|
|
44
46
|
)
|
|
45
47
|
|
|
46
|
-
action.added_constraints =
|
|
48
|
+
action.added_constraints = claripy.true
|
|
47
49
|
return action
|
|
48
50
|
|
|
49
51
|
def _add_constraints(self, c, action=None, **kwargs):
|
|
50
52
|
if action is not None:
|
|
51
|
-
action.added_constraints =
|
|
53
|
+
action.added_constraints = claripy.And(action.added_constraints, c)
|
|
52
54
|
return super()._add_constraints(c, action=action, **kwargs)
|
|
53
55
|
|
|
54
56
|
|
|
@@ -255,7 +255,7 @@ class AddressConcretizationMixin(MemoryMixin):
|
|
|
255
255
|
if read_value is None:
|
|
256
256
|
return sub_value
|
|
257
257
|
else:
|
|
258
|
-
return
|
|
258
|
+
return claripy.If(addr == concrete_addr, sub_value, read_value)
|
|
259
259
|
|
|
260
260
|
def load(self, addr, size=None, condition=None, **kwargs):
|
|
261
261
|
if type(size) is not int:
|
|
@@ -285,7 +285,7 @@ class AddressConcretizationMixin(MemoryMixin):
|
|
|
285
285
|
if not trivial:
|
|
286
286
|
# apply the concretization results to the state
|
|
287
287
|
constraint_options = [addr == concrete_addr for concrete_addr in concrete_addrs]
|
|
288
|
-
conditional_constraint =
|
|
288
|
+
conditional_constraint = claripy.Or(*constraint_options)
|
|
289
289
|
self._add_constraints(conditional_constraint, condition=condition, **kwargs)
|
|
290
290
|
|
|
291
291
|
# quick optimization to not introduce the DUMMY value if there's only one loop
|
|
@@ -338,7 +338,7 @@ class AddressConcretizationMixin(MemoryMixin):
|
|
|
338
338
|
if not trivial:
|
|
339
339
|
# apply the concretization results to the state
|
|
340
340
|
constraint_options = [addr == concrete_addr for concrete_addr in concrete_addrs]
|
|
341
|
-
conditional_constraint =
|
|
341
|
+
conditional_constraint = claripy.Or(*constraint_options)
|
|
342
342
|
self._add_constraints(conditional_constraint, condition=condition, **kwargs)
|
|
343
343
|
|
|
344
344
|
if len(concrete_addrs) == 1:
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
+
import claripy
|
|
4
|
+
|
|
3
5
|
from . import MemoryMixin
|
|
4
6
|
from ... import sim_options as options
|
|
5
7
|
from ...misc.ux import once
|
|
@@ -15,7 +17,7 @@ class DefaultFillerMixin(MemoryMixin):
|
|
|
15
17
|
if self.state.project and self.state.project.concrete_target:
|
|
16
18
|
mem = self.state.project.concrete_target.read_memory(addr, size)
|
|
17
19
|
endness = kwargs["endness"]
|
|
18
|
-
bvv =
|
|
20
|
+
bvv = claripy.BVV(mem)
|
|
19
21
|
return bvv if endness == "Iend_BE" else bvv.reversed
|
|
20
22
|
|
|
21
23
|
if fill_missing is False:
|
|
@@ -25,13 +27,13 @@ class DefaultFillerMixin(MemoryMixin):
|
|
|
25
27
|
|
|
26
28
|
if type(addr) is int:
|
|
27
29
|
if self.category == "mem" and options.ZERO_FILL_UNCONSTRAINED_MEMORY in self.state.options:
|
|
28
|
-
return
|
|
30
|
+
return claripy.BVV(0, bits)
|
|
29
31
|
elif self.category == "reg" and options.ZERO_FILL_UNCONSTRAINED_REGISTERS in self.state.options:
|
|
30
|
-
return
|
|
32
|
+
return claripy.BVV(0, bits)
|
|
31
33
|
|
|
32
34
|
if self.category == "reg" and type(addr) is int and addr == self.state.arch.ip_offset:
|
|
33
35
|
# short-circuit this pathological case
|
|
34
|
-
return
|
|
36
|
+
return claripy.BVV(0, self.state.arch.bits)
|
|
35
37
|
|
|
36
38
|
is_mem = (
|
|
37
39
|
self.category == "mem"
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import os
|
|
2
1
|
import binascii
|
|
3
2
|
import logging
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
import claripy
|
|
4
6
|
|
|
5
7
|
from .... import concretization_strategies
|
|
6
8
|
from ....errors import SimUnsatError, SimMemoryAddressError
|
|
@@ -188,7 +190,7 @@ class JavaVmMemoryMixin(MemoryMixin):
|
|
|
188
190
|
)
|
|
189
191
|
|
|
190
192
|
# constraint start_idx, s.t. it evals to one of the concretized indexes
|
|
191
|
-
constraint_on_start_idx =
|
|
193
|
+
constraint_on_start_idx = claripy.Or(*start_idx_options)
|
|
192
194
|
self.state.add_constraints(constraint_on_start_idx)
|
|
193
195
|
|
|
194
196
|
def _store_array_element_on_heap(self, array, idx, value, value_type, store_condition=None):
|
|
@@ -197,7 +199,7 @@ class JavaVmMemoryMixin(MemoryMixin):
|
|
|
197
199
|
if store_condition is not None:
|
|
198
200
|
current_value = self._load_array_element_from_heap(array, idx)
|
|
199
201
|
new_value = value
|
|
200
|
-
value =
|
|
202
|
+
value = claripy.If(store_condition, new_value, current_value)
|
|
201
203
|
self.heap.store(heap_elem_id, value, value_type)
|
|
202
204
|
|
|
203
205
|
#
|
|
@@ -256,11 +258,11 @@ class JavaVmMemoryMixin(MemoryMixin):
|
|
|
256
258
|
# => if concrete_start_idx == start_idx
|
|
257
259
|
# then use new value
|
|
258
260
|
# else use the current value
|
|
259
|
-
load_values[i] =
|
|
261
|
+
load_values[i] = claripy.If(concrete_start_idx == start_idx, value, load_values[i])
|
|
260
262
|
start_idx_options.append(start_idx == concrete_start_idx)
|
|
261
263
|
|
|
262
264
|
# constraint start_idx, s.t. it evals to one of the concretized indexes
|
|
263
|
-
constraint_on_start_idx =
|
|
265
|
+
constraint_on_start_idx = claripy.Or(*start_idx_options)
|
|
264
266
|
self.state.add_constraints(constraint_on_start_idx)
|
|
265
267
|
|
|
266
268
|
return load_values
|
|
@@ -323,7 +323,7 @@ class PagedMemoryMixin(MemoryMixin):
|
|
|
323
323
|
raise SimMemoryError("%#x is not mapped" % addr) from e
|
|
324
324
|
|
|
325
325
|
if type(permissions) is int:
|
|
326
|
-
permissions =
|
|
326
|
+
permissions = claripy.BVV(permissions, 3)
|
|
327
327
|
|
|
328
328
|
result = page.permissions
|
|
329
329
|
if permissions is not None:
|
|
@@ -35,7 +35,7 @@ class AbstractMergerMixin(MemoryMixin):
|
|
|
35
35
|
# if should_reverse:
|
|
36
36
|
# merged_val = merged_val.reversed
|
|
37
37
|
|
|
38
|
-
if not values[0][0].uninitialized and
|
|
38
|
+
if not values[0][0].uninitialized and claripy.backends.vsa.identical(merged_val, values[0][0]):
|
|
39
39
|
return None
|
|
40
40
|
|
|
41
41
|
return merged_val
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from sortedcontainers import SortedDict
|
|
2
2
|
|
|
3
|
+
import claripy
|
|
4
|
+
|
|
3
5
|
from ....errors import SimRegionMapError
|
|
4
6
|
from ....state_plugins import SimStatePlugin
|
|
5
7
|
|
|
@@ -50,7 +52,7 @@ class AddressWrapper:
|
|
|
50
52
|
:param state: A state
|
|
51
53
|
:return: The converted ValueSet instance
|
|
52
54
|
"""
|
|
53
|
-
return
|
|
55
|
+
return claripy.VS(state.arch.bits, self.region, self.region_base_addr, self.address)
|
|
54
56
|
|
|
55
57
|
|
|
56
58
|
class RegionDescriptor:
|
|
@@ -74,7 +74,7 @@ class MemoryRegionMetaMixin(MemoryMixin):
|
|
|
74
74
|
aloc_id = bbl_addr
|
|
75
75
|
|
|
76
76
|
if aloc_id not in self.alocs:
|
|
77
|
-
self.alocs[aloc_id] =
|
|
77
|
+
self.alocs[aloc_id] = AbstractLocation(
|
|
78
78
|
bbl_addr, stmt_id, self.id, region_offset=addr, size=len(data) // self.state.arch.byte_width
|
|
79
79
|
)
|
|
80
80
|
return super().store(addr, data, endness=endness, **kwargs)
|
|
@@ -58,7 +58,7 @@ class RegionedMemoryMixin(MemoryMixin):
|
|
|
58
58
|
|
|
59
59
|
if regioned_memory_cls is None:
|
|
60
60
|
# delayed import
|
|
61
|
-
from .. import RegionedMemory
|
|
61
|
+
from .. import RegionedMemory # pylint:disable=import-outside-toplevel
|
|
62
62
|
|
|
63
63
|
regioned_memory_cls = RegionedMemory
|
|
64
64
|
|
|
@@ -176,7 +176,7 @@ class RegionedMemoryMixin(MemoryMixin):
|
|
|
176
176
|
r, s, i = self._regions[region].find(si, data, max_search, **kwargs)
|
|
177
177
|
# Post-process r so that it's still a ValueSet
|
|
178
178
|
region_base_addr = self._region_base(region)
|
|
179
|
-
r =
|
|
179
|
+
r = claripy.ValueSet(r.size(), region, region_base_addr, claripy.backends.vsa.convert(r))
|
|
180
180
|
return r, s, i
|
|
181
181
|
|
|
182
182
|
def set_state(self, state):
|
|
@@ -424,8 +424,9 @@ class RegionedMemoryMixin(MemoryMixin):
|
|
|
424
424
|
|
|
425
425
|
return AddressWrapper(new_region_id, self._region_base(new_region_id), new_relative_address, False, None)
|
|
426
426
|
|
|
427
|
-
|
|
428
|
-
|
|
427
|
+
@staticmethod
|
|
428
|
+
def _apply_condition_to_symbolic_addr(addr, condition):
|
|
429
|
+
_, converted = claripy.constraint_to_si(condition)
|
|
429
430
|
for original_expr, constrained_expr in converted:
|
|
430
431
|
addr = addr.replace(original_expr, constrained_expr)
|
|
431
432
|
return addr
|
|
@@ -36,9 +36,9 @@ class SimpleInterfaceMixin(MemoryMixin):
|
|
|
36
36
|
|
|
37
37
|
def _translate_data(self, d, size):
|
|
38
38
|
if type(d) in (bytes, bytearray):
|
|
39
|
-
return
|
|
39
|
+
return claripy.BVV(d)
|
|
40
40
|
elif type(d) is int:
|
|
41
|
-
return
|
|
41
|
+
return claripy.BVV(d, size * self.state.arch.byte_width)
|
|
42
42
|
elif isinstance(d, claripy.ast.Base):
|
|
43
43
|
return d
|
|
44
44
|
else:
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
+
import claripy
|
|
4
|
+
|
|
3
5
|
from . import MemoryMixin
|
|
4
6
|
from ...errors import SimMemoryLimitError, SimMemoryError, SimUnsatError
|
|
5
7
|
|
|
@@ -133,7 +135,7 @@ class SizeConcretizationMixin(MemoryMixin):
|
|
|
133
135
|
conc_sizes = [min(cs, self._max_symbolic_size) for cs in conc_sizes]
|
|
134
136
|
|
|
135
137
|
if condition is None:
|
|
136
|
-
condition =
|
|
138
|
+
condition = claripy.true
|
|
137
139
|
for conc_size in conc_sizes:
|
|
138
140
|
if conc_size == 0:
|
|
139
141
|
continue
|
|
@@ -98,7 +98,7 @@ class SmartFindMixin(MemoryMixin):
|
|
|
98
98
|
able to handle wide characters
|
|
99
99
|
"""
|
|
100
100
|
if condition is None:
|
|
101
|
-
condition =
|
|
101
|
+
condition = claripy.true
|
|
102
102
|
chunk = None
|
|
103
103
|
chunk_progress = chunk_size
|
|
104
104
|
|
|
@@ -155,5 +155,5 @@ class SmartFindMixin(MemoryMixin):
|
|
|
155
155
|
default = claripy.BVV(0, self.state.arch.bits)
|
|
156
156
|
if cases and cases[-1][0].is_true():
|
|
157
157
|
default = cases.pop(-1)[1]
|
|
158
|
-
result =
|
|
158
|
+
result = claripy.ite_cases(cases, default)
|
|
159
159
|
return result, constraints, match_indices
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
from typing import Any
|
|
2
1
|
from collections.abc import Iterable
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import claripy
|
|
3
5
|
|
|
4
6
|
from . import MemoryMixin
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
class SymbolicMergerMixin(MemoryMixin):
|
|
8
10
|
def _merge_values(self, values: Iterable[tuple[Any, Any]], merged_size: int, **kwargs):
|
|
9
|
-
merged_val =
|
|
11
|
+
merged_val = claripy.BVV(0, merged_size * self.state.arch.byte_width)
|
|
10
12
|
for tm, fv in values:
|
|
11
|
-
merged_val =
|
|
13
|
+
merged_val = claripy.If(fv, tm, merged_val)
|
|
12
14
|
return merged_val
|
angr/tablespecs.py
CHANGED
|
@@ -62,7 +62,7 @@ class StringTableSpec:
|
|
|
62
62
|
|
|
63
63
|
def dump(self, state, end_addr, align=0x10):
|
|
64
64
|
if isinstance(end_addr, int):
|
|
65
|
-
end_addr =
|
|
65
|
+
end_addr = claripy.BVV(end_addr, state.arch.bits)
|
|
66
66
|
ptr_size = len(self._contents) * state.arch.bytes
|
|
67
67
|
size = self._str_len + ptr_size
|
|
68
68
|
start_addr = end_addr - size
|
|
@@ -80,11 +80,11 @@ class StringTableSpec:
|
|
|
80
80
|
str_i += len(item) // self._byte_width
|
|
81
81
|
else:
|
|
82
82
|
if isinstance(item, int):
|
|
83
|
-
item =
|
|
83
|
+
item = claripy.BVV(item, state.arch.bits)
|
|
84
84
|
state.memory.store(ptr_i, item, endness=state.arch.memory_endness)
|
|
85
85
|
ptr_i += state.arch.bytes
|
|
86
86
|
|
|
87
87
|
if zero_fill != 0:
|
|
88
|
-
state.memory.store(end_addr - zero_fill,
|
|
88
|
+
state.memory.store(end_addr - zero_fill, claripy.BVV(0, self._byte_width * zero_fill))
|
|
89
89
|
|
|
90
90
|
return start_addr
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: angr
|
|
3
|
-
Version: 9.2.
|
|
3
|
+
Version: 9.2.117
|
|
4
4
|
Summary: A multi-architecture binary analysis toolkit, with the ability to perform dynamic symbolic execution and various static analyses on binaries
|
|
5
5
|
Home-page: https://github.com/angr/angr
|
|
6
6
|
License: BSD-2-Clause
|
|
@@ -15,13 +15,13 @@ Description-Content-Type: text/markdown
|
|
|
15
15
|
License-File: LICENSE
|
|
16
16
|
Requires-Dist: CppHeaderParser
|
|
17
17
|
Requires-Dist: GitPython
|
|
18
|
-
Requires-Dist: ailment==9.2.
|
|
19
|
-
Requires-Dist: archinfo==9.2.
|
|
18
|
+
Requires-Dist: ailment==9.2.117
|
|
19
|
+
Requires-Dist: archinfo==9.2.117
|
|
20
20
|
Requires-Dist: cachetools
|
|
21
21
|
Requires-Dist: capstone==5.0.2
|
|
22
22
|
Requires-Dist: cffi>=1.14.0
|
|
23
|
-
Requires-Dist: claripy==9.2.
|
|
24
|
-
Requires-Dist: cle==9.2.
|
|
23
|
+
Requires-Dist: claripy==9.2.117
|
|
24
|
+
Requires-Dist: cle==9.2.117
|
|
25
25
|
Requires-Dist: dpkt
|
|
26
26
|
Requires-Dist: itanium-demangler
|
|
27
27
|
Requires-Dist: mulpyplexer
|
|
@@ -31,7 +31,7 @@ Requires-Dist: protobuf>=3.19.0
|
|
|
31
31
|
Requires-Dist: psutil
|
|
32
32
|
Requires-Dist: pycparser>=2.18
|
|
33
33
|
Requires-Dist: pyformlang
|
|
34
|
-
Requires-Dist: pyvex==9.2.
|
|
34
|
+
Requires-Dist: pyvex==9.2.117
|
|
35
35
|
Requires-Dist: rich>=13.1.0
|
|
36
36
|
Requires-Dist: rpyc
|
|
37
37
|
Requires-Dist: sortedcontainers
|