mirror of
https://github.com/chainreactors/spray.git
synced 2025-05-07 11:06:23 +00:00
新增--distance参数, 控制simhash阈值
This commit is contained in:
parent
5fdbd5e05d
commit
9b99c2a0b2
@ -47,10 +47,11 @@ type OutputOptions struct {
|
||||
}
|
||||
|
||||
type RequestOptions struct {
|
||||
Headers []string `long:"header"`
|
||||
Method string `long:"method"`
|
||||
Cookie string `long:"cookie"`
|
||||
Force bool `long:"force"`
|
||||
Headers []string `long:"header"`
|
||||
Method string `long:"method"`
|
||||
Cookie string `long:"cookie"`
|
||||
Force bool `long:"force"`
|
||||
SimhashDistance int `long:"distance"`
|
||||
}
|
||||
|
||||
type MiscOptions struct {
|
||||
@ -99,6 +100,10 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
||||
logs.Log.Writer = r.Progress.Bypass()
|
||||
}
|
||||
|
||||
if opt.SimhashDistance != 0 {
|
||||
pkg.Distance = uint8(opt.SimhashDistance)
|
||||
}
|
||||
|
||||
if opt.Force {
|
||||
breakThreshold = 999999
|
||||
}
|
||||
|
@ -116,9 +116,11 @@ func (bl *Baseline) Compare(other *Baseline) int {
|
||||
return -1
|
||||
}
|
||||
|
||||
var Distance uint8
|
||||
|
||||
func (bl *Baseline) FuzzyCompare(other *Baseline) bool {
|
||||
// todo 模糊匹配
|
||||
if parsers.SimhashCompare(other.BodySimhash, bl.BodySimhash) < 3 {
|
||||
if parsers.SimhashCompare(other.BodySimhash, bl.BodySimhash) < Distance {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
Loading…
x
Reference in New Issue
Block a user