executeKill terminates a process by PID
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 1307 | |
| 1308 | // executeKill terminates a process by PID |
| 1309 | func (e *Executor) executeKill(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
| 1310 | pidVal, ok := action.Parameters["pid"] |
| 1311 | if !ok { |
| 1312 | return "", fmt.Errorf("pid parameter required for kill") |
| 1313 | } |
| 1314 | |
| 1315 | var pid int |
| 1316 | switch v := pidVal.(type) { |
| 1317 | case float64: |
| 1318 | pid = int(v) |
| 1319 | case int: |
| 1320 | pid = v |
| 1321 | default: |
| 1322 | return "", fmt.Errorf("pid parameter must be a number") |
| 1323 | } |
| 1324 | |
| 1325 | resp, err := client.Kill(ctx, beaconID, pid) |
| 1326 | if err != nil { |
| 1327 | return "", err |
| 1328 | } |
| 1329 | |
| 1330 | return e.waitForOutput(ctx, client, resp.TaskID) |
| 1331 | } |
| 1332 | |
| 1333 | // executeGetPrivs enables all available privileges |
| 1334 | func (e *Executor) executeGetPrivs(ctx context.Context, client *csclient.Client, beaconID string) (string, error) { |
no test coverage detected