forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhunt_metadata.go
57 lines (47 loc) · 1.33 KB
/
hunt_metadata.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package paths
import (
"www.velocidex.com/golang/velociraptor/file_store/api"
)
type HuntPathManager struct {
path api.DSPathSpec
hunt_id string
}
func (self HuntPathManager) Path() api.DSPathSpec {
return self.path
}
// Get the file store path for placing the download zip for the flow.
func (self HuntPathManager) GetHuntDownloadsFile(only_combined bool,
base_filename string, locked bool) api.FSPathSpec {
suffix := ""
if only_combined {
suffix = "-summary"
}
filename := base_filename + self.hunt_id + suffix
if locked {
filename += "_locked"
}
return DOWNLOADS_ROOT.AddUnsafeChild(
"hunts", self.hunt_id, filename).SetType(
api.PATH_TYPE_FILESTORE_DOWNLOAD_ZIP)
}
func NewHuntPathManager(hunt_id string) *HuntPathManager {
return &HuntPathManager{
path: HUNTS_ROOT.AddChild(hunt_id),
hunt_id: hunt_id,
}
}
func (self HuntPathManager) Stats() api.DSPathSpec {
return self.path.AddChild("stats")
}
func (self HuntPathManager) HuntDirectory() api.DSPathSpec {
return HUNTS_ROOT
}
// Get result set for storing participating clients.
func (self HuntPathManager) Clients() api.FSPathSpec {
return HUNTS_ROOT.AddChild(self.hunt_id).AsFilestorePath()
}
// Where to store client errors.
func (self HuntPathManager) ClientErrors() api.FSPathSpec {
return HUNTS_ROOT.AddChild(self.hunt_id + "_errors").
AsFilestorePath()
}