| 1 | #!/usr/bin/perl |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | use warnings; |
|---|
| 5 | |
|---|
| 6 | use LWP::Simple; |
|---|
| 7 | use LWP::UserAgent; |
|---|
| 8 | use Term::ANSIColor qw(:constants); |
|---|
| 9 | $Term::ANSIColor::AUTORESET = 1; |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | # ---BEGIN--- EDIT |
|---|
| 13 | my $entry_id = 666; |
|---|
| 14 | my $url = "http://www.somesite.com/mt/mt-comments.cgi"; |
|---|
| 15 | # each fork will post $repeat comments. |
|---|
| 16 | my $repeat = 50; |
|---|
| 17 | my $forks = 10; |
|---|
| 18 | |
|---|
| 19 | my $proxyfile = "mtproxies"; |
|---|
| 20 | # ---END--- EDIT |
|---|
| 21 | |
|---|
| 22 | my (@pl, $author, $email, $text, $website, $response); |
|---|
| 23 | |
|---|
| 24 | # if you delete this, floodmt will read proxies from a file as defined by $proxyfile |
|---|
| 25 | @pl = ( |
|---|
| 26 | 'http://proxies.go.here:port', |
|---|
| 27 | 'http://like.this:port' |
|---|
| 28 | ); |
|---|
| 29 | |
|---|
| 30 | my $bot = LWP::UserAgent->new; |
|---|
| 31 | $bot->agent('Mozilla/5.0 [en] (FloodMT; http://floodmt.sf.net)'); |
|---|
| 32 | |
|---|
| 33 | sub rnd_int { |
|---|
| 34 | return (int(rand()* shift)); |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | sub rnd_char { |
|---|
| 38 | return (chr(rnd_int(24)+97)); |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | sub rnd_string { |
|---|
| 42 | my ($min, $max) = @_; |
|---|
| 43 | return gen_string(rnd_int($max-$min)+$min); |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | sub rnd_proxy() { |
|---|
| 47 | return @pl[rnd_int($#pl)]; |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | sub gen_string { |
|---|
| 51 | my $max = shift; |
|---|
| 52 | my $i=0; |
|---|
| 53 | my $string; |
|---|
| 54 | while($i<$max) { $string.=rnd_char();$i++ } |
|---|
| 55 | return $string; |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | sub gen_tld { |
|---|
| 59 | my @tld=('.ee','.us','.be','.sk','.int','.mil','.gov', |
|---|
| 60 | '.org','.com','.net','.cx','.no','.eu'); |
|---|
| 61 | return (@tld[rnd_int($#tld)]); |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | sub gen_email { |
|---|
| 65 | return (rnd_string(3,13)."@".rnd_string(3,13).gen_tld()) |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | sub gen_website { |
|---|
| 69 | return ("www.".rnd_string(3,15).gen_tld()); |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | sub msg { |
|---|
| 73 | return (CYAN, "-!- ", WHITE); |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | sub flood { |
|---|
| 77 | my $p = shift; |
|---|
| 78 | my $i = 0; |
|---|
| 79 | my $pr; |
|---|
| 80 | my $suc = 0; |
|---|
| 81 | while($repeat > $i) { |
|---|
| 82 | $i++; |
|---|
| 83 | |
|---|
| 84 | my $email=''; |
|---|
| 85 | my $n=0; |
|---|
| 86 | |
|---|
| 87 | $author = rnd_string(4,20); |
|---|
| 88 | $email = gen_email(); |
|---|
| 89 | $text = rnd_string(400,900); |
|---|
| 90 | $website = gen_website(); |
|---|
| 91 | $pr = rnd_proxy(); |
|---|
| 92 | $bot->proxy('http', $pr); |
|---|
| 93 | |
|---|
| 94 | print msg() ,"child $p: ($suc/$i) ", CYAN, "[$pr] ", WHITE, "posting comment $i/$repeat ... "; |
|---|
| 95 | |
|---|
| 96 | $response = $bot->post($url, |
|---|
| 97 | [ |
|---|
| 98 | entry_id => $entry_id, |
|---|
| 99 | author => $author, |
|---|
| 100 | email => $email, |
|---|
| 101 | text => $text, |
|---|
| 102 | post => 'Post ', |
|---|
| 103 | checkbox => 'false', |
|---|
| 104 | snoop => 'goaway', |
|---|
| 105 | bully => 'goaway', |
|---|
| 106 | # code => 'later', |
|---|
| 107 | # scode => 'later', |
|---|
| 108 | url => $website |
|---|
| 109 | ], |
|---|
| 110 | ); |
|---|
| 111 | if($response->is_success()) { |
|---|
| 112 | $suc++; |
|---|
| 113 | print GREEN, "OK.\n"; |
|---|
| 114 | } |
|---|
| 115 | else { |
|---|
| 116 | print RED, "Failed.\n"; |
|---|
| 117 | } |
|---|
| 118 | } |
|---|
| 119 | print msg(), "child $p exiting... \n"; |
|---|
| 120 | } |
|---|
| 121 | |
|---|
| 122 | my $arg = (shift @ARGV || '0') ; |
|---|
| 123 | if(($arg eq '-v')||($arg eq '--version')) { |
|---|
| 124 | print msg(), "FloodMT 1.2 on ".`uname -sp`; |
|---|
| 125 | exit(0); |
|---|
| 126 | } elsif(($arg eq '-h')||($arg eq '--help')) { |
|---|
| 127 | print "\nOpen floodmt.pl with your editor of choice and read the damn thing\n"; |
|---|
| 128 | print "use -v or --version to find out which floodmt version you have\n"; |
|---|
| 129 | exit(0); |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | unless(@pl) { |
|---|
| 133 | open (PROXYFILE, $proxyfile) or die "$!"; |
|---|
| 134 | my $h=0; |
|---|
| 135 | while(<PROXYFILE>) { |
|---|
| 136 | chomp; |
|---|
| 137 | $pl[$h] = $_; |
|---|
| 138 | $h++; |
|---|
| 139 | } |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | close PROXYFILE; |
|---|
| 143 | |
|---|
| 144 | print msg(), "init complete, loading children... \n\n"; |
|---|
| 145 | sleep(1); |
|---|
| 146 | |
|---|
| 147 | for(my $w=0; $w < $forks; $w++) { |
|---|
| 148 | my $id = fork(); |
|---|
| 149 | if($id==0) { |
|---|
| 150 | flood($w+1); |
|---|
| 151 | exit(0); |
|---|
| 152 | } |
|---|
| 153 | else { |
|---|
| 154 | |
|---|
| 155 | } |
|---|
| 156 | } |
|---|
| 157 | |
|---|
| 158 | sleep(1); |
|---|
| 159 | print "\n\n", msg() ,"floodmt is going to sleep. don't forget to wake it up.\n"; |
|---|
| 160 | print msg(),"should you change your mind press C-c and it will all end.\n\n"; |
|---|
| 161 | sleep(); |
|---|