| 1 | #!/usr/bin/perl | 
|---|
| 2 | # Most of the file rDNS.html should be copied exactly from DNSAdmin.  This | 
|---|
| 3 | # script creates rDNS.html from the source file in SVN at | 
|---|
| 4 | # https://secure.deepnet.cx/svn/dnsadmin/trunk/reverse-patterns.html | 
|---|
| 5 |  | 
|---|
| 6 | use strict; | 
|---|
| 7 | use warnings; | 
|---|
| 8 |  | 
|---|
| 9 | use LWP; | 
|---|
| 10 |  | 
|---|
| 11 | my $ua = LWP::UserAgent->new; | 
|---|
| 12 | $ua->agent("ipdb-gen-rDNS"); | 
|---|
| 13 | my $req = HTTP::Request->new(GET => "https://secure.deepnet.cx/svn/dnsadmin/trunk/reverse-patterns.html"); | 
|---|
| 14 | my $res = $ua->request($req); | 
|---|
| 15 | die "Failed to retrieve source file from SVN: ".$res->status_line."\n" if !$res->is_success; | 
|---|
| 16 |  | 
|---|
| 17 | my $srcfile = $res->content; | 
|---|
| 18 |  | 
|---|
| 19 | open LRDNS, ">rDNS.html.new"; | 
|---|
| 20 | print LRDNS << 'EOH' | 
|---|
| 21 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | 
|---|
| 22 | <html> | 
|---|
| 23 | <head> | 
|---|
| 24 | <title>IP Database Reverse DNS Help</title> | 
|---|
| 25 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | 
|---|
| 26 | <link rel="stylesheet" type="text/css" href="ipdb.css"> | 
|---|
| 27 | <link rel="stylesheet" type="text/css" href="local.css"> | 
|---|
| 28 | </head> | 
|---|
| 29 | <body> | 
|---|
| 30 |  | 
|---|
| 31 | <!-- | 
|---|
| 32 | This file is generated, and should not be edited directly.  Edit gen-rDNS.pl to edit the header below, and | 
|---|
| 33 | see https://secure.deepnet.cx/svn/dnsadmin/trunk/reverse-patterns.html for the tables. | 
|---|
| 34 | --> | 
|---|
| 35 |  | 
|---|
| 36 | <p>The IP Database can pass reverse DNS information back and forth to a DNS management backend to simplify | 
|---|
| 37 | maintenance of the reverse DNS records associated with the IPs being managed.</p> | 
|---|
| 38 |  | 
|---|
| 39 | <p>Several shortcuts can be used when specifying a pattern for an IPv4 netblock, which will be expanded to | 
|---|
| 40 | actual DNS records by the DNS management system.</p> | 
|---|
| 41 |  | 
|---|
| 42 | <p>Entries should generally only be present in the "Per-IP reverse entries" section if they are different from | 
|---|
| 43 | the block pattern.</p> | 
|---|
| 44 |  | 
|---|
| 45 | <p>Template patterns are not supported for IPv6 allocations due to the size of the address space and typical | 
|---|
| 46 | size of allocations.</p> | 
|---|
| 47 |  | 
|---|
| 48 | <p>"(cached)" or "[local]" indicates the rDNS information shown came from IPDB records, | 
|---|
| 49 | and not the DNS management utility.  It may be out of date, or DNS | 
|---|
| 50 | management integration may be missing or incomplete for this block.</p> | 
|---|
| 51 |  | 
|---|
| 52 | EOH | 
|---|
| 53 | ; | 
|---|
| 54 |  | 
|---|
| 55 | my @l = split "\n", $srcfile; | 
|---|
| 56 | my $flag = 0; | 
|---|
| 57 | foreach my $line(@l) { | 
|---|
| 58 | $flag = 1 if $line eq '<!-- rdns pattern table -->'; | 
|---|
| 59 | $flag = 0 if $line eq '<!-- done rdns pattern table -->'; | 
|---|
| 60 | next unless $flag; | 
|---|
| 61 | print LRDNS "$line\n"; | 
|---|
| 62 | } | 
|---|
| 63 | print LRDNS "<!-- done rdns pattern table -->\n\n</body>\n</html>\n"; | 
|---|
| 64 | close LRDNS; | 
|---|
| 65 |  | 
|---|
| 66 | # now that we have a supposedly good copy, move the .new to the canonical file. | 
|---|
| 67 |  | 
|---|
| 68 | rename "rDNS.html.new", "rDNS.html"; | 
|---|