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

Function TestE2E_ShellModule_Whoami

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

Source from the content-addressed store, hash-verified

680}
681
682func TestE2E_ShellModule_Whoami(t *testing.T) {
683 mgr := sessions.NewManager(10 * time.Minute)
684 origGlobal := swapGlobalManager(mgr)
685 defer swapGlobalManager(origGlobal)
686
687 b, stream, sess := setupTestBridge(t, mgr, "codex_cli_rs/0.112.0 (Windows 10.0.26200; x86_64)", testClaudeTools)
688
689 spite := &implantpb.Spite{
690 Name: consts.ModuleWhoami,
691 Body: &implantpb.Spite_Request{Request: &implantpb.Request{}},
692 }
693
694 b.taskManager.StartSessionListener(sess.ID)
695 simulateToolResult(mgr, sess.ID, 40, "Exit code: 0\nOutput:\ncodemonkey\\john", 50*time.Millisecond)
696 dispatchWithTimeout(t, b, sess.ID, 40, spite, 3*time.Second)
697
698 sent := stream.getSent()
699 if len(sent) == 0 {
700 t.Fatal("expected SpiteResponse")
701 }
702
703 last := sent[len(sent)-1]
704 r := last.Spite.GetResponse()
705 if r == nil {
706 t.Fatal("expected Response body")
707 }
708 if !strings.Contains(r.Output, "codemonkey") {
709 t.Errorf("expected output containing 'codemonkey', got %q", r.Output)
710 }
711}
712
713func TestE2E_ShellModule_Env(t *testing.T) {
714 mgr := sessions.NewManager(10 * time.Minute)

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected