Basic IRC Bot with Perl


#!/usr/bin/perl
use IO::Socket;
$irc='irc.example.net';
$nick='ตั้งชื่อบอท';
$owner='ชื่อคนใช้บอท';
$channel='#channel';
########################################################################
system('cls');
print "\n [+] Connection To $irc Please Wait ...\n\n";
########################################################################
$connect=IO::Socket::INET->new(PeerAddr=>$irc,
PeerPort=>'6667',
Proto=>'tcp',
Timeout=>60) or die "[!] Couldnt Connect To $irc\n\n";
#########################################################################
print $connect "USER xxx xxx xxx xxx\r\n";
print $connect "NICK ".$nick."\r\n";
print $connect "JOIN ".$channel."\r\n";
######################- Loop Connection -##############################
while ($svrmsg=<$connect>) {
if ($svrmsg=~m/^\:(.+?)\s+433/i) {
die "NickName in use";
}
print $svrmsg;
if ($svrmsg=~m/^PING (.*?)$/gi) {
print $connect "PONG ".$1."\r\n";
print "PONG ".$1."\r\n";
}
########################################################################
if ($svrmsg=~/Where you from ?/) {
if ($svrmsg=~/^\:$owner\!/) {

print $connect “PRIVMSG “,$channel,” :I’m Form Thailand\r\n”;

}
}
}

ที่มา : http://icheernoom.blogspot.com/2011/06/basic-irc-bot-with-perl.html
โดย : ICheer_No0M

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.