forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindexing.go
76 lines (61 loc) · 1.87 KB
/
indexing.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
64
65
66
67
68
69
70
71
72
73
74
75
76
package services
import (
"context"
api_proto "www.velocidex.com/golang/velociraptor/api/proto"
config_proto "www.velocidex.com/golang/velociraptor/config/proto"
"www.velocidex.com/golang/velociraptor/file_store/api"
"www.velocidex.com/golang/vfilter"
)
func GetIndexer(config_obj *config_proto.Config) (Indexer, error) {
org_manager, err := GetOrgManager()
if err != nil {
return nil, err
}
return org_manager.Services(config_obj.OrgId).Indexer()
}
type Indexer interface {
// Set a search term on a client
SetIndex(client_id, term string) error
// Clear a search term on a client
UnsetIndex(client_id, term string) error
// Search the index for clients matching the term
SearchIndexWithPrefix(
ctx context.Context,
config_obj *config_proto.Config,
prefix string) <-chan *api_proto.IndexRecord
SearchClientsChan(
ctx context.Context,
scope vfilter.Scope,
config_obj *config_proto.Config,
search_term string, principal string) (chan *api_proto.ApiClient, error)
SearchClients(
ctx context.Context,
config_obj *config_proto.Config,
in *api_proto.SearchClientsRequest,
principal string) (*api_proto.SearchClientsResponse, error)
SetSimpleIndex(
config_obj *config_proto.Config,
index_urn api.DSPathSpec,
entity string,
keywords []string) error
UnsetSimpleIndex(
config_obj *config_proto.Config,
index_urn api.DSPathSpec,
entity string,
keywords []string) error
CheckSimpleIndex(
config_obj *config_proto.Config,
index_urn api.DSPathSpec,
entity string,
keywords []string) error
UpdateMRU(
config_obj *config_proto.Config,
user_name string, client_id string) error
FastGetApiClient(
ctx context.Context,
config_obj *config_proto.Config,
client_id string) (*api_proto.ApiClient, error)
// Rebuild the index completely from the client info manager.
RebuildIndex(ctx context.Context,
config_obj *config_proto.Config) error
}