Skip to main content

Debug exploits like a boss with Radare2 in pwntools

Project description

pwntools-r2

Launch radare2 from pwntools. This has been tested to work in combination with tmux - other combinations may or may not work. This might also work with other setups without tmux but that's not supported currently.

alt text

Ok How To Use This?

  • Create a new pipenv: pipenv --python 2.7
  • Install this: pipenv install pwntools-r2
  • Enter the virtual environment: pipenv shell
  • Code your 1337 exploit:
#!/usr/bin/env python2

from pwntools_r2 import *

r2script = """
#r2.cmd('db sym.main')
#r2.cmd('aaa')
#r2.cmd('V!')
"""

p = r2dbg('./a', r2script=r2script)
p.interactive()

Be sure to not forget interactive() at the end :)

Please note that the commands for r2 have to be prefixed with a #. If you want to pass additional parameters, you can use the same in the function prototype of gdb.debug from pwntools.

  • Do stuff: python2.7 ./exploit.py

Troubleshooting

  • You can debug any errors with context.log_level = 'DEBUG' via your pwntools python script.
  • If no terminal can be found, try setting context.terminal accordingly - e.g. to urxvtc

Credits

This is based on this and this.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pwntools_r2-1.3.3.8-py2-none-any.whl (3.7 kB view details)

Uploaded Python 2

File details

Details for the file pwntools_r2-1.3.3.8-py2-none-any.whl.

File metadata

  • Download URL: pwntools_r2-1.3.3.8-py2-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3

File hashes

Hashes for pwntools_r2-1.3.3.8-py2-none-any.whl
Algorithm Hash digest
SHA256 f4129a774f830a5962ab8dcfceed96d0ee72493e1e7694973c2cc2427788c122
MD5 0fdb0f7b253769f73c08f5cbd7cb8403
BLAKE2b-256 162eb2a45210740dfc5a7e539816ded7bae894c7a01023cd8a63ef5a38f4e014

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page