netcomm
Oct 27 2003, 01:50 AM
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
Oct 26 2003, 07:04 PM
///////.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
Oct 20 2003, 11:10 PM
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???
ArEs
Oct 21 2003, 04:17 AM
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
Oct 21 2003, 04:45 PM
yes this is the kind of thing am looking for! not barebones tho lol, cheers ill make a start
Uniter
Oct 25 2003, 05:48 PM
You could not be lazy and look for the RFC

Try winsoc help sites, they usually have IRC Client tutorials