-
Notifications
You must be signed in to change notification settings - Fork 3
/
dump_func_sizes.py
41 lines (31 loc) · 1022 Bytes
/
dump_func_sizes.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
def define_uncalled_functions():
for addr, name in idautils.Names():
flags = idc.GetFlags(addr)
if idc.isCode(flags):
MakeFunction(addr, BADADDR)
def GetName(name):
dname = demangle_name(name, 0)
if dname == None:
dname = name
return dname
def build_function_list():
function_list = []
for addr in idautils.Functions():
start, end = list(idautils.Chunks(addr))[0]
name = GetName(idc.GetFunctionName(addr))
#stop at first lib, we passed game code
if name == "__wcpp_2_undef_vfun__":
break
entry = {
'name': name,
'size': end - start
}
function_list.append(entry)
return function_list
def sort_method(list):
return list['name']
define_uncalled_functions()
function_list = build_function_list()
#function_list.sort(key=sort_method)
for item in function_list:
print('%s\t%s' %(item['name'], (item['size'])))