mirror of https://github.com/daffainfo/nuclei.git
Fixed extractions + input path clear + misc
parent
7403ade437
commit
8b93d5e1d2
|
@ -121,7 +121,7 @@ func (r *Operators) Execute(data map[string]interface{}, match MatchFunc, extrac
|
|||
}
|
||||
// Write a final string of output if matcher type is
|
||||
// AND or if we have extractors for the mechanism too.
|
||||
if len(result.Extracts) > 0 || matches {
|
||||
if len(result.Extracts) > 0 || len(result.OutputExtracts) > 0 || matches {
|
||||
return result, true
|
||||
}
|
||||
return nil, false
|
||||
|
|
|
@ -54,7 +54,7 @@ type ResultEvent struct {
|
|||
// TemplateID is the ID of the template for the result.
|
||||
TemplateID string `json:"templateID"`
|
||||
// Info contains information block of the template for the result.
|
||||
Info map[string]string `json:"info"`
|
||||
Info map[string]string `json:"info,inline"`
|
||||
// MatcherName is the name of the matcher matched if any.
|
||||
MatcherName string `json:"matcher_name,omitempty"`
|
||||
// ExtractorName is the name of the extractor matched if any.
|
||||
|
|
|
@ -56,7 +56,7 @@ func (r *Request) ExecuteWithResults(input string, metadata output.InternalEvent
|
|||
|
||||
event := &output.InternalWrappedEvent{InternalEvent: ouputEvent}
|
||||
if r.CompiledOperators != nil {
|
||||
result, ok := r.Operators.Execute(ouputEvent, r.Match, r.Extract)
|
||||
result, ok := r.CompiledOperators.Execute(ouputEvent, r.Match, r.Extract)
|
||||
if ok && result != nil {
|
||||
event.OperatorsResult = result
|
||||
event.Results = r.MakeResultEvent(event)
|
||||
|
|
|
@ -50,7 +50,7 @@ func (r *Request) ExecuteWithResults(input string, metadata output.InternalEvent
|
|||
|
||||
event := &output.InternalWrappedEvent{InternalEvent: ouputEvent}
|
||||
if r.CompiledOperators != nil {
|
||||
result, ok := r.Operators.Execute(ouputEvent, r.Match, r.Extract)
|
||||
result, ok := r.CompiledOperators.Execute(ouputEvent, r.Match, r.Extract)
|
||||
if ok && result != nil {
|
||||
event.OperatorsResult = result
|
||||
event.Results = r.MakeResultEvent(event)
|
||||
|
|
|
@ -105,6 +105,8 @@ type generatedRequest struct {
|
|||
// Make creates a http request for the provided input.
|
||||
// It returns io.EOF as error when all the requests have been exhausted.
|
||||
func (r *requestGenerator) Make(baseURL string, dynamicValues map[string]interface{}) (*generatedRequest, error) {
|
||||
baseURL = strings.TrimSuffix(baseURL, "/")
|
||||
|
||||
data, payloads, ok := r.nextValue()
|
||||
if !ok {
|
||||
return nil, io.EOF
|
||||
|
@ -155,9 +157,6 @@ func baseURLWithTemplatePrefs(data string, parsedURL *url.URL) string {
|
|||
|
||||
// MakeHTTPRequestFromModel creates a *http.Request from a request template
|
||||
func (r *requestGenerator) makeHTTPRequestFromModel(ctx context.Context, data string, values map[string]interface{}) (*generatedRequest, error) {
|
||||
if strings.HasSuffix(values["BaseURL"].(string), "/") {
|
||||
data = strings.TrimPrefix(data, "/")
|
||||
}
|
||||
URL := replacer.New(values).Replace(data)
|
||||
|
||||
// Build a request on the specified URL
|
||||
|
|
|
@ -96,9 +96,6 @@ func Parse(request, baseURL string, unsafe bool) (*Request, error) {
|
|||
} else if strings.HasPrefix(rawRequest.Path, "?") {
|
||||
rawRequest.Path = fmt.Sprintf("%s%s", parsedURL.Path, rawRequest.Path)
|
||||
}
|
||||
if strings.HasSuffix(hostURL, "/") {
|
||||
rawRequest.Path = strings.TrimPrefix(rawRequest.Path, "/")
|
||||
}
|
||||
rawRequest.FullURL = fmt.Sprintf("%s://%s%s", parsedURL.Scheme, strings.TrimSpace(hostURL), rawRequest.Path)
|
||||
|
||||
// Set the request body
|
||||
|
|
|
@ -330,7 +330,7 @@ func (r *Request) executeRequest(reqURL string, request *generatedRequest, dynam
|
|||
|
||||
event := &output.InternalWrappedEvent{InternalEvent: ouputEvent}
|
||||
if r.CompiledOperators != nil {
|
||||
result, ok := r.Operators.Execute(ouputEvent, r.Match, r.Extract)
|
||||
result, ok := r.CompiledOperators.Execute(ouputEvent, r.Match, r.Extract)
|
||||
if ok && result != nil {
|
||||
event.OperatorsResult = result
|
||||
result.PayloadValues = request.meta
|
||||
|
|
|
@ -122,7 +122,7 @@ func (r *Request) executeAddress(actualAddress, address, input string, callback
|
|||
|
||||
event := &output.InternalWrappedEvent{InternalEvent: ouputEvent}
|
||||
if r.CompiledOperators != nil {
|
||||
result, ok := r.Operators.Execute(ouputEvent, r.Match, r.Extract)
|
||||
result, ok := r.CompiledOperators.Execute(ouputEvent, r.Match, r.Extract)
|
||||
if ok && result != nil {
|
||||
event.OperatorsResult = result
|
||||
event.Results = r.MakeResultEvent(event)
|
||||
|
|
Loading…
Reference in New Issue