适配新版words库

This commit is contained in:
M09Ic 2022-11-30 01:31:15 +08:00
parent f05fd498be
commit 3e9bb1d5bf
5 changed files with 17 additions and 17 deletions

2
go.mod
View File

@ -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.1.1
github.com/chainreactors/words v0.2.1
)
require (

4
go.sum
View File

@ -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.1.1 h1:Zw4HKFtYcIH5SfuCV0X6kj/A5sN99jrQD2ChUonLOV8=
github.com/chainreactors/words v0.1.1/go.mod h1:jRcFgafTKqdkd1+StzPCTJG1ESrZHluXEO2eERdHBMQ=
github.com/chainreactors/words v0.2.1 h1:yQvNnLF3VM2QBo611FhXUEr5i+O4cWY3jUvhDfAknIA=
github.com/chainreactors/words v0.2.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=

View File

@ -18,7 +18,7 @@ func NewCheckPool(ctx context.Context, config *pkg.Config) (*CheckPool, error) {
ctx: pctx,
cancel: cancel,
client: ihttp.NewClient(config.Thread, 2, config.ClientType),
worder: words.NewWorder(config.Wordlist),
worder: words.NewWorder(config.Wordlist, config.Fns),
wg: sync.WaitGroup{},
reqCount: 1,
failedCount: 1,
@ -103,12 +103,6 @@ Loop:
break Loop
}
for _, fn := range p.Fns {
u = fn(u)
}
if u == "" {
continue
}
p.wg.Add(1)
_ = p.pool.Invoke(newUnit(u, WordSource))
case <-ctx.Done():

View File

@ -208,17 +208,23 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
}
if opt.Suffixes != nil {
dicts = append(dicts, opt.Suffixes)
opt.Word += fmt.Sprintf("{?%d}", len(dicts)-1)
mask.SpecialWords["suffix"] = opt.Suffixes
opt.Word += "{@suffix}"
}
if opt.Prefixes != nil {
dicts = append(dicts, opt.Prefixes)
opt.Word = fmt.Sprintf("{?%d}", len(dicts)-1) + opt.Word
mask.SpecialWords["prefix"] = opt.Prefixes
opt.Word = "{@prefix}" + opt.Word
}
if opt.Extensions != "" {
dicts = append(dicts, strings.Split(opt.Extensions, ","))
opt.Word += fmt.Sprintf("{?%d}", len(dicts)-1)
exts := strings.Split(opt.Extensions, ",")
for i, e := range exts {
if !strings.HasPrefix(e, ".") {
exts[i] = "." + e
}
}
mask.SpecialWords["ext"] = exts
opt.Word += "{@ext}"
}
mask.CustomWords = dicts

View File

@ -33,7 +33,7 @@ func NewPool(ctx context.Context, config *pkg.Config) (*Pool, error) {
ctx: pctx,
cancel: cancel,
client: ihttp.NewClient(config.Thread, 2, config.ClientType),
worder: words.NewWorder(config.Wordlist),
worder: words.NewWorder(config.Wordlist, config.Fns),
baselines: make(map[int]*pkg.Baseline),
tempCh: make(chan *pkg.Baseline, config.Thread),
wg: sync.WaitGroup{},