forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservices.go
63 lines (54 loc) · 1.63 KB
/
services.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
58
59
60
61
62
63
package executor
import (
"context"
"errors"
"sync"
"www.velocidex.com/golang/velociraptor/actions"
config_proto "www.velocidex.com/golang/velociraptor/config/proto"
"www.velocidex.com/golang/velociraptor/constants"
crypto_proto "www.velocidex.com/golang/velociraptor/crypto/proto"
"www.velocidex.com/golang/velociraptor/logging"
"www.velocidex.com/golang/velociraptor/responder"
"www.velocidex.com/golang/velociraptor/services"
"www.velocidex.com/golang/velociraptor/startup"
)
// Start services that are available on the client.
func StartServices(
sm *services.Service,
client_id string,
exe *ClientExecutor) error {
err := startup.StartupEssentialServices(sm)
if err != nil {
return err
}
// Now start client specific services.
err = sm.Start(func(ctx context.Context,
wg *sync.WaitGroup,
config_obj *config_proto.Config) error {
return StartEventTableService(ctx, wg, config_obj, exe)
})
if err != nil {
return err
}
return sm.Start(StartNannyService)
}
func StartEventTableService(
ctx context.Context,
wg *sync.WaitGroup,
config_obj *config_proto.Config,
exe *ClientExecutor) error {
if config_obj.Writeback == nil {
return errors.New("Client writeback not configured")
}
logger := logging.GetLogger(config_obj, &logging.ClientComponent)
logger.Info("<green>Starting</> event query service.")
responder := responder.NewResponder(
config_obj, &crypto_proto.GrrMessage{
SessionId: constants.MONITORING_WELL_KNOWN_FLOW,
}, exe.Outbound)
if config_obj.Writeback.EventQueries != nil {
actions.UpdateEventTable{}.Run(config_obj, ctx,
responder, config_obj.Writeback.EventQueries)
}
return nil
}