Also catch gaierror in !rdns, print e.strerror instead of str(e)

This commit is contained in:
jesopo 2018-10-04 10:29:22 +01:00
parent 078891127d
commit ded6ff03ce

View file

@ -62,7 +62,7 @@ class Module(ModuleManager.BaseModule):
event["stderr"].set_prefix("rDNS")
try:
hostname, alias, ips = socket.gethostbyaddr(event["args_split"][0])
except socket.herror as e:
event["stderr"].write(str(e))
except (socket.herror, socket.gaierror) as e:
event["stderr"].write(e.strerror)
return
event["stdout"].write("%s: %s" % (ips[0], hostname))