-
Notifications
You must be signed in to change notification settings - Fork 1
/
16_hostname_subdomain_alternate.go
45 lines (40 loc) · 1.25 KB
/
16_hostname_subdomain_alternate.go
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
43
44
45
package http_fuzzer
import (
"log"
"github.com/censoredplanet/CenFuzz/config"
"github.com/censoredplanet/CenFuzz/util"
)
type HostnameSubdomainsAlternate struct{}
func (h *HostnameSubdomainsAlternate) Init(all bool) []*RequestWord {
var requestWords []*RequestWord
var requestWord *RequestWord
retries := 0
if !all {
for i := 0; i < config.NumberOfProbesPerTest; i++ {
HostnameAlternate := util.GenerateSubdomainsAlternatives()
requestWord = &RequestWord{
Hostname: HostnameAlternate,
}
if containsRequestWord(requestWords, requestWord) {
i--
retries += 1
if retries >= 10 {
log.Println("[HostnameSubdomainsAlternate.Init] Could not find a new random value after 10 retries. Breaking.")
break
}
} else {
requestWords = append(requestWords, requestWord)
retries = 0
}
}
} else {
HostnameAllAlternatives := util.GenerateAllSubdomainsAlternatives()
for _, Hostname := range HostnameAllAlternatives {
requestWords = append(requestWords, &RequestWord{Hostname: Hostname})
}
}
return requestWords
}
func (h *HostnameSubdomainsAlternate) Fuzz(target string, hostname string, requestWord RequestWord) (interface{}, interface{}, interface{}) {
return MakeConnection(target, hostname, requestWord)
}