Skip to content

Commit b937deb

Browse files
committed
Merge remote-tracking branch 'origin'
2 parents 96203d8 + e4dae52 commit b937deb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1391
-242
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@ dist
3939
pkg/protocols/common/helpers/deserialization/testdata/Deserialize.class
4040
pkg/protocols/common/helpers/deserialization/testdata/ValueObject.class
4141
pkg/protocols/common/helpers/deserialization/testdata/ValueObject2.ser
42-
vendor
42+
vendor
43+
44+
# Headless `screenshot` action
45+
*.png

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ FROM golang:1.21-alpine AS build-env
33
RUN apk add build-base
44
WORKDIR /app
55
COPY . /app
6-
WORKDIR /app
76
RUN go mod download
87
RUN go build ./cmd/nuclei
98

SYNTAX-REFERENCE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3664,8 +3664,18 @@ Enum Values:
36643664

36653665
- <code>files</code>
36663666

3667+
- <code>waitdom</code>
3668+
3669+
- <code>waitfcp</code>
3670+
3671+
- <code>waitfmp</code>
3672+
3673+
- <code>waitidle</code>
3674+
36673675
- <code>waitload</code>
36683676

3677+
- <code>waitstable</code>
3678+
36693679
- <code>getresource</code>
36703680

36713681
- <code>extract</code>

cmd/integration-test/matcher-status.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"encoding/json"
55
"fmt"
6+
"strings"
67

78
"github.com/projectdiscovery/nuclei/v3/pkg/output"
89
"github.com/projectdiscovery/nuclei/v3/pkg/testutils"
@@ -26,9 +27,9 @@ func (h *httpNoAccess) Execute(filePath string) error {
2627
}
2728
event := &output.ResultEvent{}
2829
_ = json.Unmarshal([]byte(results[0]), event)
29-
30-
if event.Error != "no address found for host" {
31-
return fmt.Errorf("unexpected result: expecting \"no address found for host\" error but got none")
30+
expectedError := "no address found for host"
31+
if !strings.Contains(event.Error, expectedError) {
32+
return fmt.Errorf("unexpected result: expecting \"%s\" error but got \"%s\"", expectedError, event.Error)
3233
}
3334
return nil
3435
}

cmd/integration-test/workflow.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/projectdiscovery/nuclei/v3/pkg/templates"
1414
"github.com/projectdiscovery/nuclei/v3/pkg/templates/signer"
1515
"github.com/projectdiscovery/nuclei/v3/pkg/testutils"
16+
sliceutil "github.com/projectdiscovery/utils/slice"
1617
)
1718

1819
var workflowTestcases = []TestCaseInfo{
@@ -25,6 +26,7 @@ var workflowTestcases = []TestCaseInfo{
2526
{Path: "workflow/dns-value-share-workflow.yaml", TestCase: &workflowDnsKeyValueShare{}},
2627
{Path: "workflow/code-value-share-workflow.yaml", TestCase: &workflowCodeKeyValueShare{}, DisableOn: isCodeDisabled}, // isCodeDisabled declared in code.go
2728
{Path: "workflow/multiprotocol-value-share-workflow.yaml", TestCase: &workflowMultiProtocolKeyValueShare{}},
29+
{Path: "workflow/multimatch-value-share-workflow.yaml", TestCase: &workflowMultiMatchKeyValueShare{}},
2830
{Path: "workflow/shared-cookie.yaml", TestCase: &workflowSharedCookies{}},
2931
}
3032

@@ -229,6 +231,44 @@ func (h *workflowMultiProtocolKeyValueShare) Execute(filePath string) error {
229231
return expectResultsCount(results, 2)
230232
}
231233

234+
type workflowMultiMatchKeyValueShare struct{}
235+
236+
// Execute executes a test case and returns an error if occurred
237+
func (h *workflowMultiMatchKeyValueShare) Execute(filePath string) error {
238+
var receivedData []string
239+
router := httprouter.New()
240+
router.GET("/", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
241+
fmt.Fprintf(w, "This is test matcher text")
242+
})
243+
router.GET("/path1", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
244+
fmt.Fprintf(w, "href=\"test-value-%s\"", r.URL.Query().Get("v"))
245+
})
246+
router.GET("/path2", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
247+
body, _ := io.ReadAll(r.Body)
248+
receivedData = append(receivedData, string(body))
249+
fmt.Fprintf(w, "test-value")
250+
})
251+
ts := httptest.NewServer(router)
252+
defer ts.Close()
253+
254+
results, err := testutils.RunNucleiWorkflowAndGetResults(filePath, ts.URL, debug)
255+
if err != nil {
256+
return err
257+
}
258+
259+
// Check if we received the data from both request to /path1 and it is not overwritten by the later one.
260+
// They will appear in brackets because of another bug: https://github.com/orgs/projectdiscovery/discussions/3766
261+
if !sliceutil.Contains(receivedData, "[test-value-1]") || !sliceutil.Contains(receivedData, "[test-value-2]") {
262+
return fmt.Errorf(
263+
"incorrect data: did not receive both extracted data from the first request!\nReceived Data:\n\t%s\nResults:\n\t%s",
264+
strings.Join(receivedData, "\n\t"),
265+
strings.Join(results, "\n\t"),
266+
)
267+
}
268+
// The number of expected results is 3: the workflow's Matcher Name based condition check forwards both match, and the other branch with simple subtemplates goes with one
269+
return expectResultsCount(results, 3)
270+
}
271+
232272
type workflowSharedCookies struct{}
233273

234274
// Execute executes a test case and returns an error if occurred

cmd/nuclei/issue-tracker-config.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,23 @@
142142
# # Username for the elasticsearch instance
143143
# username: test
144144
# # Password is the password for elasticsearch instance
145-
# password: test
145+
# password: test
146+
#linear:
147+
# # api-key is the API key for the linear account
148+
# api-key: ""
149+
# # allow-list sets a tracker level filter to only create issues for templates with
150+
# # these severity labels or tags (does not affect exporters. set those globally)
151+
# deny-list:
152+
# severity: critical
153+
# # deny-list sets a tracker level filter to never create issues for templates with
154+
# # these severity labels or tags (does not affect exporters. set those globally)
155+
# deny-list:
156+
# severity: low
157+
# # team-id is the ID of the team in Linear
158+
# team-id: ""
159+
# # project-id is the ID of the project in Linear
160+
# project-id: ""
161+
# # duplicate-issue-check flag to enable duplicate tracking issue check
162+
# duplicate-issue-check: false
163+
# # open-state-id is the ID of the open state in Linear
164+
# open-state-id: ""

cmd/nuclei/main.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ func main() {
123123

124124
runner.ParseOptions(options)
125125

126+
if options.ScanUploadFile != "" {
127+
if err := runner.UploadResultsToCloud(options); err != nil {
128+
gologger.Fatal().Msgf("could not upload scan results to cloud dashboard: %s\n", err)
129+
}
130+
return
131+
}
132+
126133
nucleiRunner, err := runner.New(options)
127134
if err != nil {
128135
gologger.Fatal().Msgf("Could not create runner: %s\n", err)
@@ -420,9 +427,11 @@ on extensive configurability, massive extensibility and ease of use.`)
420427
flagSet.CreateGroup("cloud", "Cloud",
421428
flagSet.DynamicVar(&pdcpauth, "auth", "true", "configure projectdiscovery cloud (pdcp) api key"),
422429
flagSet.StringVarP(&options.TeamID, "team-id", "tid", _pdcp.TeamIDEnv, "upload scan results to given team id (optional)"),
423-
flagSet.BoolVarP(&options.EnableCloudUpload, "cloud-upload", "cup", false, "upload scan results to pdcp dashboard"),
430+
flagSet.BoolVarP(&options.EnableCloudUpload, "cloud-upload", "cup", false, "upload scan results to pdcp dashboard [DEPRECATED use -dashboard]"),
424431
flagSet.StringVarP(&options.ScanID, "scan-id", "sid", "", "upload scan results to existing scan id (optional)"),
425432
flagSet.StringVarP(&options.ScanName, "scan-name", "sname", "", "scan name to set (optional)"),
433+
flagSet.BoolVarP(&options.EnableCloudUpload, "dashboard", "pd", false, "upload / view nuclei results in projectdiscovery cloud (pdcp) UI dashboard"),
434+
flagSet.StringVarP(&options.ScanUploadFile, "dashboard-upload", "pdu", "", "upload / view nuclei results file (jsonl) in projectdiscovery cloud (pdcp) UI dashboard"),
426435
)
427436

428437
flagSet.CreateGroup("Authentication", "Authentication",

go.mod

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ require (
1919
github.com/miekg/dns v1.1.59
2020
github.com/olekukonko/tablewriter v0.0.5
2121
github.com/pkg/errors v0.9.1
22-
github.com/projectdiscovery/clistats v0.1.0
23-
github.com/projectdiscovery/fastdialer v0.2.7
24-
github.com/projectdiscovery/hmap v0.0.56
22+
github.com/projectdiscovery/clistats v0.1.1
23+
github.com/projectdiscovery/fastdialer v0.2.9
24+
github.com/projectdiscovery/hmap v0.0.59
2525
github.com/projectdiscovery/interactsh v1.2.0
26-
github.com/projectdiscovery/rawhttp v0.1.61
27-
github.com/projectdiscovery/retryabledns v1.0.73
28-
github.com/projectdiscovery/retryablehttp-go v1.0.76
26+
github.com/projectdiscovery/rawhttp v0.1.67
27+
github.com/projectdiscovery/retryabledns v1.0.77
28+
github.com/projectdiscovery/retryablehttp-go v1.0.78
2929
github.com/projectdiscovery/yamldoc-go v1.0.4
3030
github.com/remeh/sizedwaitgroup v1.0.0
3131
github.com/rs/xid v1.5.0
@@ -38,9 +38,9 @@ require (
3838
github.com/weppos/publicsuffix-go v0.30.2
3939
github.com/xanzy/go-gitlab v0.107.0
4040
go.uber.org/multierr v1.11.0
41-
golang.org/x/net v0.26.0
41+
golang.org/x/net v0.29.0
4242
golang.org/x/oauth2 v0.22.0
43-
golang.org/x/text v0.16.0
43+
golang.org/x/text v0.18.0
4444
gopkg.in/yaml.v2 v2.4.0
4545
)
4646

@@ -59,7 +59,7 @@ require (
5959
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.72
6060
github.com/aws/aws-sdk-go-v2/service/s3 v1.37.0
6161
github.com/cespare/xxhash v1.1.0
62-
github.com/charmbracelet/glamour v0.6.0
62+
github.com/charmbracelet/glamour v0.8.0
6363
github.com/clbanning/mxj/v2 v2.7.0
6464
github.com/ditashi/jsbeautifier-go v0.0.0-20141206144643-2520a8026a9c
6565
github.com/docker/go-units v0.5.0
@@ -72,7 +72,7 @@ require (
7272
github.com/go-sql-driver/mysql v1.7.1
7373
github.com/h2non/filetype v1.1.3
7474
github.com/invopop/yaml v0.3.1
75-
github.com/kitabisa/go-ci v1.0.2
75+
github.com/kitabisa/go-ci v1.0.3
7676
github.com/labstack/echo/v4 v4.10.2
7777
github.com/leslie-qiwa/flat v0.0.0-20230424180412-f9d1cf014baa
7878
github.com/lib/pq v1.10.9
@@ -85,26 +85,27 @@ require (
8585
github.com/projectdiscovery/fasttemplate v0.0.2
8686
github.com/projectdiscovery/go-smb2 v0.0.0-20240129202741-052cc450c6cb
8787
github.com/projectdiscovery/goflags v0.1.64
88-
github.com/projectdiscovery/gologger v1.1.21
88+
github.com/projectdiscovery/gologger v1.1.24
8989
github.com/projectdiscovery/gostruct v0.0.2
9090
github.com/projectdiscovery/gozero v0.0.2
9191
github.com/projectdiscovery/httpx v1.6.8
9292
github.com/projectdiscovery/mapcidr v1.1.34
9393
github.com/projectdiscovery/n3iwf v0.0.0-20230523120440-b8cd232ff1f5
94-
github.com/projectdiscovery/ratelimit v0.0.53
94+
github.com/projectdiscovery/ratelimit v0.0.56
9595
github.com/projectdiscovery/rdap v0.9.1-0.20221108103045-9865884d1917
9696
github.com/projectdiscovery/sarif v0.0.1
9797
github.com/projectdiscovery/tlsx v1.1.7
9898
github.com/projectdiscovery/uncover v1.0.9
99-
github.com/projectdiscovery/useragent v0.0.65
100-
github.com/projectdiscovery/utils v0.2.7
101-
github.com/projectdiscovery/wappalyzergo v0.1.14
99+
github.com/projectdiscovery/useragent v0.0.71
100+
github.com/projectdiscovery/utils v0.2.11
101+
github.com/projectdiscovery/wappalyzergo v0.1.18
102102
github.com/redis/go-redis/v9 v9.1.0
103103
github.com/seh-msft/burpxml v1.0.1
104+
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466
104105
github.com/stretchr/testify v1.9.0
105106
github.com/tarunKoyalwar/goleak v0.0.0-20240429141123-0efa90dbdcf9
106107
github.com/zmap/zgrab2 v0.1.8-0.20230806160807-97ba87c0e706
107-
golang.org/x/term v0.21.0
108+
golang.org/x/term v0.24.0
108109
gopkg.in/yaml.v3 v3.0.1
109110
moul.io/http2curl v1.0.0
110111
)
@@ -119,6 +120,7 @@ require (
119120
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
120121
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
121122
github.com/VividCortex/ewma v1.2.0 // indirect
123+
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
122124
github.com/andybalholm/brotli v1.1.0 // indirect
123125
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
124126
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.27 // indirect
@@ -133,6 +135,8 @@ require (
133135
github.com/bytedance/sonic v1.9.1 // indirect
134136
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
135137
github.com/cespare/xxhash/v2 v2.2.0 // indirect
138+
github.com/charmbracelet/lipgloss v0.13.0 // indirect
139+
github.com/charmbracelet/x/ansi v0.3.2 // indirect
136140
github.com/cheggaaa/pb/v3 v3.1.4 // indirect
137141
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
138142
github.com/cloudflare/cfssl v1.6.4 // indirect
@@ -141,7 +145,7 @@ require (
141145
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
142146
github.com/davidmz/go-pageant v1.0.2 // indirect
143147
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
144-
github.com/dlclark/regexp2 v1.11.0 // indirect
148+
github.com/dlclark/regexp2 v1.11.4 // indirect
145149
github.com/docker/cli v24.0.5+incompatible // indirect
146150
github.com/docker/docker v24.0.9+incompatible // indirect
147151
github.com/docker/go-connections v0.4.0 // indirect
@@ -192,18 +196,18 @@ require (
192196
github.com/moby/term v0.5.0 // indirect
193197
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
194198
github.com/muesli/reflow v0.3.0 // indirect
195-
github.com/muesli/termenv v0.15.1 // indirect
199+
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a // indirect
196200
github.com/opencontainers/go-digest v1.0.0 // indirect
197201
github.com/opencontainers/image-spec v1.0.2 // indirect
198-
github.com/opencontainers/runc v1.1.12 // indirect
202+
github.com/opencontainers/runc v1.1.14 // indirect
199203
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
200204
github.com/perimeterx/marshmallow v1.1.5 // indirect
201205
github.com/pierrec/lz4/v4 v4.1.21 // indirect
202206
github.com/pjbgf/sha1cd v0.3.0 // indirect
203207
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
204208
github.com/projectdiscovery/asnmap v1.1.1 // indirect
205209
github.com/projectdiscovery/cdncheck v1.1.0 // indirect
206-
github.com/projectdiscovery/freeport v0.0.5 // indirect
210+
github.com/projectdiscovery/freeport v0.0.6 // indirect
207211
github.com/projectdiscovery/ldapserver v1.0.2-0.20240219154113-dcc758ebc0cb // indirect
208212
github.com/projectdiscovery/machineid v0.0.0-20240226150047-2e2c51e35983 // indirect
209213
github.com/refraction-networking/utls v1.6.7 // indirect
@@ -229,13 +233,13 @@ require (
229233
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
230234
github.com/ysmood/fetchup v0.2.3 // indirect
231235
github.com/ysmood/got v0.34.1 // indirect
232-
github.com/yuin/goldmark v1.5.4 // indirect
233-
github.com/yuin/goldmark-emoji v1.0.1 // indirect
236+
github.com/yuin/goldmark v1.7.4 // indirect
237+
github.com/yuin/goldmark-emoji v1.0.3 // indirect
234238
github.com/zcalusic/sysinfo v1.0.2 // indirect
235239
github.com/zeebo/blake3 v0.2.3 // indirect
236240
go.uber.org/goleak v1.3.0 // indirect
237241
golang.org/x/arch v0.3.0 // indirect
238-
golang.org/x/sync v0.7.0 // indirect
242+
golang.org/x/sync v0.8.0 // indirect
239243
gopkg.in/djherbis/times.v1 v1.3.0 // indirect
240244
mellium.im/sasl v0.3.1 // indirect
241245
)
@@ -277,16 +281,16 @@ require (
277281
github.com/lor00x/goldap v0.0.0-20180618054307-a546dffdd1a3 // indirect
278282
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
279283
github.com/mattn/go-isatty v0.0.20 // indirect
280-
github.com/mattn/go-runewidth v0.0.15 // indirect
284+
github.com/mattn/go-runewidth v0.0.16 // indirect
281285
github.com/mholt/acmez v1.2.0 // indirect
282-
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
286+
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
283287
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
284288
github.com/modern-go/reflect2 v1.0.2 // indirect
285289
github.com/pmezard/go-difflib v1.0.0 // indirect
286290
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
287291
github.com/projectdiscovery/blackrock v0.0.1 // indirect
288292
github.com/projectdiscovery/networkpolicy v0.0.9
289-
github.com/rivo/uniseg v0.4.6 // indirect
293+
github.com/rivo/uniseg v0.4.7 // indirect
290294
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
291295
github.com/tklauser/go-sysconf v0.3.12 // indirect
292296
github.com/tklauser/numcpus v0.6.1 // indirect
@@ -302,10 +306,10 @@ require (
302306
go.etcd.io/bbolt v1.3.10 // indirect
303307
go.uber.org/zap v1.25.0 // indirect
304308
goftp.io/server/v2 v2.0.1 // indirect
305-
golang.org/x/crypto v0.24.0 // indirect
309+
golang.org/x/crypto v0.27.0 // indirect
306310
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
307311
golang.org/x/mod v0.17.0 // indirect
308-
golang.org/x/sys v0.21.0 // indirect
312+
golang.org/x/sys v0.25.0 // indirect
309313
golang.org/x/time v0.6.0 // indirect
310314
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d
311315
google.golang.org/protobuf v1.34.2 // indirect

0 commit comments

Comments
 (0)