MCPcopy Create free account
hub / github.com/chainreactors/spray / invoke

Method invoke

core/pool/brutepool.go:301–388  ·  view source on GitHub ↗
(v interface{})

Source from the content-addressed store, hash-verified

299}
300
301func (pool *BrutePool) invoke(v interface{}) {
302 defer pool.wg.Done()
303 unit := v.(*Unit)
304 if pool.RateLimit != 0 {
305 if err := pool.limiter.Wait(pool.ctx); err != nil {
306 bl := &baseline.Baseline{
307 SprayResult: &parsers.SprayResult{
308 UrlString: unit.path,
309 ErrString: err.Error(),
310 Reason: pkg.ErrRequestFailed.Error(),
311 },
312 }
313 bl.Number = unit.number
314 bl.Parent = unit.parent
315 bl.Source = unit.source
316 bl.From = unit.from
317 bl.ReqDepth = unit.depth
318 bl.Retry = unit.retry
319 pool.sendProcess(bl)
320 return
321 }
322 }
323
324 // 使用RequestConfig.Build()构建请求
325 req, err := pool.Request.Build(pool.ctx, pool.ClientType, pool.base, unit.path, unit.host, unit.word)
326 if err != nil {
327 logs.Log.Debug(err.Error())
328 bl := &baseline.Baseline{
329 SprayResult: &parsers.SprayResult{
330 UrlString: unit.path,
331 ErrString: err.Error(),
332 Reason: pkg.ErrUrlError.Error(),
333 },
334 }
335 bl.Number = unit.number
336 bl.Parent = unit.parent
337 bl.Source = unit.source
338 bl.From = unit.from
339 bl.ReqDepth = unit.depth
340 bl.Retry = unit.retry
341 pool.sendProcess(bl)
342 return
343 }
344
345 start := time.Now()
346 resp, reqerr := pool.client.Do(req)
347 if pool.ClientType == ihttp.FAST {
348 defer fasthttp.ReleaseResponse(resp.FastResponse)
349 defer fasthttp.ReleaseRequest(req.FastRequest)
350 }
351
352 // compare与各种错误处理
353 var bl *baseline.Baseline
354 if reqerr != nil && !errors.Is(reqerr, fasthttp.ErrBodyTooLarge) {
355 bl = &baseline.Baseline{
356 SprayResult: &parsers.SprayResult{
357 UrlString: req.URI(),
358 ErrString: reqerr.Error(),

Callers

nothing calls this directly

Calls 11

checkHostMethod · 0.95
doRedirectMethod · 0.95
NewBaselineFunction · 0.92
CheckBodySizeFunction · 0.92
ErrorMethod · 0.80
sendProcessMethod · 0.80
BuildMethod · 0.80
DoMethod · 0.80
URIMethod · 0.80
HostMethod · 0.80
DoneMethod · 0.45

Tested by

no test coverage detected