Skip to content

Commit

Permalink
Gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
rwincey committed Nov 6, 2024
1 parent ccf3701 commit 82e294e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions client/assets/c2profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ type HTTPC2ServerConfig struct {
}

type NameValueProbability struct {
Name string `json:"name"`
Value string `json:"value"`
Probability int `json:"probability"`
Name string `json:"name"`
Value string `json:"value"`
Probability int `json:"probability"`
Methods []string `json:"methods"`
}

Expand Down
20 changes: 10 additions & 10 deletions client/command/c2profiles/c2profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,16 +453,16 @@ func C2ConfigToProtobuf(profileName string, config *assets.HTTPC2Config) *client
})
}

for _, clientHeader := range config.ImplantConfig.Headers {
for _, method := range clientHeader.Methods {
httpC2Headers = append(httpC2Headers, &clientpb.HTTPC2Header{
Method: method,
Name: clientHeader.Name,
Value: clientHeader.Value,
Probability: int32(clientHeader.Probability),
})
}
}
for _, clientHeader := range config.ImplantConfig.Headers {
for _, method := range clientHeader.Methods {
httpC2Headers = append(httpC2Headers, &clientpb.HTTPC2Header{
Method: method,
Name: clientHeader.Name,
Value: clientHeader.Value,
Probability: int32(clientHeader.Probability),
})
}
}

implantConfig := &clientpb.HTTPC2ImplantConfig{
UserAgent: config.ImplantConfig.UserAgent,
Expand Down
30 changes: 15 additions & 15 deletions server/db/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,12 @@ func HTTPC2ConfigUpdate(newConf *clientpb.HTTPC2Config, oldConf *clientpb.HTTPC2
return err.Error
}

err = Session().Where(&models.HttpC2Header{
HttpC2ServerConfigID: &clientID,
}).Delete(&models.HttpC2Header{})
if err.Error != nil {
return err.Error
}
err = Session().Where(&models.HttpC2Header{
HttpC2ServerConfigID: &clientID,
}).Delete(&models.HttpC2Header{})
if err.Error != nil {
return err.Error
}

err = Session().Where(&models.ImplantConfig{
ID: clientID,
Expand All @@ -494,15 +494,15 @@ func HTTPC2ConfigUpdate(newConf *clientpb.HTTPC2Config, oldConf *clientpb.HTTPC2
}
}

for _, header := range c2Config.ImplantConfig.Headers {
header.HttpC2ImplantConfigID = &clientID
err = Session().Clauses(clause.OnConflict{
UpdateAll: true,
}).Create(&header)
if err.Error != nil {
return err.Error
}
}
for _, header := range c2Config.ImplantConfig.Headers {
header.HttpC2ImplantConfigID = &clientID
err = Session().Clauses(clause.OnConflict{
UpdateAll: true,
}).Create(&header)
if err.Error != nil {
return err.Error
}
}

serverID, _ := uuid.FromString(oldConf.ServerConfig.ID)

Expand Down

0 comments on commit 82e294e

Please sign in to comment.