从事IT方面的工作,无论是开发或运维,当测试某些系统服务端口时,总会遇到TCP或 UDP 两种协议。众所周知,TCP 服务端口,可以通过telnet 进行远程测试,而UDP 端口,一般来说都会使用Nmap,无论是在linux 还是 windows环境下。
创新互联公司主要从事成都网站建设、成都做网站、网页设计、企业做网站、公司建网站等业务。立足成都服务雁塔,十多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18980820575
在windows 下的Nmap软件有图形界面也有命令行模式,但大多数人使用熟练的人,更偏向于命令行模式,因为操作简便而快速。
下载地址:
https://nmap.org/download.html
在windows上安装完毕后,直接运行打开图形界面
如何使用命令模式?
1、直接cmd,cd到安装目录下,执行nmap命令
2、修改环境变量,这样随时可执行nmap
在我的电脑-属性-高级-环境变量environment variables-system variables-path
path路径修改:添加完整的安装目录路径,前后用分号隔开。
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;E:\software\BIND9.11.1.x64;C:\Program Files (x86)\Nmap;
测试命令行扫描udp端口
打开xshell或cmd
扫描DNS 114.114.114.114 的udp 53端口,结果是端口state 为 closed
扫描dns 8.8.8.8 的udp 53端口,结果是端口state为up
当然也可以扫描站点的tcp端口
在命令行下,直接输入 nmap ,可查看具体命令使用说明
[c:\~]$ nmap
Nmap 6.46 ( http://nmap.org )
Usage: nmap [Scan Type(s)] [Options] {target specification}
TARGET SPECIFICATION:
Can pass hostnames, IP addresses, networks, etc.
Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254
-iL
-iR
--exclude
--excludefile
HOST DISCOVERY:
-sL: List Scan - simply list targets to scan
-sn: Ping Scan - disable port scan
-Pn: Treat all hosts as online -- skip host discovery
-PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports
-PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes
-PO[protocol list]: IP Protocol Ping
-n/-R: Never do DNS resolution/Always resolve [default: sometimes]
--dns-servers
--system-dns: Use OS's DNS resolver
--traceroute: Trace hop path to each host
SCAN TECHNIQUES:
-sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans
-sU: UDP Scan
-sN/sF/sX: TCP Null, FIN, and Xmas scans
--scanflags
-sI
-sY/sZ: SCTP INIT/COOKIE-ECHO scans
-sO: IP protocol scan
-b
PORT SPECIFICATION AND SCAN ORDER:
-p
Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9
-F: Fast mode - Scan fewer ports than the default scan
-r: Scan ports consecutively - don't randomize
--top-ports
--port-ratio
SERVICE/VERSION DETECTION:
-sV: Probe open ports to determine service/version info
--version-intensity
--version-light: Limit to most likely probes (intensity 2)
--version-all: Try every single probe (intensity 9)
--version-trace: Show detailed version scan activity (for debugging)
SCRIPT SCAN:
-sC: equivalent to --script=default
--script=
directories, script-files or script-categories
--script-args=
--script-args-file=filename: provide NSE script args in a file
--script-trace: Show all data sent and received
--script-updatedb: Update the script database.
--script-help=
< Lua scripts> is a comma-separated list of script-files or
script-categories.
OS DETECTION:
-O: Enable OS detection
--osscan-limit: Limit OS detection to promising targets
--osscan-guess: Guess OS more aggressively
TIMING AND PERFORMANCE:
Options which take
本文标题:Nmapforwindows下命令行使用
文章起源:http://scgulin.cn/article/ipecop.html