Precompute total number of HTTP requests when using multiple templates

dev
Manuel Bua 2020-07-09 21:21:37 +02:00
parent 81eed093d2
commit e5949c8eba
1 changed files with 17 additions and 2 deletions

View File

@ -200,6 +200,23 @@ func (r *Runner) RunEnumeration() {
// track progress // track progress
p := progress.NewProgress(nil) p := progress.NewProgress(nil)
// precompute request count
var totalRequests int64 = 0
for _, match := range matches {
t, err := r.parse(match)
switch t.(type) {
case *templates.Template:
template := t.(*templates.Template)
totalRequests += template.GetHTTPRequestsCount()
default:
p.StartStdCapture()
gologger.Errorf("Could not parse file '%s': %s\n", r.options.Templates, err)
p.StopStdCapture()
}
}
p.SetupProgressBar("Multiple templates", r.inputCount * totalRequests)
var results bool var results bool
for _, match := range matches { for _, match := range matches {
t, err := r.parse(match) t, err := r.parse(match)
@ -213,8 +230,6 @@ func (r *Runner) RunEnumeration() {
} }
} }
p.SetupProgressBar(template.ID, r.inputCount * template.GetHTTPRequestsCount())
for _, request := range template.RequestsHTTP { for _, request := range template.RequestsHTTP {
httpResults := r.processTemplateWithList(p, template, request) httpResults := r.processTemplateWithList(p, template, request)
if httpResults { if httpResults {