diff options
author | Henryk Plötz <henryk@ploetzli.ch> | 2014-10-03 19:58:52 +0200 |
---|---|---|
committer | Henryk Plötz <henryk@ploetzli.ch> | 2014-10-03 19:58:52 +0200 |
commit | 0e5b2871ca6456b01d4bf037a6e68badf1ff1a41 (patch) | |
tree | 97b95b74c9618d85da9aa9451a55a819cd7b1c2e /dnstracesort.sh | |
download | tinydnssec-0e5b2871ca6456b01d4bf037a6e68badf1ff1a41.tar.gz tinydnssec-0e5b2871ca6456b01d4bf037a6e68badf1ff1a41.tar.bz2 |
Initial commit of djbdns-1.05.tar.gz
Source was http://cr.yp.to/djbdns/djbdns-1.05.tar.gz, SHA1 2efdb3a039d0c548f40936aa9cb30829e0ce8c3d
Diffstat (limited to 'dnstracesort.sh')
-rw-r--r-- | dnstracesort.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/dnstracesort.sh b/dnstracesort.sh new file mode 100644 index 0000000..e57359c --- /dev/null +++ b/dnstracesort.sh @@ -0,0 +1,51 @@ +awk -F: ' + BEGIN { OFS=":" } + { + if ($5 == "tx") next + if ($5 == "A") { + print "glue",$6,$3,$4,"answer",$6" A "$7 + next + } + if ($5 == "NS") { + print "glue",$6,$3,$4,"answer",$6" NS "$7 + next + } + print + } +' | sort -t: +0 -2 +4 +3 -4 +2 -3 | uniq | awk -F: ' + { + type = $1 + q = $2 + c = $3 + ip = sprintf("%-16s",$4) + + if (q != lastq) { print ""; lastq = q } + + if ($5 == "ALERT") { + result = "A\bAL\bLE\bER\bRT\bT:\b: " $6 + } + else if ($5 == "answer") { + if (index($6,q" ") == 1) + $6 = substr($6,length(q) + 2) + result = $6 + } + else if ($5 == "see") { + result = "see " $6 + } + else if ($5 == "CNAME") { + result = "CNAME "$6 + } + else + result = $5 + + if (c != ".") { + q = substr(q,1,length(q) - length(c)) + for (i = 1;i <= length(c);++i) { + ci = substr(c,i,1) + q = q "_\b" ci + } + } + + print type,q,ip,result + } +' |