Logo
RSS Feed

Exploit Development Env

Created: 28.07.2022

This is about … .

pwntools

Installing this was no piece of cake. Running brew info pwntools did install it but it was not usable from a python console of file, whichever version I was trying to use. I kept getting the following error with a unicorn module:

error: [Errno 2] No such file or directory: '/private/var/folders/qr/0141vtnn6b90rb95k7dxt_v40000gn/T/pip-install-aay617qf/unicorn_2e7424c1f653496d8b2d9a21682df184/../../include/unicorn'

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.

  ERROR: Failed building wheel for unicorn

  Running setup.py clean for unicorn

  Building wheel for colored-traceback (setup.py) ... done

  Created wheel for colored-traceback: filename=colored_traceback-0.3.0-py3-none-any.whl size=4608 sha256=57af77a3aec068552968097c7a71b2d672a6d8bbc5322635f77fa399f08cef04

  Stored in directory: /Users/user/Library/Caches/pip/wheels/10/49/bd/750e09783fb038570efede2d03819a7141fc2350de51daf575

Successfully built capstone intervaltree psutil colored-traceback

Failed to build unicorn

Installing collected packages: unicorn, sortedcontainers, pyserial, pyelftools, urllib3, python-dateutil, pysocks, pyparsing, pygments, pycparser, psutil, plumbum, pathlib2, MarkupSafe, intervaltree, idna, charset-normalizer, certifi, capstone, rpyc, ropgadget, requests, packaging, mako, colored-traceback, cffi, pynacl, cryptography, bcrypt, paramiko, pwntools

  Running setup.py install for unicorn ... error

  error: subprocess-exited-with-error

  × Running setup.py install for unicorn did not run successfully.

  │ exit code: 1

  ╰─> [6 lines of output]

      running install

      /opt/homebrew/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

        warnings.warn(

      running build

      Building C extensions

      error: [Errno 2] No such file or directory: '/private/var/folders/qr/0141vtnn6b90rb95k7dxt_v40000gn/T/pip-install-aay617qf/unicorn_2e7424c1f653496d8b2d9a21682df184/../../include/unicorn'

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.

error: legacy-install-failure

  

× Encountered error while trying to install package.

╰─> unicorn

  

note: This is an issue with the package mentioned above, not pip.

As it turned out, the PipPy package is too old and one must install the latest version some other way. I even tried building the unicorn myself but it did not help (even though it was installed).

Below is the solution that might also be helpful in similar cases:

MACOS_UNIVERSAL=no pip install capstone
pip install "git+https://github.com/aquynh/capstone.git#egg=capstone&subdirectory=bindings/python"

MACOS_UNIVERSAL=no pip install unicorn
pip install "git+https://github.com/unicorn-engine/unicorn.git#egg=unicorn&subdirectory=bindings/python"

References

Expand… https://pergunte.org/question/stack/53015819/installing-pwntools-on-macos