Merge branch 'bugfix-engine-rework' into enumeration-progressbar-next

This commit is contained in:
Manuel Bua 2020-07-25 22:18:28 +02:00
commit 24341bf34c
4 changed files with 14 additions and 5 deletions

View File

@ -120,7 +120,9 @@ func (e *DNSExecuter) ExecuteDNS(URL string) (result Result) {
var extractorResults []string
for _, extractor := range e.dnsRequest.Extractors {
for match := range extractor.ExtractDNS(resp) {
extractorResults = append(extractorResults, match)
if !extractor.Internal {
extractorResults = append(extractorResults, match)
}
}
}

View File

@ -199,7 +199,7 @@ func (e *HTTPExecuter) handleHTTP(p *progress.Progress, URL string, request *req
} else {
// If the matcher has matched, and its an OR
// write the first output then move to next matcher.
if matcherCondition == matchers.ORCondition && len(e.bulkHttpRequest.Extractors) == 0 {
if matcherCondition == matchers.ORCondition {
result.Matches[matcher.Name] = nil
// probably redundant but ensures we snapshot current payload values when matchers are valid
result.Meta = request.Meta
@ -213,13 +213,16 @@ func (e *HTTPExecuter) handleHTTP(p *progress.Progress, URL string, request *req
// All matchers have successfully completed so now start with the
// next task which is extraction of input from matchers.
var extractorResults []string
var extractorResults, outputExtractorResults []string
for _, extractor := range e.bulkHttpRequest.Extractors {
for match := range extractor.Extract(resp, body, headers) {
if _, ok := dynamicvalues[extractor.Name]; !ok {
dynamicvalues[extractor.Name] = match
}
extractorResults = append(extractorResults, match)
if !extractor.Internal {
outputExtractorResults = append(outputExtractorResults, match)
}
}
// probably redundant but ensures we snapshot current payload values when extractors are valid
result.Meta = request.Meta
@ -228,9 +231,9 @@ func (e *HTTPExecuter) handleHTTP(p *progress.Progress, URL string, request *req
// Write a final string of output if matcher type is
// AND or if we have extractors for the mechanism too.
if len(e.bulkHttpRequest.Extractors) > 0 || matcherCondition == matchers.ANDCondition {
if len(outputExtractorResults) > 0 || matcherCondition == matchers.ANDCondition {
p.StartStdCapture()
e.writeOutputHTTP(request, resp, body, nil, extractorResults)
e.writeOutputHTTP(request, resp, body, nil, outputExtractorResults)
p.StopStdCapture()
result.GotResults = true
}

View File

@ -32,5 +32,6 @@ func (e *Extractor) CompileExtractors() error {
} else {
e.part = BodyPart
}
return nil
}

View File

@ -25,6 +25,9 @@ type Extractor struct {
Part string `yaml:"part,omitempty"`
// part is the part of the request to match
part Part
// Internal defines if this is used internally
Internal bool `yaml:"internal,omitempty"`
}
// ExtractorType is the type of the extractor specified