A nice little Perl script I used while playing.
|
|
Here's a Perl script I wrote to automate all that tedious cracking. Just run it in the same directory as "IP.txt", a text file containing a list of IPs, with a max of one IP per line. Uncomment and change the "next if /NPC/;" lines if you want to avoid lines that contain certain text.
(Note to those unfamiliar with Slavehack: It's a web based cracking game. There are no compsec threats here. This is not real.)
#!/usr/bin/perl -w
####
open INFILE, "<IP.txt";
@infile = <INFILE>;
close INFILE;
open OUTFILE, ">Crack.html";
print OUTFILE "<html><body>\n<iframe id=\"scan\" name=\"scan\" width=\"100%\" height=\"75%\"></iframe>\n<div id=\"progress\">Scanning...</div>\n";
print OUTFILE "<script type=\"text/javascript\">\nvar ipaddr = new Array();\n";
$ct = 0;
foreach (@infile) {
# next if /NPC/;
if (/(\d+\.\d+\.\d+\.\d+)/) {
print OUTFILE "ipaddr[".$ct++."] = \"$1\";\n";
}
}
print OUTFILE "ipaddr[".$ct++."] = \"0.0.0.0\";\n";
print OUTFILE <<"(EOF)";
function DoScan(ct)
{
frames['scan'].location.href = "http://www.slavehack.com/index2.php?page=internet&action=crack&aktie=&gow=" + ipaddr[ct];
ct=ct+1;
percent = (100*(ct/(ipaddr.length))).toFixed(2);
document.getElementById("progress").innerHTML =
("Scanning " + ct + " of " + (ipaddr.length) + " ("+percent+"% complete)...");
if (ct < ipaddr.length)
{
setTimeout('DoScan('+ct+')',1000);
}
}
DoScan(0);
</script>
(EOF)
foreach (@infile) {
# next if /NPC/;
if (/(\d+\.\d+\.\d+\.\d+)/) {
print OUTFILE "<a href=\"http://www.slavehack.com/index2.php?page=internet&action=crack&aktie=&gow=$1\" target=\"scan\">$1 Gone</a><br><br>\n";
}
}
print OUTFILE "\n</body></html>\n";
close OUTFILE;
|