PTP

class ptp.PTP(tool_name='', cumulative=False)[source]

PTP class exposing ptp’s public API.

Example:

ptp = PTP(pathname='my/path')
ptp.parse()
__init__(tool_name='', cumulative=False)[source]

Initialize PTP.

Parameters:
  • tool_name (str) – help ptp by specifying the name of the tool that has generated the target report.
  • cumulative (bool) – True to cumulate the vulns across multiple tools. False to reset them.
Raises:

ptp.libptp.exceptions.NotSupportedToolError when tool_name is not in the PTP’s supported tools list.

_init_parser(*args, **kwargs)[source]

Find and initialize the parser automatically.

Parameters:
  • *args (list) – Arguments that are needed by the parser.
  • **kwargs (dict) – Arguments that are needed by the parser.
cumulative = None

bool – Check if user wants vulns to be re-intialised for each run ot not.

highest_ranking

Return the highest ranking of the report.

Returns:the risk id of the highest ranked vulnerability referenced in the report.
Return type:int

Note

The ranking starts from 0 to n where n represents the most critical risk. (See ptp.libptp.constants).

metadata = None

dict – Metadata from the report.

parse(*args, **kwargs)[source]

Parse a tool report.

Parameters:
  • *args (list) – Arguments that are needed by the parser.
  • **kwargs (dict) – Arguments that are needed by the parser.
Raises:

NotSupportedToolError if the tool that has generated the report is not supported by PTP.

Returns:

The list of dictionaries of the results found in the report.

Return type:

list

supported = {'arachni': [<class 'ptp.tools.arachni.parser.ArachniXMLParser'>, <class 'ptp.tools.arachni.parser.ArachniJSONParser'>], 'skipfish': [<class 'ptp.tools.skipfish.parser.SkipfishJSParser'>], 'w3af': [<class 'ptp.tools.w3af.parser.W3AFXMLParser'>], 'wapiti': [<class 'ptp.tools.wapiti.parser.WapitiXMLParser'>, <class 'ptp.tools.wapiti.parser.Wapiti221XMLParser'>], 'metasploit': [<class 'ptp.tools.metasploit.parser.MetasploitParser'>], 'dirbuster': [<class 'ptp.tools.dirbuster.parser.DirbusterParser'>], 'nmap': [<class 'ptp.tools.nmap.parser.NmapXMLParser'>], 'owasp-cm-008': [<class 'ptp.tools.owasp.cm008.parser.OWASPCM008Parser'>], 'robots': [<class 'ptp.tools.robots.parser.RobotsParser'>], 'burpsuite': [<class 'ptp.tools.burpsuite.parser.BurpXMLParser'>], 'hoppy': [<class 'ptp.tools.hoppy.parser.HoppyParser'>]}

dict – Supported tools and their parser(s).

tool_name = None

str – Name of the tool that generated the report.

vulns = None

list – Vulnerabilities that are listed in the report.