diff --git a/cmd/bruter/main.go b/cmd/bruter/main.go index 7bfa683..bee2bf9 100644 --- a/cmd/bruter/main.go +++ b/cmd/bruter/main.go @@ -3,6 +3,7 @@ package main import ( "flag" "fmt" + "math" "net/http" "os" "strings" @@ -116,12 +117,13 @@ func main() { }) for index, payload := range list { - index += shift + modifiedIndex := index + shift // Replace %EXT% with extensions payload = strings.ReplaceAll(payload, "%EXT%", "js") - progress := 100 * float32(index) / float32(total) + progress := 100 * float32(modifiedIndex) / float32(total) + progress = float32(math.Round(float64(progress))) // Round the progress to the nearest integer queue.Add(async.Job(&workerContext{ Mu: &app.Mu, Domain: *Domain, diff --git a/pkg/fuzzer/fuzzer.go b/pkg/fuzzer/fuzzer.go index 844e712..6832e62 100644 --- a/pkg/fuzzer/fuzzer.go +++ b/pkg/fuzzer/fuzzer.go @@ -5,13 +5,15 @@ import ( "crypto/tls" "encoding/json" "fmt" - "github.com/CyberRoute/bruter/pkg/models" - "github.com/rs/zerolog/log" "io" "net/http" "net/url" "os" + "sort" "sync" + + "github.com/CyberRoute/bruter/pkg/models" + "github.com/rs/zerolog/log" ) func checkError(err error) { @@ -106,6 +108,12 @@ func readUrlsFromFile(filename string) (models.AllUrls, error) { } func writeUrlsToFile(filename string, allUrls models.AllUrls) error { + // Sort the URLs based on the Progress field in ascending order + sort.Slice(allUrls.Urls, func(i, j int) bool { + return allUrls.Urls[i].Progress < allUrls.Urls[j].Progress + }) + + // Marshal and write the sorted URLs to the file newUserBytes, err := json.MarshalIndent(allUrls.Urls, "", " ") if err != nil { return err