Advertisement
noyoudont

Fork Bombs

Jan 25th, 2015
751
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. Fork Bombs
  2.  
  3. In computing, a fork bomb is a denial-of-service attack whereby a process continually replicates itself to deplete available system resources.
  4. - Wikipedia
  5.  
  6. So, a fork bomb is a program that just copies itself until (hopefully) the system crashes.
  7. In the windows cmd and the linux sh / bash shells, you can launch multiple programs at the same time by piping them into each other.
  8.  
  9. Let's analyse some example implementations:
  10.  
  11. Windows Batch file (.bat)
  12. Code:
  13.  
  14. %0 | %0
  15.  
  16. This one is the "classic" forkbomb. %0 is always the name of the current batch file, or the full path to it if you open it from another directory. So if you write this into a fork.bat and launch it, it will execute as this:
  17. fork.bat | fork.bat
  18. The pipe character moves the output from one thread into the input of a second one. For that to work both must be running.
  19. This means that in theory the number of executing batch files will exponentially grow, as every batch window will open two new ones.
  20.  
  21. Here is another .bat:
  22. Code:
  23.  
  24. @echo off
  25. :start
  26. start "Forkbomb" /high %0
  27. goto start
  28.  
  29. This one works a bit different. Instead of launching two parallel copies, it repeatedly creates a copy of itself.
  30.  
  31. BASH function
  32. Code:
  33.  
  34. :(){ :|:&};:
  35.  
  36. This is probably the most popular fork bomb. It works on bash shells and makes use of bash functions.
  37.  
  38. Part 2 - https://hightechlowlife.eu/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement