arp-scan
Display hosts on local network using ARP packets.
Installation
sudo apt install -y arp-scan
Usage
Quick usage
sudo arp-scan --localnet
Scan specific network
sudo arp-scan 192.168.1.0/24
Advance use
while read -r LINE ; do
if [ -z "${LINE}" ] ; then
break;
fi
echo "${LINE}"
done < <( sudo arp-scan --localnet | grep -v '^Interface: ' | grep -v '^Ending arp-scan ' | grep -v '^Starting arp-scan ' )
Display all hosts IP, Mac Address, full hostname and description in markdown table.
function arp_scan_markdown {
local ip=
local mac=
local desc=
while read -r ip mac desc ; do
if [ -z "${ip}" ] ; then
break;
fi
hostname="$( nslookup "${ip}" | grep ' = ' | cut -d '=' -f2 )"
printf "| %s\t | %s | %s\t | %s |\n" "${ip}" "${mac}" "${hostname%.}" "${desc}"
done < <( sudo arp-scan --localnet | grep -v '^Interface: ' | grep -v '^Ending arp-scan ' | grep -v '^Starting arp-scan ' )
}
# Display arp-scan result in markdown format.
arp_scan_markdown