Giter Site home page Giter Site logo

pwntools-r2's Introduction

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

As of now, only the Python2 version of pwntools is being actively maintained. A version for the currently unmaintained Python3 fork of pwntools will be released as soon as it's being actively maintained and updated with pwntools-gdb environment variable support.

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 *

# You might want to change this
context.terminal = ['tmux', 'splitw', '-v']

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

Ok But How To Pass argv Values?

  • Write your payload to a temporary file before running the target process
  • Use this:
#r2.cmd('ood `!cat /tmp/payload`')

Troubleshooting

  • You can debug any errors with context.log_level = 'DEBUG' via your pwntools python script.
  • If no terminal can be found or any weird errors come up, try setting context.terminal accordingly - e.g. to urxvtc or ['tmux', 'splitw', '-v']

Credits

This is based on this and this.

pwntools-r2's People

Contributors

ps1337 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.