@@ -35,6 +35,7 @@ type pushC2Server struct {
35
35
services.UnimplementedPushC2Server
36
36
sync.RWMutex
37
37
clients map [int ]* grpcPushC2ClientConnections
38
+ clientsOneToMany map [string ]* grpcPushC2ClientConnections
38
39
connectionTimeout time.Duration
39
40
channelSendTimeout time.Duration
40
41
rabbitmqProcessPushC2AgentConnection chan PushC2ServerConnected
@@ -66,6 +67,7 @@ type grpcPushC2ClientConnections struct {
66
67
var TranslationContainerServer translationContainerServer
67
68
var PushC2Server pushC2Server
68
69
70
+ // translationContainerServer functions
69
71
func (t * translationContainerServer ) addNewGenerateKeysClient (translationContainerName string ) (chan services.TrGenerateEncryptionKeysMessage , chan services.TrGenerateEncryptionKeysMessageResponse , error ) {
70
72
t .Lock ()
71
73
if _ , ok := t .clients [translationContainerName ]; ! ok {
@@ -190,6 +192,7 @@ func (t *translationContainerServer) GetChannelTimeout() time.Duration {
190
192
return t .channelSendTimeout
191
193
}
192
194
195
+ // pushC2Server functions
193
196
func (t * pushC2Server ) GetRabbitMqProcessAgentMessageChannel () chan PushC2ServerConnected {
194
197
return t .rabbitmqProcessPushC2AgentConnection
195
198
}
@@ -207,6 +210,20 @@ func (t *pushC2Server) addNewPushC2Client(CallbackAgentID int, callbackUUID stri
207
210
t .Unlock ()
208
211
return fromMythic , nil
209
212
}
213
+ func (t * pushC2Server ) addNewPushC2OneToManyClient (c2ProfileName string ) (chan services.PushC2MessageFromMythic , error ) {
214
+ t .Lock ()
215
+ if _ , ok := t .clientsOneToMany [c2ProfileName ]; ! ok {
216
+ t .clientsOneToMany [c2ProfileName ] = & grpcPushC2ClientConnections {}
217
+ t .clientsOneToMany [c2ProfileName ].pushC2MessageFromMythic = make (chan services.PushC2MessageFromMythic , 100 )
218
+ }
219
+ fromMythic := t .clientsOneToMany [c2ProfileName ].pushC2MessageFromMythic
220
+ t .clientsOneToMany [c2ProfileName ].connected = true
221
+ t .clientsOneToMany [c2ProfileName ].callbackUUID = ""
222
+ t .clientsOneToMany [c2ProfileName ].base64Encoded = true
223
+ t .clientsOneToMany [c2ProfileName ].c2ProfileName = c2ProfileName
224
+ t .Unlock ()
225
+ return fromMythic , nil
226
+ }
210
227
func (t * pushC2Server ) GetPushC2ClientInfo (CallbackAgentID int ) (chan services.PushC2MessageFromMythic , string , bool , string , error ) {
211
228
t .RLock ()
212
229
if _ , ok := t .clients [CallbackAgentID ]; ok {
@@ -233,6 +250,13 @@ func (t *pushC2Server) SetPushC2ChannelExited(CallbackAgentID int) {
233
250
}
234
251
t .RUnlock ()
235
252
}
253
+ func (t * pushC2Server ) SetPushC2OneToManyChannelExited (c2ProfileName string ) {
254
+ t .RLock ()
255
+ if _ , ok := t .clientsOneToMany [c2ProfileName ]; ok {
256
+ t .clientsOneToMany [c2ProfileName ].connected = false
257
+ }
258
+ t .RUnlock ()
259
+ }
236
260
func (t * pushC2Server ) CheckListening () (listening bool , latestError string ) {
237
261
return t .listening , t .latestError
238
262
}
@@ -254,6 +278,11 @@ func (t *pushC2Server) GetConnectedClients() []int {
254
278
clientIDs = append (clientIDs , clientID )
255
279
}
256
280
}
281
+ for c2 , _ := range t .clientsOneToMany {
282
+ if t .clientsOneToMany [c2 ].connected {
283
+
284
+ }
285
+ }
257
286
return clientIDs
258
287
}
259
288
func (t * pushC2Server ) GetTimeout () time.Duration {
0 commit comments