View Single Post
Source koden til "kamel boten" (for at den skal funke må du ha den vanlige boten, dere forstår):


#!/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize;
my $mech;
my %counter = ( Utpressing => 16, Biltyveri => 6, 'Club.+?Gangster' => 240, Kriminalitet => 3, 'Fight Club' => 2);
my %wait = ( Utpressing => 16, Biltyveri => 6, 'Club.+?Gangster' => 240, Kriminalitet => 3, 'Fight Club' => 2);

sub gotolink {
my ($text) = @_;
$counter{$text}++;
if (!$wait{$text} || $counter{$text} >= $wait{$text}) {
check();
LINK: $mech->follow_link(text_regex=>qr/$text/) or die scalar localtime() . "Kunne ikke finne $text\n";
check() or goto LINK;
return 1;
}
return 0;
}
sub antibot {
#Finner koden i antibot verifikasjonen.

my $convert = `convert -negate -geometry 800 antibot.png antibot.pbm`;
my $gocr;
open GOCR, "gocr -m 2 -m 256 -s 200 -d 200 antibot.pbm|";
$gocr = $_ while (<GOCR>);
close GOCR;
chomp($gocr);
unlink('antibot.png', 'antibot.pbm');
return $gocr;
}
sub cdg_bruker {
#Finn en random bruker fra forumet.

$mech->follow_link(text_regex=>qr/Klubb forum/);
my @users;
$_ = $mech->content;
while(/valg=les\&id=\d+\">(.+?)<\/a>.+?brukernavn=(.+?)\">/gs) {
my $thread = $1;
my $user = $2;
push @users, $user if ($thread =~ /(0|null).*?forsvar/i);
}
$mech->back;
my $count = (scalar @users)-1;
return @users[rand($count)];
}
sub check() {
login() if (!$mech);
if (my $img = $mech->find_image( url_regex => qr/image\.php/i)) {
$mech->get( $img->url_abs, ":content_file"=>"antibot.png" );
$mech->back();
$mech->submit_form(button => 'subimgvalid', fields=> { imgenter => antibot() });
print scalar localtime() . " Skrev inn antibot kode\n";
return 0;
}
if ($mech->form_name('nmLoggInn2')) {
login();
return 0;
}

return 1;
}
sub flytt_bil {
#Flytter den siste bilen til det stedet hvor det er billigst.

FLYTT: $mech->follow_link(text_regex=>qr/Biltyveri/);
goto FLYTT unless check();
$mech->form_name('trainform');
if (my ($carid) = $mech->content =~ /style=\"cursor: pointer;\">(\d+)<\/a>/) {
my %places = map { /(.+?) - (\d+)/ } $mech->form_name('trainform')->find_input('trainto')->value_names;
my $trainto = ((sort {$places{$a}<=>$places{$b}} keys %places)[0]);

$mech->submit_form(button => 'subtrans', fields => { trainid => $carid, trainto => $trainto });
print scalar localtime() . " Flytta bilen til $trainto\n";
return 1;
}
}
sub login {
open LOGIN, "login.txt";
my $user = <LOGIN>; my $pass = <LOGIN>;
$user =~ s/\s+$//; $pass =~ s/\s+$//;
close LOGIN;

if (!$mech) {
$mech = WWW::Mechanize->new(quiet => 1);
$mech->agent_alias('Windows IE 6');
$mech->get("http://www.nordicmafia.net");
}
if ($mech->form_name('nmLoggInn2')) {
if ($mech->submit_form (form_name=>'nmLoggInn2', fields=> { brukernavn => $user, passord => $pass }) && !$mech->form_name('nmLoggInn2')) {
print scalar localtime() . " Logget inn\n";
return 1;
}
else {
die scalar localtime() . "Kunne ikke logge inn\n";
}
}
}

while(1) {
if (gotolink('Kriminalitet')) {
if ($mech->form_number(1) && $mech->submit_form (fields => { valg => 'bank'}) && (my ($content) = $mech->content =~ /class=\"content\">\s*(.+?)<table>/)) {
$content =~ s/<.+?>//g;
print scalar localtime() . " Prøvde å rane bank: $content\n";
}
}

if (gotolink('Biltyveri')) {
if ($mech->form_name('f') && $mech->submit_form (form_name => 'f', button => 'stjelsubmit', fields => { gtanr => '4'}) && (my ($content) = $mech->content =~ /class=\"content\">\s*(.+?)\s*<br>/)) {
$content = "Men kom i fengsel." if ($content =~ /side=fengsel/);
$content =~ s/<.+?>//g;
print scalar localtime() . " Prøvde å stjele bil på gata: $content\n";
flytt_bil() if ($content =~ /Du stjal/);
$counter{Biltyveri} = 0;
}
}

if (gotolink('Utpressing')) {
if ($mech->form_number(1) && $mech->submit_form(form_number => 1, button => 'subpress')) {
my ($content) = $mech->content =~ /class=\"content\">\s*(.+?)\s*<br>/; $content =~ s/<.+?>//g;
print scalar localtime() . " Prøvde utpressing: $content\n";
$counter{Utpressing} = 0;
}
}


if (gotolink('Fight Club')) {
if ($mech->form_number(1) && $mech->submit_form(form_number => 1, button => 'subtrennaa', fields => {aktivitetvalg => 1})) {
my ($content) = $mech->content =~ /class=\"content\">\s*(.+?)\s*<table/; $content =~ s/<.+?>//g;
print scalar localtime() . " Utførte 25 pushups: $content\n";
$counter{'Fight Club'} = 0;
}
}

sleep(60);
}