Created
September 5, 2019 00:38
-
-
Save cod1ingcoding/0a178cb79cb486d45f8b257b8a850d85 to your computer and use it in GitHub Desktop.
get all ip mac pairs in current lan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ip_prefix=192.168.1 | |
for((i = 1; i < 255; i++)) | |
do | |
ip=${ip_prefix}.${i} | |
ping $ip -c 2 | |
arp -a | grep "(${ip})" | grep -E [0-9a-f]{2}:[0-9a-f]{2} >> ~/ip-mac-pairs.txt | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment