Skip to content

Instantly share code, notes, and snippets.

@toolbear
Last active September 19, 2022 13:33
Embed
What would you like to do?
DNS zone file
// Hover.com "Zone file import/export" has been *Planned* since 2011
// https://help.hover.com/entries/471066-Zone-file-import-export
// Here's a brittle approximation of export.
//
// 1. login to your account: https://www.hover.com/domains
// 2. run the following in your browser's JavaScript console, changing the first line
// to your domain
// 3. copy the text logged to the console.
// 4. manually correct FQDNs, these have to end with a period "."
//
// If things go wrong a noisy error should appear in the console; JavaScript debugger might
// stop on the offending code.
var domain = 'tool-man.org'
$.ajax({ type:"GET", url:"/api/dns", success:function(response){
if (response.succeeded) {
var entries = _(response.domains).find(function(d) { return d.domain_name === domain }).entries
var records = _(entries).map(function(e) { return [e.name, 'IN', e.type, e.content].join(' ') })
var result = "$TTL 900\n" + records.join("\n")
console.log(result)
}
}})
$TTL 900
@ IN TXT v=spf1 include:_spf.google.com ~all
@ IN MX 1 ASPMX.L.GOOGLE.COM.
@ IN MX 5 ALT1.ASPMX.L.GOOGLE.COM.
@ IN MX 5 ALT2.ASPMX.L.GOOGLE.COM.
@ IN MX 10 ASPMX2.GOOGLEMAIL.COM.
@ IN MX 10 ASPMX3.GOOGLEMAIL.COM.
blog IN CNAME toolbear74.wordpress.com.
mail IN CNAME ghs.google.com.
sites IN CNAME ghs.google.com.
docs IN CNAME ghs.google.com.
calendar IN CNAME ghs.google.com.
smtp IN CNAME smtp.gmail.com.
tim IN CNAME toolbear.github.io.
boxen IN CNAME toolbear-boxen.herokuapp.com.
@ IN A 192.30.252.153
@ IN A 192.30.252.154
@ IN TXT keybase-site-verification=pcgVuIGYAkz2Nu5_YeDbzsvG-YiWgi3Ryz9RMlsWMsU
@fadookie
Copy link

fadookie commented Aug 5, 2015

Thanks! I was getting an error where it wasn't locating the domain object in the response, so I forked it and put in a dirty hack to just use the first domain it finds to get it working. 😄
https://gist.github.com/fadookie/300cedf98ca592628e9b

@kylehotchkiss
Copy link

Amazing. This worked like a charm.

@briankelly
Copy link

You rock. Thank you for posting this. Worked just fine for me, too. I copied the output from the console into my own .zone file and appended a period (.) to each line with a FQDN, same as shown in your example file.

@ehourigan
Copy link

Thanks!

@curtisspendlove
Copy link

This worked excellently, thanks! Very clever. ;)

@gmcz
Copy link

gmcz commented Nov 29, 2017

Thank you so much for writing this little script and sharing it, I really appreciate it.

@longda
Copy link

longda commented Dec 31, 2017

Thank you sir! :godmode::godmode::godmode:

@yood
Copy link

yood commented Jan 9, 2018

Much appreciated!

@siberian1967
Copy link

Years later this is still much appreciated. Thank you!

@espen
Copy link

espen commented Feb 15, 2021

2021 still works 🙏

@mustefa
Copy link

mustefa commented Apr 18, 2021

works. +1 what's up with hover.com?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment