How to Set Up Custom Flags Using Spyctl CLI
How to Set Up Custom Detections Using Spyctl CLI
1. Create a Custom Detection
$ spyctl create custom-flag --help
Create a custom flag from a saved query.
This command allows you to write custom detections using the Spyderbat Query
Language (SpyQL).
At a minimum you must provide the following:
- schema
- query
- description
- severity
- name
To view available schema options run:
'spyctl search --describe'
To view available query fields for your schema run:
'spyctl search --describe <schema>'
Query operators are described here:
https://docs.spyderbat.com/reference/search/search-operators
Example:
spyctl create custom-flag --schema Process --query "interactive = true and container_uid ~= '*'" --description "Detects interactive processes in containers" --severity high interactive-container-process
Options:
-o, --output [yaml|json|ndjson|default]
-a, --apply Apply the custom flag during creation.
-d, --description A description explaining what the flag
detects. [required]
-q, --query Objects matching this query + schema
combination will be flagged. If used, this
will create a saved query.
-s, --schema The schema for the SpyQL query used by the
custom flag. If used, this will create a
saved query.
-Q, --saved-query The UID of a previously saved query. If
used, this will override the query and
schema options.
-t, --type The type of the custom flag. One of
['redflag', 'opsflag'].
-S, --severity The severity of the custom flag. One of
['critical', 'high', 'medium', 'low',
'info']. [required]
-D, --disable Disable the custom flag on creation.
-T, --tags The tags associated with the custom flag.
Comma delimited.
-i, --impact The impact of the custom flag on the
organization.
-c, --content Markdown content describing extra details
about the custom flag.
-N, --saved_query_name If a new saved query needs to be created,
this overrides the auto-generated name.
-y, --yes Automatically answer yes to all prompts.
Usage:
spyctl create custom-flag [OPTIONS] NAME
2. Get All Custom Flags
3. Edit a Custom Flag
4. Delete a Custom Flag
5. Disable a Custom Flag
6. Enable a Custom Flag
Last updated
Was this helpful?