skip to content
Hafiz Farhad

Using pwntools

Pwntools is a python utility used for testing exploits.

Other than some built-in functions, it works same as python. So having a python understanding is PLUS here.

from pwn import *

Every program is a process. If its on your host machines you simply write 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.recv()
p.recvuntil(b'some string')

And then we put/write exploit

p.send(b'data')
p.sendafter(b'some string', b'aaaa')