Server.Hunts.CancelAndDelete
Type: Server
Cancels all in-flight flows in a hunt, deletes the hunt, and optionally removes collected data.
Velociraptor Hunts are a way of running the same flow on many endpoints at once. Hunts issue very quickly and wait until each endpoint returns results.
Sometimes, the artifacts collected might take a long time and have unacceptable performance impact on the endpoint. In some cases the artifacts end up retrieving too much data that is not needed.
For those cases you might want to run the following server artifact. It cancels all currently in-flight collections.
Optionally you can also remove any files already collected if you do not need them.
This artifact is implicitly collected by the GUI when pressing the “Delete Hunt” Button.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
HuntId |
string | hunt_id you would like to kill all associated flows. | |
Hunts |
json_array | [] |
A list of hunt ids to delete |
DeleteAllFiles |
bool | Also delete all collected files |
Source
Defined in artifacts/definitions/Server/Hunts/CancelAndDelete.yaml.
name: Server.Hunts.CancelAndDelete
description: |
Cancels all in-flight flows in a hunt, deletes the hunt, and
optionally removes collected data.
Velociraptor Hunts are a way of running the same flow on many
endpoints at once. Hunts issue very quickly and wait until each
endpoint returns results.
Sometimes, the artifacts collected might take a long time and have
unacceptable performance impact on the endpoint. In some cases the
artifacts end up retrieving too much data that is not needed.
For those cases you might want to run the following server artifact.
It cancels all currently in-flight collections.
Optionally you can also remove any files already collected if you do
not need them.
This artifact is implicitly collected by the GUI when pressing the
"Delete Hunt" Button.
type: SERVER
parameters:
- name: HuntId
description: hunt_id you would like to kill all associated flows.
- name: Hunts
type: json_array
description: A list of hunt ids to delete
default: '[]'
- name: DeleteAllFiles
description: Also delete all collected files
type: bool
sources:
- name: CancelFlows
query: |
LET all_flows(HuntId) = SELECT Flow.client_id AS client_id, Flow.session_id AS flow_id
FROM hunt_flows(hunt_id=HuntId)
WHERE NOT Flow.state =~ "ERROR|FINISHED"
LET cancellations(HuntId) = SELECT HuntId, client_id, flow_id,
cancel_flow(client_id=client_id, flow_id=flow_id) AS Cancellation
FROM all_flows(HuntId=HuntId)
LET AllHunts <= if(condition=HuntId, then=Hunts + HuntId, else=Hunts)
SELECT * FROM foreach(row={
SELECT _value AS HuntId
FROM items(item=AllHunts)
WHERE hunt_update(hunt_id=HuntId, add_labels="Deleting...")
}, query={
SELECT * FROM cancellations(HuntId=HuntId)
}, workers=2)
- name: HuntFiles
query: |
LET AllHunts <= if(condition=HuntId, then=Hunts + HuntId, else=Hunts)
SELECT * FROM foreach(row={
SELECT _value as HuntId
FROM items(item=AllHunts)
WHERE if(condition=DeleteAllFiles,
then=hunt_update(hunt_id=HuntId, add_labels="Deleting..."),
else=TRUE)
}, query={
SELECT *
FROM hunt_delete(hunt_id=HuntId, really_do_it=DeleteAllFiles)
})