angr 9.2.87__py3-none-win_amd64.whl → 9.2.89__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 (249) hide show
  1. angr/__init__.py +4 -1
  2. angr/analyses/decompiler/clinic.py +16 -0
  3. angr/analyses/decompiler/decompiler.py +3 -0
  4. angr/analyses/decompiler/optimization_passes/__init__.py +5 -0
  5. angr/analyses/decompiler/optimization_passes/cross_jump_reverter.py +108 -0
  6. angr/analyses/decompiler/optimization_passes/optimization_pass.py +17 -4
  7. angr/analyses/decompiler/optimization_passes/return_duplicator.py +4 -32
  8. angr/analyses/decompiler/structured_codegen/c.py +12 -2
  9. angr/analyses/decompiler/utils.py +13 -0
  10. angr/analyses/typehoon/dfa.py +108 -0
  11. angr/analyses/typehoon/lifter.py +34 -2
  12. angr/analyses/typehoon/simple_solver.py +1043 -503
  13. angr/analyses/typehoon/translator.py +13 -4
  14. angr/analyses/typehoon/typeconsts.py +117 -36
  15. angr/analyses/typehoon/typehoon.py +31 -11
  16. angr/analyses/typehoon/typevars.py +88 -21
  17. angr/analyses/typehoon/variance.py +10 -0
  18. angr/analyses/variable_recovery/engine_ail.py +28 -9
  19. angr/analyses/variable_recovery/engine_base.py +50 -43
  20. angr/analyses/variable_recovery/variable_recovery_base.py +16 -3
  21. angr/analyses/variable_recovery/variable_recovery_fast.py +14 -5
  22. angr/exploration_techniques/tracer.py +2 -0
  23. angr/lib/angr_native.dll +0 -0
  24. angr/misc/autoimport.py +26 -0
  25. angr/procedures/definitions/__init__.py +32 -3
  26. angr/utils/constants.py +1 -0
  27. angr/utils/graph.py +20 -1
  28. {angr-9.2.87.dist-info → angr-9.2.89.dist-info}/METADATA +7 -6
  29. {angr-9.2.87.dist-info → angr-9.2.89.dist-info}/RECORD +33 -245
  30. angr-9.2.89.dist-info/top_level.txt +1 -0
  31. angr/procedures/definitions/ntdll.py +0 -12
  32. angr-9.2.87.dist-info/top_level.txt +0 -2
  33. tests/__init__.py +0 -0
  34. tests/analyses/__init__.py +0 -0
  35. tests/analyses/cfg/__init__.py +0 -0
  36. tests/analyses/cfg/test_cfg_clflush.py +0 -43
  37. tests/analyses/cfg/test_cfg_get_any_node.py +0 -34
  38. tests/analyses/cfg/test_cfg_manager.py +0 -32
  39. tests/analyses/cfg/test_cfg_model.py +0 -55
  40. tests/analyses/cfg/test_cfg_patching.py +0 -378
  41. tests/analyses/cfg/test_cfg_rust_got_resolution.py +0 -36
  42. tests/analyses/cfg/test_cfg_thumb_firmware.py +0 -50
  43. tests/analyses/cfg/test_cfg_vex_postprocessor.py +0 -27
  44. tests/analyses/cfg/test_cfgemulated.py +0 -634
  45. tests/analyses/cfg/test_cfgfast.py +0 -1123
  46. tests/analyses/cfg/test_cfgfast_soot.py +0 -38
  47. tests/analyses/cfg/test_const_resolver.py +0 -38
  48. tests/analyses/cfg/test_iat_resolver.py +0 -37
  49. tests/analyses/cfg/test_jumptables.py +0 -3008
  50. tests/analyses/cfg/test_noop_blocks.py +0 -54
  51. tests/analyses/cfg_slice_to_sink/__init__.py +0 -0
  52. tests/analyses/cfg_slice_to_sink/test_cfg_slice_to_sink.py +0 -93
  53. tests/analyses/cfg_slice_to_sink/test_graph.py +0 -114
  54. tests/analyses/cfg_slice_to_sink/test_transitions.py +0 -28
  55. tests/analyses/decompiler/__init__.py +0 -0
  56. tests/analyses/decompiler/test_baseptr_save_simplifier.py +0 -80
  57. tests/analyses/decompiler/test_decompiler.py +0 -3336
  58. tests/analyses/decompiler/test_peephole_optimizations.py +0 -48
  59. tests/analyses/decompiler/test_propagator_loops.py +0 -101
  60. tests/analyses/decompiler/test_structurer.py +0 -275
  61. tests/analyses/reaching_definitions/__init__.py +0 -0
  62. tests/analyses/reaching_definitions/test_dep_graph.py +0 -432
  63. tests/analyses/reaching_definitions/test_function_handler.py +0 -131
  64. tests/analyses/reaching_definitions/test_heap_allocator.py +0 -46
  65. tests/analyses/reaching_definitions/test_rd_state.py +0 -78
  66. tests/analyses/reaching_definitions/test_reachingdefinitions.py +0 -463
  67. tests/analyses/reaching_definitions/test_subject.py +0 -76
  68. tests/analyses/test_bindiff.py +0 -52
  69. tests/analyses/test_block_simplifier.py +0 -112
  70. tests/analyses/test_boyscout.py +0 -104
  71. tests/analyses/test_calling_convention_analysis.py +0 -352
  72. tests/analyses/test_callsite_maker.py +0 -60
  73. tests/analyses/test_cdg.py +0 -165
  74. tests/analyses/test_cfb.py +0 -37
  75. tests/analyses/test_class_identifier.py +0 -46
  76. tests/analyses/test_clinic.py +0 -30
  77. tests/analyses/test_codetagging.py +0 -32
  78. tests/analyses/test_constantpropagation.py +0 -88
  79. tests/analyses/test_ddg.py +0 -95
  80. tests/analyses/test_ddg_global_var_dependencies.py +0 -83
  81. tests/analyses/test_ddg_memvar_addresses.py +0 -40
  82. tests/analyses/test_disassembly.py +0 -121
  83. tests/analyses/test_find_objects_static.py +0 -35
  84. tests/analyses/test_flirt.py +0 -49
  85. tests/analyses/test_identifier.py +0 -33
  86. tests/analyses/test_init_finder.py +0 -38
  87. tests/analyses/test_proximitygraph.py +0 -31
  88. tests/analyses/test_reassembler.py +0 -295
  89. tests/analyses/test_regionidentifier.py +0 -27
  90. tests/analyses/test_slicing.py +0 -164
  91. tests/analyses/test_stack_pointer_tracker.py +0 -74
  92. tests/analyses/test_static_hooker.py +0 -28
  93. tests/analyses/test_typehoon.py +0 -55
  94. tests/analyses/test_variablerecovery.py +0 -464
  95. tests/analyses/test_vfg.py +0 -221
  96. tests/analyses/test_vtable.py +0 -31
  97. tests/analyses/test_xrefs.py +0 -77
  98. tests/common.py +0 -128
  99. tests/engines/__init__.py +0 -0
  100. tests/engines/light/__init__.py +0 -0
  101. tests/engines/light/test_data.py +0 -17
  102. tests/engines/pcode/__init__.py +0 -0
  103. tests/engines/pcode/test_emulate.py +0 -607
  104. tests/engines/pcode/test_pcode.py +0 -84
  105. tests/engines/test_actions.py +0 -27
  106. tests/engines/test_hook.py +0 -112
  107. tests/engines/test_java.py +0 -697
  108. tests/engines/test_unicorn.py +0 -518
  109. tests/engines/vex/__init__.py +0 -0
  110. tests/engines/vex/test_lifter.py +0 -124
  111. tests/engines/vex/test_vex.py +0 -574
  112. tests/exploration_techniques/__init__.py +0 -0
  113. tests/exploration_techniques/test_cacher.py +0 -45
  114. tests/exploration_techniques/test_director.py +0 -67
  115. tests/exploration_techniques/test_driller_core.py +0 -48
  116. tests/exploration_techniques/test_loop_seer.py +0 -158
  117. tests/exploration_techniques/test_memory_watcher.py +0 -46
  118. tests/exploration_techniques/test_oppologist.py +0 -65
  119. tests/exploration_techniques/test_spiller.py +0 -82
  120. tests/exploration_techniques/test_stochastic.py +0 -40
  121. tests/exploration_techniques/test_tech_builder.py +0 -61
  122. tests/exploration_techniques/test_tracer.py +0 -856
  123. tests/exploration_techniques/test_unique.py +0 -40
  124. tests/exploration_techniques/test_veritesting.py +0 -120
  125. tests/factory/__init__.py +0 -0
  126. tests/factory/block/__init__.py +0 -0
  127. tests/factory/block/test_block_cache.py +0 -33
  128. tests/factory/block/test_keystone.py +0 -106
  129. tests/factory/test_argc.py +0 -101
  130. tests/factory/test_argc_sym.py +0 -110
  131. tests/factory/test_argv.py +0 -158
  132. tests/factory/test_callable.py +0 -266
  133. tests/factory/test_windows_args.py +0 -36
  134. tests/knowledge_plugins/__init__.py +0 -0
  135. tests/knowledge_plugins/cfg/__init__.py +0 -0
  136. tests/knowledge_plugins/cfg/test_cfg_manager.py +0 -36
  137. tests/knowledge_plugins/functions/__init__.py +0 -0
  138. tests/knowledge_plugins/functions/test_function.py +0 -91
  139. tests/knowledge_plugins/functions/test_function2.py +0 -79
  140. tests/knowledge_plugins/functions/test_function_manager.py +0 -139
  141. tests/knowledge_plugins/functions/test_prototypes.py +0 -53
  142. tests/knowledge_plugins/key_definitions/__init__.py +0 -0
  143. tests/knowledge_plugins/key_definitions/test_atoms.py +0 -24
  144. tests/knowledge_plugins/key_definitions/test_environment.py +0 -126
  145. tests/knowledge_plugins/key_definitions/test_heap_address.py +0 -27
  146. tests/knowledge_plugins/key_definitions/test_live_definitions.py +0 -72
  147. tests/knowledge_plugins/test_dwarf_variables.py +0 -240
  148. tests/knowledge_plugins/test_kb_plugins.py +0 -91
  149. tests/knowledge_plugins/test_kb_plugins_dwarf.py +0 -36
  150. tests/knowledge_plugins/test_patches.py +0 -48
  151. tests/misc/__init__.py +0 -0
  152. tests/misc/test_hookset.py +0 -57
  153. tests/perf/__init__.py +0 -0
  154. tests/perf/perf_cfgemulated.py +0 -19
  155. tests/perf/perf_cfgfast.py +0 -18
  156. tests/perf/perf_concrete_execution.py +0 -41
  157. tests/perf/perf_siminspect_nop.py +0 -36
  158. tests/perf/perf_state_copy.py +0 -33
  159. tests/perf/perf_unicorn_0.py +0 -27
  160. tests/perf/perf_unicorn_1.py +0 -23
  161. tests/procedures/__init__.py +0 -0
  162. tests/procedures/glibc/__init__.py +0 -0
  163. tests/procedures/glibc/test_ctype_locale.py +0 -164
  164. tests/procedures/libc/__init__.py +0 -0
  165. tests/procedures/libc/test_fgets.py +0 -53
  166. tests/procedures/libc/test_scanf.py +0 -205
  167. tests/procedures/libc/test_sprintf.py +0 -44
  168. tests/procedures/libc/test_sscanf.py +0 -63
  169. tests/procedures/libc/test_strcasecmp.py +0 -37
  170. tests/procedures/libc/test_string.py +0 -1102
  171. tests/procedures/libc/test_strtol.py +0 -78
  172. tests/procedures/linux_kernel/__init__.py +0 -0
  173. tests/procedures/linux_kernel/test_lseek.py +0 -174
  174. tests/procedures/posix/__init__.py +0 -0
  175. tests/procedures/posix/test_chroot.py +0 -33
  176. tests/procedures/posix/test_getenv.py +0 -78
  177. tests/procedures/posix/test_pwrite_pread.py +0 -57
  178. tests/procedures/posix/test_sim_time.py +0 -46
  179. tests/procedures/posix/test_unlink.py +0 -46
  180. tests/procedures/test_project_resolve_simproc.py +0 -43
  181. tests/procedures/test_sim_procedure.py +0 -117
  182. tests/procedures/test_stub_procedure_args.py +0 -53
  183. tests/serialization/__init__.py +0 -0
  184. tests/serialization/test_db.py +0 -197
  185. tests/serialization/test_pickle.py +0 -95
  186. tests/serialization/test_serialization.py +0 -132
  187. tests/serialization/test_vault.py +0 -169
  188. tests/sim/__init__.py +0 -3
  189. tests/sim/exec_func/__init__.py +0 -0
  190. tests/sim/exec_func/test_mem_funcs.py +0 -55
  191. tests/sim/exec_func/test_str_funcs.py +0 -93
  192. tests/sim/exec_func/test_syscall_result.py +0 -39
  193. tests/sim/exec_insn/__init__.py +0 -0
  194. tests/sim/exec_insn/test_adc.py +0 -44
  195. tests/sim/exec_insn/test_ops.py +0 -83
  196. tests/sim/exec_insn/test_rcr.py +0 -26
  197. tests/sim/exec_insn/test_rol.py +0 -51
  198. tests/sim/exec_insn/test_signed_div.py +0 -34
  199. tests/sim/exec_insn/test_sqrt.py +0 -56
  200. tests/sim/options/__init__.py +0 -0
  201. tests/sim/options/test_0div.py +0 -54
  202. tests/sim/options/test_symbolic_fd.py +0 -59
  203. tests/sim/options/test_unsupported.py +0 -34
  204. tests/sim/test_accuracy.py +0 -137
  205. tests/sim/test_checkbyte.py +0 -53
  206. tests/sim/test_echo.py +0 -36
  207. tests/sim/test_fauxware.py +0 -202
  208. tests/sim/test_self_modifying_code.py +0 -65
  209. tests/sim/test_simple_api.py +0 -36
  210. tests/sim/test_simulation_manager.py +0 -147
  211. tests/sim/test_stack_alignment.py +0 -65
  212. tests/sim/test_state.py +0 -303
  213. tests/sim/test_state_customization.py +0 -54
  214. tests/sim/test_symbol_hooked_by.py +0 -49
  215. tests/simos/__init__.py +0 -0
  216. tests/simos/windows/__init__.py +0 -0
  217. tests/simos/windows/test_windows_stack_cookie.py +0 -58
  218. tests/state_plugins/__init__.py +0 -0
  219. tests/state_plugins/inspect/__init__.py +0 -0
  220. tests/state_plugins/inspect/test_inspect.py +0 -310
  221. tests/state_plugins/inspect/test_syscall_override.py +0 -90
  222. tests/state_plugins/posix/__init__.py +0 -0
  223. tests/state_plugins/posix/test_file_struct_funcs.py +0 -56
  224. tests/state_plugins/posix/test_files.py +0 -69
  225. tests/state_plugins/posix/test_posix.py +0 -72
  226. tests/state_plugins/solver/__init__.py +0 -0
  227. tests/state_plugins/solver/test_simsolver.py +0 -58
  228. tests/state_plugins/solver/test_symbolic.py +0 -153
  229. tests/state_plugins/solver/test_variable_registration.py +0 -46
  230. tests/state_plugins/test_callstack.py +0 -54
  231. tests/state_plugins/test_gdb_plugin.py +0 -35
  232. tests/state_plugins/test_multi_open_file.py +0 -47
  233. tests/state_plugins/test_symbolization.py +0 -38
  234. tests/storage/__init__.py +0 -0
  235. tests/storage/test_memory.py +0 -960
  236. tests/storage/test_memory_merge.py +0 -114
  237. tests/storage/test_memview.py +0 -205
  238. tests/storage/test_mmap.py +0 -26
  239. tests/storage/test_multivalues.py +0 -44
  240. tests/storage/test_permissions.py +0 -32
  241. tests/storage/test_ptmalloc.py +0 -291
  242. tests/storage/test_relro_perm.py +0 -49
  243. tests/test_calling_conventions.py +0 -86
  244. tests/test_types.py +0 -329
  245. tests/utils/__init__.py +0 -0
  246. tests/utils/test_graph.py +0 -41
  247. {angr-9.2.87.dist-info → angr-9.2.89.dist-info}/LICENSE +0 -0
  248. {angr-9.2.87.dist-info → angr-9.2.89.dist-info}/WHEEL +0 -0
  249. {angr-9.2.87.dist-info → angr-9.2.89.dist-info}/entry_points.txt +0 -0
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env python3
2
- # pylint: disable=missing-class-docstring,no-self-use,line-too-long
3
- __package__ = __package__ or "tests.analyses" # pylint:disable=redefined-builtin
4
-
5
- import os
6
- import unittest
7
-
8
- import angr
9
-
10
- from ..common import bin_location
11
-
12
-
13
- test_location = os.path.join(bin_location, "tests")
14
-
15
-
16
- class TestVtable(unittest.TestCase):
17
- def test_vtable_extraction_x86_64(self):
18
- p = angr.Project(os.path.join(test_location, "x86_64", "cpp_classes"), auto_load_libs=False)
19
- vtables_sizes = {0x403CB0: 24, 0x403CD8: 16, 0x403CF8: 16, 0x403D18: 16}
20
- vtable_analysis = p.analyses.VtableFinder()
21
- vtables = vtable_analysis.vtables_list
22
-
23
- assert len(vtables) == 4
24
-
25
- for vtable in vtables:
26
- assert vtable.vaddr in [0x403CB0, 0x403CD8, 0x403CF8, 0x403D18]
27
- assert vtables_sizes[vtable.vaddr] == vtable.size
28
-
29
-
30
- if __name__ == "__main__":
31
- unittest.main()
@@ -1,77 +0,0 @@
1
- #!/usr/bin/env python3
2
- # pylint: disable=missing-class-docstring,no-self-use,line-too-long
3
- __package__ = __package__ or "tests.analyses" # pylint:disable=redefined-builtin
4
-
5
- import os
6
- import unittest
7
-
8
- import angr
9
- from angr.knowledge_plugins.xrefs import XRef, XRefType
10
-
11
- from ..common import bin_location
12
-
13
-
14
- test_location = os.path.join(bin_location, "tests")
15
-
16
-
17
- class TestXrefs(unittest.TestCase):
18
- def test_lwip_udpecho_bm(self):
19
- bin_path = os.path.join(test_location, "armel", "lwip_udpecho_bm.elf")
20
- p = angr.Project(bin_path, auto_load_libs=False)
21
- cfg = p.analyses.CFG(data_references=True)
22
-
23
- func = cfg.functions[0x23C9]
24
- state = p.factory.blank_state()
25
- prop = p.analyses.Propagator(func=func, base_state=state)
26
- _ = p.analyses.XRefs(func=func, replacements=prop.replacements)
27
-
28
- timenow_cp_xrefs = p.kb.xrefs.get_xrefs_by_dst(0x23D4) # the constant in the constant pool
29
- timenow_xrefs = p.kb.xrefs.get_xrefs_by_dst(0x1FFF36F4) # the value in .bss
30
-
31
- assert len(timenow_cp_xrefs) == 1
32
- assert next(iter(timenow_cp_xrefs)) == XRef(ins_addr=0x23C9, dst=0x23D4, xref_type=XRefType.Read)
33
-
34
- assert len(timenow_xrefs) == 3
35
- assert [x for x in timenow_xrefs if x.type == XRefType.Offset][0] == XRef(
36
- ins_addr=0x23C9, dst=0x1FFF36F4, xref_type=XRefType.Offset
37
- )
38
- assert [x for x in timenow_xrefs if x.type == XRefType.Read][0] == XRef(
39
- ins_addr=0x23CB, dst=0x1FFF36F4, xref_type=XRefType.Read
40
- )
41
- assert [x for x in timenow_xrefs if x.type == XRefType.Write][0] == XRef(
42
- ins_addr=0x23CF, dst=0x1FFF36F4, xref_type=XRefType.Write
43
- )
44
-
45
- def test_lwip_udpecho_bm_the_better_way(self):
46
- bin_path = os.path.join(test_location, "armel", "lwip_udpecho_bm.elf")
47
- p = angr.Project(bin_path, auto_load_libs=False)
48
- p.analyses.CFG(cross_references=True)
49
-
50
- timenow_cp_xrefs = p.kb.xrefs.get_xrefs_by_dst(0x23D4) # the constant in the constant pool
51
- timenow_xrefs = p.kb.xrefs.get_xrefs_by_dst(0x1FFF36F4) # the value in .bss
52
-
53
- assert len(timenow_cp_xrefs) == 1
54
- assert next(iter(timenow_cp_xrefs)) == XRef(ins_addr=0x23C9, dst=0x23D4, xref_type=XRefType.Read)
55
- # sys_now (2), time_isr (3) == 5
56
- assert len(timenow_xrefs) == 5
57
-
58
- def test_p2im_drone_with_inits(self):
59
- bin_path = os.path.join(test_location, "armel", "p2im_drone.elf")
60
- proj = angr.Project(bin_path, auto_load_libs=False)
61
- cfg = proj.analyses.CFG(data_references=True)
62
-
63
- func = cfg.functions["Peripherals_Init"]
64
- state = proj.factory.blank_state()
65
- prop = proj.analyses.Propagator(func=func, base_state=state)
66
-
67
- init_finder = proj.analyses.InitializationFinder(func=func, replacements=prop.replacements)
68
- overlay_state = init_finder.overlay_state
69
-
70
- cfg.do_full_xrefs(overlay_state=overlay_state)
71
-
72
- h12c1_inst_xrefs = proj.kb.xrefs.get_xrefs_by_dst(0x20001500)
73
- assert len(h12c1_inst_xrefs) == 5
74
-
75
-
76
- if __name__ == "__main__":
77
- unittest.main()
tests/common.py DELETED
@@ -1,128 +0,0 @@
1
- import os
2
- import pickle
3
- import sys
4
- import logging
5
- import subprocess
6
- from functools import lru_cache
7
- from typing import Optional, Sequence
8
- from tempfile import NamedTemporaryFile
9
-
10
- from unittest import skipIf, skipUnless, skip, SkipTest
11
-
12
- l = logging.getLogger("angr.tests.common")
13
-
14
- try:
15
- import tracer
16
- except ImportError:
17
- tracer = None
18
-
19
- bin_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "binaries")
20
- bin_priv_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "binaries-private")
21
-
22
- if not os.path.isdir(bin_location):
23
- raise Exception(
24
- "Can't find the angr/binaries repo for holding testcases. "
25
- "It should be cloned into the same folder as the rest of your angr modules."
26
- )
27
-
28
-
29
- def broken(func):
30
- return skip(reason="Broken test method")(func)
31
-
32
-
33
- def requires_binaries_private(func):
34
- return skipIf(
35
- not os.path.exists(
36
- os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "binaries-private"),
37
- ),
38
- "Skip this test since we do not have the binaries-private repo cloned on Travis CI.",
39
- )(func)
40
-
41
-
42
- def slow_test(func):
43
- func.speed = "slow"
44
- slow_test_env = os.environ["SKIP_SLOW_TESTS"].lower() if "SKIP_SLOW_TESTS" in os.environ else ""
45
- return skipIf(slow_test_env == "true" or slow_test_env == "1", "Skipping slow test")(func)
46
-
47
-
48
- def skip_if_not_linux(func):
49
- return skipUnless(sys.platform.startswith("linux"), "Skipping Linux Test Cases")(func)
50
-
51
-
52
- TRACE_VERSION = 1
53
-
54
-
55
- def do_trace(proj, test_name, input_data, **kwargs):
56
- """
57
- trace, magic, crash_mode, crash_addr = load_cached_trace(proj, "test_blurble")
58
- """
59
- fname = os.path.join(
60
- bin_location,
61
- "tests_data",
62
- "runner_traces",
63
- f"{test_name}_{os.path.basename(proj.filename)}_{proj.arch.name}.p",
64
- )
65
-
66
- if os.path.isfile(fname):
67
- try:
68
- with open(fname, "rb") as f:
69
- r = pickle.load(f)
70
- if type(r) is tuple and len(r) == 2 and r[1] == TRACE_VERSION:
71
- return r[0]
72
- except (pickle.UnpicklingError, UnicodeDecodeError):
73
- print("Can't unpickle trace - rerunning")
74
-
75
- if tracer is None:
76
- raise SkipTest("Tracer is not installed and cached data is not present")
77
-
78
- runner = tracer.QEMURunner(project=proj, input=input_data, **kwargs)
79
- r = (runner.trace, runner.magic, runner.crash_mode, runner.crash_addr)
80
- with open(fname, "wb") as f:
81
- pickle.dump((r, TRACE_VERSION), f, -1)
82
- return r
83
-
84
-
85
- @skipUnless(tracer, "tracer is not installed")
86
- def load_cgc_pov(pov_file: str) -> "tracer.TracerPoV":
87
- return tracer.TracerPoV(pov_file)
88
-
89
-
90
- def compile_c(c_code: str, cflags: Optional[Sequence[str]], silent: bool = False) -> NamedTemporaryFile:
91
- # pylint:disable=consider-using-with
92
- """
93
- Compile `c_code` and return the file containing the compiled output
94
- """
95
- dst = None
96
- try:
97
- dst = NamedTemporaryFile(delete=False)
98
- dst.close()
99
- src = NamedTemporaryFile(mode="x", delete=False, suffix=".c")
100
- src.write(c_code)
101
- src.close()
102
-
103
- call_args = ["cc"] + (cflags or []) + ["-o", dst.name, src.name]
104
- l.debug("Compiling with: %s", " ".join(call_args))
105
- l.debug("Source:\n%s", c_code)
106
- out = subprocess.DEVNULL if silent else None
107
- subprocess.check_call(call_args, stderr=out, stdout=out)
108
- return dst
109
- except:
110
- if dst and os.path.exists(dst.name):
111
- os.remove(dst.name)
112
- raise
113
- finally:
114
- if src and os.path.exists(src.name):
115
- os.remove(src.name)
116
-
117
-
118
- @lru_cache
119
- def has_32_bit_compiler_support() -> bool:
120
- """
121
- Check if we are able to compile a 32-bit binary
122
- """
123
- try:
124
- binary = compile_c("#include <stdlib.h>\nint main() { return 0; }", ["-m32"], True)
125
- os.remove(binary.name)
126
- return True
127
- except subprocess.CalledProcessError:
128
- return False
tests/engines/__init__.py DELETED
File without changes
File without changes
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env python3
2
- from unittest import main, TestCase
3
-
4
- from angr.engines.light.data import SpOffset
5
-
6
-
7
- class TestSpOffset(TestCase):
8
- def test_difference_between_two_sp_offset_is_concrete(self):
9
- size = 8
10
- first_offset = SpOffset(size, 10)
11
- second_offset = SpOffset(size, 20)
12
-
13
- self.assertEqual(first_offset - second_offset, -10)
14
-
15
-
16
- if __name__ == "__main__":
17
- main()
File without changes