Pwntools
This section covers many of the useful features of the Pwntools library. All of this information comes straight from the Pwntools documentation.
All of our exploits will be written in Python3, so we will use the Python3 version of Pwntools.
Installation
Pwntools can be installed on Linux systems using:
pip3 install pwntools
Usage
Pwntools can be imported into a Python3 script using:
from pwn import *
This imports every function from Pwntools into the current namespace. This includes several functions.
Context
context.binarycontext.log_levelcontext.archcontext.os
Connection
remote()process()listen()ssh()
Assembly
asm()disasm()shellcraft
ELF
ELF()ROP()DynELF()
Packing/Unpacking
pack()unpack()p32()/p64()u32()/u64()
GDB
gdb.attach()gdb.debug()
Misc
hexdump()read()andwrite()enhex()andunhex()align()andalign_down()urlencode()andurldecode()
Other Modules
The following are automatically imported:
import osimport sysimport timeimport randomimport requestsimport re