Nmap(Network Mapper)是一款开放源代码的网络探测和安全审核工具。它的设计目标是快速地扫描大型网络,不适应于单一主机。Nmap使用检测IP数据包来确定访问的主机、提供的服务、数据包的类型等其他信息;Nmap通常被用来做安全审查,比如日常的网络日常检查、管理service升级计划以及检测hosts和service的运行时长等。
使用方法:nmap [Scan Type(s)] [Options] {target specification}
主要的参数和用法
|
-sT
|
TCP connect()扫描,这是最基本的TCP扫描方式。这种扫描很容易被检测到,在目标主机的日志中会记录大批的连接请求以及错误信息。
|
|
-sS
|
TCP同步扫描(TCP SYN),因为不必全部打开一个TCP连接,所以这项技术通常称为半开扫描(half-open)。这项技术最大的好处是,很少有系统能够把这记入系统日志。不过,你需要root权限来定制SYN数据包。
|
|
-sF,-sX,-sN
|
秘密FIN数据包扫描、圣诞树(Xmas Tree)、空(Null)扫描模式。这些扫描方式的理论依据是:关闭的端口需要对你的探测包回应RST包,而打开的端口必需忽略有问题的包(参考RFC 793第64页)。
|
|
-sP
|
ping扫描,用ping方式检查网络上哪些主机正在运行。当主机阻塞ICMP echo请求包是ping扫描是无效的。nmap在任何情况下都会进行ping扫描,只有目标主机处于运行状态,才会进行后续的扫描。
|
|
-sU
|
如果你想知道在某台主机上提供哪些UDP(用户数据报协议,RFC768)服务,可以使用此选项。
|
|
-sA
|
ACK扫描,这项高级的扫描方法通常可以用来穿过防火墙。
|
|
-sW
|
滑动窗口扫描,非常类似于ACK的扫描。
|
|
-sR
|
RPC扫描,和其它不同的端口扫描方法结合使用。
|
|
-sV
|
扫描服务端口、名称和版本
|
实例1:扫描UDP端口
点击(此处)折叠或打开
-
[root@wqdb01 ~]# nmap -sU 127.0.0.1
-
-
Starting Nmap 5.21 ( http://nmap.org ) at 2016-05-03 16:40 CST
-
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
-
Nmap scan report for wqdb01 (127.0.0.1)
-
Host is up (0.000017s latency).
-
Not shown: 996 closed ports
-
PORT STATE SERVICE
-
111/udp open rpcbind
-
177/udp open xdmcp
-
631/udp open|filtered ipp
-
5353/udp open|filtered zeroconf
-
-
Nmap done: 1 IP address (1 host up) scanned in 1.38 seconds
实例2:TCP同步扫描
-
[root@wqdb01 ~]# nmap -sS 127.0.0.1
-
-
Starting Nmap 5.21 ( http://nmap.org ) at 2016-05-03 16:41 CST
-
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
-
Nmap scan report for wqdb01 (127.0.0.1)
-
Host is up (0.000012s latency).
-
Not shown: 988 closed ports
-
PORT STATE SERVICE
-
22/tcp open ssh
-
111/tcp open rpcbind
-
1521/tcp open oracle
-
5432/tcp open postgresql
-
7000/tcp open afs3-fileserver
-
8009/tcp open ajp13
-
8021/tcp open ftp-proxy
-
8080/tcp open http-proxy
-
8888/tcp open sun-answerbook
-
9009/tcp open unknown
-
9099/tcp open unknown
-
9999/tcp open abyss
-
-
Nmap done: 1 IP address (1 host up) scanned in 0.15 seconds
实例3:扫描服务端口、名称和版本
-
[root@wqdb01 ~]# nmap -sV 127.0.0.1
-
-
Starting Nmap 5.21 ( http://nmap.org ) at 2016-05-03 16:41 CST
-
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
-
Nmap scan report for wqdb01 (127.0.0.1)
-
Host is up (0.000012s latency).
-
Not shown: 988 closed ports
-
PORT STATE SERVICE VERSION
-
22/tcp open ssh OpenSSH 5.3 (protocol 2.0)
-
111/tcp open rpcbind
-
1521/tcp open oracle-tns Oracle TNS Listener
-
5432/tcp open postgresql PostgreSQL DB
-
7000/tcp open afs3-fileserver?
-
8009/tcp open ajp13 Apache Jserv (Protocol v1.3)
-
8021/tcp open ftp-proxy?
-
8080/tcp open http Apache Tomcat/Coyote JSP engine 1.1
-
8888/tcp open http Oracle Application Server 10g httpd 10.1.3.4.0 (Oracle Containers for J2EE)
-
9009/tcp open unknown
-
9099/tcp open unknown
-
9999/tcp open abyss?
-
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at http://www.insecure.org/cgi-bin/servicefp-submit.cgi :
-
SF-Port1521-TCP:V=5.21%I=7%D=5/3%Time=57286459%P=x86_64-redhat-linux-gnu%r
-
SF:(oracle-tns,65,"\0e\0\0\x04\0\0\0\"\0\0Y\(DESCRIPTION=\(TMP=\)\(VSNNUM=
-
SF:186647296\)\(ERR=1189\)\(ERROR_STACK=\(ERROR=\(CODE=1189\)\(EMFI=4\)\)\
-
SF:)\)");
-
-
Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
-
Nmap done: 1 IP address (1 host up) scanned in 41.35 seconds
更多详细的使用方法请参考:http://blog.jobbole.com/54595/
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/27039319/viewspace-2092849/
,如需转载,请注明出处,否则将追究法律责任。