forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.go
52 lines (43 loc) · 1.24 KB
/
utils.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
package artifacts
import (
config_proto "www.velocidex.com/golang/velociraptor/config/proto"
"www.velocidex.com/golang/velociraptor/constants"
"www.velocidex.com/golang/velociraptor/uploads"
"www.velocidex.com/golang/velociraptor/utils"
vql_subsystem "www.velocidex.com/golang/velociraptor/vql"
"www.velocidex.com/golang/vfilter"
)
// Gets the client config from the scope.
func GetConfig(scope vfilter.Scope) (*config_proto.ClientConfig, bool) {
scope_config, pres := scope.Resolve(constants.SCOPE_CONFIG)
if !pres {
return nil, false
}
config, ok := scope_config.(*config_proto.ClientConfig)
if config == nil {
return nil, false
}
return config, ok
}
func GetUploader(scope vfilter.Scope) (uploads.Uploader, bool) {
scope_uploader, pres := scope.Resolve(constants.SCOPE_UPLOADER)
if !pres {
return nil, false
}
config, ok := scope_uploader.(uploads.Uploader)
if utils.IsNil(config) {
return nil, false
}
return config, ok
}
func GetACLManager(scope vfilter.Scope) (vql_subsystem.ACLManager, bool) {
scope_manager, pres := scope.Resolve(vql_subsystem.ACL_MANAGER_VAR)
if !pres {
return nil, false
}
config, ok := scope_manager.(vql_subsystem.ACLManager)
if utils.IsNil(config) {
return nil, false
}
return config, ok
}