about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/main.go35
-rw-r--r--src/wordlist.go9
2 files changed, 20 insertions, 24 deletions
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 {
 
diff --git a/src/wordlist.go b/src/wordlist.go
index 76df5f4..5841c47 100644
--- a/src/wordlist.go
+++ b/src/wordlist.go
@@ -24,3 +24,12 @@ func readWordlist(wordlistPath string) ([]string, error) {
 	// return the lines, the line count and no error
 	return lines, nil
 }
+
+func writeWordlistToChannel(wordlistChannel chan string, wordlist []string) {
+	// write all the words from the wordlist into the wordlistChannel
+	go func() {
+		for _, line := range wordlist {
+			wordlistChannel <- line
+		}
+	}()
+}