forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaths.go
49 lines (43 loc) · 977 Bytes
/
paths.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
// This file defines the schema of where various things go into the
// filestore.
package paths
import (
"strings"
)
const (
// The different types of artifacts.
MODE_INVALID = iota
MODE_CLIENT
MODE_CLIENT_EVENT
MODE_SERVER
MODE_SERVER_EVENT
MODE_NOTEBOOK
INTERNAL
)
func ModeNameToMode(name string) int {
name = strings.ToUpper(name)
switch name {
case "CLIENT":
return MODE_CLIENT
case "CLIENT_EVENT":
return MODE_CLIENT_EVENT
case "SERVER":
return MODE_SERVER
case "SERVER_EVENT":
return MODE_SERVER_EVENT
case "NOTEBOOK":
return MODE_NOTEBOOK
case "INTERNAL":
return INTERNAL
}
return MODE_INVALID
}
// Fully qualified source names are obtained by joining the artifact
// name to the source name. This splits them back up.
func SplitFullSourceName(artifact_source string) (artifact string, source string) {
parts := strings.Split(artifact_source, "/")
if len(parts) == 2 {
return parts[0], parts[1]
}
return artifact_source, ""
}