{"id":7,"date":"2008-03-24T19:16:12","date_gmt":"2008-03-25T01:16:12","guid":{"rendered":"http:\/\/xux.in\/blog\/post\/ip-updater-for-editdnsnet\/"},"modified":"2008-12-18T19:07:44","modified_gmt":"2008-12-19T01:07:44","slug":"ip-updater-for-editdnsnet","status":"publish","type":"post","link":"http:\/\/xux.in\/blog\/post\/ip-updater-for-editdnsnet\/","title":{"rendered":"IP updater for EditDNS.net"},"content":{"rendered":"<p>As anyone know (and should know) <a href=\"http:\/\/www.editdns.net\">EditDNS<\/a> it&#8217;s the best alternative for DNS Management and the best of all it is FREE \ud83d\ude09<\/p>\n<p>Here I wrote\/adapted some code which will allow you to update your dynamic IP through EditDNS&#8217;s API.<\/p>\n<p>Requirements:<\/p>\n<ul>\n<li>You need to <a href=\"http:\/\/www.editdns.net\/?site=register\">register<\/a> first! (duh)<\/li>\n<li><a href=\"http:\/\/www.editdns.net\/?site=donate\">Donations<\/a> are optional, but if it makes your life easier you should consider it and you&#8217;ll also get more services.<\/li>\n<li>Perl!<\/li>\n<\/ul>\n<p>File: editdns.pl<\/p>\n<pre lang=\"perl\">#!\/usr\/bin\/perl\r\n\r\nuse strict;\r\n\r\n## Configure ONLY this 2 variables\r\nmy $editdns_pass   = \"a\"; # put your password\r\nmy $editdns_record = \"b\"; # put the record you wish to update\r\n\r\n## ###############\r\n## Nothing else should be changed unless you know what to do\r\n## ###############\r\n\r\nmy $host = \"DynDNS.EditDNS.net\";\r\nmy $port = 80;\r\nmy $editdns_post = \"p=$editdns_pass&r=$editdns_record\";\r\n\r\nmy $editdns_req = join(\"\",\r\n  \"POST \/api\/dynLinux.php HTTP\/1.0\\r\\n\",\r\n  \"Host: $host:$port\\r\\n\",\r\n  \"User-Agent: EditDNS Browser 0.1\\r\\n\",\r\n  \"Referer: http:\/\/www.editdns.net\\r\\n\",\r\n  \"Content-Type: application\/x-www-form-urlencoded\\r\\n\",\r\n  \"Content-Length: \".length($editdns_post).\"\\r\\n\\r\\n\",\r\n  \"$editdns_post\\n\"\r\n);\r\n\r\nmy $hostaddr = (gethostbyname($host))[4] || &error(\"Couldn't get IP for $host\");\r\nmy $remotehost= pack('S n a4 x8',2,$port,$hostaddr);\r\nsocket(S,2,1,6) || &error(\"Couldn't create socket\");\r\nconnect(S,$remotehost) || &error(\"Couldn't connect to $host:$port\");\r\nselect((select(S),$|=1)[0]);\r\nprint S $editdns_req;\r\nvec(my $rin='',fileno(S),1)= 1 ;\r\nselect($rin,undef,undef,60) || &error(\"No response from $host:$port\");\r\nundef($\/);\r\nclose(S);\r\nprint \"[DONE]\\n\";\r\nexit;\r\n\r\nsub error {\r\n        print \"[ERROR] $_[0]\\n\";\r\n        exit;\r\n}<\/pre>\n<p>Next and once you have configured the script:<\/p>\n<pre lang=\"bash\">chmod +x editdns.pl\r\npico \/etc\/crontab\r\n# Add editdns.pl to execute every 15 minutes\r\n*\/15 * * * * root \/path\/editdns.pl > \/dev\/null 2>&1<\/pre>\n<p>Do not set intervals lower than 15 minutes, since it can be considered as an abuse and you&#8217;ll get banned.<\/p>\n<p>Part of this code was taken from <a href=\"http:\/\/jmarshall.com\/\">James Marshal<\/a>, happy coding!<\/p>\n<p><strong>*** If you are looking for SSL support and multiple records you might want to check <a href=\"http:\/\/xux.in\/blog\/post\/php-editdns-updater-for-linux\/\">http:\/\/xux.in\/blog\/post\/php-editdns-updater-for-linux\/<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As anyone know (and should know) EditDNS it&#8217;s the best alternative for DNS Management and the best of all it is FREE \ud83d\ude09 Here I wrote\/adapted some code which will allow you to update your dynamic IP through EditDNS&#8217;s API. Requirements: You need to register first! (duh) Donations are optional, but if it makes your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,8,5],"tags":[18,4],"class_list":["post-7","post","type-post","status-publish","format-standard","hentry","category-code","category-linux","category-software","tag-editdns","tag-perl"],"_links":{"self":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts\/7","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/comments?post=7"}],"version-history":[{"count":4,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts\/7\/revisions"}],"predecessor-version":[{"id":61,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts\/7\/revisions\/61"}],"wp:attachment":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/media?parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/categories?post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/tags?post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}