From 05f69a6b24f106a8ea0867d9ec9225b959f286f7 Mon Sep 17 00:00:00 2001 From: Ice3man Date: Sat, 19 Jul 2025 00:11:25 +0530 Subject: [PATCH 1/2] feat: log event for template host skipped during scanning (#6324) * feat: log event for template host skipped during scanning * misc changes --- pkg/core/executors.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/core/executors.go b/pkg/core/executors.go index 05430233b..424b8c50a 100644 --- a/pkg/core/executors.go +++ b/pkg/core/executors.go @@ -4,9 +4,11 @@ import ( "context" "sync" "sync/atomic" + "time" "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/nuclei/v3/pkg/input/provider" + "github.com/projectdiscovery/nuclei/v3/pkg/output" "github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/contextargs" "github.com/projectdiscovery/nuclei/v3/pkg/scan" "github.com/projectdiscovery/nuclei/v3/pkg/templates" @@ -108,6 +110,22 @@ func (e *Engine) executeTemplateWithTargets(ctx context.Context, template *templ // Skip if the host has had errors if e.executerOpts.HostErrorsCache != nil && e.executerOpts.HostErrorsCache.Check(e.executerOpts.ProtocolType.String(), contextargs.NewWithMetaInput(ctx, scannedValue)) { + skipEvent := &output.ResultEvent{ + TemplateID: template.ID, + TemplatePath: template.Path, + Info: template.Info, + Type: e.executerOpts.ProtocolType.String(), + Host: scannedValue.Input, + MatcherStatus: false, + Error: "host was skipped as it was found unresponsive", + Timestamp: time.Now(), + } + + if e.Callback != nil { + e.Callback(skipEvent) + } else if e.executerOpts.Output != nil { + _ = e.executerOpts.Output.Write(skipEvent) + } return true } From 06707ea76fe2b5503ef504dd1e71fd2788ae2299 Mon Sep 17 00:00:00 2001 From: Ice3man Date: Wed, 30 Jul 2025 21:38:07 +0530 Subject: [PATCH 2/2] bugfix: preserve original transport for linear http client (#6357) --- pkg/reporting/trackers/linear/linear.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/reporting/trackers/linear/linear.go b/pkg/reporting/trackers/linear/linear.go index 24b464f33..be8723368 100644 --- a/pkg/reporting/trackers/linear/linear.go +++ b/pkg/reporting/trackers/linear/linear.go @@ -54,15 +54,17 @@ type Options struct { // New creates a new issue tracker integration client based on options. func New(options *Options) (*Integration, error) { + var transport http.RoundTripper = http.DefaultTransport + if options.HttpClient != nil && options.HttpClient.HTTPClient.Transport != nil { + transport = options.HttpClient.HTTPClient.Transport + } + httpClient := &http.Client{ Transport: &addHeaderTransport{ - T: http.DefaultTransport, + T: transport, Key: options.APIKey, }, } - if options.HttpClient != nil { - httpClient.Transport = options.HttpClient.HTTPClient.Transport - } integration := &Integration{ url: "https://api.linear.app/graphql", @@ -385,8 +387,8 @@ func (i *Integration) doGraphqlRequest(ctx context.Context, query string, v any, return err } defer func() { - _ = resp.Body.Close() - }() + _ = resp.Body.Close() + }() if resp.StatusCode != http.StatusOK { body, _ := io.ReadAll(resp.Body) return fmt.Errorf("non-200 OK status code: %v body: %q", resp.Status, body)