38 lines
1.0 KiB
Bash
38 lines
1.0 KiB
Bash
#!/bin/bash
|
|
|
|
WIFI_MAC=$(/usr/sbin/networksetup -listallhardwareports | awk '/Wi-Fi/{getline; getline; print $NF}')
|
|
|
|
if [ ! -z "$WIFI_MAC" ]; then
|
|
echo "<result>WiFi $WIFI_MAC</result>"
|
|
else
|
|
echo "<result>Not Available</result>"
|
|
fi
|
|
|
|
|
|
TBOLT_MAC=$(/usr/sbin/networksetup -listallhardwareports | awk '/Thunderbolt Ethernet/{getline; getline; print $NF}')
|
|
|
|
if [ ! -z "$TBOLT_MAC" ]; then
|
|
echo "<result>Ethernet $TBOLT_MAC</result>"
|
|
else
|
|
echo "<result>Not Available</result>"
|
|
fi
|
|
|
|
|
|
TBOLT_MAC_Dell=$(/usr/sbin/networksetup -listallhardwareports | awk '/Dell Universal Dock D6000/{getline; getline; print $NF}')
|
|
|
|
if [ ! -z "$TBOLT_MAC_Dell" ]; then
|
|
echo "<result>Dell $TBOLT_MAC_Dell</result>"
|
|
else
|
|
echo "<result>Not Available</result>"
|
|
fi
|
|
|
|
PORT=$(networksetup -listallhardwareports | awk '/Device: en/{print $NF}' | sort | sed -n 2p)
|
|
|
|
if [ ! -z "$PORT" ]; then
|
|
MACADD=$(ifconfig "$PORT" | awk '/ether/{print $2}' | tr '[a-z]' '[A-Z]')
|
|
else
|
|
MACADD=$(ifconfig en0 | awk '/ether/{print $2}' | tr '[a-z]' '[A-Z]')
|
|
fi
|
|
|
|
echo "<result>Secondary MAC Address $MACADD</result>"
|