Nmap

Warning

The development of the Nmap ranking system has been postponed to after the GSoC. For now, the classes below only parse the XML reports generated by Nmap but do not rank the discoveries.

Parser

synopsis:Specialized ptp.libptp.parser.AbstractParser classes for the tool Nmap.
class ptp.tools.nmap.parser.NmapXMLParser(pathname='./', filename='*.xml', **kwargs)[source]
__tool__ = 'nmap'
__format__ = 'xml'
__version__ = '6\\.46'
classmethod is_mine(pathname, filename='*.xml', light=False, first=True)[source]

Check if it can handle the report file.

Parameters:
  • pathname (str) – Path to the report directory.
  • filename (str) – Regex matching the report file.
  • light (bool) – True to only parse the ranking of the findings from the report.
  • first (bool) – Only process first file (True) or each file that matched (False).
Raises:
  • IOError – when the report file cannot be found.
  • OSError – when the report file cannot be found.
Returns:

True if it supports the report, False otherwise.

Return type:

bool

parse_metadata()[source]

Parse the metadatas of the report.

Returns:The metadatas of the report.
Return type:dict
Raises:NotSupportedVersionError – if it does not support the version of this report.
parse_report()[source]

Parse the results of the report.

Returns:List of dicts where each one represents a vuln.
Return type:list

Warning

Not implemented yet.