TheTaylorLee / AdminToolbox

Repository for the AdminToolbox PowerShell Modules
MIT License
191 stars 23 forks source link

Networking - Invoke-NetworkScan.ps1 - Custom TCP ports #133

Closed bscheewe closed 1 year ago

bscheewe commented 1 year ago

Feature Target Details

Describe the solution you'd like There are currently 2 groups of ports scanned - either the default or deepscan ports. Could we either replace the default ports with a requirement to enter ports, or add a 3rd option for custom ports where a comma-delimited list of ports can be entered as a parameter?

Why is this change needed? The need to specify ports that are not in the default list.

Code Sample

**Code Sample**
.Parameter Ports
    Specify the TCP ports to scan in comma-delimited list.
#
 if ($null -ne $ArpRefresh) {
            if ($Ports) {
                $Script:QuickScan = Invoke-PSnmap -ComputerName $CIDR -Port $Ports -ScanOnPingFail -Dns -NoSummary -PortConnectTimeoutMs 500 -ThrottleLimit $Threads
            }
            if ($DeepScan) {
                $Script:SlowScan = Invoke-PSnmap -ComputerName $CIDR -Port 21, 22, 23, 25, 53, 67, 80, 139, 389, 443, 445, 902, 3389, 9100 -ScanOnPingFail -Dns -NoSummary -PortConnectTimeoutMs 500 -ThrottleLimit $Threads
            }
            else {
                $Script:QuickScan = Invoke-PSnmap -ComputerName $CIDR -Port 21, 22, 23, 80, 443, 3389, 9100 -ScanOnPingFail -Dns -NoSummary -PortConnectTimeoutMs 500 -ThrottleLimit $Threads
            }
        }

Additional context None

TheTaylorLee commented 1 year ago

If added, this will require another parametersetname and a rewrite to handle the variable output options. I'll consider it after I have time to look at this. You might also check out the module psnmap. This function is just an expansion of that module to add certain scan details.

TheTaylorLee commented 1 year ago
TheTaylorLee commented 1 year ago

This is now implemented.