From 6f5c6926065f083a7ff3eff6b207041494459642 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 25 Jun 2019 14:50:30 +0100 Subject: [PATCH] Allow specifying of nameserver as '!dns @1.2.3.4' --- modules/ip_addresses.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/ip_addresses.py b/modules/ip_addresses.py index 74e848af..2f7af88d 100644 --- a/modules/ip_addresses.py +++ b/modules/ip_addresses.py @@ -25,12 +25,19 @@ class Module(ModuleManager.BaseModule): :prefix: DNS """ hostname = event["args_split"][0] - nameserver = event["server"].get_setting("dns-nameserver", None) - has_nameserver = not nameserver == None - record_types = ["A?", "AAAA?"] + nameserver = event["server"].get_setting("dns-nameserver", None) + + record_types = [] if len(event["args_split"]) > 1: - record_types = [t.upper() for t in event["args_split"][1:]] + for arg in event["args_split"][1:]: + if arg.startswith("@"): + nameserver = arg[1:] + else: + record_types.append(arg.upper()) + + if not record_types: + record_types = ["A?", "AAAA?"] if not nameserver == None: resolver = dns.resolver.Resolver(configure=False)