Friday, September 24, 2010

Check-TCPUDPClient.ps1

The output from the script below is designed to be a framework to check TCP and UDP open ports under connection. It makes use of whatever TCP and UDP Client sockets code is native to Powershell 2.0. My original conception was to create a scripted 'fuzzer' that would send non-arbitrary data to open ports to test or provoke library module loading.  Powershell's socket facilities are impressive for a scripted language. I don't know how much documentation there is for TCP/IP.  No error checking implemented.

Check-TCPUDPClient.ps1



 .\Check-TCPUDPClient.ps1 rmfvista

Listening TCP Ports:
135
139
445
1025
1026
1027
1028
1029
7800
9000
47001
Listening UDP Ports:
123
137
138
500
1900
4500
5355
50353
55326
Connected TCPPorts:
RMFVista 127.0.0.1:7801 127.0.0.1:7800
RMFVista 127.0.0.1:7800 127.0.0.1:7801
c6.59.85ae.static.theplanet.com 174.133.89.198:80 192.168.0.13:1031
h108.www5.itahost.com 85.13.200.108:110 192.168.0.13:8125
pz-in-f18.1e100.net 74.125.127.18:443 192.168.0.13:9104
pz-in-f189.1e100.net 74.125.127.189:443 192.168.0.13:9105
pz-in-f18.1e100.net 74.125.127.18:443 192.168.0.13:9107
nuq04s01-in-f102.1e100.net 74.125.19.102:80 192.168.0.13:9120
RMFVista.rmfdevelopment.com 192.168.0.13:47001 192.168.0.13:9131
RMFVista.rmfdevelopment.com 192.168.0.13:47001 192.168.0.13:9142
RMFVista.rmfdevelopment.com 192.168.0.13:9131 192.168.0.13:47001
RMFVista.rmfdevelopment.com 192.168.0.13:9142 192.168.0.13:47001
TCP Ports:
 TCP Port 135 open
 TCP Port 139 open
 TCP Port 445 open
 TCP Port 1025 open
 TCP Port 1026 open
 TCP Port 1027 open
 TCP Port 1028 open
 TCP Port 1029 open
Exception calling "Connect" with "2" argument(s): "No connection could be m
At C:\Ps1\Check-TCPUDPClient_006.ps1:77 char:36
+       $Connection = $TCPclient.Connect <<<< ($ip,$_)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationExcepti
    + FullyQualifiedErrorId : DotNetMethodException


 TCP Port 7800 closed
 TCP Port 9000 open
 TCP Port 47001 open
UDP Ports:
 UDP Port 123 open
 UDP Port 137 open
 UDP Port 138 open
 UDP Port 500 open
 UDP Port 1900 open
 UDP Port 4500 open
 UDP Port 5355 open
 UDP Port 50353 open
 UDP Port 55326 open

No comments:

Post a Comment