@@ -9,14 +9,16 @@ import (
9
9
agentstructs "github.com/MythicMeta/MythicContainer/agent_structs"
10
10
"github.com/MythicMeta/MythicContainer/mythicrpc"
11
11
"github.com/google/uuid"
12
+ "golang.org/x/exp/slices"
12
13
"io"
13
14
"os"
14
15
"os/exec"
15
16
"path/filepath"
17
+ "strconv"
16
18
"strings"
17
19
)
18
20
19
- const version = "2.0.28 "
21
+ const version = "2.0.29 "
20
22
21
23
var payloadDefinition = agentstructs.PayloadType {
22
24
Name : "poseidon" ,
@@ -252,15 +254,47 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
252
254
agentConfigString = strings.ReplaceAll(agentConfigString, "\n", "")
253
255
ldflags += fmt.Sprintf(" -X '%s.%s_%s=%s'", poseidon_repo_profile, payloadBuildMsg.C2Profiles[index].Name, key, agentConfigString)
254
256
*/
255
- } else {
256
- val , err := payloadBuildMsg .C2Profiles [index ].GetArg (key )
257
+ } else if slices .Contains ([]string {"callback_jitter" , "callback_interval" , "callback_port" , "port" }, key ) {
258
+
259
+ val , err := payloadBuildMsg .C2Profiles [index ].GetNumberArg (key )
257
260
if err != nil {
258
261
payloadBuildResponse .Success = false
259
262
payloadBuildResponse .BuildStdErr = err .Error ()
260
263
return payloadBuildResponse
261
264
}
262
- initialConfig [key ] = val
265
+ initialConfig [key ] = int ( val )
263
266
//ldflags += fmt.Sprintf(" -X '%s.%s_%s=%v'", poseidon_repo_profile, payloadBuildMsg.C2Profiles[index].Name, key, val)
267
+ } else if slices .Contains ([]string {"encrypted_exchange_check" }, key ) {
268
+ val , err := payloadBuildMsg .C2Profiles [index ].GetBooleanArg (key )
269
+ if err != nil {
270
+ payloadBuildResponse .Success = false
271
+ payloadBuildResponse .BuildStdErr = err .Error ()
272
+ return payloadBuildResponse
273
+ }
274
+ initialConfig [key ] = val
275
+ } else {
276
+ val , err := payloadBuildMsg .C2Profiles [index ].GetStringArg (key )
277
+ if err != nil {
278
+ payloadBuildResponse .Success = false
279
+ payloadBuildResponse .BuildStdErr = err .Error ()
280
+ return payloadBuildResponse
281
+ }
282
+ if key == "proxy_port" {
283
+ if val == "" {
284
+ initialConfig [key ] = 0
285
+ } else {
286
+ intval , err := strconv .Atoi (val )
287
+ if err != nil {
288
+ payloadBuildResponse .Success = false
289
+ payloadBuildResponse .BuildStdErr = err .Error ()
290
+ return payloadBuildResponse
291
+ }
292
+ initialConfig [key ] = intval
293
+ }
294
+ } else {
295
+ initialConfig [key ] = val
296
+ }
297
+
264
298
}
265
299
}
266
300
initialConfigBytes , err := json .Marshal (initialConfig )
@@ -270,7 +304,7 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
270
304
return payloadBuildResponse
271
305
}
272
306
initialConfigBase64 := base64 .StdEncoding .EncodeToString (initialConfigBytes )
273
- payloadBuildResponse .BuildStdOut += fmt .Sprintf ("%s's config: \n %v\n " , payloadBuildMsg .C2Profiles [index ].Name , initialConfig )
307
+ payloadBuildResponse .BuildStdOut += fmt .Sprintf ("%s's config: \n %v\n " , payloadBuildMsg .C2Profiles [index ].Name , string ( initialConfigBytes ) )
274
308
ldflags += fmt .Sprintf (" -X '%s.%s_%s=%v'" , poseidon_repo_profile , payloadBuildMsg .C2Profiles [index ].Name , "initial_config" , initialConfigBase64 )
275
309
}
276
310
0 commit comments