diff --git a/v2/internal/runner/runner.go b/v2/internal/runner/runner.go index 5f3de895..4cfe171c 100644 --- a/v2/internal/runner/runner.go +++ b/v2/internal/runner/runner.go @@ -233,12 +233,13 @@ func (r *Runner) RunEnumeration() { for _, cluster := range clusters { if len(cluster) > 1 && !r.options.OfflineHTTP { executerOpts := protocols.ExecuterOptions{ - Output: r.output, - Options: r.options, - Progress: r.progress, - Catalogue: r.catalogue, - RateLimiter: r.ratelimiter, - ProjectFile: r.projectFile, + Output: r.output, + Options: r.options, + Progress: r.progress, + Catalogue: r.catalogue, + RateLimiter: r.ratelimiter, + IssuesClient: r.issuesClient, + ProjectFile: r.projectFile, } clusterID := fmt.Sprintf("cluster-%s", xid.New().String()) diff --git a/v2/internal/runner/templates.go b/v2/internal/runner/templates.go index 8411c479..22163857 100644 --- a/v2/internal/runner/templates.go +++ b/v2/internal/runner/templates.go @@ -44,12 +44,13 @@ func (r *Runner) getParsedTemplatesFor(templatePaths []string, severities []stri // parseTemplateFile returns the parsed template file func (r *Runner) parseTemplateFile(file string) (*templates.Template, error) { executerOpts := protocols.ExecuterOptions{ - Output: r.output, - Options: r.options, - Progress: r.progress, - Catalogue: r.catalogue, - RateLimiter: r.ratelimiter, - ProjectFile: r.projectFile, + Output: r.output, + Options: r.options, + Progress: r.progress, + Catalogue: r.catalogue, + IssuesClient: r.issuesClient, + RateLimiter: r.ratelimiter, + ProjectFile: r.projectFile, } template, err := templates.Parse(file, executerOpts) if err != nil { diff --git a/v2/internal/testutils/testutils.go b/v2/internal/testutils/testutils.go index fd652e88..b62452c9 100644 --- a/v2/internal/testutils/testutils.go +++ b/v2/internal/testutils/testutils.go @@ -111,6 +111,7 @@ func NewMockExecuterOptions(options *types.Options, info *TemplateInfo) *protoco Options: options, Progress: progress, ProjectFile: nil, + IssuesClient: nil, Catalogue: catalogue.New(options.TemplatesDirectory), RateLimiter: ratelimit.New(options.RateLimit), } diff --git a/v2/pkg/protocols/common/clusterer/clusterer_test.go b/v2/pkg/protocols/common/clusterer/clusterer_test.go index 48ceadee..dd006c19 100644 --- a/v2/pkg/protocols/common/clusterer/clusterer_test.go +++ b/v2/pkg/protocols/common/clusterer/clusterer_test.go @@ -24,12 +24,13 @@ func TestHTTPRequestsCluster(t *testing.T) { list := make(map[string]*templates.Template) for _, template := range templatesList { executerOpts := protocols.ExecuterOptions{ - Output: &mockOutput{}, - Options: &types.Options{}, - Progress: nil, - Catalogue: catalogue, - RateLimiter: nil, - ProjectFile: nil, + Output: &mockOutput{}, + Options: &types.Options{}, + Progress: nil, + Catalogue: catalogue, + RateLimiter: nil, + IssuesClient: nil, + ProjectFile: nil, } t, err := templates.Parse(template, executerOpts) if err != nil { diff --git a/v2/pkg/protocols/http/operators.go b/v2/pkg/protocols/http/operators.go index c4211bde..d8dde448 100644 --- a/v2/pkg/protocols/http/operators.go +++ b/v2/pkg/protocols/http/operators.go @@ -146,7 +146,7 @@ func (r *Request) makeResultEventItem(wrapped *output.InternalWrappedEvent) *out } if r.options.Options.JSONRequests { data.Request = types.ToString(wrapped.InternalEvent["request"]) - data.Response = types.ToString(wrapped.InternalEvent["raw"]) + data.Response = types.ToString(wrapped.InternalEvent["response"]) } return data } diff --git a/v2/pkg/reporting/issues/format/format.go b/v2/pkg/reporting/issues/format/format.go index ff19cc80..fc941a61 100644 --- a/v2/pkg/reporting/issues/format/format.go +++ b/v2/pkg/reporting/issues/format/format.go @@ -17,9 +17,9 @@ func Summary(output *output.ResultEvent) string { builder.WriteString("[") builder.WriteString(template) builder.WriteString("] [") - builder.WriteString(output.Info["severity"]) + builder.WriteString(types.ToString(output.Info["severity"])) builder.WriteString("] ") - builder.WriteString(output.Info["name"]) + builder.WriteString(types.ToString(output.Info["name"])) builder.WriteString(" found on ") builder.WriteString(output.Host) data := builder.String() diff --git a/v2/pkg/reporting/issues/issues.go b/v2/pkg/reporting/issues/issues.go index 6ed66fec..acb34cbd 100644 --- a/v2/pkg/reporting/issues/issues.go +++ b/v2/pkg/reporting/issues/issues.go @@ -10,6 +10,7 @@ import ( "github.com/projectdiscovery/nuclei/v2/pkg/reporting/issues/github" "github.com/projectdiscovery/nuclei/v2/pkg/reporting/issues/gitlab" "github.com/projectdiscovery/nuclei/v2/pkg/reporting/issues/jira" + "github.com/projectdiscovery/nuclei/v2/pkg/types" "gopkg.in/yaml.v2" ) @@ -50,7 +51,7 @@ func (f *Filter) Compile() { // GetMatch returns true if a filter matches result event func (f *Filter) GetMatch(event *output.ResultEvent) bool { - severity := event.Info["severity"] + severity := types.ToString(event.Info["severity"]) if len(f.severity) > 0 { if stringSliceContains(f.severity, severity) { return true @@ -59,7 +60,7 @@ func (f *Filter) GetMatch(event *output.ResultEvent) bool { } tags := event.Info["tags"] - tagParts := strings.Split(tags, ",") + tagParts := strings.Split(types.ToString(tags), ",") for i, tag := range tagParts { tagParts[i] = strings.TrimSpace(tag) } diff --git a/v2/pkg/templates/compile.go b/v2/pkg/templates/compile.go index a5849950..9a44026d 100644 --- a/v2/pkg/templates/compile.go +++ b/v2/pkg/templates/compile.go @@ -152,12 +152,13 @@ func (t *Template) parseWorkflowTemplate(workflow *workflows.WorkflowTemplate, o } for _, path := range paths { opts := protocols.ExecuterOptions{ - Output: options.Output, - Options: options.Options, - Progress: options.Progress, - Catalogue: options.Catalogue, - RateLimiter: options.RateLimiter, - ProjectFile: options.ProjectFile, + Output: options.Output, + Options: options.Options, + Progress: options.Progress, + Catalogue: options.Catalogue, + RateLimiter: options.RateLimiter, + IssuesClient: options.IssuesClient, + ProjectFile: options.ProjectFile, } template, err := Parse(path, opts) if err != nil {