Alfred IP Lookup
The snippet can be accessed without any authentication.
Authored by
Erick Hitter
IP_Address_v1.2.1.alfredworkflow
- Modified from http://dferg.us/ip-address-workflow/ to return IPv4 and IPv6 separately
- Reorder with external IPs first as they're more often what I need
LOCAL=$(ifconfig | grep -A 1 "en" | grep broadcast | cut -d " " -f 2 | tr "\\n" " ")
EXTERNAL=$(curl --silent http://whatismyip.akamai.com)
EXTERNAL6=$(curl --silent http://ipv6.whatismyip.akamai.com)
cat<<EOB
<?xml version="1.0"?>
<items>
<item uid="externalip" arg="$EXTERNAL">
<title>External IPv4: $EXTERNAL</title>
<subtitle>Press Enter to paste, or Cmd+C to copy</subtitle>
<icon>icon.png</icon>
</item>
<item uid="externalip6" arg="$EXTERNAL6">
<title>External IPv6: $EXTERNAL</title>
<subtitle>Press Enter to paste, or Cmd+C to copy</subtitle>
<icon>icon.png</icon>
</item>
<item uid="localip" arg="$LOCAL">
<title>Local IP: $LOCAL</title>
<subtitle>Press Enter to paste, or Cmd+C to copy</subtitle>
<icon>icon.png</icon>
</item>
</items>
EOB
Please register or sign in to comment