Linux 系统/网络管理员的前 32 个 Nmap 命令示例

[ad_1]

ñmap 是网络映射器的缩写。 它是用于网络探索、安全扫描和审计的开源安全工具。 但是,Nmap 命令带有许多选项,可以使该实用程序更加健壮且难以为新用户使用。 本指南的目的是向用户介绍 Nmap 命令行工具来扫描主机或网络以找出主机中可能存在的漏洞点。 您还将学习如何使用 Nmap 进行进攻和防御。 让我们看一些在 Linux 或类 Unix 系统上运行的常见 Nmap 命令示例。

Nmap 是什么,它的用途是什么?

从手册页:

Nmap(“Network Mapper”)是用于网络探索和安全审计的开源工具。 它旨在快速扫描大型网络,尽管它对单个主机运行良好。 Nmap 以新颖的方式使用原始 IP 数据包来确定网络上可用的主机、这些主机提供的服务(应用程序名称和版本)、它们运行的​​操作系统(和操作系统版本)、数据包过滤器/防火墙的类型正在使用中,以及其他数十种特性。 虽然 Nmap 通常用于安全审计,但许多系统和网络管理员发现它对于网络清单、管理服务升级计划以及监控主机或服务正常运行时间等日常任务很有用。

它最初由 Gordon Lyon 编写,可以轻松回答以下问题:

  1. 在本地网络上查找正在运行的计算机
  2. 您发现哪些 IP 地址在本地网络上运行?
  3. 发现目标机器的操作系统
  4. 找出您刚刚扫描的机器上打开了哪些端口?
  5. 查看系统是否感染了恶意软件或病毒。
  6. 在您的网络上搜索未经授权的服务器或网络服务。
  7. 找到并删除不符合组织最低安全级别的计算机。

Linux 和 Unix 中的 Nmap 命令示例 – 示例设置 (LAB)

在某些司法管辖区,端口扫描可能是非法的。 所以设置一个实验室如下:

                              +---------+
        +---------+           | Network |         +--------+
        | server1 |-----------+ swtich  +---------|server2 |
        +---------+           | (sw0)   |         +--------+
                              +----+----+
                                   | 
                                   |
                         +---------+----------------+
                         | wks01 Linux/macOS/Win    |
                         +--------------------------+

在哪里,

  • wks01 是运行 Linux/macOS (OS X) 或类 Unix 操作系统的计算机。 它用于扫描您的本地网络。 nmap 命令必须安装在这台计算机上。
  • server1 可以由 Linux / Unix / MS-Windows 操作系统驱动。 这是未打补丁的服务器。 随意安装一些服务,例如网络服务器、文件服务器等。
  • server2 可以由 Linux / Unix / MS-Windows 操作系统驱动。 这是一个带有防火墙的完全修补的服务器。 同样,请随意安装一些服务,例如 Web 服务器、文件服务器等。
  • 所有三个系统都通过交换机连接。

如何在 Linux 上安装 nmap?

看:

  1. Debian / Ubuntu Linux:安装用于扫描网络的 nmap 软件
  2. CentOS / RHEL:安装 nmap 网络安全扫描器
  3. OpenBSD:安装 nmap 网络安全扫描器

1.使用nmap扫描单个主机或IP地址(IPv4)

### Scan a single ip address ###
nmap 192.168.1.1
 
## Scan a host name ###
nmap server1.cyberciti.biz
 
## Scan a host name with more info###
nmap -v server1.cyberciti.biz

Fig.01: nmap output

2.扫描多个IP地址或子网(IPv4)

nmap 192.168.1.1 192.168.1.2 192.168.1.3
## works with same subnet i.e. 192.168.1.0/24 
nmap 192.168.1.1,2,3

您也可以扫描 IP 地址范围:

nmap 192.168.1.1-20

您可以使用通配符扫描 IP 地址范围:

nmap 192.168.1.*

最后,扫描整个子网:

nmap 192.168.1.0/24

3. 从文件中读取主机/网络列表(IPv4)

-iL 选项允许您使用文本文件读取目标系统列表。 这对于扫描大量主机/网络很有用。 创建一个文本文件,如下所示:
cat > /tmp/test.txt

附加名称如下:

server1.cyberciti.biz
192.168.1.0/24
192.168.1.1/24
10.1.2.3
localhost

语法如下:

nmap -iL /tmp/test.txt

4. 从 nmap 扫描示例中排除主机/网络(IPv4)

扫描大量主机/网络时,您可以从扫描中排除主机:

nmap 192.168.1.0/24 --exclude 192.168.1.5
nmap 192.168.1.0/24 --exclude 192.168.1.5,192.168.1.254

或从名为 /tmp/exclude.txt 的文件中排除列表

nmap -iL /tmp/scanlist.txt --excludefile /tmp/exclude.txt

5.用nmap开启操作系统和版本检测扫描脚本(IPv4)

nmap -A 192.168.1.254
nmap -v -A 192.168.1.1
nmap -A -iL /tmp/scanlist.txt 

6. 使用 namp 命令查看主机/网络是否受防火墙保护

## nmap command examples for your host ##
nmap -sA 192.168.1.254
nmap -sA server1.cyberciti.biz

7. 受防火墙保护时扫描主机

在这个 Nmap 命令示例中,我们将扫描 IP 为 192.168.1.1 的路由器/wifi 设备:

nmap -PN 192.168.1.1
nmap -PN server1.cyberciti.biz

8. 扫描 IPv6 主机/地址示例

-6 选项使用namp 命令启用IPv6 扫描。 语法是:

nmap -6 IPv6-Address-Here
nmap -6 server1.cyberciti.biz
nmap -6 2607:f0d0:1002:51::4
nmap -v A -6 2607:f0d0:1002:51::4

9. 扫描网络并找出哪些服务器和设备已启动并正在运行

这称为主机发现或 ping 扫描:

nmap -sP 192.168.1.0/24

这是它的外观:

Host 192.168.1.1 is up (0.00035s latency).
MAC Address: BC:AE:C5:C3:16:93 (Unknown)
Host 192.168.1.2 is up (0.0038s latency).
MAC Address: 74:44:01:40:57:FB (Unknown)
Host 192.168.1.5 is up.
Host nas03 (192.168.1.12) is up (0.0091s latency).
MAC Address: 00:11:32:11:15:FC (Synology Incorporated)
Nmap done: 256 IP addresses (4 hosts up) scanned in 2.80 second

10.如何使用namp进行快速扫描?

nmap -F 192.168.1.1
nmap -6 -F IPv6_Address_Here

Practical Examples of NMAP Commands for Linux System

11. 显示端口处于特定状态的原因

nmap --reason 192.168.1.1
nmap --reason server1.cyberciti.biz

输出:

Starting Nmap 7.80 ( https://nmap.org ) at 2020-05-07 21:16 IST
Nmap scan report for router (192.168.2.254)
Host is up, received arp-response (0.00026s latency).
Not shown: 995 filtered ports
Reason: 995 no-responses
PORT    STATE SERVICE REASON
22/tcp  open  ssh     syn-ack ttl 64
53/tcp  open  domain  syn-ack ttl 64
80/tcp  open  http    syn-ack ttl 64
443/tcp open  https   syn-ack ttl 64
666/tcp open  doom    syn-ack ttl 64
MAC Address: 00:08:A2:0D:05:41 (ADI Engineering)
 
Nmap done: 1 IP address (1 host up) scanned in 4.85 seconds

12. 在 Linux 中使用 nmap 命令仅显示打开(或可能打开)的端口

跑:

nmap --open 192.168.1.1
nmap --open server1.cyberciti.biz
nmap --open 192.168.2.18

从我的 CentOS 7 Linux 服务器扫描输出:

Starting Nmap 7.80 ( https://nmap.org ) at 2020-05-07 21:17 IST
Nmap scan report for centos7 (192.168.2.18)
Host is up (0.00015s latency).
Not shown: 998 filtered ports, 1 closed port
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
PORT   STATE SERVICE
22/tcp open  ssh
MAC Address: 00:01:C0:1B:28:7E (CompuLab)
 
Nmap done: 1 IP address (1 host up) scanned in 5.07 seconds

13.显示所有发送和接收的数据包

nmap --packet-trace 192.168.1.1
nmap --packet-trace server1.cyberciti.biz

14. 显示主机接口和路由

这对于调试很有用(ip 命令或 route 命令或 netstat 命令,如 Linux 上使用 nmap 命令的输出)

nmap --iflist

Namp 命令创建的详细报告:

Starting Nmap 5.00 ( https://nmap.org ) at 2012-11-27 02:01 IST
************************INTERFACES************************
DEV    (SHORT)  IP/MASK          TYPE        UP MAC
lo     (lo)     127.0.0.1/8      loopback    up
eth0   (eth0)   192.168.1.5/24   ethernet    up B8:AC:6F:65:31:E5
vmnet1 (vmnet1) 192.168.121.1/24 ethernet    up 00:50:56:C0:00:01
vmnet8 (vmnet8) 192.168.179.1/24 ethernet    up 00:50:56:C0:00:08
ppp0   (ppp0)   10.1.19.69/32    point2point up
 
**************************ROUTES**************************
DST/MASK         DEV    GATEWAY
10.0.31.178/32   ppp0
209.133.67.35/32 eth0   192.168.1.2
192.168.1.0/0    eth0
192.168.121.0/0  vmnet1
192.168.179.0/0  vmnet8
169.254.0.0/0    eth0
10.0.0.0/0       ppp0
0.0.0.0/0        eth0   192.168.1.2

15. 如何使用 nmap 扫描特定端口?

nmap -p [port] hostName
## Scan port 80
nmap -p 80 192.168.1.1
 
## Scan TCP port 80
nmap -p T:80 192.168.1.1
 
## Scan UDP port 53
nmap -p U:53 192.168.1.1
 
## Scan two ports ##
nmap -p 80,443 192.168.1.1
 
## Scan port ranges ##
nmap -p 80-200 192.168.1.1
 
## Combine all options ##
nmap -p U:53,111,137,T:21-25,80,139,8080 192.168.1.1
nmap -p U:53,111,137,T:21-25,80,139,8080 server1.cyberciti.biz
nmap -v -sU -sT -p U:53,111,137,T:21-25,80,139,8080 192.168.1.254
 
## Scan all ports with * wildcard ##
nmap -p "*" 192.168.1.1
 
## Scan top ports i.e. scan $number most common ports ##
nmap --top-ports 5 192.168.1.1
nmap --top-ports 10 192.168.1.1

示例输出:

Starting Nmap 5.00 ( https://nmap.org ) at 2012-11-27 01:23 IST
Interesting ports on 192.168.1.1:
PORT     STATE  SERVICE
21/tcp   closed ftp
22/tcp   open   ssh
23/tcp   closed telnet
25/tcp   closed smtp
80/tcp   open   http
110/tcp  closed pop3
139/tcp  closed netbios-ssn
443/tcp  closed https
445/tcp  closed microsoft-ds
3389/tcp closed ms-term-serv
MAC Address: BC:AE:C5:C3:16:93 (Unknown)
 
Nmap done: 1 IP address (1 host up) scanned in 0.51 seconds

16:扫描所有设备/计算机以查找开放端口的最快方法

nmap -T5 192.168.1.0/24
nmap -T5 {sub/net}

17.如何借助nmap检测远程操作系统?

您可以使用 -O 选项识别远程主机应用程序和操作系统:

nmap -O 192.168.1.1
nmap -O  --osscan-guess 192.168.1.1
nmap -v -O --osscan-guess 192.168.1.1

示例输出:

Starting Nmap 5.00 ( https://nmap.org ) at 2012-11-27 01:29 IST
NSE: Loaded 0 scripts for scanning.
Initiating ARP Ping Scan at 01:29
Scanning 192.168.1.1 [1 port]
Completed ARP Ping Scan at 01:29, 0.01s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 01:29
Completed Parallel DNS resolution of 1 host. at 01:29, 0.22s elapsed
Initiating SYN Stealth Scan at 01:29
Scanning 192.168.1.1 [1000 ports]
Discovered open port 80/tcp on 192.168.1.1
Discovered open port 22/tcp on 192.168.1.1
Completed SYN Stealth Scan at 01:29, 0.16s elapsed (1000 total ports)
Initiating OS detection (try #1) against 192.168.1.1
Retrying OS detection (try #2) against 192.168.1.1
Retrying OS detection (try #3) against 192.168.1.1
Retrying OS detection (try #4) against 192.168.1.1
Retrying OS detection (try #5) against 192.168.1.1
Host 192.168.1.1 is up (0.00049s latency).
Interesting ports on 192.168.1.1:
Not shown: 998 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http
MAC Address: BC:AE:C5:C3:16:93 (Unknown)
Device type: WAP|general purpose|router|printer|broadband router
Running (JUST GUESSING) : Linksys Linux 2.4.X (95%), Linux 2.4.X|2.6.X (94%), MikroTik RouterOS 3.X (92%), Lexmark embedded (90%), Enterasys embedded (89%), D-Link Linux 2.4.X (89%), Netgear Linux 2.4.X (89%)
Aggressive OS guesses: OpenWrt White Russian 0.9 (Linux 2.4.30) (95%), OpenWrt 0.9 - 7.09 (Linux 2.4.30 - 2.4.34) (94%), OpenWrt Kamikaze 7.09 (Linux 2.6.22) (94%), Linux 2.4.21 - 2.4.31 (likely embedded) (92%), Linux 2.6.15 - 2.6.23 (embedded) (92%), Linux 2.6.15 - 2.6.24 (92%), MikroTik RouterOS 3.0beta5 (92%), MikroTik RouterOS 3.17 (92%), Linux 2.6.24 (91%), Linux 2.6.22 (90%)
No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=5.00%D=11/27%OT=22%CT=1%CU=30609%PV=Y%DS=1%G=Y%M=BCAEC5%TM=50B3CA
OS:4B%P=x86_64-unknown-linux-gnu)SEQ(SP=C8%GCD=1%ISR=CB%TI=Z%CI=Z%II=I%TS=7
OS:)OPS(O1=M2300ST11NW2%O2=M2300ST11NW2%O3=M2300NNT11NW2%O4=M2300ST11NW2%O5
OS:=M2300ST11NW2%O6=M2300ST11)WIN(W1=45E8%W2=45E8%W3=45E8%W4=45E8%W5=45E8%W
OS:6=45E8)ECN(R=Y%DF=Y%T=40%W=4600%O=M2300NNSNW2%CC=N%Q=)T1(R=Y%DF=Y%T=40%S
OS:=O%A=S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%R
OS:D=0%Q=)T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%W=
OS:0%S=A%A=Z%F=R%O=%RD=0%Q=)T7(R=N)U1(R=Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID
OS:=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N%T=40%CD=S)
Uptime guess: 12.990 days (since Wed Nov 14 01:44:40 2012)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=200 (Good luck!)
IP ID Sequence Generation: All zeros
Read data files from: /usr/share/nmap
OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 12.38 seconds
           Raw packets sent: 1126 (53.832KB) | Rcvd: 1066 (46.100KB)

另请参阅对 Web 服务器和 dns 服务器命令行工具进行指纹识别以获取更多信息。

18. 如何检测远程服务(服务器/守护进程)的版本号?

打开终端,然后键入以下 nmap 命令:

nmap -sV 192.168.1.1

示例输出:

Starting Nmap 5.00 ( https://nmap.org ) at 2012-11-27 01:34 IST
Interesting ports on 192.168.1.1:
Not shown: 998 closed ports
PORT   STATE SERVICE VERSION
22/tcp open  ssh     Dropbear sshd 0.52 (protocol 2.0)
80/tcp open  http?
1 service unrecognized despite returning data.

19. 使用 TCP ACK (PA) 和 TCP Syn (PS) ping 扫描主机

如果防火墙阻止标准 ICMP ping,请尝试以下主机发现方法:

nmap -PS 192.168.1.1
nmap -PS 80,21,443 192.168.1.1
nmap -PA 192.168.1.1
nmap -PA 80,21,200-512 192.168.1.1

20.使用IP协议ping扫描主机

nmap -PO 192.168.1.1

21. 使用 UDP ping 扫描主机

此扫描绕过仅筛选 TCP 的防火墙和过滤器:

nmap -PU 192.168.1.1
nmap -PU 2000.2001 192.168.1.1

22. 使用 TCP SYN Scan 找出最常用的 TCP 端口

### Stealthy scan ###
nmap -sS 192.168.1.1
 
### Find out the most commonly used TCP ports using  TCP connect scan (warning: no stealth scan)
###  OS Fingerprinting ###
nmap -sT 192.168.1.1
 
### Find out the most commonly used TCP ports using TCP ACK scan
nmap -sA 192.168.1.1
 
### Find out the most commonly used TCP ports using TCP Window scan
nmap -sW 192.168.1.1
 
### Find out the most commonly used TCP ports using TCP Maimon scan
nmap -sM 192.168.1.1

23.扫描主机的UDP服务(UDP扫描)

Internet 上大多数流行的服务都通过 TCP 协议运行。 DNS、SNMP 和 DHCP 是三种最常见的 UDP 服务。 使用以下语法查找 UDP 服务:

nmap -sU nas03
nmap -sU 192.168.1.1

示例输出:

Starting Nmap 5.00 ( https://nmap.org ) at 2012-11-27 00:52 IST
Stats: 0:05:29 elapsed; 0 hosts completed (1 up), 1 undergoing UDP Scan
UDP Scan Timing: About 32.49% done; ETC: 01:09 (0:11:26 remaining)
Interesting ports on nas03 (192.168.1.12):
Not shown: 995 closed ports
PORT     STATE         SERVICE
111/udp  open|filtered rpcbind
123/udp  open|filtered ntp
161/udp  open|filtered snmp
2049/udp open|filtered nfs
5353/udp open|filtered zeroconf
MAC Address: 00:11:32:11:15:FC (Synology Incorporated)
 
Nmap done: 1 IP address (1 host up) scanned in 1099.55 seconds

24.扫描IP协议

这种类型的扫描允许您确定目标机器支持哪些 IP 协议(​​TCP、ICMP、IGMP 等):

nmap -sO 192.168.1.1

25.扫描防火墙的安全漏洞

以下扫描类型利用了 TCP 中的一个细微漏洞,有利于测试常见攻击的安全性:

## TCP Null Scan to fool a firewall to generate a response ##
## Does not set any bits (TCP flag header is 0) ##
nmap -sN 192.168.1.254
 
## TCP Fin scan to check firewall ##
## Sets just the TCP FIN bit ##
nmap -sF 192.168.1.254
 
## TCP Xmas scan to check firewall ##
## Sets the FIN, PSH, and URG flags, lighting the packet up like a Christmas tree ##
nmap -sX 192.168.1.254

了解如何使用 iptables 阻止 Xmas packkets、syn-floods 和其他骗子攻击。

26. 扫描防火墙寻找数据包碎片

-f 选项使请求的扫描(包括 ping 扫描)使用微小的分段 IP 数据包。 这个想法是将 TCP 标头拆分为
几个数据包,以使数据包过滤器、入侵检测系统和其他烦恼更难检测到您在做什么。

nmap -f 192.168.1.1
nmap -f fw2.nixcraft.net.in
nmap -f 15 fw2.nixcraft.net.in

## Set your own offset size with the --mtu option ##
nmap --mtu 32 192.168.1.1

27.用诱饵掩盖扫描

-D 选项向远程主机显示,您指定为诱饵的主机也在扫描目标网络。 因此,他们的 IDS 可能会报告来自唯一 IP 地址的 5-10 个端口扫描,但他们不知道哪个 IP 正在扫描它们,哪些是无辜的诱饵:

nmap -n -Ddecoy-ip1,decoy-ip2,your-own-ip,decoy-ip3,decoy-ip4 remote-host-ip
nmap -n -D192.168.1.5,10.5.1.2,172.1.2.4,3.4.2.1 192.168.1.5

28.扫描防火墙MAC地址欺骗

### Spoof your MAC address ##
nmap --spoof-mac MAC-ADDRESS-HERE 192.168.1.1
 
### Add other options ###
nmap -v -sT -PN --spoof-mac MAC-ADDRESS-HERE 192.168.1.1
 
 
### Use a random MAC address ###
### The number 0, means nmap chooses a completely random MAC address ###
nmap -v -sT -PN --spoof-mac 0 192.168.1.1

29. 如何将输出保存到文本文件?

语法是:

nmap 192.168.1.1 > output.txt
nmap -oN /path/to/filename 192.168.1.1
nmap -oN output.txt 192.168.1.1

30. 扫描网络服务器和管道进入 Nikto 进行扫描

nmap -p80 192.168.1.2/24 -oG - | /path/to/nikto.pl -h -
nmap -p80,443 192.168.1.2/24 -oG - | /path/to/nikto.pl -h -

31.加速nmap

将 -T 选项传递给 nmap 命令:
nmap -v -sS -A -T4 192.168.2.5

示例输出:

Starting Nmap 7.40 ( https://nmap.org ) at 2017-05-15 01:52 IST
NSE: Loaded 143 scripts for scanning.
NSE: Script Pre-scanning.
Initiating NSE at 01:52
Completed NSE at 01:52, 0.00s elapsed
Initiating NSE at 01:52
Completed NSE at 01:52, 0.00s elapsed
Initiating ARP Ping Scan at 01:52
Scanning 192.168.2.15 [1 port]
Completed ARP Ping Scan at 01:52, 0.01s elapsed (1 total hosts)
Initiating SYN Stealth Scan at 01:52
Scanning dellm6700 (192.168.2.15) [1000 ports]
Discovered open port 5900/tcp on 192.168.2.15
Discovered open port 80/tcp on 192.168.2.15
Discovered open port 22/tcp on 192.168.2.15
Completed SYN Stealth Scan at 01:53, 4.62s elapsed (1000 total ports)
Initiating Service scan at 01:53
Scanning 3 services on dellm6700 (192.168.2.15)
Completed Service scan at 01:53, 6.01s elapsed (3 services on 1 host)
Initiating OS detection (try #1) against dellm6700 (192.168.2.15)
Retrying OS detection (try #2) against dellm6700 (192.168.2.15)
NSE: Script scanning 192.168.2.15.
Initiating NSE at 01:53
Completed NSE at 01:53, 30.02s elapsed
Initiating NSE at 01:53
Completed NSE at 01:53, 0.00s elapsed
Nmap scan report for dellm6700 (192.168.2.15)
Host is up (0.00044s latency).
Not shown: 996 filtered ports
PORT     STATE  SERVICE VERSION
22/tcp   open   ssh     (protocol 2.0)
| fingerprint-strings: 
|   NULL: 
|_    SSH-2.0-OpenSSH_7.4p1 Ubuntu-10
| ssh-hostkey: 
|   2048 1d:14:84:f0:c7:21:10:0e:30:d9:f9:59:6b:c3:95:97 (RSA)
|_  256 dc:59:c6:6e:33:33:f2:d2:5d:9b:fd:b4:9c:52:c1:0a (ECDSA)
80/tcp   open   http    nginx 1.10.0 (Ubuntu)
| http-methods: 
|_  Supported Methods: GET HEAD
|_http-server-header: nginx/1.10.0 (Ubuntu)
|_http-title: Apache2 Ubuntu Default Page: It works
443/tcp  closed https
5900/tcp open   vnc     VNC (protocol 3.7)
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port22-TCP:V=7.40%I=7%D=5/15%Time=5918BCAA%P=x86_64-apple-darwin16.3.0%
SF:r(NULL,20,"SSH-2.0-OpenSSH_7.4p1x20Ubuntu-10n");
MAC Address: F0:1F:AF:1F:2C:60 (Dell)
Device type: general purpose
Running (JUST GUESSING): Linux 3.X|4.X|2.6.X (95%), OpenBSD 4.X (85%)
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:2.6.32 cpe:/o:openbsd:openbsd:4.0
Aggressive OS guesses: Linux 3.11 - 4.1 (95%), Linux 4.4 (95%), Linux 3.13 (92%), Linux 4.0 (90%), Linux 2.6.32 (89%), Linux 2.6.32 or 3.10 (89%), Linux 3.2 - 3.8 (89%), Linux 3.10 - 3.12 (88%), Linux 2.6.32 - 2.6.33 (87%), Linux 2.6.32 - 2.6.35 (87%)
No exact OS matches for host (test conditions non-ideal).
Uptime guess: 0.000 days (since Mon May 15 01:53:08 2017)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=252 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE
HOP RTT     ADDRESS
1   0.44 ms dellm6700 (192.168.2.15)

NSE: Script Post-scanning.
Initiating NSE at 01:53
Completed NSE at 01:53, 0.00s elapsed
Initiating NSE at 01:53
Completed NSE at 01:53, 0.00s elapsed
Read data files from: /usr/local/bin/../share/nmap
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 46.02 seconds
           Raw packets sent: 2075 (95.016KB) | Rcvd: 50 (3.084KB)

32. 不喜欢namp命令行工具?

到目前为止,我们已经看到了使用 Linux 和 Unix 命令行选项的 Nmap 命令示例。 然而,并不是每个人都对 CLI 感到非常满意。 因此,我们可以使用名为 禅图,这是官方的网络映射器前端/GUI工具:

Zenmap 是官方的 Nmap 安全扫描器 GUI。 它是一个多平台(Linux、Windows、Mac OS X、BSD 等)的免费开源应用程序,旨在使 Nmap 易于初学者使用,同时为有经验的 Nmap 用户提供高级功能。 经常使用的扫描可以保存为配置文件,以便于重复运行。 命令创建器允许交互式创建 Nmap 命令行。 扫描结果可以保存并在以后查看。 保存的扫描结果可以相互比较,看看它们有何不同。 最近扫描的结果存储在可搜索的数据库中。

您可以使用以下 apt-get 命令或 apt 命令安装 zenmap:
$ sudo apt-get install zenmap

示例输出:

[sudo] password for vivek: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  zenmap
0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
Need to get 616 kB of archives.
After this operation, 1,827 kB of additional disk space will be used.
Get:1 https://debian.osuosl.org/debian/ squeeze/main zenmap amd64 5.00-3 [616 kB]
Fetched 616 kB in 3s (199 kB/s)                       
Selecting previously deselected package zenmap.
(Reading database ... 281105 files and directories currently installed.)
Unpacking zenmap (from .../zenmap_5.00-3_amd64.deb) ...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Processing triggers for man-db ...
Setting up zenmap (5.00-3) ...
Processing triggers for python-central ...

键入以下命令以启动 zenmap:
$ sudo zenmap

样本输出

Fig.02: zenmap in action

如何在 Linux 和 Unix/BSD 服务器上检测和阻止端口扫描?

尝试以下资源:

  1. 如何使用psad工具实时检测和拦截端口扫描攻击。
  2. Debian / Ubuntu Linux:安装和配置海岸线防火墙(Shorewall)。
  3. CentOS / Redhat iptables 防火墙配置教程。
  4. Linux:新系统管理员的 20 个 Iptables 示例。
  5. 20 个 Linux 服务器强化安全提示。

结论

在本指南中,您了解了 Nmap 命令以及许多适用于 Linux 的示例以及各种示例的用法。 还要检查 nmap 命令手册页,使用 人命令
man nmap

请参阅以下资源以获取更多信息:

Nmap 命令有更多选项,请通过手册页或文档了解更多信息。 你最喜欢的 Nmap 命令行技巧有哪些? 在下面的评论中分享您最喜欢的提示、技巧和建议。

[ad_2]

Related Posts