executeRemoteExec executes a command on a target via specific remote execution method
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 155 | |
| 156 | // executeRemoteExec executes a command on a target via specific remote execution method |
| 157 | func (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 |
| 181 | func (e *Executor) executeJump(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
no test coverage detected