Path: blob/dev/pkg/protocols/common/helpers/writer/writer.go
2073 views
package writer12import (3"github.com/projectdiscovery/gologger"4"github.com/projectdiscovery/nuclei/v3/pkg/output"5"github.com/projectdiscovery/nuclei/v3/pkg/progress"6"github.com/projectdiscovery/nuclei/v3/pkg/reporting"7)89// WriteResult is a helper for writing results to the output10func WriteResult(data *output.InternalWrappedEvent, output output.Writer, progress progress.Progress, issuesClient reporting.Client) bool {11// Handle the case where no result found for the template.12// In this case, we just show misc information about the failed13// match for the template.14if !data.HasOperatorResult() {15return false16}17var matched bool18for _, result := range data.Results {19if issuesClient != nil {20if err := issuesClient.CreateIssue(result); err != nil {21gologger.Warning().Msgf("Could not create issue on tracker: %s", err)22}23}24if err := output.Write(result); err != nil {25gologger.Warning().Msgf("Could not write output event: %s\n", err)26}27if !matched {28matched = true29}30progress.IncrementMatched()31}32return matched33}343536