@@ -411,6 +411,14 @@ func dbFlags(conf *config.Config) {
411
411
412
412
// handle generic sounding c2 flags.
413
413
func c2Flags (c2Selection * string , conf * config.Config ) {
414
+
415
+ flag .BoolVar (& conf .ThirdPartyC2Server , "o" , false , "Indicates if the reverse shell should be caught by an outside program (nc, openssl)" )
416
+
417
+ if len (conf .SupportedC2 ) == 0 {
418
+ // the implementing exploit doesn't support any c2, just exit
419
+ return
420
+ }
421
+
414
422
c2Default , _ := c2 .ImplToString (conf .SupportedC2 [0 ])
415
423
c2Available := "The C2 server implementation to use. Supported: "
416
424
for _ , value := range conf .SupportedC2 {
@@ -437,15 +445,13 @@ func c2Flags(c2Selection *string, conf *config.Config) {
437
445
} else {
438
446
flag .IntVar (& conf .C2Timeout , "t" , 30 , "The number of seconds to listen for reverse shells." )
439
447
}
440
-
441
- flag .BoolVar (& conf .ThirdPartyC2Server , "o" , false , "Indicates if the reverse shell should be caught by an outside program (nc, openssl)" )
442
448
}
443
449
444
450
// loop through the c2 the exploit supports and find the one the user actually selected.
445
451
func validateC2Selection (c2Selection string , conf * config.Config ) bool {
446
452
c2Selected , ok := c2 .StringToImpl (c2Selection )
447
453
if ! ok {
448
- output .PrintFrameworkError ("Provided an invalid c2 implementation" )
454
+ output .PrintFrameworkError ("The user provided an invalid c2 implementation" )
449
455
450
456
return false
451
457
}
@@ -679,7 +685,9 @@ func FormatFileCmdLineParse(conf *config.Config) bool {
679
685
680
686
return false
681
687
}
682
- if ! validateC2Selection (c2Selection , conf ) {
688
+
689
+ // must be validate (to set default for payload gen) and then check third party c2
690
+ if validateC2Selection (c2Selection , conf ) && ! conf .ThirdPartyC2Server {
683
691
return false
684
692
}
685
693
if ! conf .ThirdPartyC2Server && (conf .Lport == 0 || len (conf .Lhost ) == 0 ) {
@@ -715,7 +723,8 @@ func LocalCmdLineParse(conf *config.Config) bool {
715
723
}
716
724
flag .Parse ()
717
725
718
- if ! validateC2Selection (c2Selection , conf ) {
726
+ // must be validate (to set default for payload gen) and then check third party c2
727
+ if validateC2Selection (c2Selection , conf ) && ! conf .ThirdPartyC2Server {
719
728
return false
720
729
}
721
730
0 commit comments