Make regex filter match headers too

This commit is contained in:
Joona Hoikkala 2019-03-30 01:38:37 +02:00
parent 35f02c622b
commit 81c398eeb0
No known key found for this signature in database
GPG key ID: D5AA86BBF9B29A5C

View file

@ -21,7 +21,15 @@ func NewRegexpFilter(value string) (ffuf.FilterProvider, error) {
} }
func (f *RegexpFilter) Filter(response *ffuf.Response) (bool, error) { func (f *RegexpFilter) Filter(response *ffuf.Response) (bool, error) {
return f.Value.Match(response.Data), nil matchheaders := ""
for k, v := range response.Headers {
for _, iv := range v {
matchheaders += k + ": " + iv + "\r\n"
}
}
matchdata := []byte(matchheaders)
matchdata = append(matchdata, response.Data...)
return f.Value.Match(matchdata), nil
} }
func (f *RegexpFilter) Repr() string { func (f *RegexpFilter) Repr() string {