YAZONG 我的开源

nmap网络安全扫描工具

  , , ,
0 评论0 浏览

Nmap是一个用于网络探索和安全审计的开源工具。它被设计用来快速扫描大型网络,尽管它在单主机上运行良好。

Nmap支持在Windows、Unix/Linux以及MAC OS平台下运行。它的设计目标是快速地扫描大型网络,当然用它扫描单个主机也没有问题。Nmap以新颖的方式使用原始IP报文来发现网络上有哪些主机、那些主机提供什么服务(应用程序名和版本)、那些服务运行在什么操作系统(包括版本信息)、它们使用什么类型的报文过滤器/防火墙,以及一堆其它功能。

NMAP是一款流行的网络扫描和嗅探工具也是一个强大的端口扫描类安全测评工具,被广泛应用在安全扫描,nmap是一个好用的网络工具,在生产和开发中也经常用到,主要做端口开放性检测和局域网信息的查看收集等,不同Linux发行版包管理中一般也带有nmap工具。


官网下载源码包进行编译安装

[https://namp.org/](https://namp.org/)

http://www.nmap.com.cn/

root@yalong-:~# apt-get install nmap

root@yalong:~# man nmap

root@yalong:~# nmap --help

针对本机进行扫描,检测开放了哪些常用的TCP端口、UDP端口

root@yalong:~# nmap 127.0.0.1

 

Starting Nmap 7.60 ( https://nmap.org ) at 2021-02-10 14:43 CST

Nmap scan report for localhost (127.0.0.1)

Host is up (0.000032s latency).

Not shown: 998 closed ports

PORT    STATE SERVICE

22/tcp  open  ssh

631/tcp open  ipp

 

Nmap done: 1 IP address (1 host up) scanned in 1.69 seconds

扫描结果中,STATE列若为 open 则表示开放状态,为 filtered 表示可能被防火墙过滤,为 closed 表示端口为关闭状态。

 

检测网段中哪些主机提供FTP服务

root@yalong:~# nmap -p 21 192.168.1.0/24

 

Starting Nmap 7.60 ( https://nmap.org ) at 2021-02-10 14:50 CST

Nmap scan report for _gateway (192.168.1.1)

Host is up (0.0042s latency).

 

PORT   STATE  SERVICE

21/tcp closed ftp

MAC Address: YY (Huawei Technologies)

 

Nmap scan report for 192.168.1.2

Host is up (0.047s latency).

 

PORT   STATE    SERVICE

21/tcp filtered ftp

MAC Address: XX (Tp-link Technologies)

 

Nmap scan report for 192.168.1.7

Host is up (0.071s latency).

 

PORT   STATE  SERVICE

21/tcp closed ftp

MAC Address: ZZ (Unknown)

 

Nmap scan report for peer1 (192.168.1.6)

Host is up (0.000050s latency).

 

PORT   STATE  SERVICE

21/tcp closed ftp

 

Nmap done: 256 IP addresses (4 hosts up) scanned in 60.62 seconds

 

 

快速检测网段中有哪些存活主机(能 ping 通)

root@yalong:~# nmap -n -sP 192.168.1.0/24

 

Starting Nmap 7.60 ( https://nmap.org ) at 2021-02-10 14:50 CST

Nmap scan report for 192.168.1.1

Host is up (0.0077s latency).

MAC Address: YY (Huawei Technologies)

Nmap scan report for 192.168.1.2

Host is up (0.0077s latency).

MAC Address: XX (Tp-link Technologies)

Nmap scan report for 192.168.1.7

Host is up (0.0083s latency).

MAC Address: ZZ (Unknown)

Nmap scan report for 192.168.1.6

Host is up.

Nmap done: 256 IP addresses (4 hosts up) scanned in 26.91 seconds

 

 

 

检测IP地址位于192.168.1.5~7 的主机是否开启文件共享

root@yalong-:# nmap -p 139,445 192.168.1.5-7

 

Starting Nmap 7.60 ( https://nmap.org ) at 2021-02-10 14:50 CST

Nmap scan report for peer1 (192.168.1.6)

Host is up (0.00014s latency).

 

PORT    STATE  SERVICE

139/tcp closed netbios-ssn

445/tcp closed microsoft-ds

 

Nmap done: 3 IP addresses (1 host up) scanned in 0.77 seconds

 

 

下面,nmap工具的基本用法:

扫描特定主机:

root@yalong-:# nmap 192.168.1.6

Starting Nmap 7.60 ( https://nmap.org ) at 2021-02-10 14:53 CST

Nmap scan report for peer1 (192.168.1.6)

Host is up (0.000018s latency).

Not shown: 999 closed ports

PORT   STATE SERVICE

22/tcp open  ssh

Nmap done: 1 IP address (1 host up) scanned in 1.67 seconds

 

 

扫描整个子网:

root@yalong-:~# nmap 192.168.1.1/24

Starting Nmap 7.60 ( https://nmap.org ) at 2021-02-10 14:53 CST

Nmap scan report for _gateway (192.168.1.1)

Host is up (0.0070s latency).

Not shown: 996 closed ports

PORT   STATE    SERVICE

22/tcp filtered ssh

23/tcp filtered telnet

53/tcp open     domain

80/tcp open     http

MAC Address: AA (Huawei Technologies)

 

Nmap scan report for 192.168.1.2

Host is up (0.0067s latency).

All 1000 scanned ports on 192.168.1.2 are filtered

MAC Address: ZZ (Tp-link Technologies)

 

Nmap scan report for 192.168.1.7

Host is up (0.014s latency).

Not shown: 999 closed ports

PORT      STATE SERVICE

62078/tcp open  iphone-sync

MAC Address: XX (Unknown)

 

Nmap scan report for peer1 (192.168.1.6)

Host is up (0.000041s latency).

Not shown: 999 closed ports

PORT   STATE SERVICE

22/tcp open  ssh

 

Nmap done: 256 IP addresses (4 hosts up) scanned in 150.95 seconds

 

 

 

扫描多个目标:

root@yalong-:~# nmap 192.168.1.6 192.168.1.7

Starting Nmap 7.60 ( https://nmap.org ) at 2021-02-10 14:54 CST

Nmap scan report for peer1 (192.168.1.6)

Host is up (0.000019s latency).

Not shown: 999 closed ports

PORT   STATE SERVICE

22/tcp open  ssh

Nmap done: 2 IP addresses (1 host up) scanned in 2.15 seconds

 

 

扫描一个范围内主机:

#nmap 192.168.1.1-10 (扫描IP地址为192.168.1.1-192.168.1.10内的所有主机)

root@yalong-:# nmap 192.168.1.1-10

 

Starting Nmap 7.60 ( https://nmap.org ) at 2021-02-10 14:54 CST

Nmap scan report for 192.168.1.2

Host is up (0.036s latency).

All 1000 scanned ports on 192.168.1.2 are filtered

MAC Address: ZZ (Tp-link Technologies)

 

Nmap scan report for peer1 (192.168.1.6)

Host is up (0.000030s latency).

Not shown: 999 closed ports

PORT   STATE SERVICE

22/tcp open  ssh

Nmap done: 10 IP addresses (2 hosts up) scanned in 39.80 seconds

 

 

向目标发送两个ping数据包:

root@yalong-:# nmap -sn -PE 2 --send-ip 192.168.1.6

Starting Nmap 7.60 ( https://nmap.org ) at 2021-02-10 14:55 CST

Nmap scan report for peer1 (192.168.1.6)

Host is up.

Nmap done: 2 IP addresses (1 host up) scanned in 2.10 seconds

 

 


标题:nmap网络安全扫描工具
作者:yazong
地址:https://blog.llyweb.com/articles/2021/02/10/1612943553219.html