Skip to content

Instantly share code, notes, and snippets.

@SciresM
Created January 11, 2020 02:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SciresM/825cc59251c7299bb0020fc1fc40b8ed to your computer and use it in GitHub Desktop.
Save SciresM/825cc59251c7299bb0020fc1fc40b8ed to your computer and use it in GitHub Desktop.
from idautils import *
from idaapi import *
from idc import *
from ida_hexrays import *
START_100 = 0x7100770C10
END_100 = 0x710077FC60
START_110 = 0x7100770E30
END_110 = 0x710077FE80
MAPPING = {
# Generate this in your old IDB
}
V100, V110 = range(2)
VERSION = V100
if VERSION == V100:
FUNCRANGE = (START_100, END_100)
elif VERSION == V110:
FUNCRANGE = (START_110, END_110)
else:
raise ValueError()
def is_pml_func(ea):
return FUNCRANGE[0] <= ea and ea <= FUNCRANGE[1]
# Iterate over all segments
COUNT = 0
for segea in Segments():
for funcea in Functions(segea, get_segm_end(segea)):
func_name = idc.get_func_name(funcea)
func_type = idc.get_type(funcea)
if is_pml_func(funcea):
if VERSION == V100:
print '%d: (\'%s\', \'%s\'),' % (COUNT, func_name, func_type)
elif VERSION == V110:
name, type = MAPPING[COUNT]
idc.set_name(funcea, name, SN_CHECK)
idc.SetType(funcea, type.replace('(', ' a(')+';')
COUNT += 1
print 'Total: %d' % COUNT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment