Parsing output files

... or how to integrate tools that save their output to a file.

If your tool supports output as individual files, you can easily integrate it with secator.


Setting the file path

Steps:

  • Set the file path before the command runs using the on_init hook

  • Use the on_cmd_done hook to read the file and yield secator output types.

Example:

Assume mytool outputs to a JSON file like:

mytool -u mytarget.com -format json -o result.json
...

and the corresponding JSON would look like:

[
  { "type": "url", "url": "http://mytarget.com", "status": 200 },
  { "type": "vulnerability", "target": "https://mytarget.com", "cve_id": "CVE-XXXX-XXXX", "name": "Bad vuln", "severity": "CRITICAL"},
]

An integration of mytool with secator would look like:

Run it with secator:


Using a regular expression to get the file path

Steps:

  • Use the RegexSerializer to read and set the output file path.

  • Use the on_cmd_done hook to read the file and yield secator output types.

Example:

Assume mytool outputs to a JSON file like:

and the corresponding JSON would look like:

First we need to find a named regular expression that will match the filename.

Here is the one we came up with:

An integration of mytool with secator would look like:

Run it with secator:


Last updated

Was this helpful?