Created
December 9, 2012 14:24
-
-
Save mralexgray/4245196 to your computer and use it in GitHub Desktop.
dns.he.net BASH update script
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 | |
# Hurricane Electric dynamic dns update script by Paul Fertser | |
# When in doubt, install Live HTTP Headers extension for Firefox and | |
# compare the POST requests | |
# specify your external interface | |
wan_iface=eth1 | |
# set your HE login credentials | |
login=myhelogin | |
password=myhepassword | |
domain=mydomain.info | |
# zoneid and recordid can be easily obtained by looking at the | |
# html source of the page with the list of records on the web-interface | |
zoneid=846761 | |
recordid=88994497 | |
current_ip=`ip a s dev $wan_iface | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | head -n 1` | |
cookies=/tmp/he-cookies.txt | |
curl -k --cookie-jar $cookies https://dns.he.net/ -o /dev/null | |
curl -k --cookie $cookies --cookie-jar $cookies --data "email=$login&pass=$password&submit=Login%21" https://dns.he.net/ -o /dev/null | |
curl -k --cookie /tmp/he-cookies.txt --data "account=&menu=edit_zone&Type=A&hosted_dns_zoneid=$zoneid&hosted_dns_recordid=$recordid&hosted_dns_editzone=1&Priority=-&Name=$domain&Content=$current_ip&TTL=60&hosted_dns_editrecord=Update" "https://dns.he.net/?hosted_dns_zoneid=$zoneid&menu=edit_zone&hosted_dns_editzone" -o /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment