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

Function sendDownloadResp

internal/bridge/module_download.go:212–231  ·  view source on GitHub ↗

sendDownloadResp sends a DownloadResponse via ModuleContext.

(ctx ModuleContext, sessionID string, taskID uint32, content []byte)

Source from the content-addressed store, hash-verified

210
211// sendDownloadResp sends a DownloadResponse via ModuleContext.
212func sendDownloadResp(ctx ModuleContext, sessionID string, taskID uint32, content []byte) {
213 hash := sha256.Sum256(content)
214 checksum := hex.EncodeToString(hash[:])
215
216 spite := &implantpb.Spite{
217 Name: consts.ModuleDownload,
218 Body: &implantpb.Spite_DownloadResponse{
219 DownloadResponse: &implantpb.DownloadResponse{
220 Content: content,
221 Checksum: checksum,
222 Size: uint64(len(content)),
223 },
224 },
225 }
226 if err := ctx.SendSpite(sessionID, taskID, spite); err != nil {
227 log.Errorf("[bridge] failed to send download response task %d: %v", taskID, err)
228 } else {
229 log.Infof("[bridge] sent download response task %d for session %s (%d bytes)", taskID, sessionID, len(content))
230 }
231}

Callers 4

handleDirectDownloadMethod · 0.85
waitForReadResultMethod · 0.85
executeSingleShellMethod · 0.85
executeChunksMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected