-
Notifications
You must be signed in to change notification settings - Fork 1
/
12_path_alternate.go
49 lines (44 loc) · 1.2 KB
/
12_path_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
46
47
48
49
package http_fuzzer
import (
"log"
"github.com/censoredplanet/CenFuzz/config"
"github.com/censoredplanet/CenFuzz/util"
)
type PathAlternate struct{}
func (h *PathAlternate) Init(all bool) []*RequestWord {
var requestWords []*RequestWord
var requestWord *RequestWord
retries := 0
if !all {
for i := 0; i < config.NumberOfProbesPerTest; i++ {
pathAlternate := util.GeneratePathAlternatives()
requestWord = &RequestWord{
Path: pathAlternate,
Hostname: "%s",
}
if containsRequestWord(requestWords, requestWord) {
i--
retries += 1
if retries >= 10 {
log.Println("[pathAlternate.Init] Could not find a new random value after 10 retries. Breaking.")
break
}
} else {
requestWords = append(requestWords, requestWord)
retries = 0
}
}
} else {
pathAllAlternate := util.GenerateAllPathAlternatives()
for _, path := range pathAllAlternate {
requestWords = append(requestWords, &RequestWord{
Path: path,
Hostname: "%s",
})
}
}
return requestWords
}
func (g *PathAlternate) Fuzz(target string, hostname string, requestWord RequestWord) (interface{}, interface{}, interface{}) {
return MakeConnection(target, hostname, requestWord)
}