blob: 1ed23331fab81b54b47e35373ed766026c70ad65 (
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
32
33
34
35
36
37
38
39
40
41
42
|
package main
import (
"log"
)
func main() {
// pase the command line aguments
registerFlags()
// read the wordlist from a file
wordlist, err := readWordlist(wordlist)
if err != nil {
log.Println(err)
}
// define a channel to store the wordlist in
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
go printResponses(printChannel)
if threads > 1 {
httpRequest(wordlistChannel, printChannel)
} else {
// 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++ {
go httpRequest(wordlistChannel, printChannel)
}
}
}
|