-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
107 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
package customerrors | ||
|
||
import "errors" | ||
import ( | ||
"database/sql" | ||
"errors" | ||
) | ||
|
||
var ErrFinalSending = errors.New("[CLIENT] Failed to send final status, retrying in ") | ||
var ErrHcxToolsNotFound = errors.New("conversion was not successful, hcxtools output file not found") | ||
var ErrNoRowsFound = sql.ErrNoRows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package seed | ||
|
||
import ( | ||
"fmt" | ||
"github.com/Virgula0/progetto-dp/client/internal/constants" | ||
"github.com/Virgula0/progetto-dp/client/internal/entities" | ||
"github.com/Virgula0/progetto-dp/client/internal/repository" | ||
"github.com/google/uuid" | ||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
type Seed struct { | ||
Wordlist *entities.Wordlist | ||
} | ||
|
||
var Wordlist = &Seed{ | ||
Wordlist: &entities.Wordlist{ | ||
UUID: uuid.New().String(), | ||
UserUUID: uuid.New().String(), // we don't use it so we can fake them just for seeding | ||
ClientUUID: uuid.New().String(), // we don't use it so we can fake them just for seeding | ||
WordlistName: "rockyou.txt", | ||
WordlistHash: "9076652d8ae75ce713e23ab09e10d9ee", // this is important and what actually what is checked | ||
WordlistSize: 139921497, | ||
WordlistLocationPath: constants.WordlistPath, | ||
}, | ||
} | ||
|
||
func LoadWordlist(repo *repository.Repository) error { | ||
return loadWordlist(repo) | ||
} | ||
|
||
func loadWordlist(repo *repository.Repository) error { | ||
|
||
seeds := []*Seed{ | ||
Wordlist, | ||
} | ||
|
||
for _, ww := range seeds { | ||
|
||
err := repo.InsertWordlist(ww.Wordlist) | ||
if err != nil { | ||
e := fmt.Errorf("failed to seed wordlist table: %v", err) | ||
log.Error(e) | ||
return e | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters