From 2ef681c9b7edb76d236713d83fab9773f672177c Mon Sep 17 00:00:00 2001 From: Emile Date: Sat, 2 Nov 2019 16:50:20 +0100 Subject: better logging --- src/main.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/main.go') 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) } } } -- cgit 1.4.1