(t *testing.T)
| 646 | } |
| 647 | |
| 648 | func TestE2E_ShellModule_Ps_Linux(t *testing.T) { |
| 649 | mgr := sessions.NewManager(10 * time.Minute) |
| 650 | origGlobal := swapGlobalManager(mgr) |
| 651 | defer swapGlobalManager(origGlobal) |
| 652 | |
| 653 | b, stream, sess := setupTestBridge(t, mgr, "claude-code/1.0.33 (Linux 6.1.0; x86_64)", testClaudeTools) |
| 654 | |
| 655 | spite := &implantpb.Spite{ |
| 656 | Name: consts.ModulePs, |
| 657 | Body: &implantpb.Spite_Request{Request: &implantpb.Request{}}, |
| 658 | } |
| 659 | |
| 660 | b.taskManager.StartSessionListener(sess.ID) |
| 661 | simulateToolResult(mgr, sess.ID, 20, wrapToolOutput(linuxPsOutput), 50*time.Millisecond) |
| 662 | dispatchWithTimeout(t, b, sess.ID, 20, spite, 3*time.Second) |
| 663 | |
| 664 | sent := stream.getSent() |
| 665 | if len(sent) == 0 { |
| 666 | t.Fatal("expected SpiteResponse") |
| 667 | } |
| 668 | |
| 669 | last := sent[len(sent)-1] |
| 670 | pr := last.Spite.GetPsResponse() |
| 671 | if pr == nil { |
| 672 | t.Fatal("expected PsResponse body") |
| 673 | } |
| 674 | if len(pr.Processes) != 5 { |
| 675 | t.Errorf("expected 5 processes, got %d", len(pr.Processes)) |
| 676 | } |
| 677 | if last.TaskId != 20 { |
| 678 | t.Errorf("expected taskID=20, got %d", last.TaskId) |
| 679 | } |
| 680 | } |
| 681 | |
| 682 | func TestE2E_ShellModule_Whoami(t *testing.T) { |
| 683 | mgr := sessions.NewManager(10 * time.Minute) |
nothing calls this directly
no test coverage detected