Skip to content

Commit 65eb725

Browse files
authored
Merge pull request #1947 from BishopFox/bugfix_shellcodeDefaultExport
add exports when creating profile for windows shellcode
2 parents 7d7f858 + d86cdca commit 65eb725

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

client/command/generate/generate.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,13 @@ func parseCompileFlags(cmd *cobra.Command, con *console.SliverClient) (string, *
291291
sgnEnabled := false
292292

293293
var exports []string
294+
exportsArg, _ := cmd.Flags().GetString("exports")
295+
if exportsArg == "" {
296+
con.PrintErrorf("Shared libraries need at least one export\n")
297+
return "", nil
298+
} else {
299+
exports = strings.Split(exportsArg, ",")
300+
}
294301

295302
format, _ := cmd.Flags().GetString("format")
296303
runAtLoad := false
@@ -302,13 +309,6 @@ func parseCompileFlags(cmd *cobra.Command, con *console.SliverClient) (string, *
302309
configFormat = clientpb.OutputFormat_SHARED_LIB
303310
isSharedLib = true
304311
runAtLoad, _ = cmd.Flags().GetBool("run-at-load")
305-
exportsArg, _ := cmd.Flags().GetString("exports")
306-
if exportsArg == "" {
307-
con.PrintErrorf("Shared libraries need at least one export\n")
308-
return "", nil
309-
} else {
310-
exports = strings.Split(exportsArg, ",")
311-
}
312312
case "shellcode":
313313
configFormat = clientpb.OutputFormat_SHELLCODE
314314
isShellcode = true

server/rpc/rpc-generate.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,10 @@ func (rpc *Server) GenerateStage(ctx context.Context, req *clientpb.GenerateStag
709709
return nil, err
710710
}
711711

712+
if len(profile.Config.Exports) == 0 {
713+
profile.Config.Exports = []string{"StartW"}
714+
}
715+
712716
// generate config
713717
build, err := generate.GenerateConfig(name, profile.Config)
714718
if err != nil {

0 commit comments

Comments
 (0)