My Setup
My blog has migrated to https://wintertia.pages.dev/ ! This Gitbook will no longer be maintained.
Software
Ubuntu 22.04.5 LTS x86_64 (WSL)
gdb (Version 12.1)
pwndbg (2025.04.18 build: 02335839)
pwntools (Version 4.14.1)
ghidra (Version 11.2 2024-Sep-26)
IDA (Version 9.2)
tmux (Version 3.2a)
PWN Template
Place the template file in your pwntools template directory, in my case it was located in ~/.local/lib/python3.10/site-packages/pwnlib/data/templates:
Example on template ELF and Remote
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -*- template: wintertia -*-
# ====================
# -- PWNTOOLS SETUP --
# ====================
from pwn import *
exe = context.binary = ELF(args.EXE or 'template')
context.terminal = ['tmux', 'splitw', '-h']
context.log_level = 'debug'
host = args.HOST or 'hostname.com'
port = int(args.PORT or 1337)
def start_local(argv=[], *a, **kw):
'''Execute the target binary locally'''
if args.GDB:
return gdb.debug([exe.path] + argv, gdbscript=gdbscript, *a, **kw)
else:
return process([exe.path] + argv, *a, **kw)
def start_remote(argv=[], *a, **kw):
'''Connect to the process on the remote host'''
io = connect(host, port)
if args.GDB:
gdb.attach(io, gdbscript=gdbscript)
return io
def start(argv=[], *a, **kw):
'''Start the exploit against the target.'''
if args.LOCAL:
return start_local(argv, *a, **kw)
else:
return start_remote(argv, *a, **kw)
gdbscript = '''
tbreak main
continue
'''.format(**locals())
# =======================
# -- EXPLOIT GOES HERE --
# =======================
io = start()
# payload
io.interactive()
Last updated