From 4ab606e6538c34e784cf18fee30265bc670fd8d9 Mon Sep 17 00:00:00 2001 From: sandeep <8293321+ehsandeep@users.noreply.github.com> Date: Sun, 27 Aug 2023 02:04:18 +0530 Subject: [PATCH 1/6] Added initial API docs --- docs/editor/api/generate.mdx | 17 +++ docs/editor/api/scan.mdx | 20 +++ docs/mint.json | 284 ++++++++++++++++++----------------- 3 files changed, 185 insertions(+), 136 deletions(-) create mode 100644 docs/editor/api/generate.mdx create mode 100644 docs/editor/api/scan.mdx diff --git a/docs/editor/api/generate.mdx b/docs/editor/api/generate.mdx new file mode 100644 index 0000000000..a334ede007 --- /dev/null +++ b/docs/editor/api/generate.mdx @@ -0,0 +1,17 @@ +--- +title: "Generate Template (AI)" +description: "Generate nuclei template using AI prompt" +api: "POST https://templates-api.nuclei.sh/v1/template/user/generate" +version: 'v1' +--- + + +## Parameters (required) + + + AI Prompt to generate nuclei template + + + + OpenAI model to use + \ No newline at end of file diff --git a/docs/editor/api/scan.mdx b/docs/editor/api/scan.mdx new file mode 100644 index 0000000000..b631aa3764 --- /dev/null +++ b/docs/editor/api/scan.mdx @@ -0,0 +1,20 @@ +--- +title: "Scan Template" +description: "Scan target host using a specified nuclei template." +api: "POST https://templates-api.nuclei.sh/v1/template/user/scan" +version: 'v1' +--- + +## Parameters (required) + + + Target host to scan using nuclei template. + + **Constraints**: Valid hostname or IP address or URL. + + + + Base64 encoded nuclei template. + + **Constraints**: Valid Base64 encoded template. + \ No newline at end of file diff --git a/docs/mint.json b/docs/mint.json index 5095a8e1ba..75713010cf 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -1,138 +1,150 @@ { - "$schema": "https://mintlify.com/schema.json", - "name": "Nuclei Documentation", - "logo": { - "dark": "/logo/dark.png", - "light": "/logo/light.png" - }, - "favicon": "/favicon.png", - "colors": { - "primary": "#3B2FC9", - "light": "#6673FF", - "dark": "#3B2FC9" - }, - "backgroundImage": "/images/background.png", - "topbarCtaButton": { - "type": "github", - "url": "https://github.com/projectdiscovery/nuclei" - }, - "topAnchor": { - "name": "Getting Started", - "icon": "circle-play" - }, - "primaryTab": { - "name": "Getting Started" - }, - "tabs": [ - { - "name": "Template Guide", - "url": "template-guide" - }, - { - "name": "Template Example", - "url": "template-example" - }, - { - "name": "Template Editor", - "url": "editor" - }, - { - "name": "FAQ", - "url": "faq" - } - ], - "navigation": [ - { - "group": "Getting Started", - "pages": [ - "getting-started/overview", - "getting-started/features", - "getting-started/install", - "getting-started/running" - ] - }, - { - "group": "Template Guide", - "pages": [ - "template-guide/introduction", - "template-guide/template-details", - { - "group": "HTTPs", - "pages": [ - "template-guide/http/base-http", - "template-guide/http/raw-http", - "template-guide/http/http-payloads", - "template-guide/http/http-fuzzing", - "template-guide/http/unsafe-http", - "template-guide/http/advance-http" - ] - }, - "template-guide/headless", - "template-guide/network", - "template-guide/dns", - "template-guide/file", - { - "group": "Operators", - "pages": [ - "template-guide/operators/matchers", - "template-guide/operators/extractors" - ] - }, - "template-guide/oob-testing", - "template-guide/helper-functions", - "template-guide/variables", - "template-guide/preprocessors", - "template-guide/workflows" - ] - }, - { - "group": "Template Example", - "pages": [ - { - "group": "HTTP", - "pages": [ - "template-example/http/base-http", - "template-example/http/raw-http", - "template-example/http/http-fuzzing", - "template-example/http/http-smuggling", - "template-example/http/http-payloads", - "template-example/http/http-race-conditions" - ] - }, - "template-example/dns", - "template-example/file", - "template-example/headless", - "template-example/network", - "template-example/workflow", - "template-example/helper-functions" - ] - }, - { - "group": "Editor", - "pages": [ - "editor/introduction", - "editor/ai", - "editor/share", - "editor/shortcut" - ] - }, - - { - "group": "FAQ", - "pages": [ - "faq/nuclei", - "faq/templates", - "faq/editor" - ] - } - ], - "footerSocials": { - "twitter": "https://twitter.com/pdnuclei", - "github": "https://github.com/projectdiscovery/nuclei", - "discord": "https://discord.com/invite/projectdiscovery" - }, - "feedback": { - "thumbsRating": true, - "suggestEdit": true - } + "$schema":"https://mintlify.com/schema.json", + "name":"Nuclei Documentation", + "logo":{ + "dark":"/logo/dark.png", + "light":"/logo/light.png" + }, + "favicon":"/favicon.png", + "colors":{ + "primary":"#3B2FC9", + "light":"#6673FF", + "dark":"#3B2FC9" + }, + "backgroundImage":"/images/background.png", + "topbarCtaButton":{ + "type":"github", + "url":"https://github.com/projectdiscovery/nuclei" + }, + "topAnchor":{ + "name":"Getting Started", + "icon":"circle-play" + }, + "primaryTab":{ + "name":"Getting Started" + }, + "tabs":[ + { + "name":"Template Guide", + "url":"template-guide" + }, + { + "name":"Template Example", + "url":"template-example" + }, + { + "name":"Template Editor", + "url":"editor" + }, + { + "name":"FAQ", + "url":"faq" + } + ], + "navigation":[ + { + "group":"Getting Started", + "pages":[ + "getting-started/overview", + "getting-started/features", + "getting-started/install", + "getting-started/running" + ] + }, + { + "group":"Template Guide", + "pages":[ + "template-guide/introduction", + "template-guide/template-details", + { + "group":"HTTP", + "pages":[ + "template-guide/http/base-http", + "template-guide/http/raw-http", + "template-guide/http/http-payloads", + "template-guide/http/http-fuzzing", + "template-guide/http/unsafe-http", + "template-guide/http/advance-http" + ] + }, + "template-guide/headless", + "template-guide/network", + "template-guide/dns", + "template-guide/file", + { + "group":"Operators", + "pages":[ + "template-guide/operators/matchers", + "template-guide/operators/extractors" + ] + }, + "template-guide/oob-testing", + "template-guide/helper-functions", + "template-guide/variables", + "template-guide/preprocessors", + "template-guide/workflows" + ] + }, + { + "group":"Template Example", + "pages":[ + { + "group":"HTTP", + "pages":[ + "template-example/http/base-http", + "template-example/http/raw-http", + "template-example/http/http-fuzzing", + "template-example/http/http-smuggling", + "template-example/http/http-payloads", + "template-example/http/http-race-conditions" + ] + }, + "template-example/dns", + "template-example/file", + "template-example/headless", + "template-example/network", + "template-example/workflow", + "template-example/helper-functions" + ] + }, + { + "group":"Editor", + "pages":[ + "editor/introduction", + "editor/ai", + "editor/share", + "editor/shortcut", + { + "group":"REST API", + "pages":[ + "editor/api/scan", + "editor/api/generate" + ] + } + ] + }, + { + "group":"FAQ", + "pages":[ + "faq/nuclei", + "faq/templates", + "faq/editor" + ] + } + ], + "footerSocials":{ + "twitter":"https://twitter.com/pdnuclei", + "github":"https://github.com/projectdiscovery/nuclei", + "discord":"https://discord.com/invite/projectdiscovery" + }, + "feedback":{ + "thumbsRating":true, + "suggestEdit":true + }, + "api":{ + "auth":{ + "method":"key", + "name":"X-API-KEY" + } + } } \ No newline at end of file From 237a34efc4a420955b7251951415188cee79fcf2 Mon Sep 17 00:00:00 2001 From: sandeep <8293321+ehsandeep@users.noreply.github.com> Date: Fri, 8 Sep 2023 21:46:36 +0530 Subject: [PATCH 2/6] dark mode fixes! --- docs/getting-started/running.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started/running.mdx b/docs/getting-started/running.mdx index 9fb684f991..3aa59fc5ad 100644 --- a/docs/getting-started/running.mdx +++ b/docs/getting-started/running.mdx @@ -671,7 +671,7 @@ Nuclei comes with reporting module support with the release of [v2.3.0](https:// | **Platform** | GitHub | GitLab | Jira | Markdown | SARIF | Elasticsearch | Splunk HEC | | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **Support** | | | | | | | | +| **Support** | | | | | | | | `-rc, -report-config` flag can be used to provide a config file to read configuration details of the platform to integrate. Here is an [example config file](https://github.com/projectdiscovery/nuclei/blob/master/v2/cmd/nuclei/issue-tracker-config.yaml) for all supported platforms. From a2c48e323cb43c87ab5bcfa6dbb6e7b8bd0883aa Mon Sep 17 00:00:00 2001 From: Stefan Kahn Date: Fri, 15 Sep 2023 15:09:17 +1200 Subject: [PATCH 3/6] gitlab tracker duplicate check --- v2/pkg/reporting/trackers/gitlab/gitlab.go | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/v2/pkg/reporting/trackers/gitlab/gitlab.go b/v2/pkg/reporting/trackers/gitlab/gitlab.go index b83b4052d5..f485a0d5a6 100644 --- a/v2/pkg/reporting/trackers/gitlab/gitlab.go +++ b/v2/pkg/reporting/trackers/gitlab/gitlab.go @@ -33,6 +33,8 @@ type Options struct { // SeverityAsLabel (optional) sends the severity as the label of the created // issue. SeverityAsLabel bool `yaml:"severity-as-label"` + // DuplicateIssueCheck is a bool to enable duplicate tracking issue check and update the newest + DuplicateIssueCheck bool `yaml:"duplicate-issue-check" default:"false"` HttpClient *retryablehttp.Client `yaml:"-"` } @@ -71,6 +73,33 @@ func (i *Integration) CreateIssue(event *output.ResultEvent) error { } customLabels := gitlab.Labels(labels) assigneeIDs := []int{i.userID} + if i.options.DuplicateIssueCheck { + searchState := "all" + issues, _, err := i.client.Issues.ListProjectIssues(i.options.ProjectName, &gitlab.ListProjectIssuesOptions{ + State: &searchState, + Search: &summary, + }) + if err != nil { + return err + } + if len(issues) > 0 { + issue := issues[0] + _, _, err := i.client.Notes.CreateIssueNote(i.options.ProjectName, issue.IID, &gitlab.CreateIssueNoteOptions{ + Body: &description, + }) + if err != nil { + return err + } + if issue.State == "closed" { + reopen := "reopen" + _, resp, err := i.client.Issues.UpdateIssue(i.options.ProjectName, issue.IID, &gitlab.UpdateIssueOptions{ + StateEvent: &reopen, + }) + fmt.Sprintln(resp, err) + } + return err + } + } _, _, err := i.client.Issues.CreateIssue(i.options.ProjectName, &gitlab.CreateIssueOptions{ Title: &summary, Description: &description, From 88201c09a7053cf0f44a38ff520178cb005ac17c Mon Sep 17 00:00:00 2001 From: Stefan Kahn Date: Fri, 15 Sep 2023 15:35:40 +1200 Subject: [PATCH 4/6] integration test --- integration_tests/test-issue-tracker-config2.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/integration_tests/test-issue-tracker-config2.yaml b/integration_tests/test-issue-tracker-config2.yaml index af1da697c8..04ef818ba7 100644 --- a/integration_tests/test-issue-tracker-config2.yaml +++ b/integration_tests/test-issue-tracker-config2.yaml @@ -32,6 +32,8 @@ gitLab: project-name: "1234" # issue-label is the label of the created issue type issue-label: bug + # duplicate-issue-check flag to enable duplicate tracking issue check. + duplicate-issue-check: true # Jira contains configuration options for Jira issue tracker jira: From 6090dea661b655e8d93c9300b4f892848e396c95 Mon Sep 17 00:00:00 2001 From: Stefan Kahn Date: Fri, 15 Sep 2023 19:51:58 +1200 Subject: [PATCH 5/6] added In to search to restrict to title match --- v2/pkg/reporting/trackers/gitlab/gitlab.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/v2/pkg/reporting/trackers/gitlab/gitlab.go b/v2/pkg/reporting/trackers/gitlab/gitlab.go index f485a0d5a6..660c9b8e95 100644 --- a/v2/pkg/reporting/trackers/gitlab/gitlab.go +++ b/v2/pkg/reporting/trackers/gitlab/gitlab.go @@ -74,8 +74,10 @@ func (i *Integration) CreateIssue(event *output.ResultEvent) error { customLabels := gitlab.Labels(labels) assigneeIDs := []int{i.userID} if i.options.DuplicateIssueCheck { + searchIn := "title" searchState := "all" issues, _, err := i.client.Issues.ListProjectIssues(i.options.ProjectName, &gitlab.ListProjectIssuesOptions{ + In: &searchIn, State: &searchState, Search: &summary, }) From c51b938c1d3f63db9fa6a169d3a571fcd5a96bde Mon Sep 17 00:00:00 2001 From: Stefan Kahn Date: Wed, 20 Sep 2023 10:54:06 +1200 Subject: [PATCH 6/6] added example GitLab yaml --- docs/getting-started/running.mdx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/getting-started/running.mdx b/docs/getting-started/running.mdx index 3aa59fc5ad..1e0b738018 100644 --- a/docs/getting-started/running.mdx +++ b/docs/getting-started/running.mdx @@ -688,6 +688,21 @@ github: issue-label: 'Nuclei' ``` +Alternatively if you use GitLab, create a config file following content and replace the appropriate values: + +```yaml +# GitLab contains configuration options for GitLab issue tracker + +gitlab: + username: '$user' + base-url: 'gitlab.com' + token: '$token' + project-name: 'testing-project' + issue-label: 'nuclei-label' + severity-as-label: true + duplicate-issue-check: true +``` + To store results in Elasticsearch, create a config file with the following content and replace the appropriate values: ```yaml