SysDNS: allow passing a specific name server

This commit is contained in:
James Lu 2018-03-24 12:37:23 -07:00
parent 9e59d7d0e0
commit f3f1911d96

View File

@ -48,8 +48,8 @@ class SysDNS(callbacks.Plugin):
utility available on the host machine.
"""
threaded = True
def dns(self, irc, msg, args, optlist, server):
"""[--type type] <host>
def dns(self, irc, msg, args, optlist, target, nameserver):
"""[--type type] <target host> [<name server>]
Looks up a DNS hostname using the 'host' binary available on the system. --type
controls the type of record to look for. (A, AAAA, etc.)
"""
@ -62,9 +62,12 @@ class SysDNS(callbacks.Plugin):
optlist = dict(optlist)
recordtype = optlist.get('type')
if recordtype:
args = [cmd, '-t', dict(optlist)['type'], server]
args = [cmd, '-t', dict(optlist)['type'], target]
else:
args = [cmd, server]
args = [cmd, target]
if nameserver:
args.append(nameserver)
try:
with open(os.devnull) as null:
@ -88,7 +91,8 @@ class SysDNS(callbacks.Plugin):
irc.error('This domain exists, but no records of type %s were found.'
% (recordtype or 'A/AAAA/MX'))
dns = thread(wrap(dns, [getopts({'type':'something'}), 'somethingWithoutSpaces']))
dns = thread(wrap(dns, [getopts({'type':'something'}), 'somethingWithoutSpaces',
additional('somethingWithoutSpaces')]))
Class = SysDNS