Scan Manager
============
The scan manager handles scanning all queued data items against all
activated scan engines, and returns an array of scan results. This API
is a high-level way to interact with sscan without manually dequeueing
data items and passing them to individual scan engines.
SCANMGR METHODS
***************
+----------------+---------+--------------------------------------------+
| Method | Returns | Description |
+----------------+---------+--------------------------------------------+
| scanmgr:scan() | table | Scan all queued data items. |
| | | |
| | | The scan() method will drain the global |
| | | scan queue, passing each queued data item |
| | | to all activated scan engines for analysis |
| | | |
| | | This method returns an array of scan |
| | | results, which have the schema described |
| | | below in __Scan Results__. |
+----------------+---------+--------------------------------------------+
Scan Results
************
Each scan result item has the following schema.
{
-- Name of the scan engine that matched the data item.
engine: string,
-- The data item that was matched.
item: {
name: string,
path: string?,
}
}
Serializing Results
*******************
The following methods can be called on a table of scan results:
+---------------------+---------+---------------------------------------+
| Method | Returns | Description |
+---------------------+---------+---------------------------------------+
| results:csv( | string | Convert scan results to CSV. |
| headers: boolean? | | |
| ) | | This method accepts an optional bool |
| | | argument, which if true, emits CSV |
| | | headers along with the data. |
+---------------------+---------+---------------------------------------+
| results:json( | string | Convert scan results to JSON. |
| pretty: boolean? | | |
| ) | | This method accepts an optional bool |
| | | argument, which if true, emits pretty |
| | | JSON output. Otherwise, it emits |
| | | minified JSON. |
+---------------------+---------+---------------------------------------+
| results:ndjson() | string | Convert scan results to NDJSON. |
| | | |
| | | NDJSON is similar to JSON, but each |
| | | individual JSON object is on its own |
| | | line, instead of in a big array. |
| | | |
| | | NDJSON is commonly used for importing |
| | | data into NoSQL databases. |
+---------------------+---------+---------------------------------------+