[clug] Sitar@home; Indirectly targeting veri greedy people
Michael.James at csiro.au
Michael.James at csiro.au
Thu Sep 25 16:22:27 EST 2003
Kim's string keeps growing, and it's neater to use LWP.
#!/usr/bin/perl
# (C) Kim Holburn 2003
# released under GNU Public License http://www.gnu.org/copyleft/gpl.html
# script to generate pseudo-random strings and download robots.txt files from
# random websites.
use strict;
use LWP::Simple;
use warnings;
sub fail_usage {
my (@mess) = @_;
for (@mess) { print STDERR "$0 Error : $_ \n"; }
print STDERR "Usage : $0 [-h] [-n <chars>] \n";
print STDERR " -h|--help = show this help screen\n";
print STDERR " default number of chars is 20\n";
print STDERR " \n";
exit 1;
}
my @chars=(
"a","b","c","d","e","f","g","h","i","j","k","l","m","n",
"o","p","q","r","s","t","u","v","w","x","y","z","-",
"0","1","2","3","4","5","6","7","8","9",
);
my $number=20;
while ($ARGV=$ARGV[0]) {
if ($ARGV eq "-n")
{
shift @ARGV;
if ($#ARGV < 0)
{ &fail_usage ("no number after -n option"); }
my $n=shift @ARGV;
if ($number =~ /^[0-9]{1,}$/ && $n > 0)
{ $number = $n; }
}
elsif ($ARGV eq "-h" || $ARGV eq "--help")
{ &fail_usage (); }
elsif ($ARGV =~ /^-/)
{ &fail_usage ("unknown option \"$ARGV\""); }
else { last; }
}
while (1) {
my $randstring = '';
for (1..$number) { $randstring .= $chars[int(rand($#chars))]; }
print "Trying http://www.$randstring.com/robots.txt\t";
defined( get("http://www.$randstring.com/robots.txt") ) and
print "OK";
print "\n";
sleep 1;
}
--
Michael James michael.james at csiro.au
System Administrator voice: 02 6246 5040
CSIRO Bioinformatics Facility fax: 02 6246 5166
More information about the linux
mailing list