千家信息网

Nmap for windows 下命令行使用

发表于:2024-11-11 作者:千家信息网编辑
千家信息网最后更新 2024年11月11日,从事IT方面的工作,无论是开发或运维,当测试某些系统服务端口时,总会遇到TCP或 UDP 两种协议。众所周知,TCP 服务端口,可以通过telnet 进行远程测试,而UDP 端口,一般来说都会使用Nm
千家信息网最后更新 2024年11月11日Nmap for windows 下命令行使用

从事IT方面的工作,无论是开发或运维,当测试某些系统服务端口时,总会遇到TCP或 UDP 两种协议。众所周知,TCP 服务端口,可以通过telnet 进行远程测试,而UDP 端口,一般来说都会使用Nmap,无论是在linux 还是 windows环境下。

在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 : Input from list of hosts/networks
-iR : Choose random targets
--exclude : Exclude hosts/networks
--excludefile : Exclude list from file
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 : Specify custom 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 : Customize TCP scan flags
-sI : Idle scan
-sY/sZ: SCTP INIT/COOKIE-ECHO scans
-sO: IP protocol scan
-b : FTP bounce scan
PORT SPECIFICATION AND SCAN ORDER:
-p : Only scan specified ports
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 : Scan most common ports
--port-ratio : Scan ports more common than
SERVICE/VERSION DETECTION:
-sV: Probe open ports to determine service/version info
--version-intensity : Set from 0 (light) to 9 (try all probes)
--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=: is a comma separated list of
directories, script-files or script-categories
--script-args=: provide arguments to scripts
--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=: Show help about scripts.
< 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

0