Пример #1
0
def main():
    api_url, username, password = get_account_data(True)
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    print prettyprint.contacts(inwx_conn.contact.list()['contact'])
    print prettyprint.nameserversets(inwx_conn.nameserverset.list()['nsset'])
    print "\nRegister a new domain\n"
    domainname = raw_input('New Domain [e.g. example.com]: ')
    check = inwx_conn.domain.check({'domain': domainname})
    if check['domain'][0]['status'] == 'free':
        if raw_input(
                "The domain %s is available. Do you want to register now? [yes/no]: "
                % domainname) != 'yes':
            return
        registrant_id = int(
            raw_input(
                'Please give the ID for the registrant and admin contact [e.g. 1023532]: '
            ))
        admin_id = registrant_id
        tech_id, billing_id = 1, 1
        nameservers = ['ns.inwx.de', 'ns2.inwx.de', 'ns3.inwx.de']
        reg_result = inwx_conn.domain.create({
            'domain': domainname,
            'registrant': registrant_id,
            'admin': admin_id,
            'tech': tech_id,
            'billing': billing_id,
            'ns': nameservers
        })
        if reg_result == None:
            print "Successfully registered the domain."
    else:
        print "Sorry, the domain %s is not available anymore." % domainname
        print "The current status of the domain is '%s'." % check['domain'][0][
            'status']
def main():
    api_url, username, password = get_account_data(True)
    backup_files = get_nsbackup_files(True)
    if 'pickle_backup_file' in backup_files.keys():
        from pickle import Pickler
    if 'json_backup_file' in backup_files.keys():
        import json
    # Instantiate the inwx class (does not connect yet but dispatches calls to domrobot objects with the correct API URL
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    # get the list of all domains:
    domains = inwx_conn.nameserver.list()['domains']
    # get all the nameserver entries for each domain
    current, total = 0, len(domains)
    nsentries = dict()
    for domain in domains:
        current += 1
        domain = domain['domain']
        print "%i of %i - Currently backing up %s." % (current, total, domain)
        nsentries[domain] = inwx_conn.nameserver.info({'domain': domain})['record']
    if 'pickle_backup_file' in backup_files.keys():
        Pickler(open(backup_files['pickle_backup_file'],'wb')).dump(nsentries)
        print "Wrote backup file using Python Module Pickle : %s." % backup_files['pickle_backup_file']
    if 'json_backup_file' in backup_files.keys():
        json.dump(nsentries, open(backup_files['json_backup_file'], 'w'))
        print "Wrote backup file using Python Module JSON: %s." % backup_files['json_backup_file']
def main():
    api_url, username, password = get_account_data(True)
    invoices_folder = get_invoices_folder(True)
    # Instantiate the inwx class (does not connect yet but dispatches calls to domrobot objects with the correct API URL
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    # get the list of all invoices up to now
    invoices = inwx_conn.accounting.listInvoices()
    # download each invoice (if not already downloaded)
    current, total = 0, invoices['count']
    if total > 0: print "Saving the %i invoices to %s" % (total, invoices_folder)
    for invoice in invoices['invoice']:
        current += 1
        id = invoice['invoiceId']
        date = invoice['date']
        amount_after_tax = invoice['afterTax']
        amount_before_tax = invoice['preTax']
        type = invoice['type']
        filename = "%s_%.2f_%s.pdf" % (date, amount_before_tax, id)
        full_path = invoices_folder + '/' + filename
        if isfile(full_path):
            print "%i of %i - Invoice %s (%s) already downloaded and saved to %s" % (current, total, id, date, filename)
        else:
            print "%i of %i - Currently fetching invoice %s (%s) and saving to %s..." % (current, total, id, date, filename)
            invoice_data = inwx_conn.accounting.getInvoice({'invoiceid': id})
            with open(full_path, "wb") as handle:
                handle.write(invoice_data['pdf'].data)
def main():
    api_url, username, password = get_account_data(True)
    backup_files = get_nsbackup_files(True)
    if 'pickle_backup_file' in backup_files.keys():
        from pickle import Pickler
    if 'json_backup_file' in backup_files.keys():
        import json
    # Instantiate the inwx class (does not connect yet but dispatches calls to domrobot objects with the correct API URL
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    # get the list of all domains:
    domains = inwx_conn.nameserver.list()['domains']
    # get all the nameserver entries for each domain
    current, total = 0, len(domains)
    nsentries = dict()
    for domain in domains:
        current += 1
        domain = domain['domain']
        print "%i of %i - Currently backing up %s." % (current, total, domain)
        nsentries[domain] = inwx_conn.nameserver.info({'domain':
                                                       domain})['record']
    if 'pickle_backup_file' in backup_files.keys():
        Pickler(open(backup_files['pickle_backup_file'], 'wb')).dump(nsentries)
        print "Wrote backup file using Python Module Pickle : %s." % backup_files[
            'pickle_backup_file']
    if 'json_backup_file' in backup_files.keys():
        json.dump(nsentries, open(backup_files['json_backup_file'], 'w'))
        print "Wrote backup file using Python Module JSON: %s." % backup_files[
            'json_backup_file']
def main():
    api_url, username, password = get_account_data(True)
    domain, subdomain, _ = get_domain_update(True)

    # Instantiate the inwx class (does not connect yet but dispatches calls to domrobot objects with the correct API URL
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    nsentries = inwx_conn.nameserver.info({'domain': domain})

    # Filter entries for subdomain
    nsentries = [
        record for record in nsentries['record'] if subdomain == record['name']
    ]

    assert nsentries, "Subdomain %s not in list of nameserver entries." % subdomain

    # There may be multiple entries for one subdomain, one for each type (A, AAAA, ...)
    for record in nsentries:
        record_type = record['type']  # A, AAAA
        assert record_type in record_type_to_api, "Unsupported record type: %s" % record_type

        new_ip = get_ip(record_type_to_api[record_type])
        if new_ip:
            print "Updating %s record of %s from %s to %s" % (
                record_type, record['name'], record['content'], new_ip)
            inwx_conn.nameserver.updateRecord({
                'id': record['id'],
                'content': new_ip,
                'ttl': 3600
            })
Пример #6
0
def main():
    api_url, username, password = get_account_data(True)
    invoices_folder = get_invoices_folder(True)
    # Instantiate the inwx class (does not connect yet but dispatches calls to domrobot objects with the correct API URL
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    # get the list of all invoices up to now
    invoices = inwx_conn.accounting.listInvoices()
    # download each invoice (if not already downloaded)
    current, total = 0, invoices['count']
    if total > 0:
        print "Saving the %i invoices to %s" % (total, invoices_folder)
    for invoice in invoices['invoice']:
        current += 1
        id = invoice['invoiceId']
        date = invoice['date']
        amount_after_tax = invoice['afterTax']
        amount_before_tax = invoice['preTax']
        type = invoice['type']
        filename = "%s_%.2f_%s.pdf" % (date, amount_before_tax, id)
        full_path = invoices_folder + '/' + filename
        if isfile(full_path):
            print "%i of %i - Invoice %s (%s) already downloaded and saved to %s" % (
                current, total, id, date, filename)
        else:
            print "%i of %i - Currently fetching invoice %s (%s) and saving to %s..." % (
                current, total, id, date, filename)
            invoice_data = inwx_conn.accounting.getInvoice({'invoiceid': id})
            with open(full_path, "wb") as handle:
                handle.write(invoice_data['pdf'].data)
def update_dns(new_ip):
    record_types = ['A', 'AAAA']

    api_url, username, password = get_account_data(True, config_file)
    domain, subdomain, _ = get_domain_update(True, config_file)

    # Instantiate the inwx class (does not connect yet but dispatches calls to domrobot objects with the correct API URL
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    nsentries = inwx_conn.nameserver.info({'domain': domain})

    # Filter entries for subdomain
    records = [record for record in nsentries['record'] if subdomain == record['name']]

    if not records:
	status = "404 Failed"
	return "Subdomain {0} not in list of nameserver entries".format(subdomain), status

    for record in records:
        record_type = record['type']
	if record_type not in record_types:
	    status = "404 Failed"
            return "Unsupported record type: {0}".format(record_type), status
        
	if new_ip != record['content']:
	    try:
	        inwx_conn.nameserver.updateRecord({'id': record['id'], 'content': new_ip, 'ttl': 3600})
    		status = "200 OK"
                return "Updating record {0} from {1} to {2}".format(record['name'], record['content'], new_ip), status
	    except Exception as e:
	        status = "404 Failed"
                return "Failed {0} record of {1} from {2} to {3}::::{4}".format(record_type, record['name'], record['content'], new_ip, e.message), status
	else:
	     status = "200 OK"
             return "Same IP", status
def main():
    username = raw_input("Please enter your user name: ")
    password = getpass.getpass("Please enter your password: "******"Please enter the domain name: ")

    site_verification =  raw_input("Please enter the site verification code: ")

    # verification
    inwx_conn.nameserver.createRecord({'domain':domainname, 'type':'TXT', 'content':site_verification})

    # mx records
    inwx_conn.nameserver.createRecord({'domain':domainname, 'type':'MX', 'prio':1, 'content':'ASPMX.L.GOOGLE.COM'})
    inwx_conn.nameserver.createRecord({'domain':domainname, 'type':'MX', 'prio':5, 'content':'ALT1.ASPMX.L.GOOGLE.COM'})
    inwx_conn.nameserver.createRecord({'domain':domainname, 'type':'MX', 'prio':5, 'content':'ALT2.ASPMX.L.GOOGLE.COM'})
    inwx_conn.nameserver.createRecord({'domain':domainname, 'type':'MX', 'prio':10, 'content':'ASPMX2.GOOGLEMAIL.COM'})
    inwx_conn.nameserver.createRecord({'domain':domainname, 'type':'MX', 'prio':10, 'content':'ASPMX3.GOOGLEMAIL.COM'})

    inwx_conn.nameserver.createRecord({'domain':domainname, 'type':'CNAME', 'name':'mail', 'content':'ghs.google.com'})

    dkim_name =  raw_input("Please enter the dkim name : ")
    dkim_data =  raw_input("Please enter the dkim record : ")

    # dkim
    inwx_conn.nameserver.createRecord({'domain':domainname, 'type':'TXT', 'name':dkim_name, 'content':dkim_data})
Пример #9
0
def main():
    api_url, username, password = get_account_data(True)
    inwx_conn = domrobot(api_url, False)
    loginRet = inwx_conn.account.login({'lang': 'en', 'user': username, 'pass': password})

    domain = "mydomain.com"
    checkRet = inwx_conn.domain.check({'domain': domain})
    print prettyprint.domain_check(checkRet)
def main():
    api_url, username, password = get_account_data(True)
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    print prettyprint.contacts(inwx_conn.contact.list()['contact'])
    print "\nCreate a new contact\n"
    type = raw_input('Type [PERSON, ORG or ROLE]: ')
    name = raw_input('Prename and Surname: ')
    street, city, postal_code, country_code = raw_input('Street: '), raw_input('City: '), raw_input('Postal Code [60438]: '), raw_input('Country Code [de]: ')
    phone, email = raw_input('Phone [+49.123123123]: '), raw_input('E-Mail: ')
    print inwx_conn.contact.create({'type': type, 'name': name, 'street': street, 'city': city, 'pc': postal_code, 'cc': country_code, 'voice': phone, 'email': email})
def main():
    api_url, username, password = get_account_data(True)
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    print prettyprint.domains(inwx_conn.nameserver.list()['domains'])
    # get the list of all domains:
    domains = inwx_conn.nameserver.list()['domains']
    for domain in domains:
        domain = domain['domain']
        print "Logs for domain %s:" % domain
        print prettyprint.domain_log(inwx_conn.domain.log({'domain': domain})['domain'])
Пример #12
0
def main():
    api_url, username, password = get_account_data(True)
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    print prettyprint.domains(inwx_conn.nameserver.list()['domains'])
    # get the list of all domains:
    domains = inwx_conn.nameserver.list()['domains']
    for domain in domains:
        domain = domain['domain']
        print "Logs for domain %s:" % domain
        print prettyprint.domain_log(
            inwx_conn.domain.log({'domain': domain})['domain'])
Пример #13
0
def main():
    api_url, username, password, shared_secret = get_account_data(True)
    inwx_conn = domrobot(api_url, False)
    loginRet = inwx_conn.account.login({'lang': 'en', 'user': username, 'pass': password})

    if 'tfa' in loginRet and loginRet['tfa'] == 'GOOGLE-AUTH':
        loginRet = inwx_conn.account.unlock({'tan': getOTP(shared_secret)})

    domain = "mydomain.com"
    checkRet = inwx_conn.domain.check({'domain': domain})
    print(prettyprint.domain_check(checkRet))
Пример #14
0
def main():
    api_url, username, password = get_account_data(True)
    inwx_conn = domrobot(api_url, False)
    loginRet = inwx_conn.account.login({
        'lang': 'en',
        'user': username,
        'pass': password
    })

    domain = "mydomain.com"
    checkRet = inwx_conn.domain.check({'domain': domain})
    print prettyprint.domain_check(checkRet)
Пример #15
0
def main():
    api_url, username, password, shared_secret = get_account_data(True, config_section="live")
    inwx_conn = domrobot(api_url, True)
    loginRet = inwx_conn.account.login({'user': username, 'pass': password})

    if 'resData' in loginRet:
        loginRet = loginRet['resData']

    if 'tfa' in loginRet and loginRet['tfa'] == 'GOOGLE-AUTH':
        loginRet = inwx_conn.account.unlock({'tan': getOTP(shared_secret)})

    domain = "tonihds.de"
    checkRet = inwx_conn.domain.check({'domain': domain})
    print((prettyprint.domain_check(checkRet)))
Пример #16
0
def main():
    api_url, username, password, shared_secret = get_account_data(True, "config.cfg", "live")
    inwx_conn = domrobot(api_url, False)
    loginRet = inwx_conn.account.login({'lang': 'en', 'user': username, 'pass': password})

    if 'resData' in loginRet:
        loginRet = loginRet['resData']

    if 'tfa' in loginRet and loginRet['tfa'] == 'GOOGLE-AUTH':
        loginRet = inwx_conn.account.unlock({'tan': getOTP(shared_secret)})

    page = 1
    pageLimit = 20
    runLoop = True

    while runLoop:
        print("Page: "+str(page))
        domainList = inwx_conn.domain.list({'page': page, 'pagelimit': pageLimit})
        if(pageLimit * page < domainList["resData"]["count"] ):
            page = page + 1
        else:
            runLoop = False

        print(domainList)
        for domain in domainList["resData"]["domain"]:
            reDate = dateutil.parser.parse(str(domain["reDate"]))
            upDate = dateutil.parser.parse(str(domain["upDate"]))

            preReData = (reDate - datetime.timedelta(days = 5))

            event = Event()
            event.add('summary', 'REMINDER! Domain Renewal '+domain["domain"])
            event.add('dtstart', preReData)
            event.add('dtend', (preReData + datetime.timedelta(minutes = 10)))
            event.add('dtstamp', upDate)
            cal.add_component(event)

            event = Event()
            event.add('summary', 'Domain Renewal '+domain["domain"])
            event.add('dtstart', reDate)
            event.add('dtend', (reDate + datetime.timedelta(minutes = 10)))
            event.add('dtstamp', upDate)
            cal.add_component(event)

    f = open('domains.ical', 'wb')
    f.write(cal.to_ical())
    f.close()
Пример #17
0
def main():
    # login credentials
    cred = {"lang": "en", "user": username, "pass": password}
    # domain for request
    dom = {"domain": domain}
    # domrobot object (for request)
    conn = inwx.domrobot(api_url)
    # login
    login = conn.account.login(cred)
    # get nameserver entries
    ninfo = conn.nameserver.info(dom)
    ncount = 0
    # get the one with "server."
    for i in range(len(ninfo["record"])):
        if ninfo["record"][i]["name"] == (subdomain + "." + domain):
            ncount = i
            break
    # save the id of the entry
    nid = ninfo["record"][ncount]["id"]
    # get content of the old entry
    old = ninfo["record"][ncount]["content"]

    global iptype
    ip = getip(iptype)
    if (ip != None) and (ip != old):
        # update the record
        log("IP changed from:" + LOG_NEWLINE + old + \
            LOG_NEWLINE + "to:" + LOG_NEWLINE + ip)
        try:
            log("Now updating record...")
            conn.nameserver.updateRecord({"id": nid, "content": ip})
        except KeyError:
            log("Successfully updated nameserver-record for: " + LOG_NEWLINE + \
                subdomain + "." + domain)
        except Exception as e:
            log("Error occured: " + str(e))
            log("Check the setup of your nameserver-record." + LOG_NEWLINE + \
                "Maybe your IP-version mismatched with the recorded one.")
    elif (ip == old):
        log("Old and current IP were the same. No update required.")
    elif (ip == None):
        log("Did not update anything.")
def main():
    api_url, username, password = get_account_data(True)
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    print prettyprint.contacts(inwx_conn.contact.list()['contact'])
    print prettyprint.nameserversets(inwx_conn.nameserverset.list()['nsset'])
    print "\nRegister a new domain\n"
    domainname = raw_input('New Domain [e.g. example.com]: ')
    check = inwx_conn.domain.check({'domain': domainname})
    if check['domain'][0]['status'] == 'free':
        if raw_input("The domain %s is available. Do you want to register now? [yes/no]: " % domainname) != 'yes': return
        registrant_id = int(raw_input('Please give the ID for the registrant and admin contact [e.g. 1023532]: '))
        admin_id = registrant_id
        tech_id, billing_id = 1,1
        nameservers = ['ns.inwx.de','ns2.inwx.de','ns3.inwx.de']
        reg_result = inwx_conn.domain.create({'domain':domainname, 'registrant': registrant_id, 'admin': admin_id, 'tech': tech_id, 'billing': billing_id, 'ns': nameservers})
        if reg_result == None:
            print "Successfully registered the domain."
    else:
        print "Sorry, the domain %s is not available anymore." % domainname
        print "The current status of the domain is '%s'." % check['domain'][0]['status']
Пример #19
0
def main():
    api_url, username, password = get_account_data(True)
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    print prettyprint.contacts(inwx_conn.contact.list()['contact'])
    print "\nCreate a new contact\n"
    type = raw_input('Type [PERSON, ORG or ROLE]: ')
    name = raw_input('Prename and Surname: ')
    street, city, postal_code, country_code = raw_input('Street: '), raw_input(
        'City: '), raw_input('Postal Code [60438]: '), raw_input(
            'Country Code [de]: ')
    phone, email = raw_input('Phone [+49.123123123]: '), raw_input('E-Mail: ')
    print inwx_conn.contact.create({
        'type': type,
        'name': name,
        'street': street,
        'city': city,
        'pc': postal_code,
        'cc': country_code,
        'voice': phone,
        'email': email
    })
Пример #20
0
def main():
    api_url, username, password, shared_secret = get_account_data(
        True, config_section="live")
    inwx_conn = domrobot(api_url, True)
    loginRet = inwx_conn.account.login({'user': username, 'pass': password})

    if 'resData' in loginRet:
        loginRet = loginRet['resData']

    if 'tfa' in loginRet and loginRet['tfa'] == 'GOOGLE-AUTH':
        loginRet = inwx_conn.account.unlock({'tan': getOTP(shared_secret)})

    domain = "tonihds.de"
    ip = requests.get('https://api.ipify.org').text
    checkRet = inwx_conn.domain.check({'domain': domain})
    nameserv_info = inwx_conn.nameserver.info({'domain': domain})
    #add checks
    inwx_conn.nameserver.updateRecord({
        'id': '289183459',
        'type': 'A',
        'content': ip
    })
Пример #21
0
def main():
    api_url, username, password = get_account_data(True)
    domain, subdomain, _ = get_domain_update(True)

    # Instantiate the inwx class (does not connect yet but dispatches calls to domrobot objects with the correct API URL
    inwx_conn = domrobot(api_url, username, password, "en", False)
    nsentries = inwx_conn.nameserver.info({"domain": domain})

    # Filter entries for subdomain
    nsentries = [record for record in nsentries["record"] if subdomain == record["name"]]

    assert nsentries, "Subdomain %s not in list of nameserver entries." % subdomain

    # There may be multiple entries for one subdomain, one for each type (A, AAAA, ...)
    for record in nsentries:
        record_type = record["type"]  # A, AAAA
        assert record_type in record_type_to_api, "Unsupported record type: %s" % record_type

        new_ip = get_ip(record_type_to_api[record_type])
        if new_ip:
            print "Updating %s record of %s from %s to %s" % (record_type, record["name"], record["content"], new_ip)
            inwx_conn.nameserver.updateRecord({"id": record["id"], "content": new_ip, "ttl": 3600})
def main():
    api_url, username, password = get_account_data(True)
    domain, subdomain, default_ip = get_domain_update(True)
    try:
        new_ip = urlopen(IPV6_DETECTION_API).read().decode('ascii')
    except:
        # If something failed with the IPv6 detection, we may abort at this point
        return
        # or simply set the default value:
        new_ip = default_ip
    # Instantiate the inwx class (does not connect yet but dispatches calls to domrobot objects with the correct API URL
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    # get all the nameserver entries for a certain domain 
    nsentries = inwx_conn.nameserver.info({'domain': domain})
    for record in nsentries['record']:
        if subdomain == record['name']:
            id = record['id']
            break
    if id:
        print "Setting subdomain %s to the new IPv6 IP %s." % (subdomain, new_ip)
        inwx_conn.nameserver.updateRecord({'id':id,'content':new_ip,'ttl':3600})
    else:
        print "Subdomain not in list of nameserver entries."
Пример #23
0
def main(inwxcredentials, args):
    pp = pprint.PrettyPrinter(indent=4)
    targetdomain = args[1]
    challenge = args[2] if len(args)>2 else None

    # Remove TXT name
    if targetdomain.startswith('_acme-challenge.'):
        targetdomain = targetdomain[16:]

    print("Input:")
    pp.pprint([ targetdomain, challenge ])

    # Create api connection and login
    inwx_conn = domrobot(inwxcredentials["url"], False)
    loginRet = inwx_conn.account.login({'lang': 'en', 'user': inwxcredentials["username"], 'pass': inwxcredentials["password"] })

    # Perform OTP login if necessary
    if 'tfa' in loginRet and loginRet['tfa'] == 'GOOGLE-AUTH':
        inwx_conn.account.unlock({'tan': getOTP(inwxcredentials["otpsecret"])})

    print("Searching nameserver zone for "+targetdomain)

    # Extract second level domain from given domain
    sldmatch = re.search(ur"(^|\.)([^\.]+\.[^\.]+)$", targetdomain)

    if sldmatch is None:
        print("Could not extract second level domain");
        return False

    # Build domain filter for api request
    apisearchpattern = "*"+sldmatch.group(2)
    print("API search pattern: "+apisearchpattern)

    # Fetch all domains from api
    domains = inwx_conn.nameserver.list({ 'domain': apisearchpattern })

    # Search domain in nameserver
    matchdomain = None
    matchsublevel = None

    for domain in domains['resData']['domains']:
        sld = domain['domain']
        try:
            rgx = re.compile(ur"^(?P<sublevel>.+?)?(^|\.)"+re.escape(sld)+ur"$", re.UNICODE)
            rgxmatch = rgx.search(targetdomain)
            if rgxmatch:
                matchdomain = sld
                matchsublevel = rgxmatch.group('sublevel')
                break
        except UnicodeEncodeError:
            print("TODO: Support unicode domains")

    # Check match
    if matchdomain is None:
        print("Nameserver not found")
        return False

    print("Nameserver match: "+matchdomain)

    # Prepare
    rname = "_acme-challenge"
    rtype = "TXT"
    rvalue = challenge

    # Append sublevel part if exist
    if matchsublevel is not None:
        rname = rname+"."+matchsublevel

    # Debug info
    print("Debug:")
    pp.pprint([ rname, rtype, rvalue ])

    # Check TXT record exist
    existscheck = inwx_conn.nameserver.info({ 'domain': matchdomain, 'type': rtype, 'name': rname })

    # Delete if exist
    try:
        record = existscheck["resData"]['record'][0]
        print("TXT record exists -> delete")
        pp.pprint(record)
        result = inwx_conn.nameserver.deleteRecord({ 'id': record['id'] })
        pp.pprint(result)
    except KeyError:
        pass

    # Create if challenge given
    if rvalue is not None:
        print("Create new TXT record")
        result = inwx_conn.nameserver.createRecord({ 
            'domain': matchdomain, 
            'type': rtype, 
            'name': rname,
            'content': rvalue,
            'ttl': 300
        })

        pp.pprint(result)

    return True
Пример #24
0
def main():
    api_url, username, password = get_account_data(True)
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    print prettyprint.domain_check(
        inwx_conn.domain.check({'domain': "klaus.bz"}))
def main():
    api_url, username, password = get_account_data(True)
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    print prettyprint.nameserversets(inwx_conn.nameserverset.list()['nsset'])
def main():
    api_url, username, password = get_account_data(True)
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    print prettyprint.domain_check(inwx_conn.domain.check({'domain': "klaus.bz"}))
Пример #27
0
def main():
    api_url, username, password = get_account_data(True)
    inwx_conn = domrobot(api_url, username, password, 'en', False)
    print prettyprint.domains(inwx_conn.nameserver.list()['domains'])
Пример #28
0
#
# You should have received a copy of the GNU General Public License
# along with inwx-dyndns. If not, see <http://www.gnu.org/licenses/>.

# This is obviously heavily borrowed (almost everything is the same) from Philipp Klaus' python-inwx-xmlrpc.

import os
import time
from inwx import domrobot
from configuration import get_account_data, get_domain_update

MINUTES = 15

while True:
    api_url, username, password = get_account_data(True)
    domain, subdomain, default_ip = get_domain_update(True)
    with open(os.environ.get("IPv4_PATH")) as f:
        new_ip = f.read()

    inwx_conn = domrobot(api_url, username, password, "en", False)
    nsentries = inwx_conn.nameserver.info({"domain": domain})
    ids = []
    for record in nsentries["record"]:
        if record["name"] in ["", "*"]:
            ids.append(record["id"])
    for id_ in ids:
        print("Setting subdomain %s to the new IPv4 IP %s." % (subdomain, new_ip))
        inwx_conn.nameserver.updateRecord({"id": id_, "content": new_ip, "ttl": 3600})
    print(f"Going to sleep for {MINUTES} minutes")
    time.sleep(MINUTES * 60)
Пример #29
0
import sys
import os
from inwx import domrobot

__author__ = u'Stephan Müller'
__copyright__ = u'2018, Stephan Müller'
__license__ = u'MIT'


API_URL = os.getenv("INWX_API_URL", "https://api.domrobot.com/xmlrpc/")
USER = os.getenv("INWX_USER")
PASSWORD = os.getenv("INWX_PASSWORD")
DEBUG = bool(os.getenv("INWX_DEBUG", False))

inwx_conn = domrobot(API_URL, DEBUG)
inwx_conn.account.login({'lang': 'en', 'user': USER, 'pass': PASSWORD})


def delete_record(domain_name, domain):
    search_params = {
        'domain': domain_name,
        'name': '_acme-challenge.' + domain,
        'type': 'TXT',
    }
    info = inwx_conn.nameserver.info(search_params)
    if 'resData' in info and 'record' in info['resData'] and info['resData']['record']:
        inwx_conn.nameserver.deleteRecord({'id': info['resData']['record'][0]['id']})


def create_record(domain_name, domain, token):