X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=djbdns%2Fcommon.py;h=ef09a34418612634d049b5faf63105e51d223ff3;hb=79db9c5eb7fd558faeebadcf3accb12d00914cfd;hp=06124bf2ef03135d7177b18787a61d8bf7ed31b0;hpb=f8971980184acdac6243e806e635b420ccef1d3f;p=djbdns-logparse.git diff --git a/djbdns/common.py b/djbdns/common.py index 06124bf..ef09a34 100644 --- a/djbdns/common.py +++ b/djbdns/common.py @@ -1,39 +1,108 @@ +r""" +Information needed to parse *both* tinydns and dnscache logs. +""" from struct import pack # A pattern to match the timestamp format that the tai64nlocal program # produces. It appears in both dnscache and tinydns lines, after # they've been piped through tai64nlocal, of course. -timestamp_pat = r'[\d-]+ [\d:\.]+' +TIMESTAMP_PAT = r'[\d-]+ [\d:\.]+' # A dictionary mapping query type identifiers, in decimal, to their # friendly names for tinydns. Reference: # # https://en.wikipedia.org/wiki/List_of_DNS_record_types # -# Note that mapping here is non-exhaustive, and that tinydns will -# log responses for record types that it does not know about. -query_type_name = { +# This list *should* be exhaustive, and we hope it is, because the log +# parser will now crash if it encounters a type it doesn't know about. +QUERY_TYPE_NAME = { 1: "a", 2: "ns", + 3: "md", + 4: "mf", 5: "cname", 6: "soa", + 7: "mb", + 8: "mg", + 9: "mr", + 10: "null", + 11: "wks", 12: "ptr", 13: "hinfo", + 14: "minfo", 15: "mx", 16: "txt", 17: "rp", + 18: "afsdb", + 19: "x25", + 20: "isdn", + 21: "rt", + 22: "nsap", + 23: "nsap-ptr", 24: "sig", 25: "key", + 26: "px", + 27: "gpos", 28: "aaaa", + 29: "loc", + 30: "nxt", + 31: "eid", + 32: "nimloc", 33: "srv", + 34: "atma", 35: "naptr", + 36: "kx", + 37: "cert", 38: "a6", + 39: "dname", + 40: "sink", + 41: "opt", + 42: "apl", + 43: "ds", + 44: "sshfp", + 45: "ipseckey", + 46: "rrsig", + 47: "nsec", 48: "dnskey", + 49: "dhcid", + 50: "nsec3", + 51: "nsec3param", 52: "tlsa", + 53: "smimea", + 55: "hip", + 56: "ninfo", + 57: "rkey", + 58: "talink", + 59: "cds", + 60: "cdnskey", + 61: "openpgpkey", + 62: "csync", + 63: "zonemd", + 64: "svcb", 65: "https", + 99: "spf", + 100: "uinfo", + 101: "uid", + 102: "gid", + 103: "unspec", + 104: "nid", + 105: "l32", + 106: "l64", + 107: "lp", + 108: "eui48", + 109: "euc64", + 249: "tkey", + 250: "tsig", + 251: "ixfr", 252: "axfr", + 253: "mailb", + 254: "maila", 255: "any", - 257: "caa" + 256: "uri", + 257: "caa", + 259: "doa", + 32768: "ta", + 32769: "dlv" } def convert_ip(ip : str) -> str: