11.扫描主机侦测防火墙下面的命令将扫描远程主机以探测该主机是否使用了包过滤器或防火墙。 1 2 3 4 5 6 7 8 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 16:27 EST
All 1680 scanned ports on server2.tecmint.com (192.168.0.101) are UNfiltered
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.382 seconds
You have new mail in /var/spool/mail/root
|
12.扫描主机检测是否有防火墙保护扫描主机检测其是否受到数据包过滤软件或防火墙的保护。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 16:30 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1674 closed ports
PORT STATE SERVICE
22 /tcp open ssh
80 /tcp open http
111 /tcp open rpcbind
957 /tcp open unknown
3306 /tcp open mysql
8888 /tcp open sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.399 seconds
|
13.找出网络中的在线主机使用“-sP”选项,我们可以简单的检测网络中有哪些在线主机,该选项会跳过端口扫描和其他一些检测。 1 2 3 4 5 6 7 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-18 11:01 EST
Host server1.tecmint.com (192.168.0.100) appears to be up.
Host server2.tecmint.com (192.168.0.101) appears to be up.
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 256 IP addresses (2 hosts up) scanned in 5.109 seconds
|
14.执行快速扫描你可以使用“-F”选项执行一次快速扫描,仅扫描列在nmap-services文件中的端口而避开所有其它的端口。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 16:47 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1234 closed ports
PORT STATE SERVICE
22 /tcp open ssh
80 /tcp open http
111 /tcp open rpcbind
3306 /tcp open mysql
8888 /tcp open sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.322 seconds
|
15.查看Nmap的版本你可以使用“-V”选项来检测你机子上Nmap的版本。 1 2 3 4 | [root@server1 ~]
Nmap version 4.11 ( http: //www .insecure.org /nmap/ )
You have new mail in /var/spool/mail/root
|
16.顺序扫描端口使用“-r”选项表示不会随机的选择端口扫描。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 16:52 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1674 closed ports
PORT STATE SERVICE
22 /tcp open ssh
80 /tcp open http
111 /tcp open rpcbind
957 /tcp open unknown
3306 /tcp open mysql
8888 /tcp open sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.363 seconds
|
17.打印主机接口和路由你可以使用nmap的“–iflist”选项检测主机接口和路由信息。 1 2 3 4 5 6 7 8 9 10 11 12 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 17:07 EST
************************INTERFACES************************
DEV (SHORT) IP /MASK TYPE UP MAC
lo (lo) 127.0.0.1 /8 loopback up
eth0 (eth0) 192.168.0.100 /24 ethernet up 08:00:27:11:C7:89
**************************ROUTES**************************
DST /MASK DEV GATEWAY
192.168.0.0 /0 eth0
169.254.0.0 /0 eth0
|
从上面的输出你可以看到,nmap列举出了你系统上的接口以及它们各自的路由信息。 18.扫描特定的端口使用Nmap扫描远程机器的端口有各种选项,你可以使用“-P”选项指定你想要扫描的端口,默认情况下nmap只扫描TCP端口。 1 2 3 4 5 6 7 8 9 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 17:12 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
PORT STATE SERVICE
80 /tcp open http
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) sca
|
19.扫描TCP端口你可以指定具体的端口类型和端口号来让nmap扫描。 1 2 3 4 5 6 7 8 9 10 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 17:15 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
PORT STATE SERVICE
80 /tcp open http
8888 /tcp open sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.157 seconds
|
20.扫描UDP端口1 2 3 4 5 6 7 8 9 10 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 17:15 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
PORT STATE SERVICE
53 /udp open http
8888 /udp open sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.157 seconds
|
21.扫描多个端口你还可以使用选项“-P”来扫描多个端口。 1 2 3 4 5 6 7 8 9 10 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-18 10:56 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
PORT STATE SERVICE
80 /tcp open http
443 /tcp closed https
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.190 seconds
|
22.扫描指定范围内的端口您可以使用表达式来扫描某个范围内的端口。 23.查找主机服务版本号我们可以使用“-sV”选项找出远程主机上运行的服务版本。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 17:48 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1674 closed ports
PORT STATE SERVICE VERSION
22 /tcp open ssh OpenSSH 4.3 (protocol 2.0)
80 /tcp open http Apache httpd 2.2.3 ((CentOS))
111 /tcp open rpcbind 2 (rpc
957 /tcp open status 1 (rpc
3306 /tcp open mysql MySQL (unauthorized)
8888 /tcp open http lighttpd 1.4.32
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 12.624 seconds
|
24.使用TCP ACK (PA)和TCP Syn (PS)扫描远程主机有时候包过滤防火墙会阻断标准的ICMP ping请求,在这种情况下,我们可以使用TCP ACK和TCP Syn方法来扫描远程主机。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 17:51 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1674 closed ports
PORT STATE SERVICE
22 /tcp open ssh
80 /tcp open http
111 /tcp open rpcbind
957 /tcp open unknown
3306 /tcp open mysql
8888 /tcp open sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.360 seconds
You have new mail in /var/spool/mail/root
|
25.使用TCP ACK扫描远程主机上特定的端口1 2 3 4 5 6 7 8 9 10 11 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 18:02 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
PORT STATE SERVICE
22 /tcp open ssh
80 /tcp open http
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.166 seconds
You have new mail in /var/spool/mail/root
|
26. 使用TCP Syn扫描远程主机上特定的端口1 2 3 4 5 6 7 8 9 10 11 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 18:08 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
PORT STATE SERVICE
22 /tcp open ssh
80 /tcp open http
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.165 seconds
You have new mail in /var/spool/mail/root
|
27.执行一次隐蔽的扫描1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 18:10 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1674 closed ports
PORT STATE SERVICE
22 /tcp open ssh
80 /tcp open http
111 /tcp open rpcbind
957 /tcp open unknown
3306 /tcp open mysql
8888 /tcp open sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.383 seconds
You have new mail in /var/spool/mail/root
|
28.使用TCP Syn扫描最常用的端口1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 18:12 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1674 closed ports
PORT STATE SERVICE
22 /tcp open ssh
80 /tcp open http
111 /tcp open rpcbind
957 /tcp open unknown
3306 /tcp open mysql
8888 /tcp open sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.406 seconds
You have new mail in /var/spool/mail/root
|
29.执行TCP空扫描以骗过防火墙1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | [root@server1 ~]
Starting Nmap 4.11 ( http: //www .insecure.org /nmap/ ) at 2013-11-11 19:01 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1674 closed ports
PORT STATE SERVICE
22 /tcp open |filtered ssh
80 /tcp open |filtered http
111 /tcp open |filtered rpcbind
957 /tcp open |filtered unknown
3306 /tcp open |filtered mysql
8888 /tcp open |filtered sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 1.584 seconds
You have new mail in /var/spool/mail/root
|
以上就是NMAP的基本使用,我会在第二部分带来NMAP更多的创意选项。至此,敬请关注我们,不要忘记分享您的宝贵意见。 原文链接: Tecmint 翻译: 伯乐在线 - 敏敏 译文链接: http://blog.jobbole.com/54595/ |