easier way to get reverse ip (#1070)

This commit is contained in:
Michel Oosterhof 2019-03-23 20:17:37 +04:00 committed by GitHub
parent 18df6243ae
commit d2581ab52e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 12 deletions

View File

@ -94,19 +94,8 @@ class Output(cowrie.core.output.Output):
addr -- IPv4 Address
"""
try:
ipaddress.ip_address(addr)
ptr = ipaddress.ip_address(addr).reverse_pointer
except ValueError:
return None
ptr = self.reverseNameFromIPAddress(addr)
d = client.lookupPointer(ptr, timeout=self.timeout)
return d
@classmethod
def reverseNameFromIPAddress(self, address):
"""
Reverse the IPv4 address and append in-addr.arpa
Arguments:
address {str} -- IP address that is to be reversed
"""
return '.'.join(reversed(address.split('.'))) + '.in-addr.arpa'