angr 9.2.135__py3-none-win_amd64.whl → 9.2.136__py3-none-win_amd64.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.

Files changed (166) hide show
  1. angr/__init__.py +1 -1
  2. angr/analyses/__init__.py +3 -7
  3. angr/analyses/analysis.py +4 -0
  4. angr/analyses/backward_slice.py +1 -2
  5. angr/analyses/binary_optimizer.py +3 -4
  6. angr/analyses/bindiff.py +4 -6
  7. angr/analyses/boyscout.py +1 -3
  8. angr/analyses/callee_cleanup_finder.py +4 -4
  9. angr/analyses/calling_convention/calling_convention.py +4 -3
  10. angr/analyses/calling_convention/fact_collector.py +0 -1
  11. angr/analyses/cdg.py +1 -2
  12. angr/analyses/cfg/cfb.py +1 -3
  13. angr/analyses/cfg/cfg.py +2 -2
  14. angr/analyses/cfg/cfg_base.py +37 -35
  15. angr/analyses/cfg/cfg_emulated.py +1 -1
  16. angr/analyses/cfg/cfg_fast.py +62 -15
  17. angr/analyses/cfg/cfg_fast_soot.py +1 -1
  18. angr/analyses/cfg/indirect_jump_resolvers/__init__.py +2 -0
  19. angr/analyses/cfg/indirect_jump_resolvers/const_resolver.py +46 -10
  20. angr/analyses/cfg/indirect_jump_resolvers/default_resolvers.py +5 -1
  21. angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +50 -14
  22. angr/analyses/cfg/indirect_jump_resolvers/memload_resolver.py +81 -0
  23. angr/analyses/cfg/indirect_jump_resolvers/propagator_utils.py +24 -5
  24. angr/analyses/cfg/indirect_jump_resolvers/x86_pe_iat.py +2 -5
  25. angr/analyses/congruency_check.py +2 -3
  26. angr/analyses/data_dep/data_dependency_analysis.py +2 -2
  27. angr/analyses/ddg.py +1 -4
  28. angr/analyses/decompiler/ail_simplifier.py +3 -4
  29. angr/analyses/decompiler/clinic.py +42 -7
  30. angr/analyses/decompiler/optimization_passes/duplication_reverter/ail_merge_graph.py +2 -2
  31. angr/analyses/decompiler/optimization_passes/duplication_reverter/duplication_reverter.py +2 -2
  32. angr/analyses/decompiler/optimization_passes/ite_region_converter.py +1 -1
  33. angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +1 -1
  34. angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +1 -1
  35. angr/analyses/decompiler/structuring/phoenix.py +1 -1
  36. angr/analyses/disassembly.py +5 -5
  37. angr/analyses/fcp/__init__.py +4 -0
  38. angr/analyses/fcp/fcp.py +429 -0
  39. angr/analyses/identifier/identify.py +1 -3
  40. angr/analyses/loopfinder.py +4 -3
  41. angr/analyses/patchfinder.py +1 -1
  42. angr/analyses/propagator/engine_base.py +4 -3
  43. angr/analyses/propagator/propagator.py +14 -53
  44. angr/analyses/reassembler.py +1 -2
  45. angr/analyses/s_propagator.py +1 -3
  46. angr/analyses/soot_class_hierarchy.py +1 -2
  47. angr/analyses/stack_pointer_tracker.py +18 -2
  48. angr/analyses/static_hooker.py +1 -2
  49. angr/analyses/typehoon/simple_solver.py +2 -2
  50. angr/analyses/variable_recovery/variable_recovery_fast.py +1 -2
  51. angr/analyses/veritesting.py +4 -7
  52. angr/analyses/vfg.py +1 -1
  53. angr/analyses/vsa_ddg.py +1 -2
  54. angr/block.py +3 -2
  55. angr/callable.py +1 -3
  56. angr/calling_conventions.py +3 -3
  57. angr/codenode.py +5 -1
  58. angr/concretization_strategies/__init__.py +1 -83
  59. angr/concretization_strategies/any.py +2 -1
  60. angr/concretization_strategies/any_named.py +1 -1
  61. angr/concretization_strategies/base.py +81 -0
  62. angr/concretization_strategies/controlled_data.py +2 -1
  63. angr/concretization_strategies/eval.py +2 -1
  64. angr/concretization_strategies/logging.py +3 -1
  65. angr/concretization_strategies/max.py +2 -1
  66. angr/concretization_strategies/nonzero.py +2 -1
  67. angr/concretization_strategies/nonzero_range.py +2 -1
  68. angr/concretization_strategies/norepeats.py +2 -1
  69. angr/concretization_strategies/norepeats_range.py +2 -1
  70. angr/concretization_strategies/range.py +2 -1
  71. angr/concretization_strategies/signed_add.py +2 -1
  72. angr/concretization_strategies/single.py +2 -1
  73. angr/concretization_strategies/solutions.py +2 -1
  74. angr/concretization_strategies/unlimited_range.py +2 -1
  75. angr/engines/__init__.py +8 -5
  76. angr/engines/engine.py +3 -5
  77. angr/engines/failure.py +4 -5
  78. angr/engines/procedure.py +5 -7
  79. angr/engines/soot/expressions/__init__.py +22 -23
  80. angr/engines/soot/expressions/base.py +4 -4
  81. angr/engines/soot/expressions/invoke.py +1 -2
  82. angr/engines/soot/statements/__init__.py +9 -10
  83. angr/engines/soot/values/__init__.py +9 -10
  84. angr/engines/soot/values/arrayref.py +3 -3
  85. angr/engines/soot/values/instancefieldref.py +3 -2
  86. angr/engines/successors.py +7 -6
  87. angr/engines/syscall.py +4 -6
  88. angr/engines/unicorn.py +3 -2
  89. angr/engines/vex/claripy/ccall.py +8 -10
  90. angr/engines/vex/claripy/datalayer.py +4 -5
  91. angr/exploration_techniques/__init__.py +0 -2
  92. angr/exploration_techniques/spiller.py +1 -3
  93. angr/exploration_techniques/stochastic.py +2 -3
  94. angr/factory.py +3 -9
  95. angr/knowledge_plugins/cfg/cfg_model.py +20 -17
  96. angr/knowledge_plugins/functions/function.py +70 -73
  97. angr/knowledge_plugins/functions/function_manager.py +8 -7
  98. angr/knowledge_plugins/functions/function_parser.py +1 -1
  99. angr/knowledge_plugins/functions/soot_function.py +16 -16
  100. angr/knowledge_plugins/propagations/propagation_model.py +4 -5
  101. angr/knowledge_plugins/propagations/states.py +0 -511
  102. angr/lib/angr_native.dll +0 -0
  103. angr/procedures/libc/memcpy.py +4 -4
  104. angr/procedures/procedure_dict.py +3 -2
  105. angr/protos/__init__.py +2 -5
  106. angr/protos/cfg_pb2.py +21 -18
  107. angr/protos/function_pb2.py +17 -14
  108. angr/protos/primitives_pb2.py +44 -39
  109. angr/protos/variables_pb2.py +36 -31
  110. angr/protos/xrefs_pb2.py +15 -12
  111. angr/sim_procedure.py +15 -16
  112. angr/sim_variable.py +13 -1
  113. angr/simos/__init__.py +2 -0
  114. angr/simos/javavm.py +4 -6
  115. angr/simos/xbox.py +32 -0
  116. angr/state_plugins/__init__.py +0 -2
  117. angr/state_plugins/callstack.py +4 -4
  118. angr/state_plugins/cgc.py +3 -2
  119. angr/state_plugins/gdb.py +6 -5
  120. angr/state_plugins/globals.py +1 -2
  121. angr/state_plugins/heap/heap_brk.py +1 -2
  122. angr/state_plugins/history.py +10 -12
  123. angr/state_plugins/inspect.py +3 -5
  124. angr/state_plugins/libc.py +2 -2
  125. angr/state_plugins/log.py +8 -10
  126. angr/state_plugins/loop_data.py +1 -2
  127. angr/state_plugins/posix.py +7 -7
  128. angr/state_plugins/preconstrainer.py +2 -3
  129. angr/state_plugins/scratch.py +5 -8
  130. angr/state_plugins/sim_action.py +3 -3
  131. angr/state_plugins/solver.py +8 -3
  132. angr/state_plugins/symbolizer.py +5 -4
  133. angr/state_plugins/uc_manager.py +3 -3
  134. angr/state_plugins/unicorn_engine.py +5 -1
  135. angr/state_plugins/view.py +3 -5
  136. angr/storage/file.py +3 -5
  137. angr/storage/memory_mixins/address_concretization_mixin.py +2 -2
  138. angr/storage/memory_mixins/bvv_conversion_mixin.py +3 -3
  139. angr/storage/memory_mixins/clouseau_mixin.py +1 -3
  140. angr/storage/memory_mixins/name_resolution_mixin.py +1 -3
  141. angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +13 -15
  142. angr/storage/memory_mixins/paged_memory/pages/__init__.py +1 -22
  143. angr/storage/memory_mixins/paged_memory/pages/base.py +31 -0
  144. angr/storage/memory_mixins/paged_memory/pages/list_page.py +1 -1
  145. angr/storage/memory_mixins/paged_memory/pages/mv_list_page.py +1 -1
  146. angr/storage/memory_mixins/paged_memory/pages/ultra_page.py +2 -4
  147. angr/storage/memory_mixins/paged_memory/privileged_mixin.py +3 -4
  148. angr/storage/memory_mixins/regioned_memory/abstract_merger_mixin.py +4 -2
  149. angr/storage/memory_mixins/smart_find_mixin.py +1 -1
  150. angr/storage/memory_mixins/underconstrained_mixin.py +1 -1
  151. angr/storage/memory_mixins/unwrapper_mixin.py +1 -3
  152. angr/utils/enums_conv.py +28 -12
  153. angr/utils/segment_list.py +25 -22
  154. angr/utils/timing.py +18 -1
  155. angr/vaults.py +5 -6
  156. {angr-9.2.135.dist-info → angr-9.2.136.dist-info}/METADATA +6 -6
  157. {angr-9.2.135.dist-info → angr-9.2.136.dist-info}/RECORD +161 -160
  158. {angr-9.2.135.dist-info → angr-9.2.136.dist-info}/WHEEL +1 -1
  159. angr/analyses/propagator/outdated_definition_walker.py +0 -159
  160. angr/analyses/propagator/tmpvar_finder.py +0 -18
  161. angr/engines/concrete.py +0 -180
  162. angr/exploration_techniques/symbion.py +0 -80
  163. angr/state_plugins/concrete.py +0 -295
  164. {angr-9.2.135.dist-info → angr-9.2.136.dist-info}/LICENSE +0 -0
  165. {angr-9.2.135.dist-info → angr-9.2.136.dist-info}/entry_points.txt +0 -0
  166. {angr-9.2.135.dist-info → angr-9.2.136.dist-info}/top_level.txt +0 -0
@@ -134,7 +134,7 @@ class SmartFindMixin(MemoryMixin):
134
134
  def _find_are_bytes_symbolic(self, b):
135
135
  if not b.symbolic:
136
136
  return False
137
- if b.uninitialized:
137
+ if b.has_annotation_type(claripy.annotation.UninitializedAnnotation):
138
138
  return True
139
139
  return len(self.state.solver.eval_upto(b, 2)) > 1
140
140
 
@@ -52,7 +52,7 @@ class UnderconstrainedMixin(MemoryMixin):
52
52
  if (
53
53
  o.UNDER_CONSTRAINED_SYMEXEC in self.state.options
54
54
  and isinstance(addr, claripy.ast.Base)
55
- and addr.uninitialized
55
+ and addr.has_annotation_type(claripy.annotation.UninitializedAnnotation)
56
56
  and self.state.uc_manager.get_alloc_depth(addr) is not None
57
57
  ) and (
58
58
  not self.state.uc_manager.is_bounded(addr)
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from angr.state_plugins.sim_action_object import _raw_ast
3
4
  from angr.storage.memory_mixins.memory_mixin import MemoryMixin
4
5
 
5
6
 
@@ -23,6 +24,3 @@ class UnwrapperMixin(MemoryMixin):
23
24
 
24
25
  def copy_contents(self, dst, src, size, condition=None, **kwargs):
25
26
  return super().copy_contents(_raw_ast(dst), _raw_ast(src), _raw_ast(size), _raw_ast(condition), **kwargs)
26
-
27
-
28
- from angr.state_plugins.sim_action_object import _raw_ast
angr/utils/enums_conv.py CHANGED
@@ -2,29 +2,45 @@
2
2
  from __future__ import annotations
3
3
  import logging
4
4
 
5
- l = logging.getLogger(name=__name__)
6
-
7
5
  from angr.protos.primitives_pb2 import Edge
8
6
 
7
+ l = logging.getLogger(name=__name__)
9
8
 
10
9
  _CFG_JUMPKINDS = {
11
10
  None: Edge.UnknownJumpkind,
11
+ "Ijk_8jzf8": Edge._8jzf8,
12
12
  "Ijk_Boring": Edge.Boring,
13
13
  "Ijk_Call": Edge.Call,
14
- "Ijk_Ret": Edge.Return,
14
+ "Ijk_ClientReq": Edge.ClientReq,
15
+ "Ijk_EmFail": Edge.EmFail,
16
+ "Ijk_EmWarn": Edge.EmWarn,
17
+ "Ijk_Exception": Edge.Exception,
15
18
  "Ijk_FakeRet": Edge.FakeReturn,
16
- "Ijk_Syscall": Edge.Syscall,
17
- "Ijk_Sys_syscall": Edge.Sys_syscall,
18
- "Ijk_Sys_int128": Edge.Sys_int128,
19
+ "Ijk_FlushDCache": Edge.FlushDCache,
20
+ "Ijk_InvalICache": Edge.InvalICache,
21
+ "Ijk_MapFail": Edge.MapFail,
19
22
  "Ijk_NoDecode": Edge.NoDecode,
20
- "Ijk_EmWarn": Edge.EmWarn,
23
+ "Ijk_NoRedir": Edge.NoRedir,
24
+ "Ijk_Privileged": Edge.Privileged,
25
+ "Ijk_Ret": Edge.Return,
26
+ "Ijk_SigBUS": Edge.SigBUS,
27
+ "Ijk_SigFPE": Edge.SigFPE,
21
28
  "Ijk_SigFPE_IntDiv": Edge.SigFPE_IntDiv,
22
- "Ijk_SigTRAP": Edge.SigTRAP,
29
+ "Ijk_SigFPE_IntOvf": Edge.SigFPE_IntOvf,
30
+ "Ijk_SigILL": Edge.SigILL,
23
31
  "Ijk_SigSEGV": Edge.SigSEGV,
24
- "Ijk_MapFail": Edge.MapFail,
25
- "Ijk_NoRedir": Edge.NoRedir,
26
- "Ijk_ClientReq": Edge.ClientReq,
27
- "Ijk_Exception": Edge.Exception,
32
+ "Ijk_SigTRAP": Edge.SigTRAP,
33
+ "Ijk_Syscall": Edge.Syscall,
34
+ "Ijk_Sys_int": Edge.Sys_int,
35
+ "Ijk_Sys_int128": Edge.Sys_int128,
36
+ "Ijk_Sys_int129": Edge.Sys_int129,
37
+ "Ijk_Sys_int130": Edge.Sys_int130,
38
+ "Ijk_Sys_int145": Edge.Sys_int145,
39
+ "Ijk_Sys_int210": Edge.Sys_int210,
40
+ "Ijk_Sys_int32": Edge.Sys_int32,
41
+ "Ijk_Sys_syscall": Edge.Sys_syscall,
42
+ "Ijk_Sys_sysenter": Edge.Sys_sysenter,
43
+ "Ijk_Yield": Edge.Yield,
28
44
  }
29
45
 
30
46
 
@@ -1,5 +1,6 @@
1
1
  # pylint:disable=no-else-break
2
2
  from __future__ import annotations
3
+ from bisect import bisect_left
3
4
  import logging
4
5
 
5
6
  from angr.errors import AngrCFGError, AngrRuntimeError
@@ -221,7 +222,19 @@ class SegmentList:
221
222
  new_size = sum(seg.size for seg in new_segments)
222
223
  bytes_changed = new_size - old_size
223
224
 
224
- self._list = self._list[:previous_segment_pos] + new_segments + self._list[segment_pos + 1 :]
225
+ if len(new_segments) == 2:
226
+ self._list[previous_segment_pos] = new_segments[0]
227
+ self._list[segment_pos] = new_segments[1]
228
+ elif len(new_segments) == 1:
229
+ self._list.pop(segment_pos)
230
+ self._list[previous_segment_pos] = new_segments[0]
231
+ elif len(new_segments) == 3:
232
+ self._list[previous_segment_pos] = new_segments[0]
233
+ self._list[segment_pos] = new_segments[1]
234
+ self._list.insert(segment_pos + 1, new_segments[2])
235
+ else:
236
+ # this does not happen for now, but may happen when the above logic changes
237
+ self._list = self._list[:previous_segment_pos] + new_segments + self._list[segment_pos + 1 :]
225
238
 
226
239
  merged = True
227
240
 
@@ -245,6 +258,9 @@ class SegmentList:
245
258
  # |---address + size---|
246
259
  # shrink segment
247
260
  segment.end = address
261
+ if segment.size == 0:
262
+ # remove the segment
263
+ self._list.pop(idx)
248
264
  # adjust address
249
265
  new_address = segment.start + segment.size
250
266
  # adjust size
@@ -259,7 +275,7 @@ class SegmentList:
259
275
  seg0 = Segment(segment.start, address, segment.sort)
260
276
  seg1 = Segment(address + size, segment.start + segment.size, segment.sort)
261
277
  # remove the current segment
262
- self._list.remove(segment)
278
+ self._list.pop(idx)
263
279
  if seg1.size > 0:
264
280
  self._list.insert(idx, seg1)
265
281
  if seg0.size > 0:
@@ -282,12 +298,12 @@ class SegmentList:
282
298
  segment.start = address + size
283
299
  if segment.size == 0:
284
300
  # remove the segment
285
- self._list.remove(segment)
301
+ self._list.pop(idx)
286
302
  break
287
303
  if address + size > segment.start + segment.size:
288
304
  # |---- segment ----|
289
305
  # |--------- address + size ----------|
290
- self._list.remove(segment)
306
+ self._list.pop(idx) # remove the segment
291
307
  new_address = segment.end
292
308
  size = address + size - new_address
293
309
  address = new_address
@@ -339,23 +355,10 @@ class SegmentList:
339
355
  :return: The offset of the segment.
340
356
  """
341
357
 
342
- start = 0
343
- end = len(self._list)
344
-
345
- while start != end:
346
- mid = (start + end) // 2
347
-
348
- segment = self._list[mid]
349
- if addr < segment.start:
350
- end = mid
351
- elif addr >= segment.end:
352
- start = mid + 1
353
- else:
354
- # Overlapped :(
355
- start = mid
356
- break
357
-
358
- return start
358
+ off = bisect_left(self._list, addr, key=lambda x: x.start)
359
+ if 0 < off <= len(self._list) and self._list[off - 1].end > addr:
360
+ off -= 1
361
+ return off
359
362
 
360
363
  def next_free_pos(self, address):
361
364
  """
@@ -487,7 +490,7 @@ class SegmentList:
487
490
  # Cannot occupy a non-existent block
488
491
  return
489
492
 
490
- # l.debug("Occpuying 0x%08x-0x%08x", address, address + size)
493
+ # l.debug("Occupying 0x%08x-0x%08x", address, address + size)
491
494
  if not self._list:
492
495
  self._list.append(Segment(address, address + size, sort))
493
496
  self._bytes_occupied += size
angr/utils/timing.py CHANGED
@@ -7,13 +7,30 @@ from collections import defaultdict
7
7
 
8
8
  TIMING = os.environ.get("TIMING", "").lower() not in {"", "no", "0", "false"}
9
9
  PRINT = os.environ.get("PRINT", "").lower() not in {"", "no", "0", "false"}
10
- TIME_DISTRIBUTION = False
10
+ TIME_DISTRIBUTION = os.environ.get("TIMING_DIST", "").lower() not in {"", "no", "0", "false"}
11
11
 
12
12
  total_time = defaultdict(float)
13
13
  time_distribution = defaultdict(list)
14
14
  depth = 0
15
15
 
16
16
 
17
+ def print_timing_total():
18
+ sorted_keys = sorted(time_distribution.keys(), key=lambda x: sum(time_distribution[x]), reverse=True)
19
+ for func in sorted_keys:
20
+ millisec = sum(time_distribution[func])
21
+ sec = millisec / 1000
22
+ if sec > 1.0:
23
+ print(f"[timing] {func.__name__}: {sec} seconds.")
24
+ else:
25
+ print(f"[timing] {func.__name__}: {millisec} milliseconds.")
26
+
27
+ # list top-ten slowest calls
28
+ sorted_calls = sorted(time_distribution[func], reverse=True)
29
+ print("[timing] Slowest top 10:")
30
+ for idx, call in enumerate(sorted_calls[:10]):
31
+ print(f"[timing] {idx + 1}: {call} ms")
32
+
33
+
17
34
  def _t():
18
35
  return time.perf_counter_ns() / 1000000
19
36
 
angr/vaults.py CHANGED
@@ -13,6 +13,11 @@ import io
13
13
 
14
14
  import claripy
15
15
 
16
+ from .errors import AngrVaultError
17
+ from .project import Project
18
+ from .sim_state import SimState
19
+ from .sim_type import SimType
20
+
16
21
  l = logging.getLogger("angr.vault")
17
22
 
18
23
 
@@ -360,9 +365,3 @@ class VaultDirShelf(VaultDict):
360
365
  else:
361
366
  s.add(n[: n.rfind(".")]) # remove the suffix
362
367
  return s
363
-
364
-
365
- from .errors import AngrVaultError
366
- from .project import Project
367
- from .sim_type import SimType
368
- from .sim_state import SimState
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: angr
3
- Version: 9.2.135
3
+ Version: 9.2.136
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
@@ -16,13 +16,13 @@ Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
17
  Requires-Dist: CppHeaderParser
18
18
  Requires-Dist: GitPython
19
- Requires-Dist: ailment==9.2.135
20
- Requires-Dist: archinfo==9.2.135
19
+ Requires-Dist: ailment==9.2.136
20
+ Requires-Dist: archinfo==9.2.136
21
21
  Requires-Dist: cachetools
22
22
  Requires-Dist: capstone==5.0.3
23
23
  Requires-Dist: cffi>=1.14.0
24
- Requires-Dist: claripy==9.2.135
25
- Requires-Dist: cle==9.2.135
24
+ Requires-Dist: claripy==9.2.136
25
+ Requires-Dist: cle==9.2.136
26
26
  Requires-Dist: itanium-demangler
27
27
  Requires-Dist: mulpyplexer
28
28
  Requires-Dist: nampa
@@ -31,7 +31,7 @@ Requires-Dist: protobuf>=5.28.2
31
31
  Requires-Dist: psutil
32
32
  Requires-Dist: pycparser>=2.18
33
33
  Requires-Dist: pyformlang
34
- Requires-Dist: pyvex==9.2.135
34
+ Requires-Dist: pyvex==9.2.136
35
35
  Requires-Dist: rich>=13.1.0
36
36
  Requires-Dist: sortedcontainers
37
37
  Requires-Dist: sympy