sendDownloadResp sends a DownloadResponse via ModuleContext.
(ctx ModuleContext, sessionID string, taskID uint32, content []byte)
| 210 | |
| 211 | // sendDownloadResp sends a DownloadResponse via ModuleContext. |
| 212 | func 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 | } |
no outgoing calls
no test coverage detected