Skip to content

Commit 291b422

Browse files
ElvisBluevphuongdd
authored andcommitted
add themida_iat_fixer_x86.py script
1 parent f3dabec commit 291b422

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from x64dbg import *
2+
3+
def Log(txt):
4+
print("[Themida IAT fixer] " + txt)
5+
6+
def Trace(addr, mainModule):
7+
Log("Tracing address 0x%x" % addr)
8+
oldEIP = Register.GetEIP()
9+
Register.SetEIP(addr)
10+
while Register.GetEIP() >= mainModule.base and Register.GetEIP() <= (mainModule.base + mainModule.size):
11+
Debug.StepIn()
12+
13+
resolvedAddr = Register.GetEIP()
14+
Register.SetEIP(oldEIP)
15+
return resolvedAddr
16+
17+
def main():
18+
Gui.Message("This script does not support advanced api wrapping")
19+
startIAT = Gui.InputValue("Start IAT")
20+
endIAT = Gui.InputValue("End IAT")
21+
Log("Start IAT: 0x%X" % startIAT)
22+
Log("End IAT: 0x%X" % endIAT)
23+
24+
currentPtr = startIAT
25+
mainModule = Module.GetMainModuleInfo()
26+
while currentPtr <= endIAT:
27+
addr = Memory.ReadDword(currentPtr)
28+
if Memory.IsValidPtr(addr):
29+
if addr >= mainModule.base and addr <= (mainModule.base + mainModule.size):
30+
resolvedAddr = Trace(addr, mainModule)
31+
Memory.WriteDword(currentPtr, resolvedAddr)
32+
currentPtr += 4
33+
Gui.Message("Done")
34+
35+
if __name__ == "__main__":
36+
main()
37+

0 commit comments

Comments
 (0)