executeInjectPostExDll injects postex DLL into a process
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 485 | |
| 486 | // executeInjectPostExDll injects postex DLL into a process |
| 487 | func (e *Executor) executeInjectPostExDll(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
| 488 | pidVal, ok := action.Parameters["pid"] |
| 489 | if !ok { |
| 490 | return "", fmt.Errorf("pid parameter required for inject_postex_dll") |
| 491 | } |
| 492 | var pid int |
| 493 | switch v := pidVal.(type) { |
| 494 | case float64: |
| 495 | pid = int(v) |
| 496 | case int: |
| 497 | pid = v |
| 498 | default: |
| 499 | return "", fmt.Errorf("pid must be a number") |
| 500 | } |
| 501 | |
| 502 | dllPath, ok := action.Parameters["dll"].(string) |
| 503 | if !ok { |
| 504 | return "", fmt.Errorf("dll parameter required for inject_postex_dll") |
| 505 | } |
| 506 | args, _ := action.Parameters["args"].(string) // optional |
| 507 | |
| 508 | resp, err := client.InjectPostExDll(ctx, beaconID, pid, dllPath, args) |
| 509 | if err != nil { |
| 510 | return "", err |
| 511 | } |
| 512 | return e.waitForOutput(ctx, client, resp.TaskID) |
| 513 | } |
| 514 | |
| 515 | // --- Registry --- |
| 516 |
no test coverage detected