对单个目标进行扫描
nmap[目标]
nmap 192.168.1.8
![](https://img-blog.csdnimg.cn/img_convert/b96f0f1386db79975174b9919d119716.png)
对多个目标进行扫描
nmap[目标1 目标2]
nmap 192.168.1.8 192.168.1.10
![](https://img-blog.csdnimg.cn/img_convert/977578da0fd3cc96eaf66029c983d12a.png)
扫描某个范围内的目标
nmap192.168.1.8-10
![](https://img-blog.csdnimg.cn/img_convert/b49c1d5fa577137566cacc27d0673cf4.png)
扫描一个目标列表
nmap 目标文件路径
nmap -iL C:\Users\entong\Desktop\2.txt
![](https://img-blog.csdnimg.cn/img_convert/b749070a0707a6aea492a5f4c2033370.png)
![](https://img-blog.csdnimg.cn/img_convert/b43c40309ec5f12fc479ab9ba8d8f495.png)
扫描整个c段
nmap 192.168.1.1/24
![](https://img-blog.csdnimg.cn/img_convert/b852b155479a7eb04f86db33c49b95cb.png)
排除扫描的目标
nmap [目标]-- exclude[目标]
nmap 192.168.1.1/24 --exclude 192.168.1.133
![](https://img-blog.csdnimg.cn/img_convert/38d01799095382ffdef3983ef5b4d8b7.png)
nmap [目标]-- exclude[目标范围]
nmap 192.168.1.1/24 --exclude 192.168.1.133-150,192.168.1.5
![](https://img-blog.csdnimg.cn/img_convert/30c680251bfb9e9968cc935b0dd427dd.png)
nmap[目标]- excludefile [目标列表]
nmap 192.168.1.1/24 --excludefile C:\Users\entong\Desktop\2.txt
![](https://img-blog.csdnimg.cn/img_convert/4251c6dc54e13e4a802bbb635856b73e.png)
指定端口扫描
nmap -p80 43.138.211.45
![](https://img-blog.csdnimg.cn/img_convert/daa07b20cea7a372ee7019cc46a4e55d.png)
nmap -p80,443 43.138.211.45
![](https://img-blog.csdnimg.cn/img_convert/d72a5fb88bbadc268c05478ed0a4b9f0.png)
nmap -p1-65535 43.138.211.45
![](https://img-blog.csdnimg.cn/img_convert/39937222f6cbd10a09ec3dc9a429b015.png)
识别端口和主机操作系统
nmap -O 192.168.110.141
![](https://img-blog.csdnimg.cn/img_convert/ea3570d2dfe21e006b3156a9fd211f55.png)
nmap -sV 192.168.110.141
![](https://img-blog.csdnimg.cn/img_convert/d6a29be785cbb399657d274c8c0bf14c.png)
nmap -A 192.168.110.141
![](https://img-blog.csdnimg.cn/img_convert/7833445240dcc96c15f441b3536befa3.png)
不进行主机存活检测
使用Nmap扫描目标主机,有时会扫描失败。失败的原因可能是目标主机开启了防火墙或其他应用程序,也可能是目标主机禁ping等,这时我们可以使用这个方法来绕过防御。
使用Pn参数时nmap不在进行主机存活检测,默认主机存活直接进行端口扫描,在确认主机存活的时候,我们也可以使用这个参数来扫描,跳过存活检测的步骤,加快扫描速度。
nmap -Pn 192.168.1.8
![](https://img-blog.csdnimg.cn/img_convert/a00f458b368072b0cc64330033294d5a.png)
只进行主机存活检测
nmap -sP 192.168.1.8/24
![](https://img-blog.csdnimg.cn/img_convert/aed1c66892c03b803486de705f066f61.png)
nmap文件输出格式
nmap 192.168.1.8/24 -oX C:\Users\entong\Desktop\3.xml
![](https://img-blog.csdnimg.cn/img_convert/15395c58d0634609c1747aae83797360.png)
漏洞扫描功能
nmap 192.168.110.135 --script=vuln
![](https://img-blog.csdnimg.cn/img_convert/7446c0609f986a42072eaff09d0b40b3.png)