这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pkg/ffuf/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,12 @@ func injectKeyword(input string, keyword string, startOffset int, endOffset int)
prefix := inputslice[:startOffset]
suffix := inputslice[endOffset+1:]

inputslice = append(prefix, keywordslice...)
inputslice = append(inputslice, suffix...)
var outputslice []rune
outputslice = append(outputslice, prefix...)
outputslice = append(outputslice, keywordslice...)
outputslice = append(outputslice, suffix...)

return string(inputslice)
return string(outputslice)
}

// scrubTemplates removes all template (§) strings from the request struct
Expand Down
17 changes: 17 additions & 0 deletions pkg/ffuf/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,23 @@ func TestInjectKeyword(t *testing.T) {
t.Errorf("injectKeyword offset validation failed")
}

input = "id=§a§&sort=desc"
offsetTuple = templateLocations("§", input)
expected = "id=FUZZ&sort=desc"

result = injectKeyword(input, "FUZZ", offsetTuple[0], offsetTuple[1])
if result != expected {
t.Errorf("injectKeyword returned unexpected result: " + result)
}

input = "feature=aaa&thingie=bbb&array[§0§]=baz"
offsetTuple = templateLocations("§", input)
expected = "feature=aaa&thingie=bbb&array[FUZZ]=baz"

result = injectKeyword(input, "FUZZ", offsetTuple[0], offsetTuple[1])
if result != expected {
t.Errorf("injectKeyword returned unexpected result: " + result)
}
}

func TestScrubTemplates(t *testing.T) {
Expand Down