| 我一定是瘋了,搞了一整天XD 順便練習看c++組譯後的code,還蠻有趣的
 
 1st、2nd的地方要自己變更
 可惜Define在Disable的地方不能用,不然可以少改一次
 
 我只匯出eax、ebx、ecx、edx、esi、edi、esp、ebp這8個的值
 stack的部分應該再多加個迴圈讀就好了,不過寫累了,有空再加~
 
複製代碼
[Enable]Alloc(Hook,256)
Alloc(MyOpenFile,64)Alloc(HFILE,4)Alloc(MyFileName,64)Alloc(lpReOpenBuff,64)Alloc(uStyle,4)Alloc(OF_CREATE,4)Alloc(OF_WRITE,4)
Alloc(MyWriteFile,64)Alloc(lpBuffer,32)Alloc(nNumberOfBytesToWrite,4)Alloc(lpNumberOfBytesWritten,4)
Alloc(MyCloseFile,32)
Alloc(MyHexToStr,128)Label(number)Label(MyLoop)
Alloc(MyRegWrite,64)
Alloc(MyFunction,1024)
OF_CREATE:DD 00001000OF_WRITE:DD 00000001
//1st///////////////////////////////////////////////Define(HookAddr,004EC3C0)Define(RetAddr,004EC3C6)Define(OpcodeCode1,mov eax,[esi+2C])Define(OpcodeCode2,mov [ebp-10],eax)
MyFileName:DB 'C:\Users\Administrator\Desktop\Reg.txt'///////////////////////////////////////////////
HookAddr:jmp Hook
Hook:call MyFunctionOpcodeCode1OpcodeCode2jmp RetAddr
MyHexToStr:push eaxpush ebxpush ecxmov ebx,8xor ecx,ecxMyLoop:dec ebxmov eax,[esp+10]shr eax,cland eax,0000000Fcmp al,0Ajb numberadd al,07number:add al,30mov [lpBuffer+ebx],aladd ecx,4cmp ecx,20jne MyLoopmov [lpBuffer+8],0A0Dpop ecxpop ebxpop eaxret 0004
MyOpenFile:push eaxmov eax,[OF_CREATE]or eax,[OF_WRITE]mov [uStyle],eaxpop eaxpush [uStyle]push lpReOpenBuffpush MyFileNamecall OpenFilemov [HFILE],eaxret
MyWriteFile:pushadpush 00push lpNumberOfBytesWrittenpush [nNumberOfBytesToWrite]push lpBufferpush [HFILE]call WriteFilepopadret
MyCloseFile:push [HFILE]call CloseHandleret
MyRegWrite:push eaxmov eax,[esp+0C]mov [lpBuffer],eaxpop eaxmov [lpBuffer+3],09mov [nNumberOfBytesToWrite],04call MyWriteFile
mov [nNumberOfBytesToWrite],0Apush [esp+04]call MyHexToStrcall MyWriteFileret 0008
MyFunction:pushadcall MyOpenFilepopad
push 'eax'push eaxcall MyRegWrite
push 'ebx'push ebxcall MyRegWrite
push 'ecx'push ecxcall MyRegWrite
push 'edx'push edxcall MyRegWrite
push 'esi'push esicall MyRegWrite
push 'edi'push edicall MyRegWrite
push 'esp'push espcall MyRegWrite
push 'ebp'push ebpcall MyRegWrite
call MyCloseFileret
[Disable]//2nd///////////////////////////////////////////////004EC3C0:mov eax,[esi+2C]mov [ebp-10],eax///////////////////////////////////////////////
DeAlloc(Hook)
DeAlloc(MyOpenFile)DeAlloc(HFILE)DeAlloc(MyFileName)DeAlloc(lpReOpenBuff)DeAlloc(uStyle)DeAlloc(OF_CREATE)DeAlloc(OF_WRITE)
DeAlloc(MyWriteFile)DeAlloc(lpBuffer)DeAlloc(nNumberOfBytesToWrite)DeAlloc(lpNumberOfBytesWritten)
DeAlloc(MyCloseFile)
DeAlloc(MyHexToStr)
DeAlloc(MyRegWrite)
DeAlloc(MyFunction) | 
留言
張貼留言