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

Method executeRemoteExec

workflow/executor_pivoting.go:157–178  ·  view source on GitHub ↗

executeRemoteExec executes a command on a target via specific remote execution method

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

Source from the content-addressed store, hash-verified

155
156// executeRemoteExec executes a command on a target via specific remote execution method
157func (e *Executor) executeRemoteExec(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) {
158 method, ok := action.Parameters["method"].(string)
159 if !ok {
160 return "", fmt.Errorf("method parameter required for remote_exec")
161 }
162
163 target, ok := action.Parameters["target"].(string)
164 if !ok {
165 return "", fmt.Errorf("target parameter required for remote_exec")
166 }
167
168 command, ok := action.Parameters["command"].(string)
169 if !ok {
170 return "", fmt.Errorf("command parameter required for remote_exec")
171 }
172
173 resp, err := client.RemoteExec(ctx, beaconID, method, target, command)
174 if err != nil {
175 return "", err
176 }
177 return e.waitForOutput(ctx, client, resp.TaskID)
178}
179
180// executeJump executes a beacon session on a remote target with the specified remote execution method
181func (e *Executor) executeJump(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