📚
OpenRCE
is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.
About
Articles
Book Store
Distributed RCE
Downloads
Event Calendar
Forums
Live Discussion
Reference Library
RSS Feeds
Search
Users
What's New
Customize Theme
bluegrey
blackgreen
metal
simple
Flag:
Tornado!
Hurricane!
Login:
Password:
Remember Me
Register
Blogs
>>
mfeng
's Blog
Created: Sunday, November 9 2008 22:36.56 CST
Modified: Monday, November 10 2008 04:48.31 CST
Printer Friendly ...
HASP HL Envelope IAT Fixer
Author:
mfeng
# Views:
6581
/*************************************************
HASP HL Envelope IAT Fixer
Author: mfeng
Email:
[email protected]
Homepage: hvaonline.net
History:
+ v0.0.1: November 08, 2008.
Tools: WinXP SP2, OllyICE, OllyDbg Script 1.64.3
Notes:
- Use this script after stop at OEP.
- Some emulated functions need to be resolved manually:
GetCommandLineA
GetProcAddress
GetCurrentProcess
GetStartupInfoA
GetCurrentProcessId
GetCurrentThreadId
**************************************************/
var saveEIP
var modulebase
var addrGetTickCount
var numCallGTC
var iatStart
var iatSize
var iatEnd
var iatEntry
var addrBP
var addrAPIEntry
var protectSectionBase
var addr
var opcode
mov saveEIP, eip
gpa "GetTickCount", "kernel32.dll"
mov addrGetTickCount, $RESULT
gmi eip, MODULEBASE
mov modulebase, $RESULT
ask "Enter RVA of IAT"
cmp $RESULT, 0
je @exit
mov iatStart, $RESULT
add iatStart, modulebase
ask "IAT Size"
cmp $RESULT, 0
je @exit
mov iatSize, $RESULT
ask "Start address of `.protect` section"
cmp $RESULT, 0
je @exit
mov protectSectionBase, $RESULT
find protectSectionBase, #668BC087D387DA558BEC#
cmp $RESULT, 0
je @signature_not_found
mov addrAPIEntry, $RESULT
mov addrBP, addrAPIEntry
sub addrBP, 20
mov opcode, [addrBP]
and opcode, FFFF
cmp opcode, C35D // POP EBP, RETN opcodes
jne @signature_not_found
inc addrBP // point to retn opcode
log addrBP
log addrAPIEntry
mov iatEnd, iatStart
add iatEnd, iatSize
mov iatEntry, iatStart
@search:
cmp iatEntry, iatEnd
jae @exit
cmp [iatEntry], 00000000
je @next
mov addr, [iatEntry]
mov opcode, [addr]
and opcode, 0FF
cmp opcode, E8
jne @next
inc addr
mov offset, [addr]
add offset, addr
add offset, 4
cmp offset, addrAPIEntry
jne @next
bphws addrBP, "x"
mov eip, [iatEntry]
mov numCallGTC, 0
@run:
run
sti
cmp numCallGTC, 1
je @fix
cmp eip, addrGetTickCount
jne @next
inc numCallGTC
jmp @run
@fix:
mov numCallGTC, 0
eval "[{iatEntry}] <- {eip}"
log $RESULT
mov [iatEntry], eip
@next:
bphwc addrBP
add iatEntry, 4
jmp @search
@signature_not_found:
msg "Signature's not found!"
jmp @exit
@exit:
bphwc
mov eip, saveEIP
an eip
pause
ret
Add New Comment
Comment:
There are
31,328
total registered users.
Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12
Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n
Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM
oleavr
Oct/24
Anatomy of a code tracer
hasherezade
Sep/24
IAT Patcher - new tool for ...
oleavr
Aug/27
CryptoShark: code tracer ba...
oleavr
Jun/25
Build a debugger in 5 minutes
More ...
Recent Blog Comments
nieo
on:
Mar/22
IAT Patcher - new tool for ...
djnemo
on:
Nov/17
Kernel debugger vs user mod...
acel
on:
Nov/14
Kernel debugger vs user mod...
pedram
on:
Dec/21
frida.github.io: scriptable...
capadleman
on:
Jun/19
Using NtCreateThreadEx for ...
More ...
Imagery
SoySauce Blueprint
Jun 6, 2008
[+] expand
View Gallery
(11) /
Submit