From 0c90a5fc03536f496b553c42ef9d2c4b4a543ece Mon Sep 17 00:00:00 2001 From: M09Ic Date: Fri, 1 Nov 2024 12:27:31 +0800 Subject: [PATCH] revert: not same redirect banned --- internal/pool/brutepool.go | 11 ++++++----- pkg/baseline.go | 28 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/internal/pool/brutepool.go b/internal/pool/brutepool.go index e79ab6e..bd49aac 100644 --- a/internal/pool/brutepool.go +++ b/internal/pool/brutepool.go @@ -315,7 +315,7 @@ func (pool *BrutePool) Invoke(v interface{}) { // 手动处理重定向 if bl.IsValid && unit.source != parsers.CheckSource && bl.RedirectURL != "" { - bl.SameDomain = pool.checkHost(bl.RedirectURL) + bl.SameRedirectDomain = pool.checkHost(bl.RedirectURL) pool.doRedirect(bl, unit.depth) } @@ -586,7 +586,7 @@ func (pool *BrutePool) BaseCompare(bl *pkg.Baseline) bool { // 30x状态码的特殊处理 if bl.RedirectURL != "" { - if bl.SameDomain && strings.HasSuffix(bl.RedirectURL, bl.Url.Path+"/") { + if bl.SameRedirectDomain && strings.HasSuffix(bl.RedirectURL, bl.Url.Path+"/") { bl.Reason = pkg.ErrFuzzyRedirect.Error() return false } @@ -709,9 +709,10 @@ func (pool *BrutePool) doRedirect(bl *pkg.Baseline, depth int) { if depth >= pool.MaxRedirect { return } - if !bl.SameDomain { - return // 不同域名的重定向不处理 - } + + //if !bl.SameRedirectDomain { + // return // 不同域名的重定向不处理 + //} reURL := pkg.FormatURL(bl.Url.Path, bl.RedirectURL) pool.wg.Add(1) go func() { diff --git a/pkg/baseline.go b/pkg/baseline.go index d17e1b1..18df8c1 100644 --- a/pkg/baseline.go +++ b/pkg/baseline.go @@ -113,20 +113,20 @@ func NewInvalidBaseline(u, host string, resp *ihttp.Response, reason string) *Ba type Baseline struct { *parsers.SprayResult - Url *url.URL `json:"-"` - Dir bool `json:"-"` - Chunked bool `json:"-"` - Body BS `json:"-"` - Header BS `json:"-"` - Raw BS `json:"-"` - Response *http.Response `json:"-"` - Recu bool `json:"-"` - RecuDepth int `json:"-"` - URLs []string `json:"-"` - Collected bool `json:"-"` - Retry int `json:"-"` - SameDomain bool `json:"-"` - IsBaseline bool `json:"-"` + Url *url.URL `json:"-"` + Dir bool `json:"-"` + Chunked bool `json:"-"` + Body BS `json:"-"` + Header BS `json:"-"` + Raw BS `json:"-"` + Response *http.Response `json:"-"` + Recu bool `json:"-"` + RecuDepth int `json:"-"` + URLs []string `json:"-"` + Collected bool `json:"-"` + Retry int `json:"-"` + SameRedirectDomain bool `json:"-"` + IsBaseline bool `json:"-"` } func (bl *Baseline) IsDir() bool {