about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-11-01 19:20:18 +0100
committerEmile <hanemile@protonmail.com>2019-11-01 19:20:18 +0100
commit9c3d2c96d2e67953ce084182c3b83199106a2923 (patch)
treeb1df94ad673043ca35e13fb805260f4bf34aba87
parentb9264d1b8c3c007368a970015c4366fa5eefde7e (diff)
make the http requests
-rw-r--r--src/http.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/http.go b/src/http.go
new file mode 100644
index 0000000..ece39ed
--- /dev/null
+++ b/src/http.go
@@ -0,0 +1,31 @@
+package main
+
+import (
+	"log"
+	"net/http"
+	"strings"
+)
+
+func httpRequest(wordlistChannel chan string, printChannel chan Response) {
+	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
+	}
+}