From b9264d1b8c3c007368a970015c4366fa5eefde7e Mon Sep 17 00:00:00 2001 From: Emile Date: Fri, 1 Nov 2019 19:16:58 +0100 Subject: writing the wordlist into the wordlistChannel function --- src/main.go | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'src/main.go') diff --git a/src/main.go b/src/main.go index f64df59..ddcd344 100644 --- a/src/main.go +++ b/src/main.go @@ -11,26 +11,11 @@ func main() { // pase the command line aguments registerFlags() - fmt.Printf(red("asd")) - fmt.Printf(boldRed("asd")) - fmt.Printf(green("asd")) - fmt.Printf(boldGreen("asd")) - fmt.Printf(yellow("asd")) - fmt.Printf(boldYellow("asd")) - fmt.Printf(blue("asd")) - fmt.Printf(boldBlue("asd")) - fmt.Printf(magenta("asd")) - fmt.Printf(boldMagenta("asd")) - fmt.Printf(cyan("asd")) - fmt.Printf(boldCyan("asd") + "\n") - // read the wordlist from a file - log.Println("reading the wordlist from a file") wordlist, err := readWordlist(wordlist) if err != nil { log.Println(err) } - log.Println(green("[+] ") + "done reading the wordlist from a file") // define a channel to store the wordlist in wordlistChannel := make(chan string) @@ -39,14 +24,8 @@ func main() { // routines printChannel := make(chan Response) - // write all the words from the wordlist into the wordlistChannel - go func() { - for _, line := range wordlist { - wordlistChannel <- line - } - }() - - fmt.Println(url) + // write the wordlist into a channel + writeWordlistToChannel(wordlistChannel, wordlist) go func() { var i int @@ -62,14 +41,23 @@ func main() { // define what color should be used to print the individual status // codes var statusCode string + switch response.StatusCode { case 200: + + // jump to the beginning of the line, clear the line, then print + // the response prefix = "\r\033[K" statusCode = green(fmt.Sprintf("%d", response.StatusCode)) postfix = "\n" + case 404: + + // print the status code, then clear the line and jump back to + // the beginning statusCode = red(fmt.Sprintf("%d", response.StatusCode)) postfix = "\033[K\r" + } // print the foo @@ -79,7 +67,6 @@ func main() { }() if threads > 1 { - fmt.Println("threaded") httpRequest(wordlistChannel, printChannel) } else { -- cgit 1.4.1