-
Notifications
You must be signed in to change notification settings - Fork 1
/
3_getword_remove.go
49 lines (44 loc) · 1.22 KB
/
3_getword_remove.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 GetWordRemove struct{}
func (g *GetWordRemove) Init(all bool) []*RequestWord {
var requestWords []*RequestWord
var requestWord *RequestWord
retries := 0
if !all {
for i := 0; i < config.NumberOfProbesPerTest; i++ {
getWordRemove := util.GenerateRandomlyRemovedWord("GET")
requestWord = &RequestWord{
GetWord: getWordRemove,
Hostname: "%s",
}
if containsRequestWord(requestWords, requestWord) {
i--
retries += 1
if retries >= 10 {
log.Println("[GetWordRemove.Init] Could not find a new random value after 10 retries. Breaking.")
break
}
} else {
requestWords = append(requestWords, requestWord)
retries = 0
}
}
} else {
getWordAllRemove := util.GenerateAllSubstringPermutations("GET")
for _, getWord := range getWordAllRemove {
requestWords = append(requestWords, &RequestWord{
GetWord: getWord,
Hostname: "%s",
})
}
}
return requestWords
}
func (g *GetWordRemove) Fuzz(target string, hostname string, requestWord RequestWord) (interface{}, interface{}, interface{}) {
return MakeConnection(target, hostname, requestWord)
}