(self, *args, **kwargs)
| 27 | class DshellPlugin(dnsplugin.DNSPlugin): |
| 28 | |
| 29 | def __init__(self, *args, **kwargs): |
| 30 | super().__init__( |
| 31 | name="DNS", |
| 32 | description="Extract and summarize DNS queries/responses", |
| 33 | longdescription=""" |
| 34 | The DNS plugin extracts and summarizes DNS queries and their responses. If |
| 35 | possible, each query is paired with its response(s). |
| 36 | |
| 37 | Possible anomalies can be found using the --dns_show_noanswer, |
| 38 | --dns_only_noanswer, --dns_show_norequest, or --dns_only_norequest flags |
| 39 | (see --help). |
| 40 | |
| 41 | For example, looking for responses that did not come from a request: |
| 42 | decode -d dns --dns_only_norequest |
| 43 | |
| 44 | Additional information for responses can be seen with --dns_country and |
| 45 | --dns_asn to show country codes and ASNs, respectively. These results can be |
| 46 | piped to grep for filtering results. |
| 47 | |
| 48 | For example, to look for all traffic from Germany: |
| 49 | decode -d dns --dns_country |grep "country: DE" |
| 50 | |
| 51 | To look for non-US traffic, try: |
| 52 | decode -d dns --dns_country |grep "country:" |grep -v "country: US" |
| 53 | """, |
| 54 | author="bg/twp", |
| 55 | bpf="udp and port 53", |
| 56 | output=AlertOutput(label=__name__), |
| 57 | optiondict={'show_noanswer': {'action': 'store_true', 'help': 'report unanswered queries alongside other queries'}, |
| 58 | 'show_norequest': {'action': 'store_true', 'help': 'report unsolicited responses alongside other responses'}, |
| 59 | 'only_noanswer': {'action': 'store_true', 'help': 'report only unanswered queries'}, |
| 60 | 'only_norequest': {'action': 'store_true', 'help': 'report only unsolicited responses'}, |
| 61 | 'country': {'action': 'store_true', 'help': 'show country code for returned IP addresses'}, |
| 62 | 'asn': {'action': 'store_true', 'help': 'show ASN for returned IP addresses'}, |
| 63 | } |
| 64 | ) |
| 65 | |
| 66 | def premodule(self): |
| 67 | if self.only_norequest: |
nothing calls this directly
no test coverage detected