(v interface{})
| 299 | } |
| 300 | |
| 301 | func (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(), |
nothing calls this directly
no test coverage detected