mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-11-19 15:24:10 +01:00
@@ -19,6 +19,7 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
agents "github.com/monperrus/crawler-user-agents"
|
agents "github.com/monperrus/crawler-user-agents"
|
||||||
)
|
)
|
||||||
@@ -50,6 +51,10 @@ func NewExploitDetector(CheckCommonExploits bool, CheckAiBots bool, ExploitRespT
|
|||||||
// CheckIsAttack checks if the request is an attack based on common exploits
|
// CheckIsAttack checks if the request is an attack based on common exploits
|
||||||
// return true if the request is handled
|
// return true if the request is handled
|
||||||
func (d *Detector) CheckIsAttack(w http.ResponseWriter, r *http.Request) bool {
|
func (d *Detector) CheckIsAttack(w http.ResponseWriter, r *http.Request) bool {
|
||||||
|
path := r.URL.Path
|
||||||
|
if strings.HasPrefix(path, "/.well-known/") {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if d.CheckCommonExploits && d.RequestContainCommonExploits(r) {
|
if d.CheckCommonExploits && d.RequestContainCommonExploits(r) {
|
||||||
return d.handleExploitResponse(w, r, d.ExploitRespType)
|
return d.handleExploitResponse(w, r, d.ExploitRespType)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user