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

Abide generate name #1855

Merged
merged 3 commits into from
Jan 20, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading