Network Intel Script

I’ve known about GeekTool and it’s open source cousin, NerdTool since before I even switched from Windows to OS X. For some reason, I always stayed away. Perhaps it was terrible flashbacks to those desktop customization tools like StarDock which takes a professionally designed interface and lets people with no design sense remake their user interface in ways which bog down the system. So far, NerdTool has shown no signs of this nasty behavior.

I started considering using this tool after seeing that this really is the easiest way to confirm that your nightly SuperDuper! backup completed successfully. Getting this functionality takes a little bit of work (including a little work in the terminal) but it’s worth it. It’s great to grab a cup of coffee in the morning and see whether or not your overnight backup successfully completed.

Since I’d taken the plunge to start running NerdTool, I figured why not throw some other stuff together? You can be as minimal as simply printing the date and time on your desktop, get dangerously close to teetering over the edge by adding an image that changes the weather, or go overly geeky and just run top all the time.

Every time I connect to a network, I’d like to know a few things that are surprisingly difficult to display all at once in just about any operating system. Confirming my IP address is an obvious and anyone who has had to troubleshoot an internet connection can tell you that the address for the router is equally important. I take it one step further and like to know who else is sitting within striking distance of my computer.

The script below is pretty self evident but the script works by running a couple basic terminal commands, grabbing content from a static and predictable web page and displaying only the information for which you’re looking. I grabbed the actual syntax from a couple of easily found websites (just look for geektool scripts and you’ll find a bunch).

This goes one step further and performs a quick nmap ping sweep and pulls out the results.

echo “Network Intel”

myen0= ifconfig en0 | grep "inet " | grep -v | awk '{print $2}' if [ “$myen0” != “” ]
echo Hard Line : “$myen0”
echo “”
ifconfig en1 | grep "inet " | grep -v | awk '{print $2}' if [ “$myen1” != “” ]
echo “Wireless : $myen1”
echo “Wireless : INACTIVE”
netstat -nr | grep '^default' | awk '{print $2}' echo “AP :” “$myRouter”
curl -s | sed 's/[a-zA-Z<>/ :]//g'`
echo “External : $wip”
echo “——————————-”
echo “Nearby Machines”
echo “——————————-”
nmap -sP | awk ‘/report/ {print $5, $6}’
echo “——————————-“