This is my first "serious" IDAPython script. As I sorta suspected, it's performing waaaayyyyy too slow so I wanted to ask for some pointers on this:
fp = MinEA()
end = MaxEA()
while fp < end:
prev_inst = idc.prev_head(fp,MinEA())
prev_prev = idc.prev_head(prev_inst,MinEA())
next_inst = idc.next_head(fp,MaxEA())
if idc.SegName(fp) == '.text' or idc.SegName(fp) == '.code':
if idc.GetMnem(fp) == 'call':
if (idc.GetOpnd(fp,0) == 'ds:GetProcAddress') or (idc.GetOpnd(fp,1) == 'ds:GetProcAddress'):
if(idc.GetMnem(prev_inst) == 'push'):
if(idc.GetMnem(next_inst) == 'mov' and idc.GetMnem(prev_prev) == 'mov'):
print "GetProcAddress Found at %02X" % hex(fp)
This code is looking for this type of behavior (dynamic API loads):