forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made gRPC pool parameters tunable. (Velocidex#309)
Also removed many of the internal calls to reduce internal gRPC call load.
- Loading branch information
Showing
31 changed files
with
819 additions
and
669 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3 | ||
4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package clients | ||
|
||
import ( | ||
"strings" | ||
|
||
errors "github.com/pkg/errors" | ||
api_proto "www.velocidex.com/golang/velociraptor/api/proto" | ||
config_proto "www.velocidex.com/golang/velociraptor/config/proto" | ||
constants "www.velocidex.com/golang/velociraptor/constants" | ||
"www.velocidex.com/golang/velociraptor/datastore" | ||
) | ||
|
||
func LabelClients( | ||
config_obj *config_proto.Config, | ||
in *api_proto.LabelClientsRequest) (*api_proto.APIResponse, error) { | ||
db, err := datastore.GetDB(config_obj) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
index_func := db.SetIndex | ||
switch in.Operation { | ||
case "remove": | ||
index_func = db.UnsetIndex | ||
case "check": | ||
index_func = db.CheckIndex | ||
case "set": | ||
// default. | ||
default: | ||
return nil, errors.New( | ||
"unknown label operation. Must be set, check or remove") | ||
} | ||
|
||
for _, label := range in.Labels { | ||
for _, client_id := range in.ClientIds { | ||
if !strings.HasPrefix(label, "label:") { | ||
label = "label:" + label | ||
} | ||
err = index_func( | ||
config_obj, | ||
constants.CLIENT_INDEX_URN, | ||
client_id, []string{label}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
err = index_func( | ||
config_obj, | ||
constants.CLIENT_INDEX_URN, | ||
label, []string{client_id}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
} | ||
} | ||
|
||
return &api_proto.APIResponse{}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.