--- Privilege Elevation --- executeElevateCommand executes a command in elevated context
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 95 | |
| 96 | // executeElevateCommand executes a command in elevated context |
| 97 | func (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 |
| 116 | func (e *Executor) executeElevateBeacon(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
no test coverage detected