hacking contest

hacking exploits security forum
hacking
compliance articles
upgrade backup exec
information security consultant

Full Version: Barebones Irc Bot
netcomm
if i was you i would ditch c and go with perl here a basic perl bot i made.


#bob.pl
#irc bot
#by NetComm

$nick1 ="bob";
my $server ="irc.server.net";
my $port ="6667";
$channel ="#blah";

while($line=<$server>)
{

print $line;

$server = IO::Socket::INET->new(PeerAddr => $server,
PeerPort => $port,
Proto => "tcp",
Type => SOCK_STREAM)
or die "Can't connect to Server Check to see if your connected to the internet.\n";

$line = <$server>;
print $line;
print $server "NICK $nick\r\n";
print $server "USER $nick irc.blah.us irc.bleh.net :Bob\r\n";
print $server "PONG :$server\r\n";
print $server "JOIN $channel\r\n";

if($line=~/^PING/)
{
print $server "PONG :$server\r\n";
print "PONG!\n";
}

if($line=~/!commandhere/)
{
print $server "PRIVMSG $channel :blahblahblah\r\n";
}



as you can see its pritty simple...
anyway hope i helped,


peace
NetComm
rubbar
///////.c
#include <winsock2.h>
#include <stdio.h>
#include <shellapi.h>
#include <wininet.h>
#include "sock.h"
int main()
{
WSADATA WSData;
WSAStartup(MAKEWORD(1, 1), &WSData);
create_sock("eu.undernet.org",6667);
return 0;
}


//////////.h

SOCKET create_sock(char *host, int port)
{
DWORD err;
LPHOSTENT lpHostEntry = NULL;
SOCKADDR_IN SockAddr;
SOCKET sock;
IN_ADDR iaddr;
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) return -1;
memset(&SockAddr, 0, sizeof(SockAddr));
SockAddr.sin_family = AF_INET;
SockAddr.sin_port = htons(port);
iaddr.s_addr = inet_addr(host);
if (iaddr.s_addr == INADDR_NONE) lpHostEntry = gethostbyname(host); //hostname
if (lpHostEntry == NULL && iaddr.s_addr == INADDR_NONE) return -2;
if (lpHostEntry != NULL) SockAddr.sin_addr = *((LPIN_ADDR)*lpHostEntry->h_addr_list); //hostname
else SockAddr.sin_addr = iaddr; //ip address
if (connect(sock, (SOCKADDR *) &SockAddr, sizeof(SockAddr)) == SOCKET_ERROR) return -1;
return sock;
}
relax
hey, am looking to build a irc bot (Like spybot + sdbot etc) in C and i was wondering if any one had seen a bare bones one about somewhere?

by bare bones i mean all it has to do is connect to irc and idle in a chan...

i googled it and i found some thing called "irc suckerbot" but i couldnt file the files, just old links pointing to freshmeat.com

so has any one got this or know of any thing better to get me started???

cool.gif
ArEs
well iguess if u`re good enough u could start with iroffer ( iroffer.com ) i think its written in C and its a working bot....
relax
yes this is the kind of thing am looking for! not barebones tho lol, cheers ill make a start smile.gif
Uniter
You could not be lazy and look for the RFC wink.gif
Try winsoc help sites, they usually have IRC Client tutorials
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.

 
Invision Power Board © 2001-2005 Invision Power Services, Inc.