我一直在使用愤怒的 IP 扫描器有了它,我可以通过把起始 IP 和结束 IP 放在两个文本框中来轻松扫描 IP 范围。现在nmap,我想知道如何通过提供两个 IP(起始 IP 和结束 IP)来扫描 IP 范围。例如,我喜欢像这样使用 nmap:
nmap 10.10.10.10 10.10.15.254.254
请注意,我不想在 IP 末尾使用 /24。
答案1
从man nmap
CIDR notation is short but not always flexible enough. For example, you might want to scan 192.168.0.0/16 but skip any IPs ending with .0 or .255 because they may be used as subnet network and broadcast addresses. Nmap supports this through octet range addressing. Rather than specify a normal IP address, you can specify a comma-separated list of numbers or ranges for each octet. For example, 192.168.0-255.1-254 will skip all addresses in the range that end in .0 or .255, and 192.168.3-5,7.1 will scan the four addresses 192.168.3.1, 192.168.4.1, 192.168.5.1, and 192.168.7.1. Either side of a range may be omitted; the default values are 0 on the left and 255 on the right. Using - by itself is the same as 0-255, but remember to use 0- in the first octet so the target specification doesn't look like a command-line option. Ranges need not be limited to the final octets: the specifier 0-255.0-255.13.37 will perform an Internet-wide scan for all IP addresses ending in 13.37. This sort of broad sampling can be useful for Internet surveys and research.
因此,您需要确定您的起始和终止范围。据我所知,您似乎正在执行10.10.10.10
(10.10.15.254
您的终止 IP10.10.15.254.254
是无效地址),但这涵盖了整个 6 个子网,每个子网都以 .1 开头,以 .254 IP 结尾,因此您可能不想从 .10 开始每个子网,因为您将跳过每个子网的前 9 个 IP。因此,请按如下方式操作:(我添加了 -(s)can 命令并搜索 (n)o-port-scan(以前称为 -sP)的主机,它将扫描 1,524 个 IP 地址)
nmap -sn 10.10.10-15.1-254
但从你写的内容来看,我认为这就是你想要的。
希望有帮助!