Skip to content

Instantly share code, notes, and snippets.

@LeSpocky
Created July 3, 2013 11:40
Show Gist options
  • Save LeSpocky/5917224 to your computer and use it in GitHub Desktop.
Save LeSpocky/5917224 to your computer and use it in GitHub Desktop.
Get outside IPv4 address and echo a line for adding to some poor mans database for later analyzation.
#!/bin/sh
UTCNOW=$(date -u +%s)
CURRENTIP=$(wget -q -O - checkip.dyndns.com | sed -e 's/^.*<body>\(.*\)<\/body>.*$/\1/' | cut -f2 -d: | tr -d [:space:])
echo "${UTCNOW},${CURRENTIP}"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment