Apakekdah Posted February 10, 2007 Posted February 10, 2007 hi, is there anyone will help me, how to i was convert asm source... original source : ; NTkrnl protector 0.1 plugin tracer for impREC; bpx^2k7format PE GUI 4.0 DLLentry einclude 'c:fasm32includewin32a.inc'section '.code' code readable executablee:; DLL Entrypointxor eax,eaxinc eaxret 12Trace:push ebpmov ebp,esppush ebxpush esiinvoke MapViewOfFile, dword [ebp+4+4] , FILE_MAP_READ or FILE_MAP_WRITE, 0, 0, 0mov esi, eax; We put our found proc in this mapmov ebx, dword [ebp+16+4]invoke IsBadReadPtr, ebx, 4; Is this a valid thunk we are tracing ?test eax, eaxjz ptr_ok1jmp end2ptr_ok1:cmp dword [ebx],0000E860h; Look for ntkrnl signatureje ptr_ok2jmp end2ptr_ok2:mov word [ebx+35h],9090h; nop jmp eaxcall ebx; call redirector proc [eax now contains real API!]mov ebx, esimov dword [ebx], eaxend2:invoke UnmapViewOfFile, esi; Write changesinvoke CloseHandle, dword [ebp+4+4]pop esipop ebxmov eax,200leaveret 20section '.idata' import data readable writeablelibrary kernel,'KERNEL32.DLL'import kernel,MapViewOfFile,'MapViewOfFile',UnmapViewOfFile,'UnmapViewOfFile',CloseHandle,'CloseHandle',IsBadReadPtr,'IsBadReadPtr'section '.edata' export data readableexport 'nt_krnlprotect_0_1.dll',Trace,'Trace'section '.reloc' fixups data discardable mysouce : .486 ; set processor model.model flat, stdcall ; default STDCALL calling conventionoption casemap :none ; always use the case sensitive optioninclude e:\masm32\include\windows.incinclude e:\masm32\include\kernel32.incinclude e:\masm32\macros\macros.asmincludelib e:\masm32\lib\kernel32.libTrace PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD.data? hInstance dd ?.codeLibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD xor eax, eax inc eax ret LibMain endpTrace proc hFileMap:DWORD, dwSizeMap:DWORD, dwTimeOut:DWORD, dwToTrace:DWORD, dwExactCall:DWORD invoke MapViewOfFile, hFileMap, FILE_MAP_ALL_ACCESS, 0, 0, dwSizeMap test eax, eax je error1 mov esi, eax mov ebx, dwToTrace invoke IsBadReadPtr, ebx, 4 test eax, eax jne error2 mov esi, eax cmp dword ptr [ebx], 0E860h jne error3 mov word ptr [ebx+35h],9090h call ebx mov ebx, esi mov dword ptr [ebx], eax mov eax, 200 jmp abiserror1: mov eax, 201 jmp abiserror2: mov eax, 202 jmp abiserror3: mov eax, 203abis: invoke UnmapViewOfFile, hFileMap; Write changes invoke CloseHandle, hFileMap retTrace endpend LibMain the problem is, original code, can run (maybe, i'd never test it before, cause don't have that compiler ) and my code, always send an error... i'm sure i was following that direction... where is my mistake ? - and how to debug ImportRec, when Trace function is called, so i can debug where i'm make a mistake ? sorry for my bad english
human Posted February 10, 2007 Posted February 10, 2007 where have you lost push ebx esi, but real problem is you dont think? mov eax,200 jmp abis? and then closehandle and unmapview that change eax. man think again
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now