-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmain_f.py
More file actions
33 lines (30 loc) · 833 Bytes
/
Copy pathmain_f.py
File metadata and controls
33 lines (30 loc) · 833 Bytes
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
import re
f = open("autorev_assemble.txt")
text = f.read()
fxxx = []
for s in re.finditer("callq.*?<(?P<fn>f[0-9]*?)>", text):
fxxx.append(s.group("fn"))
#print(len(fxxx))
table = []
for t in re.finditer("<f[0-9](.|\s)*?retq", text):
u = t.group()
fn = re.match("<(?P<fn>f[0-9]*?)>", u)
fi = fn.group("fn")
pos = re.search("add(.|\s)*?0x(?P<pos>.*?),", u)
if pos != None:
se = pos.group("pos")
else:
se = "0"
cha = re.search("cmp(.|\s)*?0x(?P<cha>.*?),", u)
if cha != None:
th = cha.group("cha")
else:
th = "0"
table.append([fi, int(se, 16), int(th, 16)])
flag = ['@'] * len(fxxx)
for i in range(len(fxxx)):
for j in range(len(table)):
if fxxx[i] == table[j][0]:
flag[table[j][1]] = chr(table[j][2])
print("".join(flag))
f.close()