MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / TestE2E_ShellModule_Ps_Linux

Function TestE2E_ShellModule_Ps_Linux

internal/bridge/modules_test.go:648–680  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

646}
647
648func 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
682func TestE2E_ShellModule_Whoami(t *testing.T) {
683 mgr := sessions.NewManager(10 * time.Minute)

Callers

nothing calls this directly

Calls 8

NewManagerFunction · 0.92
swapGlobalManagerFunction · 0.85
setupTestBridgeFunction · 0.85
simulateToolResultFunction · 0.85
wrapToolOutputFunction · 0.85
dispatchWithTimeoutFunction · 0.85
StartSessionListenerMethod · 0.80
getSentMethod · 0.80

Tested by

no test coverage detected