redballoonsecurity / ofrak

OFRAK: unpack, modify, and repack binaries.
https://ofrak.com
Other
1.85k stars 127 forks source link

OFRAK dependency keystone-engine not properly installed #318

Open whyitfor opened 1 year ago

whyitfor commented 1 year ago

What is the problem? (Here is where you provide a complete Traceback.) On some systems (for example, M1/M2 Macbook), installing keystone-engine can include a cmake build step to build a shared library:

Running setup.py install for keystone-engine ... done

This build step can silently fail if cmake is not installed. This will manifest itself as an error when OFRAK is run:

% ofrak unpack -x -r --gui -r --backend angr ./hello_elf_exec
...
    raise ImportError("ERROR: fail to load the dynamic library.")
ImportError: ERROR: fail to load the dynamic library.

Please provide some information about your environment. This has been observed on system and brew versions of python3 (3.7, 3.10) on M1/M2 Macbooks. Presumably it will occur whenever a wheel is not available from PyPI.

If you've discovered it, what is the root cause of the problem? cmake is not installed.

What are the steps to reproduce the issue? See above.

How would you implement this fix? Add instructions in OFRAK Docs explaining this issue and recommending installing cmake if this error is encountered. Perhaps keystone should also be treated similarly to libmagic to create an error message specifying this?

Are there any (reasonable) alternative approaches? N/A.

Are you interested in implementing it yourself? Maybe!