初步实现主动指纹识别

This commit is contained in:
M09Ic 2023-01-03 17:16:55 +08:00
parent 9e9b0de039
commit 77d4e25c9e
5 changed files with 24 additions and 5 deletions

View File

@ -78,6 +78,7 @@ type ModeOptions struct {
CheckOnly bool `long:"check-only" description:"Bool, check only"`
Recursive string `long:"recursive" default:"current.IsDir()" description:"String,custom recursive rule, e.g.: --recursive current.IsDir()"`
Depth int `long:"depth" default:"0" description:"Int, recursive depth"`
Active bool `long:"active" description:"Bool, enable active finger detect"`
Crawl bool `long:"crawl" description:"Bool, enable crawl"`
CrawlDepth int `long:"spider-depth" default:"3" description:"Int, crawl depth"`
CheckPeriod int `long:"check-period" default:"200" description:"Int, check period when request"`
@ -127,6 +128,7 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
ErrPeriod: opt.ErrPeriod,
BreakThreshold: opt.BreakThreshold,
Crawl: opt.Crawl,
Active: opt.Active,
}
err = pkg.LoadTemplates()

View File

@ -135,7 +135,7 @@ func NewPool(ctx context.Context, config *pkg.Config) (*Pool, error) {
case RedirectSource:
bl.FrontURL = unit.frontUrl
pool.tempCh <- bl
case CrawlSource:
case CrawlSource, ActiveSource:
pool.tempCh <- bl
}
@ -292,6 +292,10 @@ func (pool *Pool) Run(ctx context.Context, offset, limit int) {
pool.reqPool.Invoke(unit)
}
}()
if pool.Active {
go pool.doActive()
}
Loop:
for {
select {
@ -466,16 +470,25 @@ func (pool *Pool) doCrawl(bl *pkg.Baseline) {
}
pool.wg.Add(1)
pool.additionCh <- &Unit{
path: parsed.Path,
source: CrawlSource,
frontUrl: bl.UrlString,
depth: bl.ReqDepth + 1,
path: parsed.Path,
source: CrawlSource,
depth: bl.ReqDepth + 1,
}
}
}
}
}
func (pool *Pool) doActive() {
for _, u := range pkg.ActivePath {
pool.wg.Add(1)
pool.additionCh <- &Unit{
path: u,
source: ActiveSource,
}
}
}
func (pool *Pool) doCheck() {
if pool.failedCount > pool.BreakThreshold {
// 当报错次数超过上限是, 结束任务

View File

@ -73,6 +73,7 @@ type Runner struct {
Force bool
IgnoreWaf bool
Crawl bool
Active bool
}
func (r *Runner) PrepareConfig() *pkg.Config {
@ -92,6 +93,7 @@ func (r *Runner) PrepareConfig() *pkg.Config {
RecuExpr: r.RecursiveExpr,
IgnoreWaf: r.IgnoreWaf,
Crawl: r.Crawl,
Active: r.Active,
}
if config.Mod == pkg.PathSpray {
config.ClientType = ihttp.FAST

View File

@ -52,6 +52,7 @@ const (
InitIndexSource
RedirectSource
CrawlSource
ActiveSource
WordSource
WafSource
)

View File

@ -39,4 +39,5 @@ type Config struct {
Fuzzy bool
IgnoreWaf bool
Crawl bool
Active bool
}