因树莓派 mac
地址以 B8:27:EB
开头
第一种方法
故结合 awk
运行命令:
sudo nmap -sP 192.168.5.0/24 | awk '/Nmap scan/{ip=$NF;next}ip && /B8:27:EB/{print ip, $3}'
返回:
192.168.5.60 B8:27:EB:84:**:**
192.168.5.69 B8:27:EB:B4:**:**
192.168.5.93 B8:27:EB:BB:**:**
192.168.5.129 B8:27:EB:41:**:**
192.168.5.183 B8:27:EB:16:**:**
192.168.5.216 B8:27:EB:EE:**:**
后 2 个字节已隐藏
第二种方法
通过 arp
命令
扫描速度更快
$ arp -na | grep -i b8:27:eb
? (192.168.5.69) at b8:27:eb:b4:**:** [ether] on enp1s0
? (192.168.5.60) at b8:27:eb:84:**:** [ether] on enp1s0
? (192.168.5.211) at b8:27:eb:43:**:** [ether] on enp1s0
? (192.168.5.93) at b8:27:eb:bb:**:** [ether] on enp1s0
? (192.168.5.183) at b8:27:eb:16:**:** [ether] on enp1s0
? (192.168.5.216) at b8:27:eb:ee:**:** [ether] on enp1s0
? (192.168.5.129) at b8:27:eb:41:**:** [ether] on enp1s0