Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/pb sgn #1068

Merged
merged 2 commits into from Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.