Giter Club home page Giter Club logo

zonefile-extract's Introduction

zonefile-extract

Tools to extract DNS records from your own domain management tool.

Some domain providers do not support exporting their zone files. The ability to extract DNS records as a zonefile can be useful to migrate to a different provider.

Contributing

You are welcome to add new scripts for other domain providers or to contribute fixes to existing ones. Just fork the repo and open a Pull Request.

Please note that the tools here are using Unlicense to put them in the public domain.

zonefile-extract's People

Contributors

5diraptor avatar biinari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

zonefile-extract's Issues

Use this in powershell

I wanted to give you this as your JS is the basis of my Powershell script.

This uses Selenium to iterate through your domain list and get the DNS. This will output a series of .zone files based on your script.

Feel free to use this as you wish.

$Username = ""
$Password = ""

$Script = @"
// CONFIG BEGIN
var defaultTTL = 300;
// CONFIG END
 
var table = document.getElementsByClassName('advanced_dns')[0];
var rows = table.getElementsByTagName('tr');
var i, len, row;
var hostname, type, priority, ttl, destination;
var output = '';
 
//output += '`$TTL ' + defaultTTL + '\n'; // start with default TTL
 
// skip header and last two rows (add new entry, delete all entries)
for (i = 1, len = rows.length - 2; i < len; i++) {
  row = rows[i];
  hostname = row.getElementsByClassName('dns_hostname')[0].innerText;
  type = row.getElementsByClassName('dns_type')[0].innerText;
  priority = row.getElementsByClassName('dns_priority')[0].innerText;
  ttl = row.getElementsByClassName('dns_ttl')[0].innerText || defaultTTL;
  destination = row.getElementsByClassName('dns_data')[0].title;
 
  if (type === 'TXT/SPF') {
    type = 'TXT';
    destination = '"' + destination + '"';
  }
 
  output += [hostname, ttl, 'IN', type, priority, destination].join(' ') + '\n';
}
return output;
"@

$Enter = ([OpenQA.Selenium.Keys]::Enter)


$Driver = Start-SeFirefox
Enter-SeUrl "https://sso.123-reg.co.uk/?app=ott&path=%2Fsecure" -Driver $Driver

Start-Sleep -Seconds 2

$E = Find-SeElement -Driver $Driver -Id "1"
Send-SeKeys -Element $E -Keys $Username

$E = Find-SeElement -Driver $Driver -Id "2"
Send-SeKeys -Element $e -Keys $Password
Send-SeKeys -Element $e -Keys $Enter

$E = Find-SeElement -Driver $Driver -CssSelector ".UPM__PrivacyModal > div:nth-child(1) > form:nth-child(1) > div:nth-child(1) > div:nth-child(3) > div:nth-child(2) > span:nth-child(2) > span:nth-child(1) > button:nth-child(1) > span:nth-child(1)"
Invoke-SeClick -Element $E


$E = Find-SeElement -Driver $Driver -CssSelector ".UDN__Modal > div:nth-child(1) > button:nth-child(2) > img:nth-child(2)"
Invoke-SeClick -Element $E

$E = Find-SeElement -Driver $Driver -Id "dom_select"

$DomainList = [OpenQA.Selenium.Support.UI.SelectElement]::new($E)
$domains = @()
$DomainList.Options | % {
    $Domains += $_.Text    
}
$domains | % {
    Enter-SeUrl "https://www.123-reg.co.uk/secure/cpanel/manage-dns?domain=$($_)" -Driver $Driver
    $use123 = $Driver.ExecuteScript("return `$('#not_use123ns.hidden').length")
    if ($use123 -eq "1") {
        $Driver.ExecuteScript("`$('#advanced-tab').trigger('click')")
        Start-Sleep -Second 2
        $dns = $Driver.ExecuteScript($Script)
        $dns | out-file -FilePath ".\$($_).zone"
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.