Vote
Bury
4
This uses a shell script to list your public facing IP addresses, as well as en0 (ethernet) and en1 (AirPort). For AirPort, if the system is connected to a network, it will also list the SSID.

The needed shell script is here:


#!/usr/bin/perl
# a little script to get your network status

$en0_info = `ifconfig en0 | grep "inet" | grep -v 127.0.0.1`;
$en1_info = `ifconfig en1 | grep "inet" | grep -v 127.0.0.1`;
$ext_info = `curl --silent http://checkip.dyndns.org | awk '{printf $6}' | cut -f 1 -d "<" | tr -d 'n'`;
$airport_network = `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | awk -F: '/ SSID/ {print $2}'`;

if($ext_info)
{
$output .= "External: $ext_info ";
}
else
{ $output .= "External: OFFLINE ";}


if($en0_info)
{
$en0_info =~ /inet (.*) netmask/s;
$output .= "Ethernet: $1 ";
}
else
{ $output .= "Ethernet: INACTIVE ";}


if($en1_info)
{
$en1_info =~ /inet (.*) netmask/s;
$en1_info = $1;
$output .= "Airport: $en1_info SSID: $airport_network ";
}
else
{ $output .= "Airport: INACTIVE ";}


print "$output";

Geeklet file(s) to download

IP-Status.glet

Either right-click and choose "Save Linked File As..." or hold the Option key and click to download files.
If using Safari, you may have to rename the files without the extra .txt extension that is added.

Comments


Written by sn00ze
213 days ago
where are the comments



Written by jkcolo22
182 days ago
Is this working for anyone? I did chmod +x then ran and get:

Joes-MBP:~ jkcolo22$ /Users/jkcolo22/scripts/IP-status.glet

/Users/jkcolo22/scripts/IP-status.glet: line 1: syntax error near unexpected token `newline'

/Users/jkcolo22/scripts/IP-status.glet: line 1: `'



Log in to comment or register here.