Last active
March 31, 2024 13:54
-
-
Save k4lizen/21ff273f794616e425d2040d102f9923 to your computer and use it in GitHub Desktop.
Binary Exploitation template with custom LIBC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from pwn import * | |
def start(): | |
if args.GDB or args.DBG: | |
return gdb.debug([ld.path, elff.path], gdbinit, aslr=using_aslr, env={"LD_PRELOAD": libc.path}) | |
elif args.REMOTE: | |
return remote(sys.argv[1], sys.argv[2]) | |
return process([ld.path, elff.path], aslr=using_aslr, env={"LD_PRELOAD": libc.path}) | |
using_aslr = False | |
elff = context.binary = ELF('./vuln', checksec=False) | |
libc = ELF('./libc.so.6', checksec=False) | |
ld = ELF('./ld-linux.so', checksec=False) | |
context.log_level = 'debug' | |
context.terminal = ['tmux', 'split', '-h', '-l', '65%', '-b'] | |
# TEMPLATE END | |
gdbinit = ''' | |
init-pwndbg | |
break main | |
''' | |
p = start() | |
p.interactive() | |
p.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment