Similar to #113, the patching of angr CLE with tinyscript fails.
Traceback
After removing the try except pass around the patching code - here
>>> exe = Executable("/mnt/share/experiments/exp1/datasets/a/files/65fbb0b87e5ffb26095f35e7b27e4932d75fc377fd0a1a64d80a45340615940d")
>>> exe.cfg
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.11/functools.py", line 1001, in __get__
val = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/pbox/core/executable/__init__.py", line 245, in cfg
from .cfg import CFG
File "/home/user/.local/lib/python3.11/site-packages/pbox/core/executable/cfg/__init__.py", line 2, in <module>
from .__common__ import *
File "/home/user/.local/lib/python3.11/site-packages/pbox/core/executable/cfg/__common__.py", line 31, in <module>
class CFG(GetItemMixin, ResetCachedPropertiesMixin):
File "/home/user/.local/lib/python3.11/site-packages/pbox/core/executable/cfg/__common__.py", line 32, in CFG
engines = {k: getattr(angr.engines, "UberEngine" if k in ["default", "vex"] else f"UberEngine{k.capitalize()}") \
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/pbox/core/executable/cfg/__common__.py", line 32, in <dictcomp>
engines = {k: getattr(angr.engines, "UberEngine" if k in ["default", "vex"] else f"UberEngine{k.capitalize()}") \
^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/tinyscript/__conf__.py", line 52, in _load
postload()
File "/home/user/.local/lib/python3.11/site-packages/pbox/core/executable/cfg/__common__.py", line 22, in __init_angr
code.insert_line(PESection.__init__, 0, "from tinyscript.helpers import ensure_str")
File "/home/user/.local/lib/python3.11/site-packages/tinyscript/preimports/codep.py", line 153, in code_add_line
return code_add_lines(func, index, addition, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/tinyscript/preimports/codep.py", line 115, in _wrapper
f(*args, **kwargs)
File "/home/user/.local/lib/python3.11/site-packages/tinyscript/preimports/codep.py", line 180, in code_add_lines
return __apply_code(func, old_code, new_code)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/tinyscript/preimports/codep.py", line 36, in __apply_code
patchy.api._set_source(func, new_code)
File "/home/user/.local/lib/python3.11/site-packages/patchy/api.py", line 305, in _set_source
new_source = _process_method()
^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/patchy/api.py", line 277, in _process_method
_def, _ast, fv_body = _process_freevars()
^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/patchy/api.py", line 260, in _process_freevars
_ast.body = _ast.body + fv_force_use # type: ignore [attr-defined]
^^^^^^^^^
AttributeError: 'ImportFrom' object has no attribute 'body'
Issue
Similar to #113, the patching of angr CLE with tinyscript fails.
Traceback
After removing the try except pass around the patching code - here