Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Other Programming › Assembly › [Collection]Snippets Vault[Assembly]

[Collection]Snippets Vault[Assembly]

Posts 1–6 of 6 · Page 1 of 1
NextGen1
NextGen1
[Collection]Snippets Vault[Assembly]
Use this format for submitting snippets

It may be used later to parse the snippets to a application (like the one in the VB Section)

If you're going to post a snippet in this thread then you should be posting it in the following format:

Snippet Name: ____________________
Keywords: ____,____,____ ...
Description(Optional): _______________________
Code:
Code:
Your Code Here...
This is to be used for any small bit of code you would like to share.


#1 · 15y ago
Void
Void
Well, I'm probably going to be the only one to post here. -sobsob-

Snippet name: Write to memory on key press.

Keywords: No one cares |:

Description: Writes to a memory address on a key press.

code:


[php]
.386
.model flat,stdcall
option casemap:none

include\masm32\include\windows.inc
include\masm32\include\user32.inc
include\masm32\include\kernel32.inc

includelib\masm32\lib\user32.lib
includelib\masm32\lib\kernel32.lib

.data
message db "Injection successfull!",0
flagAddress dd 1005194h

.code

MainThread proc

.while 1
xor eax,eax

push VK_INSERT
call GetAsyncKeyState

.if eax
mov ebx,0
mov ecx,flagAddress
mov [ecx],ebx
.endif
.endw

MainThread endp

DllMain proc hInst:HINSTANCE, dwReasonWORD, uselessWORD

.if dwReason == DLL_PROCESS_ATTACH

push 0
push 0
push 0
push offset MainThread
push 0
push 0
call CreateThread

push MB_OK
push offset message
push offset message
push 0
call MessageBoxA

.endif
mov eax,1
ret

DllMain endp
end DllMain

[/php]
#2 · 15y ago
.::SCHiM::.
.::SCHiM::.
Snippet name: Substring in asm

Keywords: Sting's, Substring, address, eax, edi, edx

Description:Find and copy a part of a string

Compiler/os/bit:MASM, windows, 32 (or 64... I dunno)

Code:

Code:
.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc
include     \masm32\include\user32.inc
include     \masm32\include\masm32.inc

includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\user32.lib
includelib  \masm32\lib\masm32.lib

.data

szMainStr   db 'SCHiM rocks in C++ and in asm W00T',0   ; String to be searched
szSubStr    db 'and',0             ; Substring to search
                                    

capt        db 'Copied substring',0


.data?

buffer      db 100 dup(?)  ; allocate our buffer

.code

start:

    xor eax, eax   ; empty the registers we're going to use
    xor edx, edx   ; empty the registers we're going to use
    xor edi, edi   ; empty the registers we're going to use
    mov [buffer], 0 ; empty the buffer we're going to use
    mov edi, offset szMainStr   ;load the address of the main string in eax
    mov edx, offset szSubStr     ;load the address of the sub string in edx

    invoke InString, 1, edi, edx   ; Find the substring and load the address back in edi

    dec eax   ; Dec eax to the base pointer
    add eax, edi ; move the address of our substring to eax
   
   invoke  lstrcpyn,ADDR buffer,eax, SIZEOF buffer  ; Copy the substring at eax to the buffer, with  the size of buffer
   invoke  MessageBox,0,ADDR buffer,ADDR capt,MB_OK   ; Message box out buffer
        
    invoke  ExitProcess,0

END start
I hope this helps someone out there, it looks like me & void are the only ones learning asm atm, good luck void

-SCHiM
#3 · 15y ago
.::SCHiM::.
.::SCHiM::.
Snippet name: Random string generator

Keywords: String, Pseudo random, Generator

Description: generate a random string at a given length

Compiler/os/bit: MASM, windows, 32 (or 64... I dunno)

Code:

Code:
.386
.model flat, stdcall
option casemap: none


include \masm32\include\windows.inc 
include \masm32\include\user32.inc 
include \masm32\include\kernel32.inc 
includelib \masm32\lib\kernel32.lib
include \masm32\include\masm32.inc
includelib \masm32\lib\user32.lib 
includelib \masm32\lib\masm32.lib



         
.data
szTable		 db		"ejiotio346juiuiotyuituiogrhjior4rhy789te5u90tuihnjfioghuigfjio2058989fjisefhioDJIAGFUHSDIFRUHOAHFVHDIOASJFOigodtghogjdfnfjkosbhjfhd",0
buffer      db 9 dup(0)
capt db "SCHiM",0

.code

Rand proc   ; Start of our random number function
start: 
invoke GetTickCount         ; we do some random operations on the registers here until...
div eax                     ; devide eax 
mov edx, sizeof szTable     ; move the size of our 
ror eax, 03h                ; rotate 3*16^0 (3 :P) to the right 
xor eax, ebx                ; xor eax, with ebx
rol eax, 013h               ; rotate to the left (3*16^0 + 1*16^1 + 0) 19 :P 
xor eax, ebx                ; xor eax with ebx
mov esi, eax                ; move eax to esi
invoke GetTickCount         ; get tick count once more
mov edx, sizeof szTable     ; move the siz of our table once more, because gtc uses edx
xor eax, esi               ; here... (and xor eax with esi)
comp:
    .if eax < edx
     ret                   ; if the number is good, return
   .else
sub eax, sizeof szTable   ; if the number is too big, decrease it's size
jmp comp
.endif
Rand endp  ; end of our random number function



main proc
xor ebx, ebx

rar:

call Rand  ; random number is stored in eax
  
mov al, [szTable + eax]   ; put a random character in al   
mov [buffer + ebx], al    ; put the character in our buffer at the location of ebx
inc ebx                   ; increment our counter (I know ebx is not a counter register, but who cares... :P
cmp ebx, 8d               ; compare our counter with 8 in decimal
jne rar                   ; if they don't match put another random char back in our buffer

invoke MessageBoxA,0, addr buffer, addr capt, MB_OK   ; if they match, show the result to the user

ret

main endp
end main
This'd be a ASM speed freaks worst nightmare, but I don't care because this works for me, I hope it will for others
#4 · edited 15y ago · 15y ago
.::SCHiM::.
.::SCHiM::.
Snippet name: Empty any buffer

Keywords: buffer, 0's, empty, clean, fast

Description:
Empty any buffer efficient, safe, and easy

Compiler/os/bit: MASM, windows, 32 (or 64... I dunno)

Code:




Code:
xor esi, esi

lp:
mov [buffer + esi], 0
inc esi
cmp esi, sizeof buffer
jne lp
#5 · 15y ago
[implicit]
[implicit]
Shit's dead as fuck :\

Fasm snippet to fade a window in, called either in WM_CREATE or after window creation:
Code:
fade_time = 1000

; start fading
        invoke GetWindowLong,[hWnd],GWL_EXSTYLE
        or eax, WS_EX_LAYERED
        invoke SetWindowLong,[hWnd],GWL_EXSTYLE,eax
        invoke GetTickCount
        mov ebx, eax
   .sfade:
        invoke GetTickCount
        sub eax, ebx
        cmp eax, fade_time
        jge .efade
        shl eax, 8
        cdq
        mov ecx, fade_time
        div ecx
        invoke SetLayeredWindowAttributes,[hWnd],0,eax,LWA_ALPHA
   ; check for window messages so it can still be controlled while we fade
   @@:
        xor eax, eax
        invoke PeekMessage,msg,eax,eax,eax,PM_REMOVE
        test eax, eax
        jz @f
        invoke TranslateMessage, msg
        invoke DispatchMessage, msg
        jmp @b
   @@:
        invoke Sleep, 10
        jmp .sfade
   .efade:
        invoke GetWindowLong,[hWnd],GWL_EXSTYLE
        mov edx, WS_EX_LAYERED
        not edx
        and eax, edx
        invoke SetWindowLong,[hWnd],GWL_EXSTYLE,eax
   ; end fading
and for fading the window out just put "xor eax, 00FFh" after the div ecx.
#6 · edited 13y ago · 13y ago
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Similar Threads

  • [Collection]Snippets Vault[C#]By NextGen1 in C# Programming
    21Last post 6y ago
  • [Collection]Snippets Vault[PHP]By NextGen1 in PHP Programming
    13Last post 7y ago
  • Snippets VaultBy NextGen1 in Visual Basic Programming
    112Last post 7y ago
  • [Collection]Snippets Vault[Flash]By NextGen1 in Flash & Actionscript
    3Last post 14y ago
  • [Collection]Snippets Vault[D3D]By NextGen1 in DirectX/D3D Development
    0Last post 15y ago

Tags for this Thread

None