Skip to content

Instantly share code, notes, and snippets.

@windows98SE
Last active August 29, 2015 13:59
Show Gist options
  • Save windows98SE/10971224 to your computer and use it in GitHub Desktop.
Save windows98SE/10971224 to your computer and use it in GitHub Desktop.
ip
#!/bin/bash
tor_network=`curl --silent --socks5-hostname 127.0.0.1:9015 http://reip.stephack.com | awk '{print $1}'`
if [[ $tor_network =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]
then
echo "TOR >> $tor_network"
else
echo "NO TOR CONNECTION"
fi
external=`curl --silent http://reip.stephack.com | awk '{print $1}'`
if [[ $external =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]
then
echo "External >> $external"
else
echo "NO INTERNET CONNECTION"
fi
wifi_network=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | awk -F: '/ SSID: / {print $2}' | sed -e 's/SSID: //' | sed -e 's/ //'`
en0=`ifconfig en0 | grep "broadcast" | awk '{print $2}'`
if [[ $en0 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]
then
echo "Wireless >> $en0 (ssid:$wifi_network)"
else
echo "NO Wireless CONNECTION"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment