Skip to content

Commit

Permalink
correcting some shit I did on calculating the progress
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberRoute committed Oct 24, 2023
1 parent 5b9ece4 commit bb0e156
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions cmd/bruter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"flag"
"fmt"
"math"
"net/http"
"os"
"strings"
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 10 additions & 2 deletions pkg/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bb0e156

Please sign in to comment.