Created
September 7, 2011 08:37
-
-
Save datamuc/1200065 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use POSIX qw/strftime/; | |
use Mojo::UserAgent; | |
use 5.010; | |
my $ua = Mojo::UserAgent->new; | |
my $dom = $ua->get("http://www.iana.org/domains/root/db/")->res->dom; | |
my @tlds = $dom->find('tr[class*="iana-type"]')->each; | |
my $serial = strftime("%Y%m%d%H", localtime(time)); | |
say << ""; | |
\$ORIGIN . | |
\$TTL 3600 ; 1 hour | |
tld.rbfh.de IN SOA ns.rbfh.de. hostmaster.rbfh.de. ( | |
$serial ; serial | |
28800 ; refresh (8 hours) | |
3600 ; retry (1 hour) | |
864000 ; expire (1 week 3 days) | |
86400 ; minimum (1 day) | |
) | |
NS ns.rbfh.de. | |
\$ORIGIN tld.rbfh.de. | |
for my $set (@tlds) { | |
(my $tld = $set->at("a[href]")->attrs->{href}) =~ s!(?:^/domains/root/db/|\.html$)!!g; | |
my $desc = $set->at("td:nth-child(3)")->text; | |
$desc =~ y/"//d; | |
say qq{$tld IN TXT "$desc"} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment