Install rimudns
pip install rimudns
Grab the script from
https://github.com/zoltanf/Zonomi-Bind-Export
Install the required package
apt-get install python-requests
----------------------------------- export_all_zones python script
---------------------------------
#!/usr/bin/env python
import os
from rimudns import RimuDNS
api_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
dns = RimuDNS(api_key)
dns.use_zonomi()
for domain in dns.list_zones():
os.system("/media/nas-backup/scripts/export_bind.py " + api_key + " " + domain['name'])
---------------------------------
-- export_bind_py
---------------------------------
---------------------------------#!/usr/bin/env pythonimport reimport sysimport xml.etree.ElementTree as ETimport requestsfrom datetime import datetimetry:api_key = sys.argv[1]domain_name = sys.argv[2]except:print("Invalid arguments. Usage: export-bind.py ZONOMI-API-KEY domain.name")exit(13)# noinspection PyUnboundLocalVariablef = open("/media/nas-backup/zones/" + datetime.today().strftime('%Y-%m-%d') + "_" + domain_name + ".zone.txt", "w")r = requests.get("https://zonomi.com/app/dns/dyndns.jsp?action=QUERY&name=**.%s&api_key=%s" % (domain_name, api_key))root = ET.fromstring(r.content)actions = root.find("actions")action = actions.find("action")def isIpAddress(target):if re.match(r'^((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])$', target):return Trueelse:return Falsedef get_content_fqn(target):if isIpAddress(target):return targetelse:return target + "."for record in action.iter("record"):source_name = record.attrib.get("name")type = record.attrib.get("type")source_content = record.attrib.get("content")if source_name == domain_name:name = " "elif "." + domain_name in source_name:name = source_name.replace("." + domain_name, "")else:name = source_name + "."if type == "NS" or type == "SOA": continueif type == "CNAME":content = get_content_fqn(source_content)elif type == "MX":content = "%s\t%s" % (record.attrib.get("prio"), get_content_fqn(source_content))elif type == "TXT":content = "\"%s\"" % source_contentelse:content = get_content_fqn(source_content)f.write("%s\t%s\t%s\t%s\t%s\n" % (name,record.attrib.get("ttl").replace(" seconds", ""),"IN",type,content))print("Exporting record: %s " % record.attrib)