Created
September 14, 2021 11:53
-
-
Save nkpro2000sr/267dfa5ba619eab922a8c0f37cd1194c to your computer and use it in GitHub Desktop.
To submit a dynamic dns update request from shell. https://www.noip.com/ (To update IP of HOSTNAME, update will happen instantly)
This file contains 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
# {NO,Updatemy}IP | |
# https://www.noip.com/integrate/request | |
nouip () | |
{ | |
USER="" | |
PASSWORD="" | |
HOSTNAME="" | |
IP="" | |
for i in "$@" | |
do | |
case $i in | |
-u=*|--user=*) | |
USER="${i#*=}" | |
;; | |
-p=*|--password=*) | |
PASSWORD="${i#*=}" | |
;; | |
-pf=*|--passwdfile=*) | |
PASSWORD="$(cat ${i#*=})" | |
;; | |
-h=*|--hostname=*) | |
HOSTNAME="${i#*=}" | |
;; | |
-i=*|--ip=*) | |
IP="${i#*=}" | |
;; | |
*) | |
;; | |
esac | |
done | |
if [ -z "$USER" ] | |
then | |
read -p 'Username : ' USER | |
fi | |
if [ -z "$PASSWORD" ] | |
then | |
read -sp 'Password : ' PASSWORD | |
echo | |
fi | |
if [ -z "$HOSTNAME" ] | |
then | |
read -p 'Hostname : ' HOSTNAME | |
fi | |
if [ -z "$IP" ] | |
then | |
read -p 'IP : ' IP | |
fi | |
USERAGENT="--user-agent=\"nouip-shell-script-curl/1.0 nkpro2000sr@gist.github.com\"" | |
NOIPURL="https://$USER:$PASSWORD@dynupdate.no-ip.com/nic/update?hostname=$HOSTNAME&myip=$IP" | |
RESULT=$(curl --user-agent $NOIPUSERAGENT --silent $NOIPURL) | |
echo $? $RESULT | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OR DuckDNS https://www.duckdns.org/spec.jsp