Nmap

nmap 主機發現以獲取 MAC 地址

  • May 30, 2020

我注意到nmap -sn不再提供遠端主機的 MAC 地址,如我可以使用 nmap 發現 IP 和 MAC 地址嗎?

我想得到類似netdiscover輸出的東西。僅 IP 和 MAC 地址。

Nmap 7.80 版

wolf@linux:~$ nmap -V
Nmap version 7.80 ( https://nmap.org )
Platform: x86_64-pc-linux-gnu

例如

wolf@linux:~$ nmap -sn -oG - 10.10.10.*
# Nmap 7.80 scan initiated Wed May 20 12:38:57 2020 as: nmap -sn -oG - 10.10.10.*
Host: 10.10.10.1 () Status: Up
Host: 10.10.10.2 () Status: Up
Host: 10.10.10.3 () Status: Up
# Nmap done at Wed May 20 12:38:59 2020 -- 256 IP addresses (3 hosts up) scanned in 2.25 seconds
wolf@linux:~$ 

-oG -首先,如果使用(即使使用 root/sudo),您將無法看到 MAC 地址。

user@linux:~$ sudo nmap -n -sn 10.10.10.* -oG -
# Nmap 7.60 scan initiated Sat May 29 12:10:09 2020 as: nmap -n -sn -oG - 10.10.10.*
Host: 10.10.10.1 () Status: Up
Host: 10.10.10.2 () Status: Up
Host: 10.10.10.3 () Status: Up
# Nmap done at Sat May 29 12:10:11 2020 -- 256 IP addresses (3 hosts up) scanned in 2.31 seconds
user@linux:~$ 

2、即使-oG -刪除後,仍然看不到MAC地址。

user@linux:~$ nmap -n -sn 10.10.10.*

Starting Nmap 7.60 ( https://nmap.org ) at 2020-05-29 12:11 +00
Nmap scan report for 10.10.10.1
Host is up (0.00086s latency).
Nmap scan report for 10.10.10.2
Host is up (0.0020s latency).
Nmap scan report for 10.10.10.3
Host is up (0.00082s latency).
Nmap done: 256 IP addresses (3 hosts up) scanned in 2.71 seconds
user@linux:~$ 

以 root 或 sudo 執行它,以便 nmap 可以發送原始數據包以獲取遠端 MAC

user@linux:~$ sudo nmap -n -sn 10.10.10.*

Starting Nmap 7.60 ( https://nmap.org ) at 2020-05-29 12:11 +00
Nmap scan report for 10.10.10.2
Host is up (0.00022s latency).
MAC Address: AA:AA:AA:AA:AA:02 (NIC manufacturer here)
Nmap scan report for 10.10.10.1
Host is up (-0.100s latency).
MAC Address: AA:AA:AA:AA:AA:01 (NIC manufacturer here)
Nmap scan report for 10.10.10.3
Host is up (0.00061s latency).
MAC Address: AA:AA:AA:AA:AA:03 (NIC manufacturer here)
Nmap done: 256 IP addresses (4 hosts up) scanned in 3.60 seconds
user@linux:~$ 

引用自:https://serverfault.com/questions/1017959