-
Notifications
You must be signed in to change notification settings - Fork 0
/
demangleAll.py
34 lines (30 loc) · 895 Bytes
/
demangleAll.py
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
import json
from files import *
from parseasm import *
from demangle import demangleFunction
from inline.helpers import getAsmFunctions
asmFiles = getAsmFiles()
funcDict = json.loads(open("demangled.json").read())
i = 0
for f in asmFiles:
blocks = parseAsm(f)
if ".text" not in blocks:
continue
text = blocks[".text"]
fs = getAsmFunctions(text)
print(f, len(fs), "functions")
for func in fs:
func = func.replace(":", "")
if func in funcDict:
continue
# print(func)
#continue
realname = None
try:
realname = demangleFunction(func)
except:
realname = None
if func not in funcDict and realname != None and func != realname:
funcDict[func] = realname
print(realname)
open("demangledplus.json", "w").write(json.dumps(funcDict, indent=4))