about summary refs log tree commit diff
path: root/src/http.go
blob: ece39edb90f54c0e6a276f1d3f59b8f780d076f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
	}
}