Skip to content

Commit

Permalink
Merge pull request #1525 from BishopFox/fix-c2-db-duplication
Browse files Browse the repository at this point in the history
Fix C2 URL Duplication in Database
  • Loading branch information
moloch-- authored Dec 22, 2023
2 parents a84f13e + de7d466 commit b4cf848
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server/db/models/implant.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,11 @@ type ImplantC2 struct {

// BeforeCreate - GORM hook
func (c2 *ImplantC2) BeforeCreate(tx *gorm.DB) (err error) {
c2.ID, err = uuid.NewV4()
if err != nil {
return err
if c2.ID == uuid.Nil {
c2.ID, err = uuid.NewV4()
if err != nil {
return err
}
}
c2.CreatedAt = time.Now()
return nil
Expand Down

0 comments on commit b4cf848

Please sign in to comment.