如何从Nmap扫描中排除主机?

Nmap是一个非常有用的网络管理和安全工具。它是这些领域最常用的工具。但是很多人用的是非常基本的手段。在这篇文章中,我们将一步一步地了解Nmap的更复杂用法。

null

目标主机

创建一个文本文件并向其中添加主机/网络,然后将此文件与Nmap一起使用。您可以使用192.168.122.0/24或192.168.122.10-20等网络块。

开始扫描

我们将开始扫描 -iL 选项,提供目标主机文件。

$ cat ismailbaydan.txt192.168.122.0/24192.168.43.0/248.8.8.8192.168.122.10-20$ sudo nmap -iL ismailbaydan.txtStarting Nmap 6.45 ( http://nmap.org ) at 2014-08-01 10:19 EESTNmap scan report for openstack (192.168.122.146)Host is up (0.000074s latency).Not shown: 996 closed portsPORT   STATE SERVICE22/tcp open  ssh25/tcp open  smtp49/tcp open  tacacs80/tcp open  httpMAC Address: 52:54:00:0D:B8:D7 (QEMU Virtual NIC)...

指定排除主机

排除与上面使用的语法相同的某些主机。您可以从文件中读取或按选项指定-v选项用于详细输出。我们将使用 --exclude 通过提供IP地址192.168.122.254`

$ cat ismailbaydan-exclude.txt192.168.122.0-128$ sudo nmap -iL ismailbaydan.txt --excludefile ismailbaydan-exclude.txt -v --exclude 192.168.122.254Starting Nmap 6.45 ( http://nmap.org ) at 2014-08-01 10:23 EESTInitiating ARP Ping Scan at 10:23Scanning 127 hosts [1 port/host]Completed ARP Ping Scan at 10:23, 1.42s elapsed (127 total hosts)Nmap scan report for 192.168.122.129 [host down]Nmap scan report for 192.168.122.130 [host down]Nmap scan report for 192.168.122.131 [host down]Nmap scan report for 192.168.122.132 [host down]

我们也可以使用主机名,但名称解析必须可用。

$ sudo nmap ismailbaydan.com

相关文章: Nmap目标规范

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享