allow @<nameserver> arg to be anywhere in !dns command

This commit is contained in:
jesopo 2019-07-16 16:52:41 +01:00
parent 69bab50335
commit 1106b5842c

View file

@ -25,18 +25,16 @@ class Module(ModuleManager.BaseModule):
:usage: <hostname> [type [type ...]] :usage: <hostname> [type [type ...]]
:prefix: DNS :prefix: DNS
""" """
hostname = event["args_split"][0] args = event["args_split"][:]
nameserver = event["server"].get_setting("dns-nameserver", None) nameserver = event["server"].get_setting("dns-nameserver", None)
for i, arg in enumerate(args):
if arg[0] == "@":
nameserver = args.pop(i)[1:]
break
record_types = [] hostname = args[0]
if len(event["args_split"]) > 1:
for arg in event["args_split"][1:]:
if arg.startswith("@"):
nameserver = arg[1:]
else:
record_types.append(arg.upper())
record_types = args[1:]
if not record_types: if not record_types:
record_types = ["A?", "AAAA?"] record_types = ["A?", "AAAA?"]