Skip to content

Instantly share code, notes, and snippets.

@FarFetchd
Created February 27, 2019 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FarFetchd/7863e36685d0a5695a0d79196cbf982b to your computer and use it in GitHub Desktop.
Save FarFetchd/7863e36685d0a5695a0d79196cbf982b to your computer and use it in GitHub Desktop.
Super simple bash dynamic DNS
# Client side (sender of their own IP), sending to port 1234
MYPUBIP=`curl https://canihazip.com/s` 2>/dev/null
echo "supersecretpassword$MYPUBIP" | nc domain.name.or.ip.of.receiver.com 1234
# Server side (receiver/displayer of the IP), listening on port 1234
while true ; do
nc -l 1234 | grep supersecretpassword | sed "s/supersecretpassword/At `date` the IP was: /"
done >>wherever_you_want_to_save_the_ip_history.txt
@FarFetchd
Copy link
Author

Whoops, didn't occur to me when date would be evaluated. That substitution should be done in a followup line.

@FarFetchd
Copy link
Author

And the 2>/dev/null should go inside the `` !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment