def reach_oep(dbg): global oep print 'reach oep:'+ hex(dbg.context.Eip) (base, size) = get_main_module(dbg) #print hex(base) dumpfile = 'dump2.exe' dumppe(dumpfile, dbg, base, size) new_rva = add_section(dumpfile, 'dump2_2.exe') #generate_conf(dbg, 'iat.conf', base, iat_rva, iat_size) rebuild_iat('dump2_2.exe', 'dump2_3.exe', 'iat.conf', new_rva) modify_oep('dump2_3.exe', 'dump2_4.exe', oep) print 'dump and fix done'
def reach_oep(dbg): global oep print 'reach oep:'+ hex(dbg.context.Eip) (base, size) = get_main_module(dbg) print 'main_module:'+hex(base)+','+hex(size) for i in range(0xc): mbi = dbg.virtual_query(base+i*0x1000) print hex(base+i*0x1000), hex(mbi.Protect), hex(mbi.RegionSize) dumpfile = 'dump2.exe' dumppe(dumpfile, dbg, base, size) new_rva = add_section(dumpfile, 'dump2_2.exe') generate_conf(dbg, 'iat.conf', base, iat_rva, iat_size) rebuild_iat('dump2_2.exe', 'dump2_3.exe', 'iat.conf', new_rva) modify_oep('dump2_3.exe', 'dump2_4.exe', oep) print 'dump and fix done'