Nmap的基本操作.docx

上传人:b****6 文档编号:7257309 上传时间:2023-01-22 格式:DOCX 页数:17 大小:45.98KB
下载 相关 举报
Nmap的基本操作.docx_第1页
第1页 / 共17页
Nmap的基本操作.docx_第2页
第2页 / 共17页
Nmap的基本操作.docx_第3页
第3页 / 共17页
Nmap的基本操作.docx_第4页
第4页 / 共17页
Nmap的基本操作.docx_第5页
第5页 / 共17页
点击查看更多>>
下载资源
资源描述

Nmap的基本操作.docx

《Nmap的基本操作.docx》由会员分享,可在线阅读,更多相关《Nmap的基本操作.docx(17页珍藏版)》请在冰豆网上搜索。

Nmap的基本操作.docx

Nmap的基本操作

给Linux系统管理员准备的Nmap命令的29个实用范例

2014-01-2110:

03佚名伯乐在线字号:

T|T

Nmap即网络映射器对Linux系统/网络管理员来说是一个开源且非常通用的工具。

Nmap用于在远程机器上探测网络,执行安全扫描,网络审计和搜寻开放端口。

本文为Linux系统管理员或网络管理员总结了Nmap命令的29个实用范例,分享给大家。

AD:

2013云计算架构师峰会课程资料下载

Nmap即网络映射器对Linux系统/网络管理员来说是一个开源且非常通用的工具。

Nmap用于在远程机器上探测网络,执行安全扫描,网络审计和搜寻开放端口。

它会扫描远程在线主机,该主机的操作系统,包过滤器和开放的端口。

我将用两个不同的部分来涵盖大部分NMAP的使用方法,这是nmap关键的第一部分。

在下面的设置中,我使用两台已关闭防火墙的服务器来测试Nmap命令的工作情况。

1.192.168.0.100–

2.192.168.0.101–

NMAP命令用法

1.#nmap[ScanType(s)][Options]{targetspecification}

如何在Linux下安装NMAP

现在大部分Linux的发行版本像RedHat,CentOS,Fedoro,Debian和Ubuntu在其默认的软件包管理库(即Yum和APT)中都自带了Nmap,这两种工具都用于安装和管理软件包和更新。

在发行版上安装Nmap具体使用如下命令。

1.#yuminstallnmap[onRedHatbasedsystems]

2.$sudoapt-getinstallnmap[onDebianbasedsystems]

一旦你安装了最新的nmap应用程序,你就可以按照本文中提供的示例说明来操作。

1.用主机名和IP地址扫描系统

Nmap工具提供各种方法来扫描系统。

在这个例子中,我使用主机名来扫描系统找出该系统上所有开放的端口,服务和MAC地址。

使用主机名扫描

1.[root@server1~]#nmap

2.StartingNmap4.11(http:

//www.insecure.org/nmap/)at2013-11-1115:

42EST

3.Interestingportson(192.168.0.101):

4.Notshown:

1674closedports

5.PORTSTATESERVICE

6.22/tcpopenssh

7.80/tcpopenhttp

8.111/tcpopenrpcbind

9.957/tcpopenunknown

10.3306/tcpopenmysql

11.8888/tcpopensun-answerbook

12.MACAddress:

08:

00:

27:

D9:

8E:

D7(CadmusComputerSystems)

13.Nmapfinished:

1IPaddress(1hostup)scannedin0.415seconds

14.Youhavenewmailin/var/spool/mail/root

使用IP地址扫描

1.[root@server1~]#nmap192.168.0.101

2.StartingNmap4.11(http:

//www.insecure.org/nmap/)at2013-11-1811:

04EST

3.Interestingportson(192.168.0.101):

4.Notshown:

1674closedports

5.PORTSTATESERVICE

6.22/tcpopenssh

7.80/tcpopenhttp

8.111/tcpopenrpcbind

9.958/tcpopenunknown

10.3306/tcpopenmysql

11.8888/tcpopensun-answerbook

12.MACAddress:

08:

00:

27:

D9:

8E:

D7(CadmusComputerSystems)

13.Nmapfinished:

1IPaddress(1hostup)scannedin0.465seconds

14.Youhavenewmailin/var/spool/mail/root

2.扫描使用“-v”选项

你可以看到下面的命令使用“-v“选项后给出了远程机器更详细的信息。

1.[root@server1~]#nmap-v

2.StartingNmap4.11(http:

//www.insecure.org/nmap/)at2013-11-1115:

43EST

3.InitiatingARPPingScanagainst192.168.0.101[1port]at15:

43

4.TheARPPingScantook0.01stoscan1totalhosts.

5.InitiatingSYNStealthScanagainst(192.168.0.101)[1680ports]at15:

43

6.Discoveredopenport22/tcpon192.168.0.101

7.Discoveredopenport80/tcpon192.168.0.101

8.Discoveredopenport8888/tcpon192.168.0.101

9.Discoveredopenport111/tcpon192.168.0.101

10.Discoveredopenport3306/tcpon192.168.0.101

11.Discoveredopenport957/tcpon192.168.0.101

12.TheSYNStealthScantook0.30stoscan1680totalports.

13.Host(192.168.0.101)appearstobeup...good.

14.Interestingportson(192.168.0.101):

15.Notshown:

1674closedports

16.PORTSTATESERVICE

17.22/tcpopenssh

18.80/tcpopenhttp

19.111/tcpopenrpcbind

20.957/tcpopenunknown

21.3306/tcpopenmysql

22.8888/tcpopensun-answerbook

23.MACAddress:

08:

00:

27:

D9:

8E:

D7(CadmusComputerSystems)

24.Nmapfinished:

1IPaddress(1hostup)scannedin0.485seconds

25.Rawpacketssent:

1681(73.962KB)|Rcvd:

1681(77.322KB)

3.扫描多台主机

你可以简单的在Nmap命令后加上多个IP地址或主机名来扫描多台主机。

1.[root@server1~]#nmap192.168.0.101192.168.0.102192.168.0.103

2.StartingNmap4.11(http:

//www.insecure.org/nmap/)at2013-11-1116:

06EST

3.Interestingportson(192.168.0.101):

4.Notshown:

1674closedports

5.PORTSTATESERVICE

6.22/tcpopenssh

7.80/tcpopenhttp

8.111/tcpopenrpcbind

9.957/tcpopenunknown

10.3306/tcpopenmysql

11.8888/tcpopensun-answerbook

12.MACAddress:

08:

00:

27:

D9:

8E:

D7(CadmusComputerSystems)

13.Nmapfinished:

3IPaddresses(1hostup)scannedin0.580seconds

4.扫描整个子网

你可以使用*通配符来扫描整个子网或某个范围的IP地址。

1.[root@server1~]#nmap192.168.0.*

2.StartingNmap4.11(http:

//www.insecure.org/nmap/)at2013-11-1116:

11EST

3.Interestingportson(192.168.0.100):

4.Notshown:

1677closedports

5.PORTSTATESERVICE

6.22/tcpopenssh

7.111/tcpopenrpcbind

8.851/tcpopenunknown

9.Interestingportson(192.168.0.101):

10.Notshown:

1674closedports

11.PORTSTATESERVICE

12.22/tcpopenssh

13.80/tcpopenhttp

14.111/tcpopenrpcbind

15.957/tcpopenunknown

16.3306/tcpopenmysql

17.8888/tcpopensun-answerbook

18.MACAddress:

08:

00:

27:

D9:

8E:

D7(CadmusComputerSystems)

19.Nmapfinished:

256IPaddresses(2hostsup)scannedin5.550seconds

20.Youhavenewmailin/var/spool/mail/root

从上面的输出可以看到,nmap扫描了整个子网,给出了网络中当前网络中在线主机的信息。

5.使用IP地址的最后一个字节扫描多台服务器

你可以简单的指定IP地址的最后一个字节来对多个IP地址进行扫描。

例如,我在下面执行中扫描了IP地址192.168.0.101,192.168.0.102和192.168.0.103。

1.[root@server1~]#nmap192.168.0.101,102,103

2.StartingNmap4.11(http:

//www.insecure.org/nmap/)at2013-11-1116:

09EST

3.Interestingportson(192.168.0.101):

4.Notshown:

1674closedports

5.PORTSTATESERVICE

6.22/tcpopenssh

7.80/tcpopenhttp

8.111/tcpopenrpcbind

9.957/tcpopenunknown

10.3306/tcpopenmysql

11.8888/tcpopensun-answerbook

12.MACAddress:

08:

00:

27:

D9:

8E:

D7(CadmusComputerSystems)

13.Nmapfinished:

3IPaddresses(1hostup)scannedin0.552seconds

14.Youhavenewmailin/var/spool/mail/root

6.从一个文件中扫描主机列表

如果你有多台主机需要扫描且所有主机信息都写在一个文件中,那么你可以直接让nmap读取该文件来执行扫描,让我们来看看如何做到这一点。

创建一个名为“nmaptest.txt”的文本文件,并定义所有你想要扫描的服务器IP地址或主机名。

1.[root@server1~]#cat>nmaptest.txt

2.localhost

3.

4.192.168.0.101

接下来运行带“iL”选项的nmap命令来扫描文件中列出的所有IP地址。

1.[root@server1~]#nmap-iLnmaptest.txt

2.StartingNmap4.11(http:

//www.insecure.org/nmap/)at2013-11-1810:

58EST

3.Interestingportsonlocalhost.localdomain(127.0.0.1):

4.Notshown:

1675closedports

5.PORTSTATESERVICE

6.22/tcpopenssh

7.25/tcpopensmtp

8.111/tcpopenrpcbind

9.631/tcpopenipp

10.857/tcpopenunknown

11.Interestingportson(192.168.0.101):

12.Notshown:

1674closedports

13.PORTSTATESERVICE

14.22/tcpopenssh

15.80/tcpopenhttp

16.111/tcpopenrpcbind

17.958/tcpopenunknown

18.3306/tcpopenmysql

19.8888/tcpopensun-answerbook

20.MACAddress:

08:

00:

27:

D9:

8E:

D7(CadmusComputerSystems)

21.Interestingportson(192.168.0.101):

22.Notshown:

1674closedports

23.PORTSTATESERVICE

24.22/tcpopenssh

25.80/tcpopenhttp

26.111/tcpopenrpcbind

27.958/tcpopenunknown

28.3306/tcpopenmysql

29.8888/tcpopensun-answerbook

30.MACAddress:

08:

00:

27:

D9:

8E:

D7(CadmusComputerSystems)

31.Nmapfinished:

3IPaddresses(3hostsup)scannedin2.047seconds

7.扫描一个IP地址范围

你可以在nmap执行扫描时指定IP范围。

1.[root@server1~]#nmap192.168.0.101-110

2.StartingNmap4.11(http:

//www.insecure.org/nmap/)at2013-11-1116:

09EST

3.Interestingportson(192.168.0.101):

4.Notshown:

1674closedports

5.PORTSTATESERVICE

6.22/tcpopenssh

7.80/tcpopenhttp

8.111/tcpopenrpcbind

9.957/tcpopenunknown

10.3306/tcpopenmysql

11.8888/tcpopensun-answerbook

12.MACAddress:

08:

00:

27:

D9:

8E:

D7(CadmusComputerSystems)

13.Nmapfinished:

10IPaddresses(1hostup)scannedin0.542seconds

8.排除一些远程主机后再扫描

在执行全网扫描或用通配符扫描时你可以使用“-exclude”选项来排除某些你不想要扫描的主机。

1.[root@server1~]#nmap192.168.0.*--exclude192.168.0.100

2.StartingNmap4.11(http:

//www.insecure.org/nmap/)at2013-11-1116:

16EST

3.Interestingportson(192.168.0.101):

4.Notshown:

1674closedports

5.PORTSTATESERVICE

6.22/tcpopenssh

7.80/tcpopenhttp

8.111/tcpopenrpcbind

9.957/tcpopenunknown

10.3306/tcpopenmysql

11.8888/tcpopensun-answerbook

12.MACAddress:

08:

00:

27:

D9:

8E:

D7(CadmusComputerSystems)

13.Nmapfinished:

255IPaddresses(1hostup)scannedin5.313seconds

14.Youhavenewmailin/var/spool/mail/root

9.扫描操作系统信息和路由跟踪

使用Nmap,你可以检测远程主机上运行的操作系统和版本。

为了启用操作系统和版本检测,脚本扫描和路由跟踪功能,我们可以使用NMAP的“-A“选项。

1.[root@server1~]#nmap-A192.168.0.101

2.StartingNmap4.11(http:

//www.insecure.org/nmap/)at2013-11-1116:

25EST

3.Interestingportson(192.168.0.101):

4.Notshown:

1674closedports

5.PORTSTATESERVICEVERSION

6.22/tcpopensshOpenSSH4.3(protocol2.0)

7.80/tcpopenhttpApachehttpd2.2.3((CentOS))

8.111/tcpopenrpcbind2(rpc#100000)

9.957/tcpopenstatus1(rpc#100024)

10.3306/tcpopenmysqlMySQL(unauthorized)

11.8888/tcpopenhttplighttpd1.4.32

12.MACAddress:

08:

00:

27:

D9:

8E:

D7(CadmusComputerSystems)

13.NoexactOSmatchesforhost(IfyouknowwhatOSisrunningonit,seehttp:

//www.insecure.org/cgi-bin/nmap-submit.cgi).

14.TCP/IPfingerprint:

15.SInfo(V=4.11%P=i686-redhat-linux-gnu%D=11/11%Tm=52814B66%O=22%C=1%M=080027)

16.TSeq(Class=TR%IPID=Z%TS=1000HZ)

17.T1(Resp=Y%DF=Y%W=16A0%ACK=S++%Flags=AS%Ops=MNNTNW)

18.T2(Resp=N)

19.T3(Resp=Y%DF=Y%W=16A0%ACK=S++%Flags=AS%Ops=MNNTNW)

20.T4(Resp=Y%DF=Y%W=0%ACK=O%Flags=R%Ops=)

21.T5(Resp=Y%DF=Y%W=0%ACK=S++%Flags=AR%Ops=)

22.T6(Resp=Y%DF=Y%W=0%ACK=O%Flags=R%Ops=)

23.T7(Resp=Y%DF=Y%W=0%ACK=S++%Flags=AR%Ops=)

24.PU(Resp=Y%DF=N%TOS=C0%IPLEN=164%RIPTL=148%RID=E%RIPCK=E%UCK=E%ULEN=134%DAT=E)

25.Uptime0.169days(sinceMonNov1112:

22:

152013)

26.Nmapfinished:

1IPaddress(1hostup)scannedin22.271seconds

从上面的输出你可以看到,Nmap显示出了远程主机操作系统的TCP/IP协议指纹,并且更加具体的显示出远程主机上的端口和服务。

10.启用Nmap的操作系统探测功能

使用选项“-O”和“-osscan-guess”也帮助探测操作系统信息。

1.[root@server1~]#nmap-Oserver2.tecmint.co

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 表格模板 > 合同协议

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1