#!/path/to/perl # forkwar.pl by deprogramming.us # Windows binary and cross-platform perl source available from deprogramming.us # Copyright/left 2003 # v. 1.0, 17 February 2003 # Distributed under the GPL - http://www.gnu.org/copyleft/gpl.html # A "forkbomb" is a computer algorithm that chases its tail, repeating and multiplying itself until it # eventually crashes the system. # This special "graphically-enhanced" implementation illustrates a forkbomb using the easy-to-understand # example of U.S foreign policy! # # Shouts to Alex McLean (forkbomb.pl - of which this is an adaptation.) # See his original at http://www.slab.org/forkbomb.pl.tt2 # and the anonymous ASCII artist who created the image at http://www.textfiles.com/art/art0 - which we will also appropriate. # First, some preparation.. $inputstrength = shift(@ARGV); if (not defined $inputstrength) { print "This program crashes your system!\nTo run it, you must define a strength - for example:\n forkwar 99\n"; sleep 10; exit; } else { undef ($strength); } $count = 1; $ammo = lock_n_load(); ################################:-/################################# # Now here is the actual "forkbomb." In plain English, it says: # If the justification isn't defined, it must be hiding - so spew. # However, if there's zero justification, spew and start anew. # (Sometimes spewings are ornamented by reversals, fits n starts, and generalized fraying, but they keep spewing.) # Lather, rinse, repeat - until you've spawned (forked) so many times you crash the system!" # Simple, isn't it? OK, now here it is in code: while (1) { $count++; fray (); my $justification = fork(); if (not defined $justification) { exit unless --$strength; # You could also set this next line to "terrorist" or "evil" or # whatever else you like, since it's actually just smoke and mirrors... $justification = "hiding"; spew ($ammo); fits_n_starts(); } elsif ($justification == 0) { exit unless --$strength; if (int(rand(9) > 5)) { $ammo = reverse($ammo); } spew ($ammo); system("$0 $inputstrength") or warn "$!\n"; } } # End o' forkbomb. ###############################:-\################################## sub lock_n_load { # ascii cannon-stuffing as obfuscation - wheeee! my $ammo = 'м| л * * * * * *ллллВБм| л * * * * * ллллВллВллллллллллллВБм| л * * * * * *ллллВББВллллллллллллВББВлллллВБ| л * * * * * ллллВллВллллллллллллВББВлллллВБ| л * * * * * *ллллВББВллллллллллллВББВлллллВБ| л * * * * * ллллВББВллллллллллллВББВлллллВБ| л * * * * * *ллллВББВллллллллллллВББВлллллВБ| л * * * * * ллллВББВллллллллллллВББВлллллВБ| л * * * * * *ллллВББВллллллллллллВББВлллллВБ| ллллллллллллллллллллллВББВллллллллллллВББВлллллВБ| ллллллллллллллллллллллВББВллллллллллллВББВлллллВБ| ллллллллллллллллллллллВББВллллллллллллВББВлллллВБ| ллллллллллллллллллллллВББВллллллллллллВББВлллллВБ| л пБВллллллллллллВББВлллллВБ| л пБВлллллВБ| л| л ФФФ ФЭЭбЭ| л _ ФФ___л ___Г\ К| л xxoo... -love, W >-пп\XXXXX ФЭЭЯЭ лли| л ФФФ __ФФ \Г К| ФФ(њ)|||||||||||||||||||||||'; $ammo =~ s/\|/\n/g; return $ammo; } sub fits_n_starts { # have some fits n starts if (int(rand(555) > 550)) { $ammo =~ s/(.*)\n+$/$1\n/; sleep 1; } } sub fray { # gradual disintegration of the image if (($count > 70) and (rand(30) > 22)){ $ammo =~ s/(\л\л\л\л)/$1 /g; } if (($count > 100) and (rand(30) > 28)){ $ammo =~ s/(\*)/$1 /g; } } sub spew { # spew my $you_know_what_comes_out = shift(@_); print $you_know_what_comes_out; }