Last active
January 11, 2016 10:45
-
-
Save oldsharp/6c172a48134be0f439aa to your computer and use it in GitHub Desktop.
Dynamic DNS POST request that matches the API provided by Google Domains
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
#!/bin/sh | |
# | |
# Construct a Dynamic DNS POST request that matches Google Domains' API. | |
# The final URL format should looks like: | |
# https://username:password@domains.google.com/nic/update?hostname=subdomain.yourdomain.com&myip=1.2.3.4 | |
# See https://support.google.com/domains/answer/6147083 | |
# | |
# Author: Ray Chen <oldsharp@gmail.com> | |
# License: Public Domain | |
# According to the document, we must set a user agent in our request. | |
# Below is an example for a true user agent(Chrome v45.0.2454.85 on | |
# GNU/Linux). | |
UAGENT='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36' | |
# We _must_ fetch our "true" public IP first in case of we may need to | |
# send a POST request via proxy. | |
PUBLIC_IP=$(dig +short myip.opendns.com @resolver1.opendns.com) | |
# Edit these three lines below to fit your demand. | |
UNAME='ddns_username_provided_by_google_domains' | |
PASSWD='ddns_password_provided_by_google_domains' | |
HOST='ddns.example.TLD' | |
proxychains4 curl --data "hostname=${HOST}&myip=${PUBLIC_IP}" \ | |
--user-agent "${UAGENT}" \ | |
https://${UNAME}:${PASSWD}@domains.google.com/nic/update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment