diff --git a/v2/go.sum b/v2/go.sum index 8a195a89..5b36edc0 100644 --- a/v2/go.sum +++ b/v2/go.sum @@ -96,6 +96,7 @@ github.com/corpix/uarand v0.1.1 h1:RMr1TWc9F4n5jiPDzFHtmaUXLKLNUFK0SgCLo4BhX/U= github.com/corpix/uarand v0.1.1/go.mod h1:SFKZvkcRoLqVRFZ4u25xPmp6m9ktANfbpXZ7SJ0/FNU= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/dave/dst v0.26.2 h1:lnxLAKI3tx7MgLNVDirFCsDTlTG9nKTk7GcptKcWSwY= github.com/dave/dst v0.26.2/go.mod h1:UMDJuIRPfyUCC78eFuB+SV/WI8oDeyFDvM/JR6NI3IU= github.com/dave/gopackages v0.0.0-20170318123100-46e7023ec56e/go.mod h1:i00+b/gKdIDIxuLDFob7ustLAVqhsZRk2qVZrArELGQ= github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= @@ -501,6 +502,7 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -666,6 +668,7 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210101214203-2dba1e4ea05c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -779,6 +782,7 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +mvdan.cc/gofumpt v0.1.1 h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA= mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= diff --git a/v2/nuclei-jsonschema.json b/v2/nuclei-jsonschema.json index 5eb5c988..6092a125 100755 --- a/v2/nuclei-jsonschema.json +++ b/v2/nuclei-jsonschema.json @@ -309,12 +309,12 @@ }, "class": { "enum": [ - "INET", - "CSNET", - "CHAOS", - "HESIOD", - "NONE", - "ANY" + "inet", + "csnet", + "chaos", + "hesiod", + "none", + "any" ], "type": "string", "title": "class of DNS request", @@ -662,6 +662,11 @@ "type": "boolean", "title": "preserve request history", "description": "Automatically assigns numbers to requests and preserves their history" + }, + "stop-at-first-match": { + "type": "boolean", + "title": "stop at first match", + "description": "Stop the execution after a match is found" } }, "additionalProperties": false, diff --git a/v2/pkg/templates/templates_doc.go b/v2/pkg/templates/templates_doc.go index 88fa7822..5e65c59e 100644 --- a/v2/pkg/templates/templates_doc.go +++ b/v2/pkg/templates/templates_doc.go @@ -108,7 +108,7 @@ func init() { MODELInfoDoc.Fields[1].Name = "author" MODELInfoDoc.Fields[1].Type = "StringSlice" MODELInfoDoc.Fields[1].Note = "" - MODELInfoDoc.Fields[1].Description = "Author of the template." + MODELInfoDoc.Fields[1].Description = "Author of the template.\n\nMultiple values can also be specified separated by commas." MODELInfoDoc.Fields[1].Comments[encoder.LineComment] = "Author of the template." MODELInfoDoc.Fields[1].AddExample("", "") @@ -188,7 +188,7 @@ func init() { FieldName: "requests", }, } - HTTPRequestDoc.Fields = make([]encoder.Doc, 24) + HTTPRequestDoc.Fields = make([]encoder.Doc, 25) HTTPRequestDoc.Fields[0].Name = "matchers" HTTPRequestDoc.Fields[0].Type = "[]matchers.Matcher" HTTPRequestDoc.Fields[0].Note = "" @@ -225,8 +225,8 @@ func init() { HTTPRequestDoc.Fields[5].Name = "id" HTTPRequestDoc.Fields[5].Type = "string" HTTPRequestDoc.Fields[5].Note = "" - HTTPRequestDoc.Fields[5].Description = "ID is the ID of the request" - HTTPRequestDoc.Fields[5].Comments[encoder.LineComment] = " ID is the ID of the request" + HTTPRequestDoc.Fields[5].Description = "ID is the the optional id of the request" + HTTPRequestDoc.Fields[5].Comments[encoder.LineComment] = " ID is the the optional id of the request" HTTPRequestDoc.Fields[6].Name = "name" HTTPRequestDoc.Fields[6].Type = "string" HTTPRequestDoc.Fields[6].Note = "" @@ -349,6 +349,11 @@ func init() { HTTPRequestDoc.Fields[23].Note = "" HTTPRequestDoc.Fields[23].Description = "ReqCondition automatically assigns numbers to requests and preserves their history.\n\nThis allows matching on them later for multi-request conditions." HTTPRequestDoc.Fields[23].Comments[encoder.LineComment] = "ReqCondition automatically assigns numbers to requests and preserves their history." + HTTPRequestDoc.Fields[24].Name = "stop-at-first-match" + HTTPRequestDoc.Fields[24].Type = "bool" + HTTPRequestDoc.Fields[24].Note = "" + HTTPRequestDoc.Fields[24].Description = "StopAtFirstMatch stops the execution of the requests and template as soon as a match is found." + HTTPRequestDoc.Fields[24].Comments[encoder.LineComment] = "StopAtFirstMatch stops the execution of the requests and template as soon as a match is found." MATCHERSMatcherDoc.Type = "matchers.Matcher" MATCHERSMatcherDoc.Comments[encoder.LineComment] = " Matcher is used to match a part in the output from a protocol." @@ -415,7 +420,7 @@ func init() { MATCHERSMatcherDoc.Fields[4].Name = "name" MATCHERSMatcherDoc.Fields[4].Type = "string" MATCHERSMatcherDoc.Fields[4].Note = "" - MATCHERSMatcherDoc.Fields[4].Description = "Name of the matcher. Name should be lowercase and must not contain\nspaces or dashes (-)." + MATCHERSMatcherDoc.Fields[4].Description = "Name of the matcher. Name should be lowercase and must not contain\nspaces or underscores (_)." MATCHERSMatcherDoc.Fields[4].Comments[encoder.LineComment] = "Name of the matcher. Name should be lowercase and must not contain" MATCHERSMatcherDoc.Fields[4].AddExample("", "cookie-matcher") @@ -507,7 +512,7 @@ func init() { EXTRACTORSExtractorDoc.Fields[0].Name = "name" EXTRACTORSExtractorDoc.Fields[0].Type = "string" EXTRACTORSExtractorDoc.Fields[0].Note = "" - EXTRACTORSExtractorDoc.Fields[0].Description = "Name of the extractor. Name should be lowercase and must not contain\nspaces or dashes (-)." + EXTRACTORSExtractorDoc.Fields[0].Description = "Name of the extractor. Name should be lowercase and must not contain\nspaces or underscores (_)." EXTRACTORSExtractorDoc.Fields[0].Comments[encoder.LineComment] = "Name of the extractor. Name should be lowercase and must not contain" EXTRACTORSExtractorDoc.Fields[0].AddExample("", "cookie-extractor") @@ -525,8 +530,8 @@ func init() { EXTRACTORSExtractorDoc.Fields[2].Name = "regex" EXTRACTORSExtractorDoc.Fields[2].Type = "[]string" EXTRACTORSExtractorDoc.Fields[2].Note = "" - EXTRACTORSExtractorDoc.Fields[2].Description = "Regex contains the regular expression patterns to exract from a part.\n\nGo regex engine does not supports lookaheads or lookbehinds, so as a result\nthey are also not supported in nuclei." - EXTRACTORSExtractorDoc.Fields[2].Comments[encoder.LineComment] = "Regex contains the regular expression patterns to exract from a part." + EXTRACTORSExtractorDoc.Fields[2].Description = "Regex contains the regular expression patterns to extract from a part.\n\nGo regex engine does not support lookaheads or lookbehinds, so as a result\nthey are also not supported in nuclei." + EXTRACTORSExtractorDoc.Fields[2].Comments[encoder.LineComment] = "Regex contains the regular expression patterns to extract from a part." EXTRACTORSExtractorDoc.Fields[2].AddExample("Braintree Access Token Regex", []string{"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-f]{32}"}) @@ -541,12 +546,8 @@ func init() { EXTRACTORSExtractorDoc.Fields[4].Name = "kval" EXTRACTORSExtractorDoc.Fields[4].Type = "[]string" EXTRACTORSExtractorDoc.Fields[4].Note = "" - EXTRACTORSExtractorDoc.Fields[4].Description = "kval contains the key-value pairs required in the response.\n\nEach protocol exposes a lot of different data in response. The kval\nextractor can be used to extract those key-value pairs. A list of\nsupported parts is available in docs for request types." - EXTRACTORSExtractorDoc.Fields[4].Comments[encoder.LineComment] = "kval contains the key-value pairs required in the response." - - EXTRACTORSExtractorDoc.Fields[4].AddExample("Extract Server Header From HTTP Response", []string{"Server"}) - - EXTRACTORSExtractorDoc.Fields[4].AddExample("Extracting value of PHPSESSID Cookie", []string{"PHPSESSID"}) + EXTRACTORSExtractorDoc.Fields[4].Description = "description: |\n kval contains the key-value pairs present in the HTTP response header.\n kval extractor can be used to extract HTTP response header and cookie key-value pairs.\n kval extractor inputs are case insensitive, and does not support dash (-) in input which can replaced with underscores (_)\n For example, Content-Type should be replaced with content_type\n\n A list of supported parts is available in docs for request types.\n examples:\n - name: Extract Server Header From HTTP Response\n value: >\n []string{\"server\"}\n - name: Extracting value of PHPSESSID Cookie\n value: >\n []string{\"phpsessid\"}\n - name: Extracting value of Content-Type Cookie\n value: >\n []string{\"content_type\"}" + EXTRACTORSExtractorDoc.Fields[4].Comments[encoder.LineComment] = " description: |" EXTRACTORSExtractorDoc.Fields[5].Name = "json" EXTRACTORSExtractorDoc.Fields[5].Type = "[]string" EXTRACTORSExtractorDoc.Fields[5].Note = "" @@ -563,8 +564,6 @@ func init() { EXTRACTORSExtractorDoc.Fields[6].Comments[encoder.LineComment] = "XPath allows using xpath expressions to extract items from html response" EXTRACTORSExtractorDoc.Fields[6].AddExample("", []string{"/html/body/div/p[2]/a"}) - - EXTRACTORSExtractorDoc.Fields[6].AddExample("", []string{".batters | .batter | .[] | .id"}) EXTRACTORSExtractorDoc.Fields[7].Name = "attribute" EXTRACTORSExtractorDoc.Fields[7].Type = "string" EXTRACTORSExtractorDoc.Fields[7].Note = "" @@ -621,8 +620,8 @@ func init() { DNSRequestDoc.Fields[3].Name = "id" DNSRequestDoc.Fields[3].Type = "string" DNSRequestDoc.Fields[3].Note = "" - DNSRequestDoc.Fields[3].Description = "ID is the ID of the request" - DNSRequestDoc.Fields[3].Comments[encoder.LineComment] = " ID is the ID of the request" + DNSRequestDoc.Fields[3].Description = "ID is the the optional id of the request" + DNSRequestDoc.Fields[3].Comments[encoder.LineComment] = " ID is the the optional id of the request" DNSRequestDoc.Fields[4].Name = "name" DNSRequestDoc.Fields[4].Type = "string" DNSRequestDoc.Fields[4].Note = "" @@ -652,12 +651,12 @@ func init() { DNSRequestDoc.Fields[6].Description = "Class is the class of the DNS request.\n\nUsually it's enough to just leave it as INET." DNSRequestDoc.Fields[6].Comments[encoder.LineComment] = "Class is the class of the DNS request." DNSRequestDoc.Fields[6].Values = []string{ - "INET", - "CSNET", - "CHAOS", - "HESIOD", - "NONE", - "ANY", + "inet", + "csnet", + "chaos", + "hesiod", + "none", + "any", } DNSRequestDoc.Fields[7].Name = "retries" DNSRequestDoc.Fields[7].Type = "int" @@ -720,8 +719,8 @@ func init() { FILERequestDoc.Fields[5].Name = "id" FILERequestDoc.Fields[5].Type = "string" FILERequestDoc.Fields[5].Note = "" - FILERequestDoc.Fields[5].Description = "ID is the ID of the request" - FILERequestDoc.Fields[5].Comments[encoder.LineComment] = " ID is the ID of the request" + FILERequestDoc.Fields[5].Description = "ID is the the optional id of the request" + FILERequestDoc.Fields[5].Comments[encoder.LineComment] = " ID is the the optional id of the request" FILERequestDoc.Fields[6].Name = "max-size" FILERequestDoc.Fields[6].Type = "int" FILERequestDoc.Fields[6].Note = "" @@ -750,8 +749,8 @@ func init() { NETWORKRequestDoc.Fields[0].Name = "id" NETWORKRequestDoc.Fields[0].Type = "string" NETWORKRequestDoc.Fields[0].Note = "" - NETWORKRequestDoc.Fields[0].Description = "ID is the ID of the request" - NETWORKRequestDoc.Fields[0].Comments[encoder.LineComment] = " ID is the ID of the request" + NETWORKRequestDoc.Fields[0].Description = "ID is the the optional id of the request" + NETWORKRequestDoc.Fields[0].Comments[encoder.LineComment] = " ID is the the optional id of the request" NETWORKRequestDoc.Fields[1].Name = "host" NETWORKRequestDoc.Fields[1].Type = "[]string" NETWORKRequestDoc.Fields[1].Note = "" @@ -862,8 +861,8 @@ func init() { HEADLESSRequestDoc.Fields[0].Name = "id" HEADLESSRequestDoc.Fields[0].Type = "string" HEADLESSRequestDoc.Fields[0].Note = "" - HEADLESSRequestDoc.Fields[0].Description = "ID is the ID of the request" - HEADLESSRequestDoc.Fields[0].Comments[encoder.LineComment] = " ID is the ID of the request" + HEADLESSRequestDoc.Fields[0].Description = "ID is the the optional id of the request" + HEADLESSRequestDoc.Fields[0].Comments[encoder.LineComment] = " ID is the the optional id of the request" HEADLESSRequestDoc.Fields[1].Name = "steps" HEADLESSRequestDoc.Fields[1].Type = "[]engine.Action" HEADLESSRequestDoc.Fields[1].Note = "" diff --git a/v2/syntax-reference.md b/v2/syntax-reference.md index bbe6ebe6..f4faa1c6 100755 --- a/v2/syntax-reference.md +++ b/v2/syntax-reference.md @@ -294,6 +294,8 @@ name: Nagios Default Credentials Check Author of the template. +Multiple values can also be specified separated by commas. + Examples: @@ -620,7 +622,7 @@ raw:
-ID is the ID of the request +ID is the the optional id of the request
@@ -1005,6 +1007,19 @@ This allows matching on them later for multi-request conditions.
+
+ +stop-at-first-match bool + +
+
+ +StopAtFirstMatch stops the execution of the requests and template as soon as a match is found. + +
+ +
+ @@ -1130,7 +1145,7 @@ It will only match if the condition is not true.
Name of the matcher. Name should be lowercase and must not contain -spaces or dashes (-). +spaces or underscores (_). @@ -1373,7 +1388,7 @@ Appears in:
Name of the extractor. Name should be lowercase and must not contain -spaces or dashes (-). +spaces or underscores (_). @@ -1420,9 +1435,9 @@ Valid values:
-Regex contains the regular expression patterns to exract from a part. +Regex contains the regular expression patterns to extract from a part. -Go regex engine does not supports lookaheads or lookbehinds, so as a result +Go regex engine does not support lookaheads or lookbehinds, so as a result they are also not supported in nuclei. @@ -1478,29 +1493,23 @@ group: 1
-kval contains the key-value pairs required in the response. - -Each protocol exposes a lot of different data in response. The kval -extractor can be used to extract those key-value pairs. A list of -supported parts is available in docs for request types. - - - -Examples: - - -```yaml -# Extract Server Header From HTTP Response -kval: - - Server -``` - -```yaml -# Extracting value of PHPSESSID Cookie -kval: - - PHPSESSID -``` +description: | + kval contains the key-value pairs present in the HTTP response header. + kval extractor can be used to extract HTTP response header and cookie key-value pairs. + kval extractor inputs are case insensitive, and does not support dash (-) in input which can replaced with underscores (_) + For example, Content-Type should be replaced with content_type + A list of supported parts is available in docs for request types. + examples: + - name: Extract Server Header From HTTP Response + value: > + []string{"server"} + - name: Extracting value of PHPSESSID Cookie + value: > + []string{"phpsessid"} + - name: Extracting value of Content-Type Cookie + value: > + []string{"content_type"}
@@ -1554,11 +1563,6 @@ xpath: - /html/body/div/p[2]/a ``` -```yaml -xpath: - - .batters | .batter | .[] | .id -``` -
@@ -1718,7 +1722,7 @@ Valid values:
-ID is the ID of the request +ID is the the optional id of the request
@@ -1798,17 +1802,17 @@ Usually it's enough to just leave it as INET. Valid values: - - INET + - inet - - CSNET + - csnet - - CHAOS + - chaos - - HESIOD + - hesiod - - NONE + - none - - ANY + - any
@@ -1988,7 +1992,7 @@ denylist:
-ID is the ID of the request +ID is the the optional id of the request
@@ -2068,7 +2072,7 @@ matchers:
-ID is the ID of the request +ID is the the optional id of the request
@@ -2374,7 +2378,7 @@ Appears in:
-ID is the ID of the request +ID is the the optional id of the request