Skip to content

Commit

Permalink
Merge pull request #1068 from BishopFox/fix/pb-sgn
Browse files Browse the repository at this point in the history
Fix/pb sgn
  • Loading branch information
rkervella committed Jan 11, 2023
2 parents be6cfc9 + 72c1de8 commit a5532e1
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 17 deletions.
1 change: 1 addition & 0 deletions client/command/commands.go
Expand Up @@ -1512,6 +1512,7 @@ func BindCommands(con *console.SliverConsoleClient) {
LongHelp: help.GetHelpFor([]string{consts.ProfilesStr, consts.GenerateStr}),
Flags: func(f *grumble.Flags) {
f.String("s", "save", "", "directory/file to the binary to")
f.Bool("G", "disable-sgn", false, "disable shikata ga nai shellcode encoder")

f.Int("t", "timeout", defaultTimeout, "command timeout in seconds")
},
Expand Down
2 changes: 1 addition & 1 deletion client/command/generate/generate-beacon.go
Expand Up @@ -32,7 +32,7 @@ func GenerateBeaconCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
save, _ = os.Getwd()
}
if !ctx.Flags.Bool("external-builder") {
compile(config, save, con)
compile(config, ctx.Flags.Bool("disable-sgn"), save, con)
} else {
externalBuild(config, save, con)
}
Expand Down
7 changes: 3 additions & 4 deletions client/command/generate/generate.go
Expand Up @@ -99,7 +99,7 @@ func GenerateCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
save, _ = os.Getwd()
}
if !ctx.Flags.Bool("external-builder") {
compile(config, save, con)
compile(config, ctx.Flags.Bool("disable-sgn"), save, con)
} else {
_, err := externalBuild(config, save, con)
if err != nil {
Expand Down Expand Up @@ -346,7 +346,6 @@ func parseCompileFlags(ctx *grumble.Context, con *console.SliverConsoleClient) *
C2: c2s,
CanaryDomains: canaryDomains,
TemplateName: ctx.Flags.String("template"),
DisableSGN: ctx.Flags.Bool("disable-sgn"),

WGPeerTunIP: tunIP.String(),
WGKeyExchangePort: uint32(ctx.Flags.Int("key-exchange")),
Expand Down Expand Up @@ -756,7 +755,7 @@ func externalBuild(config *clientpb.ImplantConfig, save string, con *console.Sli
return nil, nil
}

func compile(config *clientpb.ImplantConfig, save string, con *console.SliverConsoleClient) (*commonpb.File, error) {
func compile(config *clientpb.ImplantConfig, disableSGN bool, save string, con *console.SliverConsoleClient) (*commonpb.File, error) {
if config.IsBeacon {
interval := time.Duration(config.BeaconInterval)
con.PrintInfof("Generating new %s/%s beacon implant binary (%v)\n", config.GOOS, config.GOARCH, interval)
Expand Down Expand Up @@ -792,7 +791,7 @@ func compile(config *clientpb.ImplantConfig, save string, con *console.SliverCon

fileData := generated.File.Data
if config.IsShellcode {
if config.DisableSGN {
if disableSGN {
con.PrintErrorf("Shikata ga nai encoder is %sdisabled%s\n", console.Bold, console.Normal)
} else {
con.PrintInfof("Encoding shellcode with shikata ga nai ... ")
Expand Down
2 changes: 1 addition & 1 deletion client/command/generate/profiles-generate.go
Expand Up @@ -41,7 +41,7 @@ func ProfilesGenerateCmd(ctx *grumble.Context, con *console.SliverConsoleClient)
}
profile := GetImplantProfileByName(name, con)
if profile != nil {
implantFile, err := compile(profile.Config, save, con)
implantFile, err := compile(profile.Config, ctx.Flags.Bool("disable-sgn"), save, con)
if err != nil {
return
}
Expand Down
5 changes: 2 additions & 3 deletions protobuf/clientpb/client.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions protobuf/commonpb/common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions protobuf/dnspb/dns.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions protobuf/rpcpb/services.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions protobuf/sliverpb/sliver.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a5532e1

Please sign in to comment.