Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/python
import pwn
pwn.context.log_level = "error"
key = {}
for c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-{}":
p = pwn.process("./babyre")
p.sendline("test 16")
p.sendline("%c" % c)
data = p.recvall()
x = data[20:28]
try:
key[int(x,16)] = c
except:
print "missing: %s" % x
# print "%c:%s" % (c,x)
p.close()
out = ""
f = open("out")
for l_ in f.readlines():
l = l_.rstrip()
leftword = l[0:8]
rightword = l[8:]
out += key[int(leftword,16)]
out += key[int(rightword,16)]
# print leftword
# print rightword
f.close()
print out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment