skip to content
Hafiz Farhad

Using pwntools as a noob

/ 1 min read

Pwntools is a python utility used for testing exploits.

Other than some buit in functions, it works same as python. So having a python understading is PLUS here.

from pwntools import *

Every program is a process. If its on your host machines you simply right its name and if it is a remote process you simply write remote and give ip:port combination in the parameters.

p = process('/path/to/program')
p = remote('127:0:0:1', '8080')

Once we get the process, we read or write some data.

So if we want to read it first.

p.read()
p.readuntil('some string')

And then we put/write exploit

p.write()
p.writeafter('some string', b'aaaa')