Jump to content

IP Address Workflow


Recommended Posts

First workflow, and first upload.

 

There are no external requirements. Simple script is included.  This should print (in Large type window) your current IP addresses on "normal" interfaces, or it will say 'down' or 'invalid'.

 

Improvements certainly welcome!

 

Launch by typing "ipstat" into Alfred.

 

I created this so I could quickly see my IP addresses from anywhere in OS X without using the mouse.

 

Download here

Edited by dlacaille
Link to comment

Thanks for this workflow I modified it a bit:

 

1.  One of my ethernet addresses did not start with a number so your grep was removing it.

2.  I added the name of the device next to the 

3.  Removed displaying interfaces that do not have an ip address

4.  Added displaying the public facing ip address

INTERFACES=$(networksetup -listallhardwareports | grep -B 2 "Ethernet Address: [a-f]*" | grep -v -E '(Ethernet|\-\-)' | cut -d":" -f2 | paste -s -d" " -)

# Parse through interfaces
for interface in $INTERFACES
do
	CMD_OUT=$(ifconfig $interface inet 2>&1 | grep -v -E '(option|flags)' | cut -d" " -f2)
	if [ -z $CMD_OUT ]; then
		error=""
	else
		if [ $CMD_OUT = "interface" ]; then
			error=""
		else
			echo "$(networksetup -listallhardwareports | grep -B 1 "Device: $interface" | grep "Hardware Port" | cut -d":" -f2) ($interface) $CMD_OUT"
		fi
	fi
done
echo " Public Facing $(dig +short myip.opendns.com @resolver1.opendns.com)"
Edited by scottfwalter
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...