mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 19:50:18 +00:00
修复hash计算时的传入值为body导致多处判断出错的bug
This commit is contained in:
parent
155d0d981b
commit
6d03910049
@ -133,14 +133,12 @@ func NewPool(ctx context.Context, config *pkg.Config) (*Pool, error) {
|
|||||||
case CheckSource:
|
case CheckSource:
|
||||||
if bl.ErrString != "" {
|
if bl.ErrString != "" {
|
||||||
logs.Log.Warnf("[check.error] %s maybe ip had banned, break (%d/%d), error: %s", pool.BaseURL, pool.failedCount, pool.BreakThreshold, bl.ErrString)
|
logs.Log.Warnf("[check.error] %s maybe ip had banned, break (%d/%d), error: %s", pool.BaseURL, pool.failedCount, pool.BreakThreshold, bl.ErrString)
|
||||||
pool.failedBaselines = append(pool.failedBaselines, bl)
|
|
||||||
} else if i := pool.random.Compare(bl); i < 1 {
|
} else if i := pool.random.Compare(bl); i < 1 {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
logs.Log.Debug("[check.fuzzy] maybe trigger risk control, " + bl.String())
|
logs.Log.Debug("[check.fuzzy] maybe trigger risk control, " + bl.String())
|
||||||
} else {
|
} else {
|
||||||
logs.Log.Warn("[check.failed] maybe trigger risk control, " + bl.String())
|
logs.Log.Warn("[check.failed] maybe trigger risk control, " + bl.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
pool.failedBaselines = append(pool.failedBaselines, bl)
|
pool.failedBaselines = append(pool.failedBaselines, bl)
|
||||||
} else {
|
} else {
|
||||||
pool.resetFailed() // 如果后续访问正常, 重置错误次数
|
pool.resetFailed() // 如果后续访问正常, 重置错误次数
|
||||||
@ -459,8 +457,7 @@ func (p *Pool) resetFailed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Pool) recover() {
|
func (p *Pool) recover() {
|
||||||
logs.Log.Errorf("failed request exceeds the threshold , task will exit. Breakpoint %d", p.reqCount)
|
logs.Log.Errorf("%s ,failed request exceeds the threshold , task will exit. Breakpoint %d", p.BaseURL, p.reqCount)
|
||||||
logs.Log.Error("collecting failed check")
|
|
||||||
for i, bl := range p.failedBaselines {
|
for i, bl := range p.failedBaselines {
|
||||||
logs.Log.Errorf("[failed.%d] %s", i, bl.String())
|
logs.Log.Errorf("[failed.%d] %s", i, bl.String())
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package pkg
|
package pkg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/chainreactors/gogo/v2/pkg/utils"
|
"github.com/chainreactors/gogo/v2/pkg/utils"
|
||||||
"github.com/chainreactors/parsers"
|
"github.com/chainreactors/parsers"
|
||||||
@ -98,7 +99,7 @@ func (bl *Baseline) Collect() {
|
|||||||
if len(bl.Body) > 0 {
|
if len(bl.Body) > 0 {
|
||||||
bl.Title = utils.AsciiEncode(parsers.MatchTitle(string(bl.Body)))
|
bl.Title = utils.AsciiEncode(parsers.MatchTitle(string(bl.Body)))
|
||||||
}
|
}
|
||||||
bl.Hashes = parsers.NewHashes(bl.Body)
|
bl.Hashes = parsers.NewHashes(bl.Raw)
|
||||||
// todo extract
|
// todo extract
|
||||||
bl.Extracteds = Extractors.Extract(string(bl.Raw))
|
bl.Extracteds = Extractors.Extract(string(bl.Raw))
|
||||||
bl.Frameworks = FingerDetect(string(bl.Raw))
|
bl.Frameworks = FingerDetect(string(bl.Raw))
|
||||||
@ -116,7 +117,7 @@ func (bl *Baseline) Compare(other *Baseline) int {
|
|||||||
|
|
||||||
if i := bl.BodyLength - other.BodyLength; i < 16 || i > -16 {
|
if i := bl.BodyLength - other.BodyLength; i < 16 || i > -16 {
|
||||||
// 如果body length相等且md5相等, 则说明是同一个页面
|
// 如果body length相等且md5相等, 则说明是同一个页面
|
||||||
if bl.BodyMd5 == parsers.Md5Hash(other.Body) {
|
if bytes.Equal(bl.Body, other.Body) {
|
||||||
// 如果length相等, md5也相等, 则判断为全同
|
// 如果length相等, md5也相等, 则判断为全同
|
||||||
return 1
|
return 1
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user