All pastes #492947 Raw Edit

BLAH

public cpp v1 · immutable
·published 2007-05-17 14:46 UTC
rendered paste body
/***************************************//*NanoIRCBot by nano a.k.a Quan Chi2   *//*(c) 2007                             *//***************************************//*                                     *//*    usage: NanoIRCBot <serverip>     *//*                                     */ /***************************************/ /* C:\Program Files\Microsoft Visual Studio\MyProjects\NanoIRCBot\Debug */#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);