We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent da0ad32 commit ea16b88Copy full SHA for ea16b88
setup/scan_network.sh
@@ -0,0 +1,6 @@
1
+#!/usr/bin/env bash
2
+tab=$'\t'
3
+pIF=$(echo "show State:/Network/Global/IPv4" | scutil | awk -F: '/PrimaryInterface/{sub(/ /,"",$2); print $2}')
4
+sn=$(ipconfig getifaddr $pIF | sed -En 's/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/p')
5
+for i in {1..254}; do ping -i0.1 -W100 -c1 $sn.$i | grep from; done
6
+arp -a | grep $pIF | sed -e 's/^\?/unnamed/' -e "s/\ at\ /${tab}/g" -e "s/\ on\ /${tab}/g" -e 's/\ ifscope.*$//g' | awk 'BEGIN { FS="\t"; OFS="\t"; printf "%-17s\t%-15s\t%s\n", "MAC","INTERFACE","HOSTNAME (IP)" } { if($2!="(incomplete)") {printf "%-17s\t%-15s\t%s\n",$2,$3,$1}}'
0 commit comments