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

Method executeKill

workflow/executor.go:1309–1331  ·  view source on GitHub ↗

executeKill terminates a process by PID

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

Source from the content-addressed store, hash-verified

1307
1308// executeKill terminates a process by PID
1309func (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
1334func (e *Executor) executeGetPrivs(ctx context.Context, client *csclient.Client, beaconID string) (string, error) {

Callers 1

executeActionMethod · 0.95

Calls 1

waitForOutputMethod · 0.95

Tested by

no test coverage detected