Skip to content

Instantly share code, notes, and snippets.

@shao1555
Last active December 15, 2015 08:33
Show Gist options
  • Save shao1555/c4c4c9cd4707a37fd0b1 to your computer and use it in GitHub Desktop.
Save shao1555/c4c4c9cd4707a37fd0b1 to your computer and use it in GitHub Desktop.
Continuous shows WiFi connect information (OS X only)
while true
do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I |
ruby -e "
properties = {}
while line = STDIN.gets
match = line.match(/ *(.+): (.*)/)
key = match[1].strip
value = match[2].strip
properties[key.strip] = value.strip if match && key && value
end
out = []
%w(SSID BSSID channel MCS lastTxRate agrCtlRSSI agrCtlNoise).each do |field|
out << [field, properties[field]].join(': ')
end
puts %Q{#{Time.now.strftime('%Y-%m-%d %H:%M:%S')} #{out.join(%Q{\t})}}
"
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment