MCPcopy Create free account
hub / github.com/Xenov-X/csbot / executeElevateCommand

Method executeElevateCommand

workflow/executor_spawn.go:97–113  ·  view source on GitHub ↗

--- Privilege Elevation --- executeElevateCommand executes a command in elevated context

(ctx context.Context, client *csclient.Client, beaconID string, action Action)

Source from the content-addressed store, hash-verified

95
96// executeElevateCommand executes a command in elevated context
97func (e *Executor) executeElevateCommand(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) {
98 exploit, ok := action.Parameters["exploit"].(string)
99 if !ok {
100 return "", fmt.Errorf("exploit parameter required for elevate_command")
101 }
102 command, ok := action.Parameters["command"].(string)
103 if !ok {
104 return "", fmt.Errorf("command parameter required for elevate_command")
105 }
106 args, _ := action.Parameters["args"].(string) // optional
107
108 resp, err := client.ElevateCommand(ctx, beaconID, exploit, command, args)
109 if err != nil {
110 return "", err
111 }
112 return e.waitForOutput(ctx, client, resp.TaskID)
113}
114
115// executeElevateBeacon creates an elevated beacon session
116func (e *Executor) executeElevateBeacon(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) {

Callers 1

executeActionMethod · 0.95

Calls 1

waitForOutputMethod · 0.95

Tested by

no test coverage detected