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.
If you can set the output file path in advance, read Setting the file path.
If you cannot know, set, or guess the output file path in advance, read Using a regular expression to get the file path.
Setting the file path
Steps:
Set the file path before the command runs using the
on_inithookUse the
on_cmd_donehook to read the file and yieldsecatoroutput 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
RegexSerializerto read and set the output file path.Use the
on_cmd_donehook to read the file and yieldsecatoroutput 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?