Created
February 27, 2019 00:25
-
-
Save FarFetchd/7863e36685d0a5695a0d79196cbf982b to your computer and use it in GitHub Desktop.
Super simple bash dynamic DNS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
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
Whoops, didn't occur to me when
date
would be evaluated. That substitution should be done in a followup line.