Tuesday, January 26, 2010

IRC Bots: a small collection

Hello folks it's a while that I receive emails about IRC bots. Someone is interested on understanding how they works other ones are interested on how to write them.... If you check on google you will find tons of bots, but most of all are very complicated and hard to understand.
So, you' ll probably need more powerful IRC bots, but these perl bots helped me a lot understanding how to build my personal "home made" IRCBot. These script are pretty old, I came into this topic several years ago... but they works great also today.

Everything started from the basic IO Socket library:

#!/usr/bin/perl -w

# First and Basic Example of IRC bot

# http://marcoramilli.blogspot.com

##################################

use IO::Socket;


my $server = $ARGV[1];

my $user = 'marcoramilli';

my $botnick = $ARGV[0];

my $nickservpass = $ARGV[2];


if(@ARGV < 2) {

print STDOUT "Usage: $0 [nick] [server] [nickserv pass] -- if nickname is not registered , leave it blank.\n";

exit; }


$con = IO::Socket::INET->new(PeerAddr=>$server,

PeerPort=>'6667', # change this if needed..

Proto=>'tcp',

Timeout=>'30') || print "Error: Connection\n";


print $con "USER $user\r\n";

print $con "NICK $botnick\r\n";

if(@ARGV == 3) {

print $con "privmsg nickserv IDENTIFY $nickservpass\r\n"; } # if $ARGV[2] exists..

print $con "JOIN #channel\r\n"; # modify that ..


while($answer = <$con>) {


# #

# add code here #

# #


if($answer =~ m/^PING (.*?)$/gi) {

print $con "PONG ".$1."\n"; # replying to pings..

}


print STDOUT $answer; # printing $answer to the terminal..

}


I definitely suggest to take a look to my small but interesting ICRBot collection if you are interested on having some basic about bot programming. You probably want to reuse part of the code and/or mix it with your own. In the collection you'll find :


  1. Simple BOT (actually the code is up here)
  2. Bot Sniffer
  3. IRC spam Bot
  4. MD5 cracker irc bot
  5. The Santa Bot
  6. Stealth ShellBot
  7. [ ... not really much more ... ]

Obviously everything is only for research purpose on socket programming and on computer science security. The bots cannot be installed on unaware systems, you can install the bots only on your own systems.


Have fun !

5 comments:

Anonymous said...

Hello,

can anyone tell me which is the best counter strike guide ? :)...i found this one :

http://www.downloadzdb.com/Counter_Strike_Best_Guide

What do you more roughly it ?

Thanx in advance

Sorry for my bad english :s

Il Monno said...

The links on that Linkbucks.com don't work. The site never load after you waited for the required seconds... Is there any other way to download Your files rather than crappy Linkbucks?

Tnx

Il Monno said...

Wtf..... "Skip this page" on the right top corner.... :|

St Louis Catholic Church said...

Wow! your are a brave guy. Sounds like a good experience! Thank you for sharing to us. Please one more post about that.. thanks.

muebles de madera said...

I read so much helpful data above!