Add tactical fleet remote actions and agent command channel.

Extend remote commands with exec, PowerShell, file transfer, and fleet-wide broadcast; refresh AgentRemoteActions UI and WebSocket handling.
This commit is contained in:
drjones
2026-05-27 21:24:57 -07:00
parent b10d353a8b
commit 830c755235
6 changed files with 477 additions and 234 deletions

View File

@@ -81,6 +81,9 @@ func (f *FleetHandler) GetAgentLog(w http.ResponseWriter, r *http.Request) {
type agentCommandRequest struct {
Action string `json:"action"`
TailLines int `json:"tail_lines,omitempty"`
Command string `json:"command,omitempty"`
Path string `json:"path,omitempty"`
Data string `json:"data,omitempty"`
}
func (f *FleetHandler) PostAgentCommand(w http.ResponseWriter, r *http.Request) {
@@ -102,9 +105,23 @@ func (f *FleetHandler) PostAgentCommand(w http.ResponseWriter, r *http.Request)
if req.TailLines > 0 {
args["tail_lines"] = req.TailLines
}
if err := f.ws.SendAgentCommand(id, req.Action, args); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
if req.Command != "" {
args["command"] = req.Command
}
if req.Path != "" {
args["path"] = req.Path
}
if req.Data != "" {
args["data"] = req.Data
}
if id == "all" {
f.ws.BroadcastAgentCommand(req.Action, args)
} else {
if err := f.ws.SendAgentCommand(id, req.Action, args); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
}
writeJSON(w, map[string]interface{}{
"success": true,