nmap使用
Nmap是一款网络扫描和主机检测的非常有用的工具。
功能:
主机发现
端口发现或枚举
服务发现
操作系统
漏洞
目标选择:
扫描单个IP地址: nmap 192.168.1
扫描主机: nmap www.linuxplus.loca
扫描连续IP: nmap 192.168.1.1-20
扫描子网: nmap 192.168.1.0/24
从文本文件获得扫描目标: nmap -iL list-of-ips.txt
无ping扫描:常用于防火墙禁止ping的情况 nmap -P0 172.20.62.150端口选择
注:-iL <inputfilename>: Input from list of hosts/networks 从网络或主机中选择输入(参考手册:http://www.nmap.com.cn/doc/manual.shtm)
-P0: Treat all hosts as online -- skip host discovery 将所有主机视为在线-跳过主机发现
端口选择
扫描单个端口 nmap -p 22 192.168.1.1
扫描一系列端口 nmap -p 1-100 192.168.1.1
扫描100个最常见的端口(快速)nmap -F 192.168.1.1
扫描所有65535端口 nmap -p- 192.168.1.1
注:-p <port ranges>: Only scan specified ports 端口范围,仅扫描指定的端口
-F: Fast - Scan only the ports listed in the nmap-services file) 快速-仅扫描nmap-services文件中列出的端口)
Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080
扫描单个端口: -p22
扫描几个端口: -p22,3306
扫描端口范围: -p1-100
扫描所有端口: -p-
指定协议探测端口: nmap -p T:25 U:53 scanme.nmap.org
通过协议名来扫描端口:nmap -p smtp scanme.nmap.org
通过名称范围扫描:nmap -p s* scanme.nmap.org
扫描注册在nmap中的端口号:nmap -p [1-65535] scanme.nmap.org
操作系统和服务检测
检测操作系统和服务
nmap -A 192.168.1.1
标准服务检测
nmap -sV 192.168.1.1
激进的服务检测
nmap -sV --version-intensity 5 192.168.1.1
轻量Banner抓取检测
nmap -sV --version-intensity 0 192.168.1.1
注:-A: Enables OS detection and Version detection 启用OS检测和版本检测
-sV: Probe open ports to determine service/version info 探测打开的端口以确定服务/版本信息
--version-light: Limit to most likely probes for faster identification 限制为最可能进行探测的探针,以便更快地进行识别
--version-light(打开轻量级模式)
这是--version-intensity 2的方便的别名。轻量级模式使版本扫描快很多,但它识别服务的可能也略微小一点。
--version-all(尝试每个探测)
--version-intensity 9的别名,保证对每个端口尝试每个探测报文。
Nmap输出格式
将默认输出保存到文件
nmap -oN outputfile.txt 192.168.1.1
将结果保存为XML
nmap -oX outputfile.xml 192.168.1.1
为方便grep来保存格式
nmap -oG outputfile.txt 192.168.1.1
保存所有格式
nmap -oA outputfile 192.168.1.1
注:-oN/-oX/-oS/-oG <file>: Output scan results in normal, XML, s|<rIpt kIddi3,
and Grepable format, respectively, to the given filename. -oN 默认 -oX xml -oG grep -oA 所有格式
常用选项:
-O: Enable OS detection 启用OS检测

浙公网安备 33010602011771号