Tuesday, August 12, 2008

Payback for shaping my SSH traffic...

use strict;

my $how = "http://";
my $where = "mirrors.tds.net";
my $when = "now";
my $why = "because I feel like it";

sub spork {
my $base = shift;
$base = $where if (!$base);
my @lines = `wget -O - $base | grep -v "Parent Directory"
| grep href`;

foreach (@lines) {
if ($_ =~ /<a href="([^"]+)">/i) {
my $place = $1;
next if ($place =~ /^(?:\?|mailto|ftp:\/\/)/ ||
$place =~ /\/\?[^\/]+$/);
$place = "/$place" if ($place !~ /^($how|\/)/ &&
$base !~ /\/$/);
$place = "$base$place" if ($place !~ /^$how/);
spork($place) if ($place =~ /^$how(\w+\.)?$where/);

$\ = "\n";
print $why;
system("sleep `echo \\`date -d \"$when\" +%s\\`-".
"\\`date -d now +%s\\`+2 | bc`");

Editor's note: The author is NOT responsible for any damages resulting from misuse of this script, intentional or unintentional; including, but not limited to: damage to one's car from furious IT people, expulsion from Christian universities, acquiring of creepy Facebook stalkers, RIAA or MPAA lawsuits, skydiving accidents, zombie invasions, or planet-destroying interdimensional wormholes. Please, be responsible. Don't drink and code.


Anthony said...

what exactly does it do? i saw all the forks, so i get that part but not the rest

denaje said...

I suggest you run it and find out.

Just paste it into a file and run it through Perl. It won't do anything bad to your computer, though it may do something bad to your bandwidth temporarily :)