class documentation

class NmapHost(object): (source)

View In Hierarchy

NmapHost is a class representing a host object of NmapReport

Method __eq__ Compare eq NmapHost based on :
Method __hash__ Hash is needed to be able to use our object in sets :return: hash
Method __init__ NmapHost constructor :param starttime: unix timestamp of when the scan against that host started :type starttime: string :param endtime: unix timestamp of when the scan against that host ended :type endtime: string :param address: dict ie :{'addr': '127...
Method __ne__ Compare ne NmapHost based on:
Method __repr__ String representing the object :return: string
Method address.setter Setter for the address dictionnary.
Method changed return the number of attribute who have changed :param other: NmapHost object to compare :return int
Method diff Calls NmapDiff to check the difference between self and another NmapHost object.
Method get_dict Return a dict representation of the object.
Method get_open_ports Same as get_ports() but only for open ports
Method get_ports Retrieve a list of the port used by each service of the NmapHost
Method get_service :param portno: int the portnumber :param protocol='tcp': string ('tcp','udp')
Method get_service_byid Returns a NmapService by providing its id.
Method is_up method to determine if host is up or not
Method os_class_probabilities Returns an array of possible OS class detected during the OS fingerprinting.
Method os_match_probabilities Returns an array of possible OS match detected during the OS fingerprinting
Method os_ports_used Returns an array of the ports used for OS fingerprinting
Method status.setter Setter for the status dictionnary.
Instance Variable os Undocumented
Property address Accessor for the IP address of the scanned host
Property distance Number of hops to host
Property endtime Accessor for the unix timestamp of when the scan ended
Property extraports_reasons dictionnary containing reasons why extra ports scanned for which a common state, usually, closed was discovered.
Property extraports_state dictionnary containing state and amount of extra ports scanned for which a common state, usually, closed was discovered.
Property hostnames Accessor returning the list of hostnames (array of strings).
Property id id of the host. Used for diff()ing NmapObjects
Property ipsequence Return the class of ip sequence of the remote hosts.
Property ipv4 Accessor for the IPv4 address of the scanned host
Property ipv6 Accessor for the IPv6 address of the scanned host
Property lastboot Since when the host was booted.
Property mac Accessor for the MAC address of the scanned host
Property os_fingerprint Returns the fingerprint of the scanned system.
Property os_fingerprinted Specify if the host has OS fingerprint data available
Property scripts_results Scripts results specific to the scanned host
Property services Accessor for the array of scanned services for that host.
Property starttime Accessor for the unix timestamp of when the scan was started
Property status Accessor for the host's status (up, down, unknown...)
Property tcpsequence Returns the difficulty to determine remotely predict the tcp sequencing.
Property uptime uptime of the remote host (if nmap was able to determine it)
Property vendor Accessor for the vendor attribute of the scanned host
Instance Variable _address Undocumented
Instance Variable _endtime Undocumented
Instance Variable _extras Undocumented
Instance Variable _hostnames Undocumented
Instance Variable _ipv4_addr Undocumented
Instance Variable _ipv6_addr Undocumented
Instance Variable _mac_addr Undocumented
Instance Variable _main_address Undocumented
Instance Variable _osfingerprinted Undocumented
Instance Variable _services Undocumented
Instance Variable _starttime Undocumented
Instance Variable _status Undocumented
Instance Variable _vendor Undocumented
def __eq__(self, other): (source)

Compare eq NmapHost based on : - hostnames - address - if an associated services has changed :return: boolean

def __hash__(self): (source)

Hash is needed to be able to use our object in sets :return: hash

def __init__(self, starttime='', endtime='', address=None, status=None, hostnames=None, services=None, extras=None): (source)

NmapHost constructor :param starttime: unix timestamp of when the scan against that host started :type starttime: string :param endtime: unix timestamp of when the scan against that host ended :type endtime: string :param address: dict ie :{'addr': '127.0.0.1', 'addrtype': 'ipv4'} :param status: dict ie:{'reason': 'localhost-response', 'state': 'up'} :return: NmapHost:

def __ne__(self, other): (source)

Compare ne NmapHost based on: - hostnames - address - if an associated services has changed :return: boolean

def __repr__(self): (source)

String representing the object :return: string

@address.setter
def address(self, addrdict): (source)

Setter for the address dictionnary. :param addrdict: valid dict is {'addr': '1.1.1.1', 'addrtype': 'ipv4'}

def changed(self, other): (source)

return the number of attribute who have changed :param other: NmapHost object to compare :return int

def diff(self, other): (source)

Calls NmapDiff to check the difference between self and another NmapHost object. Will return a NmapDiff object. This objects return python set() of keys describing the elements which have changed, were added, removed or kept unchanged. :param other: NmapHost to diff with :return: NmapDiff object

def get_dict(self): (source)

Return a dict representation of the object. This is needed by NmapDiff to allow comparaison :return dict

def get_open_ports(self): (source)

Same as get_ports() but only for open ports :return: list: of tuples (port,'proto') ie:[(22,'tcp'),(25, 'tcp')]

def get_ports(self): (source)

Retrieve a list of the port used by each service of the NmapHost :return: list: of tuples (port,'proto') ie:[(22,'tcp'),(25, 'tcp')]

def get_service(self, portno, protocol='tcp'): (source)

:param portno: int the portnumber :param protocol='tcp': string ('tcp','udp') :return: NmapService or None

def get_service_byid(self, service_id): (source)

Returns a NmapService by providing its id. The id of a nmap service is a python tupl made of (protocol, port)

def is_up(self): (source)

method to determine if host is up or not :return: bool

def os_class_probabilities(self): (source)

Returns an array of possible OS class detected during the OS fingerprinting. :return: Array of NmapOSClass objects

def os_match_probabilities(self): (source)

Returns an array of possible OS match detected during the OS fingerprinting :return: array of NmapOSMatches objects

def os_ports_used(self): (source)

Returns an array of the ports used for OS fingerprinting :return: array of ports used: [{'portid': '22', 'proto': 'tcp', 'state': 'open'},]

@status.setter
def status(self, statusdict): (source)

Setter for the status dictionnary. :param statusdict: valid dict is {"state": "open", "reason": "syn-ack", "reason_ttl": "0"} 'state' is the only mandatory key.

Undocumented

Accessor for the IP address of the scanned host :return: IP address as a string

Number of hops to host :return: int

Accessor for the unix timestamp of when the scan ended :return: string

@property
extraports_reasons = (source)

dictionnary containing reasons why extra ports scanned for which a common state, usually, closed was discovered. :return: array of dict containing keys 'state' and 'count' or None

@property
extraports_state = (source)

dictionnary containing state and amount of extra ports scanned for which a common state, usually, closed was discovered. :return: dict with keys 'state' and 'count' or None

Accessor returning the list of hostnames (array of strings). :return: array of string

id of the host. Used for diff()ing NmapObjects :return: string

Return the class of ip sequence of the remote hosts. :return: string

Accessor for the IPv4 address of the scanned host :return: IPv4 address as a string

Accessor for the IPv6 address of the scanned host :return: IPv6 address as a string

Since when the host was booted. :return: string

Accessor for the MAC address of the scanned host :return: MAC address as a string

@property
os_fingerprint = (source)

Returns the fingerprint of the scanned system. :return: string

@property
os_fingerprinted = (source)

Specify if the host has OS fingerprint data available :return: Boolean

@property
scripts_results = (source)

Scripts results specific to the scanned host :return: array of <script> dictionary

Accessor for the array of scanned services for that host. An array of NmapService objects is returned. :return: array of NmapService

Accessor for the unix timestamp of when the scan was started :return: string

Accessor for the host's status (up, down, unknown...) :return: string

@property
tcpsequence = (source)

Returns the difficulty to determine remotely predict the tcp sequencing. return: string

uptime of the remote host (if nmap was able to determine it) :return: string (in seconds)

Accessor for the vendor attribute of the scanned host :return: string (vendor) of empty string if no vendor defined

_address = (source)

Undocumented

_endtime = (source)

Undocumented

Undocumented

_hostnames = (source)

Undocumented

_ipv4_addr = (source)

Undocumented

_ipv6_addr = (source)

Undocumented

_mac_addr = (source)

Undocumented

_main_address = (source)

Undocumented

_osfingerprinted: bool = (source)

Undocumented

_services = (source)

Undocumented

_starttime = (source)

Undocumented

Undocumented

Undocumented