mirror of
https://github.com/chainreactors/spray.git
synced 2025-05-06 18:51:22 +00:00
实装rule-base的filter rule
This commit is contained in:
parent
7f4c75bf10
commit
10e55bdb9a
2
go.mod
2
go.mod
@ -9,7 +9,7 @@ require (
|
||||
github.com/chainreactors/ipcs v0.0.13
|
||||
github.com/chainreactors/logs v0.6.2
|
||||
github.com/chainreactors/parsers v0.2.7
|
||||
github.com/chainreactors/words v0.3.0
|
||||
github.com/chainreactors/words v0.3.1
|
||||
)
|
||||
|
||||
require (
|
||||
|
4
go.sum
4
go.sum
@ -21,8 +21,8 @@ github.com/chainreactors/logs v0.6.2/go.mod h1:Y0EtAnoF0kiASIJUnXN0pcOt420iRpHOA
|
||||
github.com/chainreactors/parsers v0.2.6/go.mod h1:Z9weht+lnFCk7UcwqFu6lXpS7u5vttiy0AJYOAyCCLA=
|
||||
github.com/chainreactors/parsers v0.2.7 h1:3iEuluL7gSDrElZWyf1KEiTgddgcoZC0IaIHb9KA3pk=
|
||||
github.com/chainreactors/parsers v0.2.7/go.mod h1:Z9weht+lnFCk7UcwqFu6lXpS7u5vttiy0AJYOAyCCLA=
|
||||
github.com/chainreactors/words v0.3.0 h1:6wC6lARE2MuD0UihW4RTV76cbiAoGVJM3k+HZg+R+hc=
|
||||
github.com/chainreactors/words v0.3.0/go.mod h1:jRcFgafTKqdkd1+StzPCTJG1ESrZHluXEO2eERdHBMQ=
|
||||
github.com/chainreactors/words v0.3.1 h1:Onx+FKOp0cZHCNQj2hB2tHOclbWCvQ8aOcreX8e5SSQ=
|
||||
github.com/chainreactors/words v0.3.1/go.mod h1:jRcFgafTKqdkd1+StzPCTJG1ESrZHluXEO2eERdHBMQ=
|
||||
github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
|
@ -34,6 +34,7 @@ type InputOptions struct {
|
||||
Limit int `long:"limit" description:"Int, wordlist limit, start with offset. e.g.: --offset 1000 --limit 100"`
|
||||
Dictionaries []string `short:"d" long:"dict" description:"Files, dict files, e.g.: -d 1.txt -d 2.txt"`
|
||||
Word string `short:"w" long:"word" description:"String, word generate dsl, e.g.: -w test{?ld#4}"`
|
||||
FilterRule string `long:"rule-filter" description:"String, filter rule, e.g.: --rule-filter '>8'"`
|
||||
Rules []string `short:"r" long:"rules" description:"Files, rule files, e.g.: -r rule1.txt -r rule2.txt"`
|
||||
Extensions string `short:"e" long:"extension" description:"String, add extensions (separated by commas), e.g.: -e jsp,jspx"`
|
||||
ExcludeExtensions string `long:"exclude-extension" description:"String, exclude extensions (separated by commas), e.g.: --exclude-extension jsp,jspx"`
|
||||
@ -238,7 +239,10 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
||||
rules.Write(content)
|
||||
rules.WriteString("\n")
|
||||
}
|
||||
r.Rules = rule.Compile(rules.String())
|
||||
r.Rules = rule.Compile(rules.String(), opt.FilterRule)
|
||||
} else if opt.FilterRule != "" {
|
||||
// if filter rule is not empty, set rules to ":", force to open filter mode
|
||||
r.Rules = rule.Compile(":", opt.FilterRule)
|
||||
}
|
||||
|
||||
if len(r.Rules) > 0 {
|
||||
|
@ -229,6 +229,7 @@ type Pool struct {
|
||||
}
|
||||
|
||||
func (p *Pool) Init() error {
|
||||
// 分成两步是为了避免闭包的线程安全问题
|
||||
p.initwg.Add(1)
|
||||
p.pool.Invoke(newUnit("/", InitIndexSource))
|
||||
p.initwg.Wait()
|
||||
@ -237,6 +238,7 @@ func (p *Pool) Init() error {
|
||||
}
|
||||
p.index.Collect()
|
||||
logs.Log.Important("[baseline.index] " + p.index.String())
|
||||
|
||||
p.initwg.Add(1)
|
||||
p.pool.Invoke(newUnit(pkg.RandPath(), InitRandomSource))
|
||||
p.initwg.Wait()
|
||||
|
Loading…
x
Reference in New Issue
Block a user