Skip to content

Commit

Permalink
Merge pull request #1530 from BishopFox/sgn-stage-listener
Browse files Browse the repository at this point in the history
Encode Shellcode with SGN when generating via stage-listener
  • Loading branch information
moloch-- authored Dec 30, 2023
2 parents b4cf848 + 32a6045 commit 04e869c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions client/command/generate/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ func GetSliverBinary(profile *clientpb.ImplantProfile, con *console.SliverConsol
return data, err
}
data = generated.GetFile().GetData()

if profile.Config.Format == clientpb.OutputFormat_SHELLCODE && profile.Config.SGNEnabled {
encodeResp, err := con.Rpc.ShellcodeEncoder(context.Background(), &clientpb.ShellcodeEncodeReq{
Encoder: clientpb.ShellcodeEncoder_SHIKATA_GA_NAI,
Architecture: profile.Config.GOARCH,
Iterations: 1,
BadChars: []byte{},
Data: data,
})
if err != nil {
con.PrintErrorf("Error encoding shellcode")
return nil, err
}
data = encodeResp.Data
}

_, err = con.Rpc.SaveImplantProfile(context.Background(), profile)
if err != nil {
con.PrintErrorf("Error updating implant profile\n")
Expand Down

0 comments on commit 04e869c

Please sign in to comment.