Skip to content

Commit

Permalink
Move DisableSGN out of protobuf since its client-side only
Browse files Browse the repository at this point in the history
  • Loading branch information
moloch-- committed Jan 11, 2023
1 parent be6cfc9 commit d935a03
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion client/command/generate/generate-beacon.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 d935a03

Please sign in to comment.