#!/bin/sh
# Kulverstukas, http://newage.ql.lt/ ;; evilzone.org
# 2011
OS=`uname`
LocalIP=""
ExternIP="External IP: Unable to retrieve"
case $OS in Linux) LocalIP="Local IP   : "`ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`;;
            FreeBSD|OpenBSD) LocalIP="Local IP: "`ifconfig  | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}'` ;;
            SunOS) LocalIP="Local IP   : "`ifconfig -a | grep inet | grep -v '127.0.0.1' | awk '{ print $2} '` ;;
            *) LocalIP="Local IP   : Unable to retrieve";;
esac

ExternIP="External IP: "`wget -qO- http://icanhazip.com`

echo "$LocalIP"
echo "$ExternIP"
