-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgenerate_symbol_list.py
49 lines (37 loc) · 1.26 KB
/
generate_symbol_list.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#SymbolList dump script
#by tomsons26
#Writes symbols to a runnable idc script
import idautils
bad_name = ["SEH_", "unknown_lib", "_SEH"]
def Demangle_Name(mangled):
func_name = ""
#comment out if needed mangled
func_name = demangle_name(mangled, INF_SHORT_DN)
#If demangled result blank use original string
if func_name == None or func_name == "":
func_name = mangled
return func_name
def Check_Name(string, specific):
if specific:
if not specific in string:
return False
#we aren't printing specific names so check for bad names
else:
#check for symbol names that are are useless to dump
if any(s in string for s in bad_name):
return False
#this is a good name
return True
def Write_IDC(idc_file, specific):
for ea, name in idautils.Names():
if Check_Name(name, specific):
idc_file.write(format("0x%X \"%s\"\n" % (ea, Demangle_Name(name))))
#this is the main
file_name = AskFile(1, "*.symlist", "symlist File")
specific = AskStr("", "Type In string to filter.\nCase Sensitive!\nLeave black for all symbols.")
if file_name:
idc_file = open(file_name, "w")
Write_IDC(idc_file, specific)
idc_file.close()
else:
Message("No file!\n");