Skip to content

Commit

Permalink
replaced hardcoded http profile value with commandline arg, fixed pb …
Browse files Browse the repository at this point in the history
…issue with certificate digest and switched from profile id to profile name in implantconfig pb
  • Loading branch information
TimBF committed May 30, 2023
1 parent c03975d commit 3e67c6e
Show file tree
Hide file tree
Showing 10 changed files with 1,383 additions and 1,368 deletions.
3 changes: 3 additions & 0 deletions client/command/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,7 @@ func BindCommands(con *console.SliverConsoleClient) {
f.String("s", "save", "", "directory/file to the binary to")

f.Int("t", "timeout", defaultTimeout, "grpc timeout in seconds")
f.String("C", "c2profile", "", "HTTP C2 profile to use")
},
Run: func(ctx *grumble.Context) error {
con.Println()
Expand Down Expand Up @@ -1444,6 +1445,8 @@ func BindCommands(con *console.SliverConsoleClient) {
f.String("s", "save", "", "directory/file to the binary to")

f.Int("t", "timeout", defaultTimeout, "grpc timeout in seconds")
f.String("C", "c2profile", "", "HTTP C2 profile to use")

},
Run: func(ctx *grumble.Context) error {
con.Println()
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 @@ -377,8 +377,9 @@ func parseCompileFlags(ctx *grumble.Context, con *console.SliverConsoleClient) *
NetGoEnabled: ctx.Flags.Bool("netgo"),
TrafficEncodersEnabled: trafficEncodersEnabled,
Assets: trafficEncoderAssets,

DebugFile: debugFile,

DebugFile: debugFile,
HTTPC2ConfigName: ctx.Flags.String("c2profile"),
}

return config
Expand Down
2,726 changes: 1,368 additions & 1,358 deletions protobuf/clientpb/client.pb.go

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions protobuf/clientpb/client.proto
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ message ImplantConfig {
string ECCPublicKey = 24;
string ECCPrivateKey = 25;
string ECCPublicKeySignature = 26;
string MinisignServerPublicKey = 27;
string ECCPublicKeyDigest = 27;
string MinisignServerPublicKey = 28;

string WGImplantPrivKey = 30;
string WGServerPubKey = 31;
Expand Down Expand Up @@ -180,7 +181,7 @@ message ImplantConfig {
bool RunAtLoad = 105;
string DebugFile = 106;

string HTTPC2ConfigID = 150;
string HTTPC2ConfigName = 150;
bool NetGoEnabled = 151;
bool TrafficEncodersEnabled = 152;
repeated string TrafficEncoders = 153;
Expand Down
2 changes: 1 addition & 1 deletion server/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func handleBuildEvent(externalBuilder *clientpb.Builder, event *clientpb.Event,
extModel := models.ImplantConfigFromProtobuf(extConfig.Config)

// retrieve http c2 implant config
httpC2Config, err := db.LoadHTTPC2ConfigByName("default")
httpC2Config, err := db.LoadHTTPC2ConfigByName(extConfig.Config.HTTPC2ConfigName)
if err != nil {
builderLog.Errorf("Unable to load HTTP C2 Configuration: %s", err)
return
Expand Down
2 changes: 1 addition & 1 deletion server/rpc/rpc-backdoor.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (rpc *Server) Backdoor(ctx context.Context, req *clientpb.BackdoorReq) (*cl
}

// retrieve http c2 implant config
httpC2Config, err := db.LoadHTTPC2ConfigByName("default")
httpC2Config, err := db.LoadHTTPC2ConfigByName(p.Config.HTTPC2ConfigName)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion server/rpc/rpc-generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (rpc *Server) Generate(ctx context.Context, req *clientpb.GenerateReq) (*cl
}

// retrieve http c2 implant config
httpC2Config, err := db.LoadHTTPC2ConfigByName("default")
httpC2Config, err := db.LoadHTTPC2ConfigByName(req.Config.HTTPC2ConfigName)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion server/rpc/rpc-hijack.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (rpc *Server) HijackDLL(ctx context.Context, req *clientpb.DllHijackReq) (*
return nil, err
}
// retrieve http c2 implant config
httpC2Config, err := db.LoadHTTPC2ConfigByName("default")
httpC2Config, err := db.LoadHTTPC2ConfigByName(p.Config.HTTPC2ConfigName)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion server/rpc/rpc-priv.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (rpc *Server) GetSystem(ctx context.Context, req *clientpb.GetSystemReq) (*
}

// retrieve http c2 implant config
httpC2Config, err := db.LoadHTTPC2ConfigByName("default")
httpC2Config, err := db.LoadHTTPC2ConfigByName(req.Config.HTTPC2ConfigName)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion server/rpc/rpc-tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (rpc *Server) Migrate(ctx context.Context, req *clientpb.MigrateReq) (*sliv
}

// retrieve http c2 implant config
httpC2Config, err := db.LoadHTTPC2ConfigByName("default")
httpC2Config, err := db.LoadHTTPC2ConfigByName(req.Config.HTTPC2ConfigName)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 3e67c6e

Please sign in to comment.