mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 11:40:13 +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"`
|
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()"`
|
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"`
|
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"`
|
Crawl bool `long:"crawl" description:"Bool, enable crawl"`
|
||||||
CrawlDepth int `long:"spider-depth" default:"3" description:"Int, crawl depth"`
|
CrawlDepth int `long:"spider-depth" default:"3" description:"Int, crawl depth"`
|
||||||
CheckPeriod int `long:"check-period" default:"200" description:"Int, check period when request"`
|
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,
|
ErrPeriod: opt.ErrPeriod,
|
||||||
BreakThreshold: opt.BreakThreshold,
|
BreakThreshold: opt.BreakThreshold,
|
||||||
Crawl: opt.Crawl,
|
Crawl: opt.Crawl,
|
||||||
|
Active: opt.Active,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = pkg.LoadTemplates()
|
err = pkg.LoadTemplates()
|
||||||
|
@ -135,7 +135,7 @@ func NewPool(ctx context.Context, config *pkg.Config) (*Pool, error) {
|
|||||||
case RedirectSource:
|
case RedirectSource:
|
||||||
bl.FrontURL = unit.frontUrl
|
bl.FrontURL = unit.frontUrl
|
||||||
pool.tempCh <- bl
|
pool.tempCh <- bl
|
||||||
case CrawlSource:
|
case CrawlSource, ActiveSource:
|
||||||
pool.tempCh <- bl
|
pool.tempCh <- bl
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,6 +292,10 @@ func (pool *Pool) Run(ctx context.Context, offset, limit int) {
|
|||||||
pool.reqPool.Invoke(unit)
|
pool.reqPool.Invoke(unit)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
if pool.Active {
|
||||||
|
go pool.doActive()
|
||||||
|
}
|
||||||
|
|
||||||
Loop:
|
Loop:
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
@ -468,7 +472,6 @@ func (pool *Pool) doCrawl(bl *pkg.Baseline) {
|
|||||||
pool.additionCh <- &Unit{
|
pool.additionCh <- &Unit{
|
||||||
path: parsed.Path,
|
path: parsed.Path,
|
||||||
source: CrawlSource,
|
source: CrawlSource,
|
||||||
frontUrl: bl.UrlString,
|
|
||||||
depth: bl.ReqDepth + 1,
|
depth: bl.ReqDepth + 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -476,6 +479,16 @@ func (pool *Pool) doCrawl(bl *pkg.Baseline) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (pool *Pool) doActive() {
|
||||||
|
for _, u := range pkg.ActivePath {
|
||||||
|
pool.wg.Add(1)
|
||||||
|
pool.additionCh <- &Unit{
|
||||||
|
path: u,
|
||||||
|
source: ActiveSource,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (pool *Pool) doCheck() {
|
func (pool *Pool) doCheck() {
|
||||||
if pool.failedCount > pool.BreakThreshold {
|
if pool.failedCount > pool.BreakThreshold {
|
||||||
// 当报错次数超过上限是, 结束任务
|
// 当报错次数超过上限是, 结束任务
|
||||||
|
@ -73,6 +73,7 @@ type Runner struct {
|
|||||||
Force bool
|
Force bool
|
||||||
IgnoreWaf bool
|
IgnoreWaf bool
|
||||||
Crawl bool
|
Crawl bool
|
||||||
|
Active bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Runner) PrepareConfig() *pkg.Config {
|
func (r *Runner) PrepareConfig() *pkg.Config {
|
||||||
@ -92,6 +93,7 @@ func (r *Runner) PrepareConfig() *pkg.Config {
|
|||||||
RecuExpr: r.RecursiveExpr,
|
RecuExpr: r.RecursiveExpr,
|
||||||
IgnoreWaf: r.IgnoreWaf,
|
IgnoreWaf: r.IgnoreWaf,
|
||||||
Crawl: r.Crawl,
|
Crawl: r.Crawl,
|
||||||
|
Active: r.Active,
|
||||||
}
|
}
|
||||||
if config.Mod == pkg.PathSpray {
|
if config.Mod == pkg.PathSpray {
|
||||||
config.ClientType = ihttp.FAST
|
config.ClientType = ihttp.FAST
|
||||||
|
@ -52,6 +52,7 @@ const (
|
|||||||
InitIndexSource
|
InitIndexSource
|
||||||
RedirectSource
|
RedirectSource
|
||||||
CrawlSource
|
CrawlSource
|
||||||
|
ActiveSource
|
||||||
WordSource
|
WordSource
|
||||||
WafSource
|
WafSource
|
||||||
)
|
)
|
||||||
|
@ -39,4 +39,5 @@ type Config struct {
|
|||||||
Fuzzy bool
|
Fuzzy bool
|
||||||
IgnoreWaf bool
|
IgnoreWaf bool
|
||||||
Crawl bool
|
Crawl bool
|
||||||
|
Active bool
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user