1、arp扫描(-sn参数)
- 只做ping扫描,不做端口扫描
nmap -sn x.x.x.x(nmap -sn x.x.x.0/24/nmap -sn x.x.x.1-254)
- 使用地址列表扫描
nmap -iL list.txt -sn
2、四层发现(不进行端口扫描)
- UDP扫描(-PU参数,该参数后面加端口)
nmap x.x.x.0/24 -PU31337 -sn
- ACK扫描
nmap x.x.x.0/24 -PA31337 -sn
- SYN扫描
nmap x.x.x.0/24 -PS31337 -sn
- SCTP扫描(不常用)
nmap x.x.x.0/24 -PY31337 -sn
- ICMP扫描
nmap -PE -sn x.x.x.x
- timestamp(时间戳扫描)
nmap -PP x.x.x.x
- netmask扫描
nmap -PM x.x.x.x
- IP扫描
nmap -PO x.x.x.x
3、端口扫描
(1)UDP扫描
nmap -sU x.x.x.x
默认扫描1000个端口
使用ICMP的host-unreachable来判断端口是否开启
- 扫描指定端口
nmap -sU -p 11 x.x.x.x/nmap -sU -p1-65535 x.x.x.x/nmap -sU -p- x.x.x.x
- 使用地址列表进行扫描
nmap -iL list.txt -sU -p 11 x.x.x.x
(2)TCP端口扫描
- 隐蔽扫描:SYN(正常使用nmap不使用参数,也会默认使用-sS参数)
(1)不建立完整连接
(2)应用日志不记录扫描行为
nmap -sS -p1-100 x.x.x.x
- 延伸:
只显示open端口
nmap -sS -p1-100 x.x.x.x --open
扫描地址列表
nmap -sS -iL lis.txt -p1-100
(3)僵尸扫描
- 判断是否可以做为僵尸机
nmap -p445 x.x.x.x --srcipt=ipidseq.nse
- 使用僵尸机扫描目标
nmap 目标IP -sI 僵尸机IP -Pn -p1-100
(4)全连接端口扫描
- 使用TCP(非隐蔽)
nmap -sT -p1-100 x.x.x.x
4、目标端口服务扫描
- banner扫描
nmap -sT -p1-100 x.x.x.x --script=banner.nse
- 指纹特征匹配识别(比banner更详细)
nmap -sV -p1-100 x.x.x.x
5、扫描操作系统
nmap -O x.x.x.x
6、smb扫描
- -v表示显示详细扫描内容
nmap -v -p139,445 x.x.x.x
- 使用脚本扫描smb信息
nmap -p139,445 x.x.x.x --script=smb-os-discovery.nse
- 扫描是否存在smb漏洞
nmap -p139,445 --script=smb-check-vulns --script-args=unsafe=1 靶机IP
注:safe——安全扫描;unsafe——不安全扫描,可能导致目标系统或服务器宕机
7、SMTP扫描(发现邮箱账号)
前提已经知道目标开启25端口
- 枚举用户脚本
nmap smtp.163.com -p25 --script=smtp-enum-users.nse --script-args=smtp-enum-users.methods={VRFY}
注:VEFY默认是去尝试root账号
8、防火墙扫描
- 防火墙检测,因为nmap不加参数默认是SYN扫描,现在加上-sA,使用ACK扫描
nmap -sA -p1-100 x.x.x.x
nmap的同时进行抓包,可以判断目标防火墙是如何过滤的
- Waf识别
nmap x.x.x.x --script=http-waf-detect.nse
9、其它
- 延时扫描
nmap x.x.x.x --scan-delay
- 多IP扫描目标,迷惑目标管理员
nmap -D x.x.x.1,x.x.x.2,x.x.x.3 目标IP
- 伪造源地址
nmap -S 伪造IP -e eth0 目标IP
- MAC地址欺骗
nmap x.x.x.x --spoof-mac 11:11:11:11:11:11
- 默认目标主机是存活的,即使不存在,依旧完成扫描
nmap -Pn x.x.x.x
- nmap集操作系统检测,版本检测,脚本扫描、跟踪路由于一体的检测
nmap -A x.x.x.x