--- Command Execution Variants --- executeRun executes a command without cmd.exe
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 11 | |
| 12 | // executeRun executes a command without cmd.exe |
| 13 | func (e *Executor) executeRun(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
| 14 | program, ok := action.Parameters["program"].(string) |
| 15 | if !ok { |
| 16 | return "", fmt.Errorf("program parameter required for run") |
| 17 | } |
| 18 | args, _ := action.Parameters["args"].(string) // optional |
| 19 | |
| 20 | resp, err := client.Run(ctx, beaconID, program, args) |
| 21 | if err != nil { |
| 22 | return "", err |
| 23 | } |
| 24 | return e.waitForOutput(ctx, client, resp.TaskID) |
| 25 | } |
| 26 | |
| 27 | // executeRunAs executes a command as another user |
| 28 | func (e *Executor) executeRunAs(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
no test coverage detected