diff options
-rw-r--r-- | src/main.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main.go b/src/main.go index 6bb8beb..2ef1f56 100644 --- a/src/main.go +++ b/src/main.go @@ -21,33 +21,33 @@ func main() { // requests wordlistChannel := make(chan string) printChannel := make(chan Response) + doneChannel := make(chan int) + log.Printf("%s Done defining channels", green("[+]")) // write into the wordlist channel and read out of the print channel go writeWordlistToChannel(wordlistChannel, wordlist) go printResponses(printChannel) + log.Printf("%s Done starting hander routines", green("[+]")) log.Printf("%s Starting the http handlers", cyan("[+]")) // handle one or more theads if threads <= 1 { - log.Printf("%s 1 thread", yellow("[+]")) - httpRequest(wordlistChannel, printChannel) + log.Printf("%s 1 thread", yellow("[i]")) + httpRequest(wordlistChannel, printChannel, nil, 0) } else { - log.Printf("%s multiple threads", yellow("[+]")) + log.Printf("%s Starting %d threads...", yellow("[i]"), threads) // loop over all the threads starting a go routine fetching a word from // the wordlistChannel, making the request and inserting the result into // the printChannel for i := 0; i < threads; i++ { - log.Printf("%s Starting Thread %d\n", cyan("[i]"), i) - go httpRequest(wordlistChannel, printChannel) + go httpRequest(wordlistChannel, printChannel, doneChannel, i) } - } - - fmt.Println(len(wordlistChannel)) + log.Printf("%s Done starting %d threads", green("[i]"), threads) - for { - if len(wordlistChannel) > 0 { - break + for i := 0; i < threads; i++ { + threadNum := <-doneChannel + fmt.Printf("Thread %d done!\n", threadNum) } } } |