Skip to content

Instantly share code, notes, and snippets.

@jpmens
Created June 29, 2012 12:30
Show Gist options
  • Select an option

  • Save jpmens/3017651 to your computer and use it in GitHub Desktop.

Select an option

Save jpmens/3017651 to your computer and use it in GitHub Desktop.
Can you pronounce your DNSSEC DS record? ;-)
#!/usr/bin/perl
# by Jan-Piet Mens <jpmens@gmail.com> June 2012
# inspired by a conversation on #powerdns
# Prints DNSSEC DS record of specified domain as well as 'babble' of it
# and PGP wordlist representation of the digest [1].
#
# Digest:
# 0ADC090C30B862FA2BC194FB73A632F4D0B7A39C
#Babble:
# xedit-sedib-sisar-momaz-pupas-cahuz-rasap-kasoz-gogir-lomun-saxax
#PGP words:
# allow sympathy Algol article chairlift provincial flagpole whimsical briefcase recover Pluto Wichita hockey paragon checkup Virginia stagnate processor reform October
#
# [1]: http://en.wikipedia.org/wiki/PGP_word_list
use strict;
use Net::DNS;
use Encode::Wordlist::PGP qw(:all); # https://github.com/gitpan/Encode-Wordlist-PGP
my $res = Net::DNS::Resolver->new();
die "Usage: $0 domain\n" unless ($ARGV[0]);
my $query = $res->query($ARGV[0], "DS");
if ($query) {
foreach my $rr (grep { $_->type eq 'DS' } $query->answer) {
print "Digest:\n\t", uc $rr->digest, "\n";
print "Babble:\n\t" . $rr->babble, "\n";
print "PGP words:\n\t" . join(' ', pgp_wordlist_encode($rr->digest)), "\n";
}
} else {
warn "query failed: ", $res->errorstring, "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment