New tag '<ip-host>' introduced: can be used in actions to retrieve the host name (dns) from the IP address

pull/1705/head
sebres 2017-03-08 16:34:03 +01:00
parent b832b77e3c
commit a0bb51ef92
2 changed files with 6 additions and 0 deletions

View File

@ -291,6 +291,7 @@ class Actions(JailThread, Mapping):
AI_DICT = { AI_DICT = {
"ip": lambda self: self.__ticket.getIP(), "ip": lambda self: self.__ticket.getIP(),
"ip-rev": lambda self: self['ip'].getPTR(''), "ip-rev": lambda self: self['ip'].getPTR(''),
"ip-host": lambda self: self['ip'].getHost(),
"fid": lambda self: self.__ticket.getID(), "fid": lambda self: self.__ticket.getID(),
"failures": lambda self: self.__ticket.getAttempt(), "failures": lambda self: self.__ticket.getAttempt(),
"time": lambda self: self.__ticket.getTime(), "time": lambda self: self.__ticket.getTime(),

View File

@ -376,6 +376,11 @@ class IPAddr(object):
return "%s.%s" % (".".join(reversed(exploded_ip)), suffix) return "%s.%s" % (".".join(reversed(exploded_ip)), suffix)
def getHost(self):
"""Return the host name (DNS) of the provided IP address object
"""
return DNSUtils.ipToName(self.ntoa)
@property @property
def isIPv4(self): def isIPv4(self):
"""Either the IP object is of address family AF_INET """Either the IP object is of address family AF_INET