angr 9.2.57__py3-none-macosx_10_9_x86_64.whl → 9.2.59__py3-none-macosx_10_9_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 CHANGED
@@ -1,7 +1,7 @@
1
1
  # pylint: disable=wildcard-import
2
2
  # pylint: disable=wrong-import-position
3
3
 
4
- __version__ = "9.2.57"
4
+ __version__ = "9.2.59"
5
5
 
6
6
  if bytes is str:
7
7
  raise Exception(
@@ -674,7 +674,9 @@ class CFGBase(Analysis):
674
674
  all_bytes = self._fast_memory_load_bytes(start, size)
675
675
 
676
676
  if all_bytes is None:
677
- return True
677
+ # failed to load bytes in this region. it might be because the region is not fully mapped (i.e., there are
678
+ # holes). we assume this region is good for analysis.
679
+ return False
678
680
 
679
681
  if len(all_bytes) < size:
680
682
  l.warning(
@@ -4,7 +4,7 @@ import ailment
4
4
  from ailment.expression import Op
5
5
 
6
6
  from ..structuring.structurer_nodes import ConditionNode
7
- from ..structured_codegen.c import is_simple_return_node
7
+ from ..utils import structured_node_is_simple_return
8
8
  from .optimization_pass import SequenceOptimizationPass, OptimizationPassStage
9
9
 
10
10
 
@@ -33,6 +33,6 @@ class FlipBooleanCmp(SequenceOptimizationPass):
33
33
  def _analyze(self, cache=None):
34
34
  condition_nodes: List[ConditionNode] = cache or []
35
35
  for node in condition_nodes:
36
- if isinstance(node.condition, Op) and is_simple_return_node(node.false_node, self._graph):
36
+ if isinstance(node.condition, Op) and structured_node_is_simple_return(node.false_node, self._graph):
37
37
  node.condition = ailment.expression.negate(node.condition)
38
38
  node.true_node, node.false_node = node.false_node, node.true_node
@@ -30,6 +30,7 @@ from ....sim_variable import SimVariable, SimTemporaryVariable, SimStackVariable
30
30
  from ....utils.constants import is_alignment_mask
31
31
  from ....utils.library import get_cpp_function_name
32
32
  from ....utils.loader import is_in_readonly_segment, is_in_readonly_section
33
+ from ..utils import structured_node_is_simple_return
33
34
  from ....errors import UnsupportedNodeTypeError
34
35
  from ....knowledge_plugins.cfg.memory_data import MemoryData, MemoryDataSort
35
36
  from ... import Analysis, register_analysis
@@ -173,35 +174,6 @@ def guess_value_type(value: int, project: "angr.Project") -> Optional[SimType]:
173
174
  return None
174
175
 
175
176
 
176
- def is_simple_return_node(node: Union[Block, SequenceNode], graph) -> bool:
177
- """
178
- Will check if a "simple return" is contained within the node a simple returns looks like this:
179
- if (cond) {
180
- // simple return
181
- ...
182
- return 0;
183
- }
184
- ...
185
-
186
- Any block can end in a return as long as it does not have condition inside.
187
- """
188
- # sanity check: we need a graph to understand returning blocks
189
- if graph is None:
190
- return False
191
-
192
- last_block = None
193
- if isinstance(node, SequenceNode) and node.nodes:
194
- for n in node.nodes:
195
- if not isinstance(n, Block):
196
- break
197
- else:
198
- last_block = n
199
- elif isinstance(node, Block):
200
- last_block = node
201
-
202
- return last_block and last_block in graph and not list(graph.successors(last_block))
203
-
204
-
205
177
  #
206
178
  # C Representation Classes
207
179
  #
@@ -2814,7 +2786,7 @@ class CStructuredCodeGenerator(BaseStructuredCodeGenerator, Analysis):
2814
2786
  condition_and_nodes,
2815
2787
  else_node=else_node,
2816
2788
  simplify_else_scope=self.simplify_else_scope
2817
- and is_simple_return_node(condition_node.true_node, self.ail_graph),
2789
+ and structured_node_is_simple_return(condition_node.true_node, self.ail_graph),
2818
2790
  tags=tags,
2819
2791
  codegen=self,
2820
2792
  )
@@ -1,5 +1,5 @@
1
1
  # pylint:disable=wrong-import-position
2
- from typing import Optional, Tuple, Any, Union
2
+ from typing import Optional, Tuple, Any, Union, List
3
3
 
4
4
  import networkx
5
5
 
@@ -358,6 +358,48 @@ def remove_labels(graph: networkx.DiGraph):
358
358
  return new_graph
359
359
 
360
360
 
361
+ def structured_node_is_simple_return(node: Union["SequenceNode", "MultiNode"], graph: networkx.DiGraph) -> bool:
362
+ """
363
+ Will check if a "simple return" is contained within the node a simple returns looks like this:
364
+ if (cond) {
365
+ // simple return
366
+ ...
367
+ return 0;
368
+ }
369
+ ...
370
+
371
+ Returns tue on any block ending in linear statements and a return.
372
+ """
373
+
374
+ def _flatten_structured_node(packed_node: Union["SequenceNode", "MultiNode"]) -> List[ailment.Block]:
375
+ if not packed_node or not packed_node.nodes:
376
+ return []
377
+
378
+ blocks = []
379
+ if packed_node.nodes is not None:
380
+ for _node in packed_node.nodes:
381
+ if isinstance(_node, (SequenceNode, MultiNode)):
382
+ blocks += _flatten_structured_node(_node)
383
+ else:
384
+ blocks.append(_node)
385
+
386
+ return blocks
387
+
388
+ # sanity check: we need a graph to understand returning blocks
389
+ if graph is None:
390
+ return False
391
+
392
+ last_block = None
393
+ if isinstance(node, (SequenceNode, MultiNode)) and node.nodes:
394
+ flat_blocks = _flatten_structured_node(node)
395
+ if all(isinstance(block, ailment.Block) for block in flat_blocks):
396
+ last_block = flat_blocks[-1]
397
+ elif isinstance(node, ailment.Block):
398
+ last_block = node
399
+
400
+ return last_block and last_block in graph and not list(graph.successors(last_block))
401
+
402
+
361
403
  # delayed import
362
404
  from .structuring.structurer_nodes import (
363
405
  MultiNode,
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: angr
3
- Version: 9.2.57
3
+ Version: 9.2.59
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.57)
20
- Requires-Dist: archinfo (==9.2.57)
19
+ Requires-Dist: ailment (==9.2.59)
20
+ Requires-Dist: archinfo (==9.2.59)
21
21
  Requires-Dist: cachetools
22
22
  Requires-Dist: capstone (!=5.0.0rc2,>=3.0.5rc2)
23
23
  Requires-Dist: cffi (>=1.14.0)
24
- Requires-Dist: claripy (==9.2.57)
25
- Requires-Dist: cle (==9.2.57)
24
+ Requires-Dist: claripy (==9.2.59)
25
+ Requires-Dist: cle (==9.2.59)
26
26
  Requires-Dist: dpkt
27
27
  Requires-Dist: itanium-demangler
28
28
  Requires-Dist: mulpyplexer
@@ -31,7 +31,7 @@ Requires-Dist: networkx (!=2.8.1,>=2.0)
31
31
  Requires-Dist: protobuf (>=3.19.0)
32
32
  Requires-Dist: psutil
33
33
  Requires-Dist: pycparser (>=2.18)
34
- Requires-Dist: pyvex (==9.2.57)
34
+ Requires-Dist: pyvex (==9.2.59)
35
35
  Requires-Dist: rich (>=13.1.0)
36
36
  Requires-Dist: rpyc
37
37
  Requires-Dist: sortedcontainers
@@ -1,4 +1,4 @@
1
- angr/__init__.py,sha256=59T1Js5whwPsIPsByrs5e6wUc25Y6ZZbG3TOZ7MbVl8,2800
1
+ angr/__init__.py,sha256=9lA9M7oDfxcCqZvnXRDL4u7oSSvAqRHmhYoy_QM0taw,2800
2
2
  angr/annocfg.py,sha256=dK5JAdN4Ig_jgxTBZeZXwk3kAS4-IQUvE6T02GBZTDQ,10818
3
3
  angr/blade.py,sha256=1f5cqw1w6mKtYszN2-5QMxaoP_bbqpIaVlE7Vpf8yjc,15161
4
4
  angr/block.py,sha256=2XEvImDfD9NeQAKPGnulds4GKepThwwtnvV-22S3Gf0,14215
@@ -62,7 +62,7 @@ angr/analyses/cfg/__init__.py,sha256=DRCry4KO2k5VJLyfxD_O6dWAdi21IUoaN5TqCnukJJs
62
62
  angr/analyses/cfg/cfb.py,sha256=TqYdFau9ZH_m6cwkxbA35vDs2ES5rOFqfIuZi0lCBsQ,15450
63
63
  angr/analyses/cfg/cfg.py,sha256=1JpPGlqXXRFwE0tk26xjabT_-dq-kqAxMv7o6-DUhp4,3146
64
64
  angr/analyses/cfg/cfg_arch_options.py,sha256=YONHg6y-h6BCsBkJK9tuxb94DDfeOoy9CUS-LVyyDyg,3112
65
- angr/analyses/cfg/cfg_base.py,sha256=ouFA6Nq2bqsd09gX_gi5FKi-5y9mi0EixyDlRC44wdo,120467
65
+ angr/analyses/cfg/cfg_base.py,sha256=jMe-bgFU7JaDRHsF4VTFO_PPnPV2B3PWKS6WwUtXkf4,120653
66
66
  angr/analyses/cfg/cfg_emulated.py,sha256=Fi3rDN5ByxhO-H4Y7qn-3WZgBG12JGyvxcWmrD_FnFQ,152842
67
67
  angr/analyses/cfg/cfg_fast.py,sha256=kToRVVWphkBO5IRLBAYNbUuJToUiEQ-pON8C80O5Hos,201393
68
68
  angr/analyses/cfg/cfg_fast_soot.py,sha256=eA_P-OY3gRRNj2BBgSPMsB_llGyFFCNW3VyGZ2uiMoM,26047
@@ -107,7 +107,7 @@ angr/analyses/decompiler/redundant_label_remover.py,sha256=kDGGFWWV61I5fbASiTQTH
107
107
  angr/analyses/decompiler/region_identifier.py,sha256=doxPwx7B4DCMtIDCf_wosGNMR9zj_SOME3lQ6AvXDF8,44212
108
108
  angr/analyses/decompiler/region_walker.py,sha256=lTfweYbY4_a2f2yGztTKG6JtU1jXf-kaz-NHbX9nkXE,717
109
109
  angr/analyses/decompiler/sequence_walker.py,sha256=Ak8jog1BRJIQZdOv7QRzcv-SgXR0Wfh0QicqgXuWUIM,7410
110
- angr/analyses/decompiler/utils.py,sha256=mOR2BphGYNoewtpL3eTpUaoXDaNRyYYrNT4jjg4qIB8,13427
110
+ angr/analyses/decompiler/utils.py,sha256=8x-_FFK6TGv5Lj4_0u_y0J8U1i3cLBv74akOY69yzm4,14844
111
111
  angr/analyses/decompiler/ccall_rewriters/__init__.py,sha256=wbWqZ8xG6ZvzEApkAwMsNQFC-iwF3swG1YJsaf1cIrQ,102
112
112
  angr/analyses/decompiler/ccall_rewriters/amd64_ccalls.py,sha256=tgNvZ6I5wPWcrc7EDnGPzgkn2Q9p4n4AAAnZaEM_Igk,10571
113
113
  angr/analyses/decompiler/ccall_rewriters/rewriter_base.py,sha256=gWezEKB7A_YnlfUDs8V8D5syoYAyIXSIme1BKQRoouM,498
@@ -118,7 +118,7 @@ angr/analyses/decompiler/optimization_passes/div_simplifier.py,sha256=1yTI1mmFHB
118
118
  angr/analyses/decompiler/optimization_passes/eager_returns.py,sha256=ASLthbC5zHvwTXA2T4Fljyl487rSyO4gHpa34izDaw0,10116
119
119
  angr/analyses/decompiler/optimization_passes/engine_base.py,sha256=Q920CTvgxX4ueuRJVNvN30SYC-oH5_TreKVgQ2yJcq4,10392
120
120
  angr/analyses/decompiler/optimization_passes/expr_op_swapper.py,sha256=vlPhWDyvuEmbGcd1ka8rS68F72Ty6Hw3J00KM3tWCus,4701
121
- angr/analyses/decompiler/optimization_passes/flip_boolean_cmp.py,sha256=TTZxHUA4OnaBzHdtWwzYjULMz0iq8nskYQYP3dyUnfw,1578
121
+ angr/analyses/decompiler/optimization_passes/flip_boolean_cmp.py,sha256=QozZWA5kOorUQVp0ohVrc00Myx95UGOstLNehhAn4EA,1585
122
122
  angr/analyses/decompiler/optimization_passes/ite_expr_converter.py,sha256=VBzHsSIImh0Q_7TUN4cV7n-4itrqn1Edn13WkgjAkGc,7610
123
123
  angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py,sha256=mnGBJ8r10cHHB0g9TV-xQYd4xO_PBj66Rzz7VAfroZA,19038
124
124
  angr/analyses/decompiler/optimization_passes/mod_simplifier.py,sha256=A9pPly7otXJlLkSbItU0wvjGGu6rUsNpcFw3bzy4DjY,3046
@@ -181,7 +181,7 @@ angr/analyses/decompiler/region_simplifiers/switch_cluster_simplifier.py,sha256=
181
181
  angr/analyses/decompiler/region_simplifiers/switch_expr_simplifier.py,sha256=HGIiC6c3C91VfcqxUHe9aTsRohwmMXOHZH_G_dbwwx4,3327
182
182
  angr/analyses/decompiler/structured_codegen/__init__.py,sha256=Glc4jBCr7lZckltN9XZdSvMrGHf0swXFyKTr_QQKdWE,290
183
183
  angr/analyses/decompiler/structured_codegen/base.py,sha256=nJPOoeJCbewchYdXjSE4S2b1-WN6pT3TxmCQMDO0azw,3845
184
- angr/analyses/decompiler/structured_codegen/c.py,sha256=mOK6lQsVp4KB6i_6ibrjmk_21i-3AwSsVHWdShv8BTY,121356
184
+ angr/analyses/decompiler/structured_codegen/c.py,sha256=LPjLr6sujZ5nEZDwm833PQ-fM6yQQ39ZOIK4WjwoedM,120597
185
185
  angr/analyses/decompiler/structured_codegen/dummy.py,sha256=IVfmtcWpTgNCRVsuW3GdQgDnuPmvodX85V0bBYtF_BI,535
186
186
  angr/analyses/decompiler/structured_codegen/dwarf_import.py,sha256=TMz65TkF_ID_Ipocj0aFDb84H6slolN90wq0tzhY2Rk,6773
187
187
  angr/analyses/decompiler/structuring/__init__.py,sha256=eSiT6xUpv9K5-enK3OZj2lNzxwowS9_5OTrjHiPgfFs,371
@@ -458,7 +458,7 @@ angr/knowledge_plugins/xrefs/__init__.py,sha256=-5A2h048WTRu6Et7q7bqlc-AyBXNuJ9A
458
458
  angr/knowledge_plugins/xrefs/xref.py,sha256=w4wjDFl4xtJYOtJplp9s1AIX3wI1RE71po3ufh1M4aY,4963
459
459
  angr/knowledge_plugins/xrefs/xref_manager.py,sha256=GYF9N1t4JxkDNGAwrVLo4_NF51P4gqiuQ21F0IbloF0,4026
460
460
  angr/knowledge_plugins/xrefs/xref_types.py,sha256=VR3xLQQ-gUg25oX0OL3BJHyQRlZh2A8syBac9ZMS9n4,271
461
- angr/lib/angr_native.dylib,sha256=DLk2Edtzmibpbh1Z-PP7HdEG1O1rJYgAStb3q-hFypA,18589728
461
+ angr/lib/angr_native.dylib,sha256=klqBdCHYR3AvNGTmAL3MU2m2BIOATsM8Qn8Ubto6Gh0,18589728
462
462
  angr/misc/__init__.py,sha256=Ct-Q6-c-Frdz5Ihkqmou3j_1jyJi8WJXlQxs-gPQg0Y,237
463
463
  angr/misc/ansi.py,sha256=TKrx7d_MViChHh5RBR2VLufNrujTUioJWsZS5ugk8k4,807
464
464
  angr/misc/autoimport.py,sha256=6WT-Z6wf5NiacQhKZmR4d2bPOvNrokA7Wg0g2MUXSuw,2371
@@ -1181,8 +1181,8 @@ angr/utils/library.py,sha256=MYbY6rvC2Fi1ofbBHynh6-cdmaDETxj8hBz1gxKvsQQ,7178
1181
1181
  angr/utils/loader.py,sha256=QdkatPiyRfz5KdfCzRI1Xp3TJL_Pa75wY0dsILgMbwk,1944
1182
1182
  angr/utils/mp.py,sha256=xSWDnZdkLaTwGXntuSDwb2tIqMsIxJpmLrxd_YWBILw,1822
1183
1183
  angr/utils/timing.py,sha256=ddkLlRzlfmDlvRn9LseX9iQNQcNnQxzaJqnDSq7i1iU,1035
1184
- angr-9.2.57.dist-info/LICENSE,sha256=cgL_ho5B1NH8UxwtBuqThRWdjear8b7hktycaS1sz6g,1327
1185
- angr-9.2.57.dist-info/METADATA,sha256=S08yKGvhVowaZ6_QueIg8f5ETONI_FySCgg58G-zKZE,4378
1186
- angr-9.2.57.dist-info/WHEEL,sha256=cVdTqkH_C8vzq7Po70Hu1iJ439UCykNgBlhmX6fytPc,107
1187
- angr-9.2.57.dist-info/top_level.txt,sha256=dKw0KWTbwLXytFvv15oAAG4sUs3ey47tt6DorJG9-hw,5
1188
- angr-9.2.57.dist-info/RECORD,,
1184
+ angr-9.2.59.dist-info/LICENSE,sha256=cgL_ho5B1NH8UxwtBuqThRWdjear8b7hktycaS1sz6g,1327
1185
+ angr-9.2.59.dist-info/METADATA,sha256=aX1bV-XmjTR8CKw2SLZ9W_6co0tV9sBxJD194S3l9EU,4378
1186
+ angr-9.2.59.dist-info/WHEEL,sha256=cVdTqkH_C8vzq7Po70Hu1iJ439UCykNgBlhmX6fytPc,107
1187
+ angr-9.2.59.dist-info/top_level.txt,sha256=dKw0KWTbwLXytFvv15oAAG4sUs3ey47tt6DorJG9-hw,5
1188
+ angr-9.2.59.dist-info/RECORD,,
File without changes
File without changes