diff options
Diffstat (limited to 'src/httpRequest.go')
-rw-r--r-- | src/httpRequest.go | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/httpRequest.go b/src/httpRequest.go index 3cc3b17..163a524 100644 --- a/src/httpRequest.go +++ b/src/httpRequest.go @@ -22,13 +22,17 @@ func httpRequest(channels channels, threadNr int) { // make the http get request resp, err := http.Get(requestURL) if err != nil { - log.Println(err) + if verbose == true { + log.Println(err) + } } else { defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { - log.Println(err) + if verbose == true { + log.Println(err) + } } responseLines := len(strings.Split(string(body), "\n")) - 1 @@ -55,7 +59,9 @@ func httpRequest(channels channels, threadNr int) { } func httpHandler(channels channels) { - log.Printf("%s Starting the http handlers", green("[i]")) + if verbose == true { + log.Printf("%s Starting the http handlers", green("[i]")) + } // handle one or more theads if threads <= 1 { @@ -63,7 +69,9 @@ func httpHandler(channels channels) { httpRequest(channels, 0) } else { - log.Printf("%s Starting %d threads...", yellow("[i]"), threads) + if verbose == true { + 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 @@ -71,13 +79,19 @@ func httpHandler(channels channels) { for i := 0; i < threads; i++ { go httpRequest(channels, i) } - log.Printf("%s Done starting %d threads", green("[i]"), threads) + if verbose == true { + log.Printf("%s Done starting %d threads", green("[i]"), threads) + } for i := 0; i < threads; i++ { threadNum := <-channels.doneChannel - fmt.Printf("Thread %d done!\n", threadNum) + if verbose == true { + fmt.Printf("Thread %d done!\n", threadNum) + } } } - log.Printf("%s Done starting the http handlers", boldGreen("[+]")) + if verbose == true { + log.Printf("%s Done starting the http handlers", boldGreen("[+]")) + } } |