mzack 2022-02-24 23:35:51 +01:00
parent 91ad446212
commit 6af462c215
2 changed files with 6 additions and 8 deletions

View File

@ -1,7 +1,6 @@
package file package file
import ( import (
"log"
"time" "time"
"github.com/projectdiscovery/nuclei/v2/pkg/model" "github.com/projectdiscovery/nuclei/v2/pkg/model"
@ -125,7 +124,6 @@ func (request *Request) MakeResultEvent(wrapped *output.InternalWrappedEvent) []
result.FileToIndexPosition = make(map[string]int) result.FileToIndexPosition = make(map[string]int)
} }
result.FileToIndexPosition[result.Matched] = calculateFileIndexFunc(allMatches, extraction) result.FileToIndexPosition[result.Matched] = calculateFileIndexFunc(allMatches, extraction)
log.Fatalf("%s %#v\n", extraction, result.FileToIndexPosition)
} }
} }
return results return results

View File

@ -4,6 +4,7 @@ import (
"bufio" "bufio"
"encoding/hex" "encoding/hex"
"io" "io"
"log"
"os" "os"
"sort" "sort"
"strings" "strings"
@ -112,6 +113,7 @@ func (request *Request) ExecuteWithResults(input string, metadata, previous outp
} }
outputEvent["all_matches"] = allMatches outputEvent["all_matches"] = allMatches
log.Printf("%#v\n", result)
callback(eventcreator.CreateEventWithResults(request, outputEvent, isResponseDebug, result)) callback(eventcreator.CreateEventWithResults(request, outputEvent, isResponseDebug, result))
request.options.Progress.IncrementRequests() request.options.Progress.IncrementRequests()
}(data) }(data)
@ -171,12 +173,10 @@ func calculateFileIndexFunc(allMatches []*output.InternalEvent, extraction strin
for _, match := range allMatches { for _, match := range allMatches {
matchPt := *match matchPt := *match
opResult := matchPt["results"].(operators.Result) opResult := matchPt["results"].(operators.Result)
if opResult.Matched {
for _, extracts := range opResult.Extracts { for _, extracts := range opResult.Extracts {
for _, extract := range extracts { for _, extract := range extracts {
if extraction == extract { if extraction == extract {
return matchPt["results"].(int) return matchPt["bytes"].(int)
}
} }
} }
} }