54 lines
1.4 KiB
Python
54 lines
1.4 KiB
Python
|
#!/usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
# This exploit template was generated via:
|
||
|
# $ pwn template mini-ntpclient
|
||
|
from pwn import *
|
||
|
|
||
|
# Set up pwntools for the correct architecture
|
||
|
exe = context.binary = ELF('mini-ntpclient')
|
||
|
|
||
|
# 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
|
||
|
|
||
|
|
||
|
def start(argv=[], *a, **kw):
|
||
|
'''Start the exploit against the target.'''
|
||
|
if args.GDB:
|
||
|
return gdb.debug([exe.path] + argv, gdbscript=gdbscript, *a, **kw)
|
||
|
else:
|
||
|
return process([exe.path] + argv, *a, **kw)
|
||
|
|
||
|
# Specify your GDB script here for debugging
|
||
|
# GDB will be launched if the exploit is run via e.g.
|
||
|
# ./exploit.py GDB
|
||
|
gdbscript = '''
|
||
|
tbreak main
|
||
|
continue
|
||
|
'''.format(**locals())
|
||
|
|
||
|
#===========================================================
|
||
|
# EXPLOIT GOES HERE
|
||
|
#===========================================================
|
||
|
# Arch: amd64-64-little
|
||
|
# RELRO: No RELRO
|
||
|
# Stack: No canary found
|
||
|
# NX: NX disabled
|
||
|
# PIE: No PIE (0x400000)
|
||
|
# RWX: Has RWX segments
|
||
|
|
||
|
io = start()
|
||
|
|
||
|
# shellcode = asm(shellcraft.sh())
|
||
|
# payload = fit({
|
||
|
# 32: 0xdeadbeef,
|
||
|
# 'iaaa': [1, 2, 'Hello', 3]
|
||
|
# }, length=128)
|
||
|
# io.send(payload)
|
||
|
# flag = io.recv(...)
|
||
|
# log.success(flag)
|
||
|
|
||
|
io.interactive()
|
||
|
|