Skip to content

Commit

Permalink
Add cmd flag to disable sgn
Browse files Browse the repository at this point in the history
  • Loading branch information
moloch-- committed Oct 1, 2022
1 parent 7c5262d commit 4ecf42b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions client/command/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,8 @@ func BindCommands(con *console.SliverConsoleClient) {
a.Uint("pid", "pid")
},
Flags: func(f *grumble.Flags) {
f.Bool("S", "disable-sgn", true, "disable shikata ga nai shellcode encoder")

f.Int("t", "timeout", defaultTimeout, "command timeout in seconds")
},
HelpGroup: consts.SliverWinHelpGroup,
Expand Down
2 changes: 1 addition & 1 deletion client/command/exec/execute-shellcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func ExecuteShellcodeCmd(ctx *grumble.Context, con *console.SliverConsoleClient)
Data: shellcodeBin,
})
if err != nil {
con.PrintErrorf("%s\n", err.Error())
con.PrintErrorf("%s\n", err)
return
}
oldSize := len(shellcodeBin)
Expand Down
9 changes: 8 additions & 1 deletion client/command/exec/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ package exec
/*
Sliver Implant Framework
Copyright (C) 2019 Bishop Fox
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Expand All @@ -35,11 +38,15 @@ func MigrateCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
config := con.GetActiveSessionConfig()
ctrl := make(chan bool)
con.SpinUntil(fmt.Sprintf("Migrating into %d ...", pid), ctrl)
encoder := clientpb.ShellcodeEncoder_SHIKATA_GA_NAI
if ctx.Flags.Bool("disable-sgn") {
encoder = clientpb.ShellcodeEncoder_NONE
}
migrate, err := con.Rpc.Migrate(context.Background(), &clientpb.MigrateReq{
Pid: uint32(pid),
Config: config,
Request: con.ActiveTarget.Request(ctx),
Encoder: clientpb.ShellcodeEncoder_SHIKATA_GA_NAI,
Encoder: encoder,
})
ctrl <- true
<-ctrl
Expand Down

0 comments on commit 4ecf42b

Please sign in to comment.