Skip to content

Commit 47a44c9

Browse files
committed
Simplify addPayloadFlags switch
1 parent c1c00eb commit 47a44c9

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

cli/commandline.go

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -852,48 +852,12 @@ func addPayloadFlags(conf *config.Config) {
852852
count := map[payload.Types]int{}
853853
for i, supported := range conf.SupportedPayloads {
854854
switch supported.Types {
855-
case payload.LinuxCommand:
855+
case payload.LinuxCommand, payload.WindowsCommand, payload.MacCommand, payload.GenericCommand:
856856
_, exists := conf.StringFlagsMap["command"]
857857
if !exists {
858858
conf.CreateStringFlag("command", "", "Command to use for the exploit, an empty string will use the exploit default.")
859859
}
860-
case payload.WindowsCommand:
861-
_, exists := conf.StringFlagsMap["command"]
862-
if !exists {
863-
conf.CreateStringFlag("command", "", "Command to use for the exploit, an empty string will use the exploit default.")
864-
}
865-
case payload.MacCommand:
866-
_, exists := conf.StringFlagsMap["command"]
867-
if !exists {
868-
conf.CreateStringFlag("command", "", "Command to use for the exploit, an empty string will use the exploit default.")
869-
}
870-
case payload.GenericCommand:
871-
_, exists := conf.StringFlagsMap["command"]
872-
if !exists {
873-
conf.CreateStringFlag("command", "", "Command to use for the exploit, an empty string will use the exploit default.")
874-
}
875-
case payload.LinuxELF:
876-
_, exists := conf.StringFlagsMap["payload"]
877-
if !exists {
878-
conf.CreateStringFlag("payload", "", "Path to load custom payload from, an empty string will use the exploit default.")
879-
}
880-
case payload.LinuxSO:
881-
_, exists := conf.StringFlagsMap["payload"]
882-
if !exists {
883-
conf.CreateStringFlag("payload", "", "Path to load custom payload from, an empty string will use the exploit default.")
884-
}
885-
case payload.WindowsEXE:
886-
_, exists := conf.StringFlagsMap["payload"]
887-
if !exists {
888-
conf.CreateStringFlag("payload", "", "Path to load custom payload from, an empty string will use the exploit default.")
889-
}
890-
891-
case payload.WindowsDLL:
892-
_, exists := conf.StringFlagsMap["payload"]
893-
if !exists {
894-
conf.CreateStringFlag("payload", "", "Path to load custom payload from, an empty string will use the exploit default.")
895-
}
896-
case payload.Webshell:
860+
case payload.LinuxELF, payload.LinuxSO, payload.WindowsEXE, payload.WindowsDLL, payload.Webshell:
897861
_, exists := conf.StringFlagsMap["payload"]
898862
if !exists {
899863
conf.CreateStringFlag("payload", "", "Path to load custom payload from, an empty string will use the exploit default.")

0 commit comments

Comments
 (0)