@@ -202,7 +202,7 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
202
202
cryptoVal , err := payloadBuildMsg .C2Profiles [index ].GetCryptoArg (key )
203
203
if err != nil {
204
204
payloadBuildResponse .Success = false
205
- payloadBuildResponse .BuildStdErr = err .Error ()
205
+ payloadBuildResponse .BuildStdErr = "Key error: " + key + " \n " + err .Error ()
206
206
return payloadBuildResponse
207
207
}
208
208
initialConfig [key ] = cryptoVal .EncKey
@@ -211,7 +211,7 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
211
211
headers , err := payloadBuildMsg .C2Profiles [index ].GetDictionaryArg (key )
212
212
if err != nil {
213
213
payloadBuildResponse .Success = false
214
- payloadBuildResponse .BuildStdErr = err .Error ()
214
+ payloadBuildResponse .BuildStdErr = "Key error: " + key + " \n " + err .Error ()
215
215
return payloadBuildResponse
216
216
}
217
217
initialConfig [key ] = headers
@@ -231,21 +231,21 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
231
231
agentConfigString , err := payloadBuildMsg .C2Profiles [index ].GetStringArg (key )
232
232
if err != nil {
233
233
payloadBuildResponse .Success = false
234
- payloadBuildResponse .BuildStdErr = err .Error ()
234
+ payloadBuildResponse .BuildStdErr = "Key error: " + key + " \n " + err .Error ()
235
235
return payloadBuildResponse
236
236
}
237
237
configData , err := mythicrpc .SendMythicRPCFileGetContent (mythicrpc.MythicRPCFileGetContentMessage {
238
238
AgentFileID : agentConfigString ,
239
239
})
240
240
if err != nil {
241
241
payloadBuildResponse .Success = false
242
- payloadBuildResponse .BuildStdErr = err .Error ()
242
+ payloadBuildResponse .BuildStdErr = "Key error: " + key + " \n " + err .Error ()
243
243
return payloadBuildResponse
244
244
}
245
245
err = json .Unmarshal (configData .Content , initialConfig [key ])
246
246
if err != nil {
247
247
payloadBuildResponse .Success = false
248
- payloadBuildResponse .BuildStdErr = err .Error ()
248
+ payloadBuildResponse .BuildStdErr = "Key error: " + key + " \n " + err .Error ()
249
249
return payloadBuildResponse
250
250
}
251
251
/*
@@ -254,29 +254,47 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
254
254
agentConfigString = strings.ReplaceAll(agentConfigString, "\n", "")
255
255
ldflags += fmt.Sprintf(" -X '%s.%s_%s=%s'", poseidon_repo_profile, payloadBuildMsg.C2Profiles[index].Name, key, agentConfigString)
256
256
*/
257
- } else if slices .Contains ([]string {"callback_jitter" , "callback_interval" , "callback_port" , "port" }, key ) {
257
+ } else if slices .Contains ([]string {"callback_jitter" , "callback_interval" , "callback_port" , "port" , "callback_port" }, key ) {
258
258
259
259
val , err := payloadBuildMsg .C2Profiles [index ].GetNumberArg (key )
260
260
if err != nil {
261
- payloadBuildResponse .Success = false
262
- payloadBuildResponse .BuildStdErr = err .Error ()
263
- return payloadBuildResponse
261
+ stringVal , err := payloadBuildMsg .C2Profiles [index ].GetStringArg (key )
262
+ if err != nil {
263
+ payloadBuildResponse .Success = false
264
+ payloadBuildResponse .BuildStdErr = "Key error: " + key + "\n " + err .Error ()
265
+ return payloadBuildResponse
266
+ }
267
+ realVal , err := strconv .Atoi (stringVal )
268
+ if err != nil {
269
+ payloadBuildResponse .Success = false
270
+ payloadBuildResponse .BuildStdErr = "Key error: " + key + "\n " + err .Error ()
271
+ return payloadBuildResponse
272
+ }
273
+ initialConfig [key ] = realVal
274
+ } else {
275
+ initialConfig [key ] = int (val )
264
276
}
265
- initialConfig [ key ] = int ( val )
277
+
266
278
//ldflags += fmt.Sprintf(" -X '%s.%s_%s=%v'", poseidon_repo_profile, payloadBuildMsg.C2Profiles[index].Name, key, val)
267
279
} else if slices .Contains ([]string {"encrypted_exchange_check" }, key ) {
268
280
val , err := payloadBuildMsg .C2Profiles [index ].GetBooleanArg (key )
269
281
if err != nil {
270
- payloadBuildResponse .Success = false
271
- payloadBuildResponse .BuildStdErr = err .Error ()
272
- return payloadBuildResponse
282
+ stringVal , err := payloadBuildMsg .C2Profiles [index ].GetStringArg (key )
283
+ if err != nil {
284
+ payloadBuildResponse .Success = false
285
+ payloadBuildResponse .BuildStdErr = "Key error: " + key + "\n " + err .Error ()
286
+ return payloadBuildResponse
287
+ }
288
+ initialConfig [key ] = stringVal == "T"
289
+ } else {
290
+ initialConfig [key ] = val
273
291
}
274
- initialConfig [ key ] = val
292
+
275
293
} else {
276
294
val , err := payloadBuildMsg .C2Profiles [index ].GetStringArg (key )
277
295
if err != nil {
278
296
payloadBuildResponse .Success = false
279
- payloadBuildResponse .BuildStdErr = err .Error ()
297
+ payloadBuildResponse .BuildStdErr = "Key error: " + key + " \n " + err .Error ()
280
298
return payloadBuildResponse
281
299
}
282
300
if key == "proxy_port" {
@@ -286,7 +304,7 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
286
304
intval , err := strconv .Atoi (val )
287
305
if err != nil {
288
306
payloadBuildResponse .Success = false
289
- payloadBuildResponse .BuildStdErr = err .Error ()
307
+ payloadBuildResponse .BuildStdErr = "Key error: " + key + " \n " + err .Error ()
290
308
return payloadBuildResponse
291
309
}
292
310
initialConfig [key ] = intval
0 commit comments