mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 13:15:25 +00:00
The crash is mitigated in two ways. - An additional check in http clustering module for req condition (no clustering with conditions) - Clustered Executer also now passes a non-nil map to mitigate the crash if for some reason we reach there.
30 lines
863 B
Go
30 lines
863 B
Go
package http
|
|
|
|
import (
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/compare"
|
|
)
|
|
|
|
// CanCluster returns true if the request can be clustered.
|
|
//
|
|
// This used by the clustering engine to decide whether two requests
|
|
// are similar enough to be considered one and can be checked by
|
|
// just adding the matcher/extractors for the request and the correct IDs.
|
|
func (r *Request) CanCluster(other *Request) bool {
|
|
if len(r.Payloads) > 0 || len(r.Raw) > 0 || len(r.Body) > 0 || r.Unsafe || r.ReqCondition || r.Name != "" {
|
|
return false
|
|
}
|
|
if r.Method != other.Method ||
|
|
r.MaxRedirects != other.MaxRedirects ||
|
|
r.CookieReuse != other.CookieReuse ||
|
|
r.Redirects != other.Redirects {
|
|
return false
|
|
}
|
|
if !compare.StringSlice(r.Path, other.Path) {
|
|
return false
|
|
}
|
|
if !compare.StringMap(r.Headers, other.Headers) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|