1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| from pwn import *
import time
dist=[0xA8, 0x1C, 0xAF, 0xD9, 0x00, 0x6C, 0xAC, 0x02, 0x9B, 0x05, 0xE3, 0x68, 0x2F, 0xC7, 0x78, 0x3A, 0x02, 0xBC, 0xBF, 0xB9, 0x4D, 0x1C, 0x7D, 0x6E, 0x31, 0x1B, 0x9B, 0x84, 0xD4, 0x84, 0x00, 0x76, 0x5A, 0x4D, 0x06, 0x75]
def list2str(a):
src=''
for i in a:
src=src+chr(i)
return src
def post(str1):
p=process('Enigma-patch')
p.recvuntil('Input flag: \n')
p.sendline(str1)
ret=p.recv()
p.close()
if ret[0]=='2' and ret[1]=='0':
print str
return ret b_data=[0x31 for i in range(36)]
flag=''
for i in range(36):
for j in range(20,128):
b_data[i]=j
rev=post(list2str(b_data)) if i>=len(rev): if i==4 or i==30: print 'maybe',i,chr(j) continue
if ord(rev[i])==dist[i]:
flag=flag+chr(j) print flag
break
elif(j==127):
flag=flag+'?'
|