新增--distance参数, 控制simhash阈值

This commit is contained in:
M09Ic committed 2022-11-10 21:26:07 +08:00
1 parent b510e48fac
commit 2a9ca15b9c
2 files changed
+12 -5

No files matched your search

+9 -4
View File
@@ -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
}
+3 -1
View File
@@ -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