Added support for invalid domain AND added front end files not commited in previous commits

This commit is contained in:
VakarisZ 2018-10-02 16:41:52 +03:00
parent 847286dec7
commit 7d34c290cc
3 changed files with 22 additions and 4 deletions

View File

@ -120,12 +120,28 @@ class SingleIpRange(NetworkRange):
def __repr__(self):
return "<SingleIpRange %s>" % (self._ip_address,)
def __iter__(self):
"""
We have to check if we have an IP to return, because user could have entered invalid
domain name and no IP was found
:return: IP if there is one
"""
if self.ip_found():
yield self._number_to_ip(self.get_range()[0])
def is_in_range(self, ip_address):
return self._ip_address == ip_address
def _get_range(self):
return [SingleIpRange._ip_to_number(self._ip_address)]
def ip_found(self):
"""
Checks if we could translate domain name entered into IP address
:return: True if dns found domain name and false otherwise
"""
return hasattr(self, "_ip_address") and self._ip_address
@staticmethod
def string_to_host(string):
"""
@ -144,7 +160,7 @@ class SingleIpRange(NetworkRange):
domain_name = string
except socket.error:
LOG.error(
"You'r specified host: {} is neither found as domain name nor it's an IP address".format(string))
return socket.error
"You'r specified host: {} is not found as a domain name and it's not an IP address".format(string))
return None, string
return ip, domain_name

View File

@ -10,7 +10,8 @@ const columns = [
Header: 'Breached Servers',
columns: [
{Header: 'Machine', accessor: 'label'},
{Header: 'IP Addresses', id: 'ip_addresses', accessor: x => renderArray(x.ip_addresses)},
{Header: 'IP Addresses', id: 'ip_addresses',
accessor: x => renderArray(x.ip_addresses)+(x.domain_name ? " ("+x.domain_name+")" : "")},
{Header: 'Exploits', id: 'exploits', accessor: x => renderArray(x.exploits)}
]
}

View File

@ -10,7 +10,8 @@ const columns = [
Header: 'Scanned Servers',
columns: [
{ Header: 'Machine', accessor: 'label'},
{ Header: 'IP Addresses', id: 'ip_addresses', accessor: x => renderArray(x.ip_addresses)},
{ Header: 'IP Addresses', id: 'ip_addresses',
accessor: x => renderArray(x.ip_addresses)+(x.domain_name ? " ("+x.domain_name+")" : "")},
{ Header: 'Accessible From', id: 'accessible_from_nodes', accessor: x => renderArray(x.accessible_from_nodes)},
{ Header: 'Services', id: 'services', accessor: x => renderArray(x.services)}
]