ya que hizo en asm, podía escribir isDebuggerPresent() en asm, no api.
mov eax, large fs:30h
movzx eax, byte ptr [eax+2]
retn
Si te fijas, compruebo si estoy siendo debugeado dos veces... una llamando a la propia API y otra vez lo compruebo mientras estoy creando los objetos de la ventana
aunque creo que nadie se tomo cuenta de eso...
Aquí os el código fuente!
format PE GUI 4.0
entry start
include 'win32w.inc'
section '.text' code readable executable
start:
invoke GetModuleHandle,0
mov [wc.hInstance],eax
invoke LoadIcon,0,IDI_APPLICATION
mov [wc.hIcon],eax
invoke LoadCursor,0,IDC_ARROW
mov [wc.hCursor],eax
invoke RegisterClass,wc
test eax,eax
jz error
invoke IsDebuggerPresent,0 ; ACTIVAR despues de depurar
cmp eax,0
jne end_loop
invoke CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_DLGFRAME+WS_SYSMENU,128,128,256,100,NULL,NULL,[wc.hInstance],NULL
test eax,eax
jz error
msg_loop:
invoke GetMessage,msg,NULL,0,0
cmp eax,1
jb end_loop
jne msg_loop
invoke TranslateMessage,msg
invoke DispatchMessage,msg
jmp msg_loop
error:
invoke MessageBox,NULL,_error,NULL,MB_ICONERROR+MB_OK
end_loop:
invoke ExitProcess,[msg.wParam]
proc WindowProc uses ebx esi edi, hwnd,wmsg,wparam,lparam
cmp [wmsg],WM_DESTROY
je .wmdestroy
cmp [wmsg],WM_CREATE
je .wmcreate
cmp [wmsg],WM_COMMAND
je .wmcommand
jmp .defwndproc
.wmcommand:
xor eax, eax
xor edx, edx
mov eax, [_buttonregistry]
mov edx, [lparam]
cmp eax,edx
jne .finish
invoke GetWindowTextA,[_editregistry],password,10
stdcall checkpass,password ; Comprobamos la contraseña.
jmp .finish
.defwndproc:
invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
jmp .finish
.wmcreate:
invoke CreateWindowExA,WS_EX_APPWINDOW,_labelclass,_labeltext,WS_CHILD+WS_VISIBLE,10,10,150,20,[hwnd],NULL,[wc.hInstance],NULL
mov edx,dword[fs:0x18]
push edx
invoke CreateWindowExA,WS_EX_APPWINDOW,_editclass,0,WS_CHILD+WS_VISIBLE+WS_BORDER,115,10,125,20,[hwnd],NULL,[wc.hInstance],NULL
mov [_editregistry],eax
pop edx
mov edx,dword[edx+0x30]
push edx
invoke CreateWindowExA,WS_EX_APPWINDOW,_buttonclass,_buttonname,WS_CHILD+WS_VISIBLE,10,40,230,20,[hwnd],NULL,[wc.hInstance],NULL
mov [_buttonregistry],eax
pop edx
movsx edx,byte[edx+2]
mov [dbg],edx ; Si esta debugger presente
jmp .finish
.wmdestroy:
invoke PostQuitMessage,0
xor eax,eax
.finish:
ret
endp
proc checkpass,pass
mov esi, [pass]
compute_hash:
xor edi, edi ;EDI = 0
xor eax, eax ;EAX = 0
cld
compute_hash_again:
lodsb ;AL = BYTE[ESI] , ESI = ESI + 1
test al, al
jz compute_hash_finished
ror edi, 0xD
add edi, eax
jmp compute_hash_again
compute_hash_finished:
;EDI = El Hash de la cadena
cmp edi,0xF6C53333
jne salircheck
mov eax, [dbg]
cmp eax,1
je salircheck
invoke MessageBoxA,0,_goodpass,_goodtitle,MB_OK+MB_ICONINFORMATION
salircheck:
ret
endp
section '.data' data readable writeable
_class TCHAR 'KeyGenMe Fary',0
_title TCHAR 'Fary KeyGenME - 1.0',0
_error TCHAR 'Startup failed.',0
_goodpass db 'Enhorabuena, superaste el reto!ahora el keygen ;)',0
_goodtitle db 'Good Boy',0
_buttonregistry dd ?
_buttonclass db 'BUTTON',0
_buttonname db 'Registrar',0
_editregistry dd ?
_editclass db 'EDIT',0
_labelclass db 'STATIC',0
_labeltext db 'Fary Password: ',0
password rb 11
dbg dd 0
wc WNDCLASS 0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BTNFACE+1,NULL,_class
msg MSG
section '.idata' import data readable writeable
library kernel32,'KERNEL32.DLL',\
user32,'USER32.DLL'
include 'api\kernel32.inc'
include 'api\user32.inc'
También quiero aclarar que el código que crear los hashes no es mio! pero me parecio interesante
https://foro.elhacker.net/programacion_visual_basic/asmvb6invoke_llamas_apis_sin_declararlas_kinvokebas-t290072.0.htmlAunque claro, veté tu a saber quién sea el autor porque por aquí también aparece el mismo hash
https://github.com/debasishm89/x86-Assembly/blob/master/speaking%20shell%20code.asmEntre otras páginas...