mirror of
https://github.com/chainreactors/spray.git
synced 2025-05-06 10:41:21 +00:00
初步实现主动指纹识别
This commit is contained in:
parent
9e9b0de039
commit
77d4e25c9e
@ -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()
|
||||
|
@ -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 {
|
||||
// 当报错次数超过上限是, 结束任务
|
||||
|
@ -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
|
||||
|
@ -52,6 +52,7 @@ const (
|
||||
InitIndexSource
|
||||
RedirectSource
|
||||
CrawlSource
|
||||
ActiveSource
|
||||
WordSource
|
||||
WafSource
|
||||
)
|
||||
|
@ -39,4 +39,5 @@ type Config struct {
|
||||
Fuzzy bool
|
||||
IgnoreWaf bool
|
||||
Crawl bool
|
||||
Active bool
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user