class documentation

class NmapReport(object): (source)

View In Hierarchy

NmapReport is the usual interface for the end user to read scans output. A NmapReport as the following structure: - Scan headers data - A list of scanned hosts (NmapReport.hosts) - Scan footer data It is to note that each NmapHost comprised in NmapReport.hosts array contains also a list of scanned services (NmapService object). This means that if NmapParser.parse*() is the input interface for the end user of the lib. NmapReport is certainly the output interface for the end user of the lib.

Method __eq__ Compare eq NmapReport based on :
Method __init__ Constructor for NmapReport object.
Method __ne__ Compare ne NmapReport based on:
Method __repr__ Returns a string-based representation of the report
Method diff Calls NmapDiff to check the difference between self and another NmapReport object.
Method get_dict Return a python dict representation of the NmapReport object. This is used to diff() NmapReport objects via NmapDiff.
Method get_host_byid Gets a NmapHost object directly from the host array by looking it up by id.
Method get_raw_data Returns a dict representing the NmapReport object.
Method is_consistent Checks if the report is consistent and can be diffed().
Method save This method gets a NmapBackendPlugin representing the backend.
Property commandline Accessor returning the full nmap command line fired.
Property elapsed Accessor returning the number of seconds the scan took
Property endtime Accessor returning a unix timestamp of when the scan ended.
Property endtimestr Accessor returning a human readable time string of when the scan ended.
Property hosts Accessor returning an array of scanned hosts.
Property hosts_down Accessor returning the number of host detected as 'down' during the scan.
Property hosts_total Accessor returning the number of hosts scanned in total.
Property hosts_up Accessor returning the number of host detected as 'up' during the scan.
Property id Dummy id() defined for reports.
Property numservices Accessor returning the number of services the scan attempted to enumerate.
Property scan_type Accessor returning a string which identifies what type of scan was launched (syn, ack, tcp,...).
Property started Accessor returning a unix timestamp of when the scan was started.
Property startedstr Accessor returning a human readable string of when the scan was started
Property summary Accessor returning a string describing and summarizing the scan.
Property version Accessor returning the version of the nmap binary used to perform the scan.
Property xmlversion Accessor returning the XML output version of the nmap report.
Method __set_raw_data Undocumented
Instance Variable _hosts Undocumented
Instance Variable _nmaprun Undocumented
Instance Variable _runstats Undocumented
Instance Variable _scaninfo Undocumented
def __eq__(self, other): (source)

Compare eq NmapReport based on : - create a diff obj and check the result report are equal if added&changed&removed are empty :return: boolean

def __init__(self, raw_data=None): (source)

Constructor for NmapReport object. This is usually called by the NmapParser module.

def __ne__(self, other): (source)

Compare ne NmapReport based on: - create a diff obj and check the result report are ne if added|changed|removed are not empty :return: boolean

def __repr__(self): (source)

Returns a string-based representation of the report :return: string

def diff(self, other): (source)

Calls NmapDiff to check the difference between self and another NmapReport object. Will return a NmapDiff object. :return: NmapDiff object :todo: remove is_consistent approach, diff() should be generic.

def get_dict(self): (source)

Return a python dict representation of the NmapReport object. This is used to diff() NmapReport objects via NmapDiff. :return: dict

def get_host_byid(self, host_id): (source)

Gets a NmapHost object directly from the host array by looking it up by id. :param ip_addr: ip address of the host to lookup :type ip_addr: string :return: NmapHost

def get_raw_data(self): (source)

Returns a dict representing the NmapReport object. :return: dict :todo: deprecate. get rid of this ugliness.

def is_consistent(self): (source)

Checks if the report is consistent and can be diffed(). This needs to be rewritten and removed: diff() should be generic. :return: boolean

def save(self, backend): (source)

This method gets a NmapBackendPlugin representing the backend. :param backend: libnmap.plugins.PluginBackend object. Object created by BackendPluginFactory and enabling nmap reports to be saved/stored in any type of backend implemented in plugins. The primary key of the stored object is returned. :return: str

@property
commandline = (source)

Accessor returning the full nmap command line fired. :return: string

Accessor returning the number of seconds the scan took :return: float (0 >= or -1)

Accessor returning a unix timestamp of when the scan ended. :return: integer

Accessor returning a human readable time string of when the scan ended. :return: string

Accessor returning an array of scanned hosts. Scanned hosts are NmapHost objects. :return: array of NmapHost

Accessor returning the number of host detected as 'down' during the scan. :return: integer (0 >= or -1)

@property
hosts_total = (source)

Accessor returning the number of hosts scanned in total. :return: integer (0 >= or -1)

Accessor returning the number of host detected as 'up' during the scan. :return: integer (0 >= or -1)

Dummy id() defined for reports.

@property
numservices = (source)

Accessor returning the number of services the scan attempted to enumerate. :return: integer

Accessor returning a string which identifies what type of scan was launched (syn, ack, tcp,...). :return: string

Accessor returning a unix timestamp of when the scan was started. :return: integer

Accessor returning a human readable string of when the scan was started :return: string

Accessor returning a string describing and summarizing the scan. :return: string

Accessor returning the version of the nmap binary used to perform the scan. :return: string

Accessor returning the XML output version of the nmap report. :return: string

def __set_raw_data(self, raw_data): (source)

Undocumented

Undocumented

_nmaprun = (source)

Undocumented

_runstats = (source)

Undocumented

_scaninfo = (source)

Undocumented