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

Method moduleContext

internal/bridge/bridge.go:243–270  ·  view source on GitHub ↗

moduleContext builds a ModuleContext that gives modules access to bridge capabilities without exposing the Bridge struct directly.

()

Source from the content-addressed store, hash-verified

241// moduleContext builds a ModuleContext that gives modules access to
242// bridge capabilities without exposing the Bridge struct directly.
243func (b *Bridge) moduleContext() ModuleContext {
244 return ModuleContext{
245 ListenerID: b.listenerID,
246 SendSpite: func(sessionID string, taskID uint32, spite *implantpb.Spite) error {
247 return b.sendSpite(&clientpb.SpiteResponse{
248 ListenerId: b.listenerID,
249 SessionId: sessionID,
250 TaskId: taskID,
251 Spite: spite,
252 })
253 },
254 Tasks: b.taskManager,
255 TappingGet: func(sessionID string) (uint32, bool) {
256 v, ok := b.tappingTask.Load(sessionID)
257 if !ok {
258 return 0, false
259 }
260 return v.(uint32), true
261 },
262 TappingSet: func(sessionID string, taskID uint32) {
263 b.tappingTask.Store(sessionID, taskID)
264 },
265 TappingDel: func(sessionID string) {
266 b.tappingTask.Delete(sessionID)
267 },
268 WaitForSession: b.waitForSession,
269 }
270}
271
272// sessionContext returns a gRPC context with session_id and listener metadata.
273func (b *Bridge) sessionContext(sessionID string) context.Context {

Callers 2

handleSpiteRecvMethod · 0.95
dispatchWithTimeoutFunction · 0.80

Calls 3

sendSpiteMethod · 0.95
LoadMethod · 0.65
DeleteMethod · 0.65

Tested by 1

dispatchWithTimeoutFunction · 0.64