I had the need to test multiple ports on multiple servers and didn't want to do each one manually. Typing telnet multiple times get old real quick not to mention the potential for fat fingering the keyboard.
I put together this script in PowerShell which will read in a "firewall.csv" file located in the scripts working folder. This file requires the columns of;
- Source IP Address(es)
- Source Hostname
- Destination IP Address(es)
- Destination Hostname
- TCP Port(s)
- UDP Port(s)
The script will look for the IP, or IP's of the system on which it is being run and check for any records with any of those IP's in the Source IP Address(es) field. If present, it will test the rule against the Destination IP Address(es) if the TCP Port(s) entry is populated.
The results are written to the screen and a new CSV file is generated with the name of the host on which the script is run and the suffix of _firewall_results.csv.
- Currently the script will omit UDP ports.
- Source and destination fields must be one per row.
- Ports can have multiple entries separated by a newline.