tag:blogger.com,1999:blog-546036873798832453.post8904629464944775438..comments2023-10-09T06:28:49.766-07:00Comments on PowerShell Scripts Blog: Send-UDPDatagram.ps1Unknownnoreply@blogger.comBlogger2125tag:blogger.com,1999:blog-546036873798832453.post-61529010886229747402015-05-24T18:11:49.130-07:002015-05-24T18:11:49.130-07:00too bad the website owner doesn't fix this. i&...too bad the website owner doesn't fix this. i've parsed the html source and stripped the code:<br /><br /><br /><# <br />.SYNOPSIS <br /> Sends a UDP datagram to a port <br />.DESCRIPTION <br /> This script used system.net.socckets to send a UDP <br /> datagram to a particular port. Being UDP, there's <br />if the UDP datagram actually <br /> was received. <br />for this sample, a port was chosen (20000). <br />.NOTES <br /> File Name : Send-UDPDatagram <br />@psp.co.uk <br /> Requires : PowerShell V2 CTP3 <br />.LINK <br /> http://www.pshscripts.blogspot.com <br />.EXAMPLE <br />#> <br /> <br />### <br /># Start of Script <br />## <br /> <br /># Define port and target IP address <br /># Random here! <br />$Port = 20000 <br />$IP = "10.10.1.100" <br />$Address = [system.net.IPAddress]::Parse( $IP ) <br /> <br /># Create IP Endpoint <br />$End = New-Object System.Net.IPEndPoint $address , $port <br /> <br /># Create Socket <br />$Saddrf = [System.Net.Sockets.AddressFamily]::InterNetwork <br />$Stype = [System.Net.Sockets.SocketType]::Dgram <br />$Ptype = [System.Net.Sockets.ProtocolType]::UDP <br />$Sock = New-Object System.Net.Sockets.Socket $saddrf , $stype , $ptype <br />$Sock.TTL = 26 <br /> <br /># Connect to socket <br />$sock.Connect( $end ) <br /> <br /># Create encoded buffer <br />$Enc = [System.Text.Encoding]::ASCII <br />$Message = "Jerry Garcia Rocks`n" *10 <br />$Buffer = $Enc.GetBytes( $Message ) <br /> <br /># Send the buffer <br />$Sent = $Sock.Send( $Buffer ) <br />"{0} characters sent to: {1} " -f $Sent , $IP <br />"Message is:" <br />$Message <br /># End of ScriptAnonymoushttps://www.blogger.com/profile/12436007086397046223noreply@blogger.comtag:blogger.com,1999:blog-546036873798832453.post-77224855850091587142015-02-18T19:31:00.047-08:002015-02-18T19:31:00.047-08:00Lines 38 - 52 are covered up with the Wireshark im...Lines 38 - 52 are covered up with the Wireshark image. Can you fix the layout so we can see the rest of the script?brettskihttps://www.blogger.com/profile/14771977258945734905noreply@blogger.com