Skip to content

Commit

Permalink
Merge branch 'connect-match-reqs' into cli-interface
Browse files Browse the repository at this point in the history
  • Loading branch information
SIMLUKE authored Aug 8, 2024
2 parents ac340dc + d967998 commit 46e8747
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/query/callWorker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,29 @@ import (
"bruteforce/src/matching"
"bruteforce/src/models"
"bruteforce/src/utils"
"time"
"sync"
)

func executeQueryFromFile(params *models.Forcing_params, currentPath chan string) {

func executeQueryFromFile(wg *sync.WaitGroup, params *models.Forcing_params, currentPath chan string) {
defer wg.Done()
for taskData := range currentPath {
QueryExecute(params, taskData, "POST")
}
}

func MainRequest(params *models.Forcing_params, criteria matcher.MatchCriteria) {
wg := &sync.WaitGroup{}
wg.Add(data.Worker)
channel := make(chan string)
wordArray := utils.GetFileContent(params.Wordlist)

for i := 0; i < params.Workers; i++ {
go executeQueryFromFile(params, channel)
go executeQueryFromFile(wg, params, channel)
}
for i := 0; i < len(wordArray); i++ {
channel <- wordArray[i]
}
time.Sleep(1 * time.Second)
wg.Wait()
close(channel)
}

0 comments on commit 46e8747

Please sign in to comment.