# This exploit template was generated via:
# $ pwn template --host pwnable.kr --port 2222 --user fd --password guest --path /home/fd/fd
# Set up pwntools for the correct architecture
exe = context.binary = ELF('fd')
# Many built-in settings can be controlled on the command-line and show up
# in "args". For example, to dump all data sent/received, and disable ASLR
# for all created processes...
# ./exploit.py DEBUG NOASLR
# ./exploit.py GDB HOST=example.com PORT=4141
host = args.HOST or 'pwnable.kr'
port = int(args.PORT or 2222)
password = args.PASSWORD or 'guest'
remote_path = '/home/fd/fd'
# Connect to the remote SSH server
shell = ssh(user, host, port, password)
shell.set_working_directory(symlink=True)
def start_local(argv=[], *a, **kw):
'''Execute the target binary locally'''
return gdb.debug([exe.path] + argv, gdbscript=gdbscript, *a, **kw)
return process([exe.path] + argv, *a, **kw)
def start_remote(argv=[], *a, **kw):
'''Execute the target binary on the remote host'''
return gdb.debug([remote_path] + argv, gdbscript=gdbscript, ssh=shell, *a, **kw)
return shell.process([remote_path] + argv, *a, **kw)
def start(argv=[], *a, **kw):
'''Start the exploit against the target.'''
return start_local(argv, *a, **kw)
return start_remote(argv, *a, **kw)
# Specify your GDB script here for debugging
# GDB will be launched if the exploit is run via e.g.
#===========================================================
#===========================================================
# PIE: No PIE (0x8048000)
success(io.readall().decode())