libnmap.objects.report¶
Using libnmap.objects.report module¶
TODO
NmapReport methods¶
-
class
libnmap.objects.
NmapReport
(raw_data=None)[source]¶ 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.
-
commandline
¶ Accessor returning the full nmap command line fired.
Returns: string
-
diff
(other)[source]¶ Calls NmapDiff to check the difference between self and another NmapReport object.
Will return a NmapDiff object.
Returns: NmapDiff object Todo: remove is_consistent approach, diff() should be generic.
-
elapsed
¶ Accessor returning the number of seconds the scan took
Returns: float (0 >= or -1)
-
endtime
¶ Accessor returning a unix timestamp of when the scan ended.
Returns: integer
-
endtimestr
¶ Accessor returning a human readable time string of when the scan ended.
Returns: string
-
get_dict
()[source]¶ Return a python dict representation of the NmapReport object. This is used to diff() NmapReport objects via NmapDiff.
Returns: dict
-
get_host_byid
(host_id)[source]¶ Gets a NmapHost object directly from the host array by looking it up by id.
Parameters: ip_addr (string) – ip address of the host to lookup Returns: NmapHost
-
get_raw_data
()[source]¶ Returns a dict representing the NmapReport object.
Returns: dict Todo: deprecate. get rid of this uglyness.
-
hosts
¶ Accessor returning an array of scanned hosts.
Scanned hosts are NmapHost objects.
Returns: array of NmapHost
-
hosts_down
¶ Accessor returning the numer of host detected as ‘down’ during the scan.
Returns: integer (0 >= or -1)
-
hosts_total
¶ Accessor returning the number of hosts scanned in total.
Returns: integer (0 >= or -1)
-
hosts_up
¶ Accessor returning the numer of host detected as ‘up’ during the scan.
Returns: integer (0 >= or -1)
-
id
¶ Dummy id() defined for reports.
-
is_consistent
()[source]¶ Checks if the report is consistent and can be diffed().
This needs to be rewritten and removed: diff() should be generic.
Returns: boolean
-
numservices
¶ Accessor returning the number of services the scan attempted to enumerate.
Returns: integer
-
save
(backend)[source]¶ This method gets a NmapBackendPlugin representing the backend.
Parameters: 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.
Returns: str
-
scan_type
¶ Accessor returning a string which identifies what type of scan was launched (syn, ack, tcp,…).
Returns: string
-
started
¶ Accessor returning a unix timestamp of when the scan was started.
Returns: integer
-
startedstr
¶ Accessor returning a human readable string of when the scan was started
Returns: string
-
summary
¶ Accessor returning a string describing and summarizing the scan.
Returns: string
-
version
¶ Accessor returning the version of the nmap binary used to perform the scan.
Returns: string
-
xmlversion
¶ Accessor returning the XML output version of the nmap report.
Returns: string