TCP Ports
I came across this post http://www.expta.com/2009/08/name-that-port.html that gives the well known service for a TCP\UDP port. Useful script but its written in VBScript. Needs to be in PowerShell.
| 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015
| param ([int]$port) $data = @' 1 = TCP Port Service Multiplexer 2 = Management Utility 3 = Compression Process 4 = Unassigned .... lots more in here 48003 = Nimbus Gateway 48556 = com-bardac-dw '@ $ports = ConvertFrom-StringData -StringData $data $ports["$port"] |
Easy. Create a script called get-port. It takes an integer as a port number. The ports and services are held in a here string and then ConvertFrom-StringData is used to create a hash table.
We then look up the port to get the service. Next trick is to turn it round so that we can find the port number given the string. I’ll add that next post and put the whole string on my skydrive as its too long to publish here