sub attack { $agent->follow_link (n => 1 ); $agent->follow_link (text => "Einstellungen", n => 1); $agent->follow_link (text => "Battle Home", n => 1); $agent->follow_link (text => "Targets", n => 1); if ($DEBUG == '1') { print("DEBUG: Getting Targets...\n");} my @targetsite = $agent->content; if ($DEBUG == '1') { print("DEBUG: Parsing Victims...\n");} my @targets; foreach (@targetsite) { push @targets, $_ =~ m/.+act=attack&m=(\d+)/; } if ($DEBUG == '1') { print ("DEBUG: Found Target: @targets\n");} if ($DEBUG == '1') { print("DEBUG: Attacking...\n");} foreach (@targets) { my $target = $_; $agent->get("http://$url/index.php?act=attack&m=$target"); if ($DEBUG == '1') { print("DEBUG: Choosing best Weapon...\n");} my @weaponlist = $agent->content =~ m/.+&w=(\d)/; my @weapons = sort(@weaponlist); my $count = '1'; if (defined $weapons[0]) { if ($DEBUG == '1') { print("DEBUG: Attack \#$count\n");} $agent->get("http://$url/index.php?act=attack&m=$target&w=$weapons[0]"); print("\#$count $username Attacked Target id $target with Weapon $weapons[0]\n"); $count++; } else { print("Cant attack $_, moving on to next Victim\n") } if ($count == '4') { print("Attacked 4 Targets, stopping..."); exit 0; } } if ($DEBUG == '1') { print("DEBUG: Attack finished\n");} }