This PowerShell script performs network scanning on specified CIDR ranges, offering various customization options and output formats.
The script conducts network scans based on provided CIDR notations. It supports multiple CIDR inputs, customizable ping settings, port scanning, DNS resolution, and various output options. The script is designed for network administrators and security professionals to efficiently scan and analyze network environments.
Parameter | Description | Required | Default |
---|---|---|---|
CIDR |
CIDR notation(s) to scan. Can be a single CIDR or an array. | Yes | N/A |
PingCount |
Number of ping attempts per host. | No | 1 |
Timeout |
Timeout in milliseconds for each ping attempt. | No | 1000 |
ShowAll |
If set, shows results for all hosts, not just alive ones. | No | False |
ExportCSV |
Path to export results as CSV. | No | N/A |
HostThrottleLimit |
Maximum number of concurrent host scans. | No | 100 |
PortThrottleLimit |
Maximum number of concurrent port scans per host. | No | 50 |
ResolveDNS |
Attempts to resolve DNS names for alive hosts. | No | False |
Ports |
Array of specific ports to scan. | No | N/A |
TopPorts |
Scan top N most common ports. Values: 10, 20, 30, 40, 50. | No | N/A |
LogFile |
Path to the log file. | No | .\scan_log.txt |
OutputFormat |
Output format for results. Values: "CSV", "JSON", "XML". | No | "CSV" |
Exclude |
Array of IP addresses or subnets to exclude from scan. | No | N/A |
UseTcpSyn |
Uses TCP SYN packets for host discovery. | No | False |
NetworkInterface |
Network interface to use for the scan. | No | N/A |
.\scanner.ps1 -CIDR "192.168.1.0/24"
Performs a basic scan on the specified CIDR range.
.\scanner.ps1 -CIDR "192.168.1.0/24","10.0.0.0/16"
Scans multiple CIDR ranges in a single execution.
.\scanner.ps1 -CIDR "192.168.1.0/24" -PingCount 3 -Timeout 500
Adjusts the number of ping attempts and timeout for each host.
.\scanner.ps1 -CIDR "192.168.1.0/24" -ShowAll
Displays results for all hosts, not just the responsive ones.
.\scanner.ps1 -CIDR "192.168.1.0/24" -ExportCSV "C:\results.csv"
Saves the scan results to a CSV file at the specified path.
.\scanner.ps1 -CIDR "192.168.1.0/24" -HostThrottleLimit 50 -PortThrottleLimit 25
Sets custom limits for concurrent host and port scanning operations.
.\scanner.ps1 -CIDR "192.168.1.0/24" -ResolveDNS
Attempts to resolve DNS names for responsive hosts.
.\scanner.ps1 -CIDR "192.168.1.0/24" -Ports 80,443,3389
Scans the specified ports on responsive hosts.
.\scanner.ps1 -CIDR "192.168.1.0/24" -TopPorts 20
Scans the top 20 most common ports on responsive hosts.
.\scanner.ps1 -CIDR "192.168.1.0/24" -LogFile "C:\custom_scan_log.txt"
Specifies a custom path for the scan log file.
.\scanner.ps1 -CIDR "192.168.1.0/24" -OutputFormat "JSON"
Changes the output format of the results to JSON.
.\scanner.ps1 -CIDR "192.168.1.0/24" -Exclude "192.168.1.100","192.168.1.200/30"
Excludes specified IP addresses or subnets from the scan.
.\scanner.ps1 -CIDR "192.168.1.0/24" -UseTcpSyn
Uses TCP SYN packets instead of ICMP for host discovery.
.\scanner.ps1 -CIDR "192.168.1.0/24" -NetworkInterface "Ethernet"
Uses the specified network interface for scanning.
.\scanner.ps1 -CIDR "192.168.1.0/24","10.0.0.0/16" -PingCount 2 -Timeout 1000 -ShowAll -ExportCSV "C:\results.csv" -ResolveDNS -TopPorts 50 -LogFile "C:\scan_log.txt" -OutputFormat "JSON" -UseTcpSyn -NetworkInterface "Wi-Fi"
Performs a detailed scan with multiple CIDR ranges, custom ping settings, DNS resolution, port scanning, custom output, and more.