All pastes #488440 Raw Edit

ELITE CODE HERE

public c v1 · immutable
·published 2007-05-15 00:30 UTC
rendered paste body
/***************************************//*NanoIRCBot by nano a.k.a Quan Chi2   *//*(c) 2007                             *//***************************************//*                                     *//*    usage: NanoIRCBot <serverip>     *//*                                     */ /***************************************/ #include <winsock2.h>#include <stdio.h>#include <windows.h>#define PORT 6667int main(int argc, char *argv[]){	char *nick		= "NICK nanobot\r\n"; //bot name	char *channel	= "JOIN #social\r\n";  //channel the bot will join	char *user      = "USER nano d d :nano\r\n";	char ping[100];	if (argc != 2)	{		fprintf(stderr,"[-]Usage: NanoIRCBot <serverip>\n");		exit(1);	}/*===========Initialize Winsock and declare connection variables.===========*/	WSADATA WSAData;	WSAStartup(MAKEWORD(2,0), &WSAData);  //Winsock 2.0	SOCKET connection;//this is a socket named 'connection'	SOCKADDR_IN sin;		connection = socket(AF_INET, SOCK_STREAM, 0); //'connection' is a stream socket	struct hostent *he;	if ((he = gethostbyname(argv[1])) == NULL) //get the ip of parameter 1 in command prompt	{		perror("gethostbyname"); //if there is a problem in gethostbyname, print the error		exit(EXIT_FAILURE);	}/*=================================Lets Get Busy=============================*/	for(;;)	{		sin.sin_addr			= *((struct in_addr *)he->h_addr); //address to connect to		sin.sin_family			= AF_INET;						   //potocol AF_INET is everything		sin.sin_port			= htons(PORT);                     //the port the irc server has open for connections	    		printf("[-]Connecting...\n");				               //some stupid message.		Sleep(1000);		connect(connection, (SOCKADDR*)&sin, sizeof(sin));         //connect to the server		printf("[-]Connected!\n");		Sleep(100);		send(connection,nick,strlen(nick),0);		printf("%s\n",nick);		send(connection,channel,strlen(channel),0);		printf("%s\n",channel);		send(connection,user,strlen(user),0);		printf("%s\n",user);		while(1)		{			recv(connection,0,255,0);			if(strstr(ping, "PING") !=0)			{				send(connection,"PONG\r\n",6,0);			}			if(strlen(ping) == 0)			{				closesocket(connection);				break;			}		}		return EXIT_SUCCESS;	}}