進行區域網路 IP 掃描的工具
前言
身為資深自宅警備隊和居家網管工程師 (MIS),擁有數套好用的程式或工作流程是相當合情合理的事情。而在管理網路方面,掃描工具更是不可或缺的一份子,它除了可以直接顯示目前裝置的連接狀態之外,也能省去你各位登入分享器檢查 Log 檔的時間。
工具程式
Nmap
nmap -sn 192.168.1.0/24
Arp-scan
arp-scan --localnet
程式碼
需要 sudo 權限
#!/bin/bash
for ip in 192.168.1.{1..254}; do
sudo arp -d $ip > /dev/null 2>&1
ping -c 5 $ip > /dev/null 2>&1 &
done
wait
arp -n | grep -v incomplete
不用 sudo 權限
for ip in 192.168.1.{1..254}; do
ping -c 1 -W 1 $ip > /dev/null &
sleep 0.01
done
wait
ip neigh | grep -E 'REACHABLE|STALE|DELAY|PROBE'
留言
張貼留言
本站留言採審核發佈, 請耐心等候
圖片消失? 請關閉瀏覽器的擋廣告工具