Domain information groper (Dig) parsers

Parsers included in this module are:

DigDnssec - command /usr/bin/dig +dnssec . SOA

DigEdns - command /usr/bin/dig +edns=0 . SOA

DigNoedns - command /usr/bin/dig +noedns . SOA

class insights.parsers.dig.Dig(context, command)[source]

Bases: CommandParser

Base class for classes using dig command.

status

Determines if the lookup succeeded.

Type:

string

has_signature

True, if signature is present.

Type:

bool

command

Specific dig command used.

Type:

string

Raises:

SkipComponent -- When content is empty or cannot be parsed.

parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.dig.DigDnssec(context)[source]

Bases: Dig

Class for parsing /usr/bin/dig +dnssec . SOA command.

Sample output of this command is:

; <<>> DiG 9.11.1-P3-RedHat-9.11.1-2.P3.fc26 <<>> +dnssec nic.cz. SOA
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58794
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags: do; udp: 4096
;; QUESTION SECTION:
;nic.cz.                                IN      SOA

;; ANSWER SECTION:
nic.cz.                 278     IN      SOA     a.ns.nic.cz.
hostmaster.nic.cz. 1508686803 10800 3600 1209600 7200
nic.cz.                 278     IN      RRSIG   SOA 13 2 1800
20171105143612 20171022144003 41758 nic.cz.
hq3rr8dASRlucMJxu2QZnX6MVaMYsKhmGGxBOwpkeUrGjfo6clzG6MZN
2Jy78fWYC/uwyIsI3nZMUKv573eCWg==

;; Query time: 22 msec
;; SERVER: 10.38.5.26#53(10.38.5.26)
;; WHEN: Tue Oct 24 14:28:56 CEST 2017
;; MSG SIZE  rcvd: 189

Examples

>>> dig_dnssec.status
'NOERROR'
>>> dig_dnssec.has_signature
True
>>> dig_dnssec.command
'/usr/bin/dig +dnssec . SOA'
class insights.parsers.dig.DigEdns(context)[source]

Bases: Dig

Class for parsing /usr/bin/dig +edns=0 . SOA command.

Sample output of this command is:

; <<>> DiG 9.11.1-P3-RedHat-9.11.1-3.P3.fc26 <<>> +edns=0 . SOA
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11158
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;.                              IN      SOA

;; ANSWER SECTION:
.                       19766   IN      SOA     a.root-servers.net. abc.com. 2017120600 1800 900 604800 86400

;; Query time: 22 msec
;; SERVER: 10.38.5.26#53(10.38.5.26)
;; WHEN: Thu Dec 07 09:38:33 CET 2017
;; MSG SIZE  rcvd: 103

Examples

>>> dig_edns.status
'NOERROR'
>>> dig_edns.has_signature
False
>>> dig_edns.command
'/usr/bin/dig +edns=0 . SOA'
class insights.parsers.dig.DigNoedns(context)[source]

Bases: Dig

Class for parsing /usr/bin/dig +noedns . SOA command.

Sample output of this command is:

; <<>> DiG 9.11.1-P3-RedHat-9.11.1-3.P3.fc26 <<>> +noedns . SOA
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47135
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;.                              IN      SOA

;; ANSWER SECTION:
.                       20195   IN      SOA     a.root-servers.net. abc.com. 2017120600 1800 900 604800 86400

;; Query time: 22 msec
;; SERVER: 10.38.5.26#53(10.38.5.26)
;; WHEN: Thu Dec 07 09:31:24 CET 2017
;; MSG SIZE  rcvd: 92

Examples

>>> dig_noedns.status
'NOERROR'
>>> dig_noedns.has_signature
False
>>> dig_noedns.command
'/usr/bin/dig +noedns . SOA'