Commit | Line | Data |
---|---|---|
dc0d77d7 CE |
1 | awk -F: ' |
2 | BEGIN { OFS=":" } | |
3 | { | |
4 | if ($5 == "tx") next | |
5 | if ($5 == "A") { | |
6 | print "glue",$6,$3,$4,"answer",$6" A "$7 | |
7 | next | |
8 | } | |
9 | if ($5 == "NS") { | |
10 | print "glue",$6,$3,$4,"answer",$6" NS "$7 | |
11 | next | |
12 | } | |
13 | ||
14 | } | |
15 | ' | sort -t: +0 -2 +4 +3 -4 +2 -3 | uniq | awk -F: ' | |
16 | { | |
17 | type = $1 | |
18 | q = $2 | |
19 | c = $3 | |
20 | ip = sprintf("%-16s",$4) | |
21 | ||
22 | if (q != lastq) { print ""; lastq = q } | |
23 | ||
24 | if ($5 == "ALERT") { | |
25 | result = "A\bAL\bLE\bER\bRT\bT:\b: " $6 | |
26 | } | |
27 | else if ($5 == "answer") { | |
28 | if (index($6,q" ") == 1) | |
29 | $6 = substr($6,length(q) + 2) | |
30 | result = $6 | |
31 | } | |
32 | else if ($5 == "see") { | |
33 | result = "see " $6 | |
34 | } | |
35 | else if ($5 == "CNAME") { | |
36 | result = "CNAME "$6 | |
37 | } | |
38 | else | |
39 | result = $5 | |
40 | ||
41 | if (c != ".") { | |
42 | q = substr(q,1,length(q) - length(c)) | |
43 | for (i = 1;i <= length(c);++i) { | |
44 | ci = substr(c,i,1) | |
45 | q = q "_\b" ci | |
46 | } | |
47 | } | |
48 | ||
49 | print type,q,ip,result | |
50 | } | |
51 | ' |