about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-11-01 21:33:59 +0100
committerEmile <hanemile@protonmail.com>2019-11-01 21:33:59 +0100
commitb991d9d8c791460a0e5ab4d28502f95efa3d866c (patch)
treee77242b4cc3b1b3198b016788e0e8c7daa43c74d
parent67b9787c3f4103100a626e6e8a71551482c7ad44 (diff)
broke stuff, fixed stuff...
-rw-r--r--src/http.go1
-rw-r--r--src/main.go26
-rw-r--r--src/printer.go6
-rw-r--r--src/wordlist.go10
4 files changed, 29 insertions, 14 deletions
diff --git a/src/http.go b/src/http.go
index ece39ed..6164976 100644
--- a/src/http.go
+++ b/src/http.go
@@ -7,6 +7,7 @@ import (
 )
 
 func httpRequest(wordlistChannel chan string, printChannel chan Response) {
+	log.Println("http request")
 	for {
 		// replace the first instance of "FUZZ" in the given url by the next
 		// value from the wordlistChannel
diff --git a/src/main.go b/src/main.go
index 25d3f3b..6bb8beb 100644
--- a/src/main.go
+++ b/src/main.go
@@ -1,43 +1,53 @@
 package main
 
 import (
+	"fmt"
 	"log"
 )
 
 func main() {
 	// pase the command line aguments
 	registerFlags()
+	log.Printf("%s Done reading flags", green("[+]"))
 
 	// read the wordlist from a file
 	wordlist, err := readWordlist(wordlist)
 	if err != nil {
 		log.Println(err)
 	}
+	log.Printf("%s Done reading the wordlist", green("[+]"))
 
-	// define a channel to store the wordlist in
+	// define channels storing the wordlist and the responses resulting from the
+	// requests
 	wordlistChannel := make(chan string)
-
-	// define a channel in which the response gets written into from the go
-	// routines
 	printChannel := make(chan Response)
 
-	// write the wordlist into a channel
-	writeWordlistToChannel(wordlistChannel, wordlist)
-
-	// print the responses from the printChannel
+	// write into the wordlist channel and read out of the print channel
+	go writeWordlistToChannel(wordlistChannel, wordlist)
 	go printResponses(printChannel)
 
+	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)
 	} else {
+		log.Printf("%s multiple threads", yellow("[+]"))
 
 		// 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)
 		}
 	}
 
+	fmt.Println(len(wordlistChannel))
+
+	for {
+		if len(wordlistChannel) > 0 {
+			break
+		}
+	}
 }
diff --git a/src/printer.go b/src/printer.go
index 7bc9beb..bb9ea63 100644
--- a/src/printer.go
+++ b/src/printer.go
@@ -1,6 +1,9 @@
 package main
 
-import "fmt"
+import (
+	"fmt"
+	"log"
+)
 
 func printResponses(printChannel chan Response) {
 	var i int
@@ -39,4 +42,5 @@ func printResponses(printChannel chan Response) {
 		fmt.Printf("%s%.7d:   %s    %s%s", prefix, i, statusCode, response.FuzzWord, postfix)
 		i++
 	}
+	log.Printf("%s Done printing the responses", green("[+]"))
 }
diff --git a/src/wordlist.go b/src/wordlist.go
index 5841c47..adfda9a 100644
--- a/src/wordlist.go
+++ b/src/wordlist.go
@@ -2,6 +2,7 @@ package main
 
 import (
 	"bufio"
+	"log"
 	"os"
 )
 
@@ -27,9 +28,8 @@ func readWordlist(wordlistPath string) ([]string, error) {
 
 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
-		}
-	}()
+	for _, line := range wordlist {
+		wordlistChannel <- line
+	}
+	log.Printf("%s Done inserting the wordlist elements into the wordlist channel", green("[+]"))
 }