Skip to content

Commit

Permalink
Merge pull request #1855 from BishopFox/abide_generate_name
Browse files Browse the repository at this point in the history
Abide generate name
  • Loading branch information
moloch-- authored Jan 20, 2025
2 parents 67c6140 + a9ef42a commit f854af1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 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(cmd *cobra.Command, con *console.SliverClient, args []str
save, _ = os.Getwd()
}
if external, _ := cmd.Flags().GetBool("external-builder"); !external {
compile(config, save, con)
compile(name, config, save, con)
} else {
externalBuild(name, config, save, con)
}
Expand Down
5 changes: 3 additions & 2 deletions client/command/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func GenerateCmd(cmd *cobra.Command, con *console.SliverClient, args []string) {
save, _ = os.Getwd()
}
if external, _ := cmd.Flags().GetBool("external-builder"); !external {
compile(config, save, con)
compile(name, config, save, con)
} else {
_, err := externalBuild(name, config, save, con)
if err != nil {
Expand Down Expand Up @@ -905,7 +905,7 @@ func externalBuild(name string, config *clientpb.ImplantConfig, save string, con
return nil, nil
}

func compile(config *clientpb.ImplantConfig, save string, con *console.SliverClient) (*commonpb.File, error) {
func compile(name string, config *clientpb.ImplantConfig, save string, con *console.SliverClient) (*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 All @@ -923,6 +923,7 @@ func compile(config *clientpb.ImplantConfig, save string, con *console.SliverCli
con.SpinUntil("Compiling, please wait ...", ctrl)

generated, err := con.Rpc.Generate(context.Background(), &clientpb.GenerateReq{
Name: name,
Config: config,
})
ctrl <- true
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 @@ -46,7 +46,7 @@ func ProfilesGenerateCmd(cmd *cobra.Command, con *console.SliverClient, args []s
if SGNDisabled, _ := cmd.Flags().GetBool("disable-sgn"); SGNDisabled {
profile.Config.SGNEnabled = !SGNDisabled
}
_, err := compile(profile.Config, save, con)
_, err := compile(name, profile.Config, save, con)
if err != nil {
return
}
Expand Down
4 changes: 2 additions & 2 deletions server/rpc/rpc-generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (rpc *Server) Generate(ctx context.Context, req *clientpb.GenerateReq) (*cl
if err != nil {
return nil, err
}
} else if err := util.AllowedName(name); err != nil {
} else if err := util.AllowedName(req.Name); err != nil {
return nil, err
} else {
name = req.Name
Expand Down Expand Up @@ -340,7 +340,7 @@ func (rpc *Server) GenerateExternal(ctx context.Context, req *clientpb.ExternalG
if err != nil {
return nil, err
}
} else if err := util.AllowedName(name); err != nil {
} else if err := util.AllowedName(req.Name); err != nil {
return nil, err
} else {
name = req.Name
Expand Down

0 comments on commit f854af1

Please sign in to comment.