Leser: 1
|< 1 2 >| | 13 Einträge, 2 Seiten |
1 2 3 4 5 6 7 8 9 10 11
my @targetsite = $agent->content; foreach (@targetsite) { chomp; my @targets = $_ =~ m/.+act=attack&m=(\d+)/; # regex matched optimal push(@targets,$1); # jetzt ist die id 2 mal drinne :( if ($DEBUG == '1') { print ("DEBUG: Found Target: @targets\n");} }
1 2 3 4 5 6 7 8 9 10
my @targetsite = $agent->content; my @targets; foreach (@targetsite) { push @targets, $_ =~ m/.+act=attack&m=(\d+)/ } if ($DEBUG == '1') { print ("DEBUG: Found Target: @targets\n"); }
Quoteaber was ist wenn ich darin ein regex mit () verwende? überschreib ich dann $_ ?
Quote
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
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");} }
push @targets, $_ =~ m/act=attack&m=(\d+)/gs;
|< 1 2 >| | 13 Einträge, 2 Seiten |