#!/usr/bin/perl #--------------------------------------------------# # IRC(InterNet Relay Chat) bot framework # #--------------------------------------------------# #----------------------Coded By--------------------# # _|_|_| _|_|_|_|_| _| _| # # _| _| _|_|_| _| _|_|_| _| _| # # _|_|_| _| _| _| _| _|_|_|_| # # _| _| _| _| _| _| _| # # _| _|_|_| _| _|_|_| _| _| # #--------------------------------------------------# # Important Notice Below, Please Read... # # ====================================== # # 1) The Terms and Conditions to this program are # # located at the bottom of the code, along with # # all the things stated here. # # # # 2) You may modify this source to fit your needs. # # It may be modified in any shape, or form... # # # # 3) You may sell this source to people in both # # physical, and digital forms. # # # # 4) This source IS owned by the original creator # # PaTcH, and by my/his wishes, please leave this # # and all the above (Including the ASCII) in this # # programs source code. # #--------------------------------------------------# #-------Please Read Notice At End Of Source--------# #--------------------------------------------------# use IO::Socket; use Digest::MD5 qw(md5_hex); my $system = system(clear); if($system = -1) { system(cls); } else { system(clear); } # Declaration of the Variables.. my ($oNICK, $NICK, $SERVER, $IDEN, $SOCKET, $PINGED); $oNICK=$ARGV[0] if $ARGV[0] || &argerror; $NICK=$ARGV[1] if $ARGV[1]; $SERVER=$ARGV[2] if $ARGV[2]; $SOCKET=new IO::Socket::INET( PeerAddr => $SERVER, PeerPort => 6667, Proto => 'tcp') or die "Could not open socket to $SERVER\n"; if($SOCKET) { print("-> You're Now Connected To : $SERVER\n"); print("-> Please do a /msg $NICK !join \n"); } $SOCKET->send("USER $NICK $NICK $NICK $NICK $NICK\r\n"); $SOCKET->send("NICK $NICK\r\n"); while(my $input = <$SOCKET>) { $input =~ s/\r\n//; if(!$PINGED) { sleep(1); $PINGED=1; } if($input =~ /^PING (\S+)$/i) { $SOCKET->send("PONG $1\r\n"); } #--------------------------# # We'll Start The CMDs Now # #--------------------------# if($input =~ /^:$oNICK!\S+ PRIVMSG (\S+) :!join (\S+)$/i) { print("-> Joining The Channel $2 | Command From $1\r\n"); $SOCKET->send("JOIN $2\r\n"); } if($input =~ /^:$oNICK!\S+ PRIVMSG (\S+) :!speak (.*)$/i) { print("-> Speaking the words '$2' to $1\r\n"); $SOCKET->send("PRIVMSG $1 $2\r\n"); } if($input =~ /^:(\S+)!\S+ PRIVMSG (\S+) :!md5 (\S+)$/i) { my $md5 = md5_hex($3); print("-> MD5 of $3 calculated to : $md5\n"); $SOCKET->send("PRIVMSG $2 Md5 of $3 is $md5\r\n"); open(MD5,">>MD5Hashes.log"); print(MD5 "$3 - $md5"); close(MD5); } } #------------# # Sub Functs # #------------# sub argerror { if($system = -1) { system(cls); } else { system(clear); } if(!$ARGV[0]) { print("\n-> You've forgotten your argument(s),\n"); print("-> which should be the owners' nick, botnick, and server.\n"); print("-> in that order...\n\n"); } } #--------------------------------------------------------------------------------# # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the Free Software # # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # #--------------------------------------------------------------------------------# # PaTcH (Robert S) Copyright (C) 2006-2008