#!/usr/bin/perl ################################################# # Name: Pollux v1.0b # # Author: Jasper # # Description: Simple IRC Bot. # # E-Mail: jasper@wintermarket.org # # WWW: http://wintermarket.org:81/~jasper/ # ################################################# use IO::Socket; use IO::Select; use IO::Handle; use Time::localtime; require 'pollux.lib'; $SIG{CHLD} = sub {wait()}; srand; ################## #bot configuration $nick = "botnick"; #bot nick $pass = "pw"; #password $realname = "name"; #bot name $user = int(rand(10000) + 1); #ident username (default: random numbers +) $server = "some.server.net"; #connect to server $sport = 6667; #server port (default: 6667) $spass = ""; #server password (if none, leave empty) $channel = "#channel"; #on connect join channel $chanpass = ""; #channel password (if none, leave empty) print "Pollux IRC Bot v1.0b Written By: Jasper <jasper\@wintermarket.o +rg>\nUSAGE: perl pollux10b.pl\n"; print "\nBot Nick: $nick *$realname* Username: $user\nServer: $serv +er:$sport Channel: $channel\n"; $sock = IO::Socket::INET->new ( PeerAddr => $server, PeerPort => $sport, Proto => "tcp" ); if($sock==undef) { print "Could not connect to Host!\n"; exit; } print $sock &makeusrid($sport,$realname); print $sock &makepass($pass); print $sock &makenick($nick); print $sock &makeusr($user,$hostname,$server,$realname); $buff; $sock->recv($buff,15000); print $buff; #$chan = &chanparse($buff); #no complete! $chan =$channel; $rnick = &nickparse($buff); $cmd = &cmdparse($buff); if (index($buff,"376")) { print $sock "JOIN $channel\r\n"; print $sock "PRIVMSG $channel :0Hello, My name is $ni +ck.\r\n"; #lame greeting } if (index($buff,"372")) { print $sock "JOIN $channel\r\n"; } if (index($buff,"PING")) { $loc=index($buff,":"); $num=substr($buff,$loc++); print $sock "PONG $num\r\n"; } if (index($cmd,".md5")) { $md5 = &md5hash($buff); print $sock $md5; } if (index($cmd,".join")) { $jchan = ¶parse($buff); print $sock "JOIN $jchan\r\n"; } if (index($cmd,".die")) { print $sock "QUIT :0...and there wa +s much rejoicing0"; } if (index($cmd,".nick")) { $newnick = ¶parse($buff); if ($newnick ne "") { print $sock "NICK $newnick\r\n"; } else { print $sock "NICK $nick\r\n"; } } if (index($cmd,".rndnick")) { $newnick = &rndstr(6); print $sock "NICK $newnick\r\n"; } if (index($cmd,".v")) { print $sock "PRIVMSG $chan :0Pollux S +cript v1.0b By: Jasper\r\n"; } if (index($cmd,".part")) { print $sock "PART $chan 0...and th +ere was much rejoicing0\r\n"; } if (index($cmd,".time")) { print $sock "PRIVMSG $chan 0Curren +t Day/Time: ctime()\r\n"; } if (index($cmd,".mode")) { print $sock "MODE $chan ¶parse( +$buff)\r\n"; } if (index($cmd,".action")) { print $sock "NOTICE $chan ¶p +arse($data)\r\n"; } if (index($cmd,".lastseen")) { print $sock "PRIVMSG $chan 0no +t quite yet...\r\n"; } if (index($cmd,".google")) { print $sock "PRIVMSG $chan 0not +quite yet...\r\n"; } if (index($cmd,".kill")) { print $sock "KILL &nickparse($data) + :0Anger is a tool, only for one's opponents\r\n"; } if (index($cmd,".away")) { print $sock "AWAY :0out...0\r\n"; + } if (index($data,"KICK")) { print $sock "PRIVMSG $chan :0haha +:P0\r\n"; } print $sock "QUIT 0...and there was much rejoicing\r\n"; close $sock;
Edit by tye to use <code> tags
In reply to Socket Client Disconnect by Jaspersan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |