From b8246ab8e554b857b857fe902bdfd5a0a08b9ae4 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 19 Nov 2021 10:55:27 +0000 Subject: [PATCH] Auto Generate Syntax Docs + JSONSchema [Fri Nov 19 10:55:27 UTC 2021] :robot: --- SYNTAX-REFERENCE.md | 18 +++++++++--------- nuclei-jsonschema.json | 24 +++++++++++++++--------- v2/pkg/templates/templates_doc.go | 2 +- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/SYNTAX-REFERENCE.md b/SYNTAX-REFERENCE.md index 6ceae433..c3fb0b63 100755 --- a/SYNTAX-REFERENCE.md +++ b/SYNTAX-REFERENCE.md @@ -87,15 +87,15 @@ Examples: ```yaml requests: matchers: - - type: word + - type: 1 words: - '[core]' - - type: dsl + - type: 6 condition: and dsl: - '!contains(tolower(body), '' -type string +type MatcherTypeHolder
@@ -2396,7 +2396,7 @@ inputs: - data: "envi\r\nquit\r\n" read-size: 2048 matchers: - - type: word + - type: 1 words: - zookeeper.version ``` diff --git a/nuclei-jsonschema.json b/nuclei-jsonschema.json index ddaf889f..32d88583 100755 --- a/nuclei-jsonschema.json +++ b/nuclei-jsonschema.json @@ -211,15 +211,8 @@ ], "properties": { "type": { - "enum": [ - "status", - "size", - "word", - "regex", - "binary", - "dsl" - ], - "type": "string", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/matchers.MatcherTypeHolder", "title": "type of matcher", "description": "Type of the matcher" }, @@ -312,6 +305,19 @@ "additionalProperties": false, "type": "object" }, + "matchers.MatcherTypeHolder": { + "enum": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "type": "string", + "title": "type of the matcher", + "description": "Type of the matcher,enum=status,enum=size,enum=word,enum=regex,enum=binary,enum=dsl" + }, "generators.AttackTypeHolder": { "enum": [ "batteringram", diff --git a/v2/pkg/templates/templates_doc.go b/v2/pkg/templates/templates_doc.go index df4ff0a4..eb547d0a 100644 --- a/v2/pkg/templates/templates_doc.go +++ b/v2/pkg/templates/templates_doc.go @@ -497,7 +497,7 @@ func init() { } MATCHERSMatcherDoc.Fields = make([]encoder.Doc, 13) MATCHERSMatcherDoc.Fields[0].Name = "type" - MATCHERSMatcherDoc.Fields[0].Type = "string" + MATCHERSMatcherDoc.Fields[0].Type = "MatcherTypeHolder" MATCHERSMatcherDoc.Fields[0].Note = "" MATCHERSMatcherDoc.Fields[0].Description = "Type is the type of the matcher." MATCHERSMatcherDoc.Fields[0].Comments[encoder.LineComment] = "Type is the type of the matcher."