about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-11-02 16:52:22 +0100
committerEmile <hanemile@protonmail.com>2019-11-02 16:52:22 +0100
commit0af71a7fe967f149b6ff2b1030c5544f1a336e3c (patch)
tree99f8ca419bbde811f98cf6279b6a9f23a374c66c
parentd9b14426c9cfca8c9cf813c8abb44a5c22de47e4 (diff)
renamed file
-rw-r--r--src/httpRequest.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/httpRequest.go b/src/httpRequest.go
new file mode 100644
index 0000000..12a8a6d
--- /dev/null
+++ b/src/httpRequest.go
@@ -0,0 +1,35 @@
+package main
+
+import (
+	"log"
+	"net/http"
+	"strings"
+)
+
+func httpRequest(wordlistChannel chan string, printChannel chan Response, doneChannel chan int, threadNr int) {
+	for {
+		// replace the first instance of "FUZZ" in the given url by the next
+		// value from the wordlistChannel
+		fuzzWord := <-wordlistChannel
+		requestURL := strings.Replace(url, "FUZZ", fuzzWord, 1)
+
+		// make the http get request
+		resp, err := http.Get("https://" + requestURL)
+		if err != nil {
+			log.Println(err)
+		}
+
+		// define the response
+		var response = Response{
+			StatusCode: resp.StatusCode,
+			FuzzWord:   fuzzWord,
+		}
+
+		// insert the response into the print channel for further printing
+		printChannel <- response
+	}
+
+	if doneChannel != nil {
+		doneChannel <- threadNr
+	}
+}