From 4c1c5301b990bbe222e78857a6b8f89a447a3042 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Tue, 1 Aug 2023 14:33:43 -0400 Subject: [PATCH] Spelling (#4008) * spelling: addresses Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: asynchronous Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: basic Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: brute force Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: constant Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: disables Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: engine Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: every time Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: execution Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: false positives Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: from Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: further Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: github Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: gitlab Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: highlight Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: hygiene Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: ignore Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: input Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: item Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: itself Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: latestxxx Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: navigation Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: negative Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: nonexistent Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: occurred Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: override Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: overrides Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: payload Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: performed Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: respective Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: retrieve Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: scanlist Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: separated Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: separator Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: severity Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: source Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: strategy Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: string Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: templates Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: terminal Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: timeout Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: trailing slash Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: trailing Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: websocket Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --------- Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- .github/workflows/build-test.yml | 2 +- .github/workflows/dockerhub-push.yml | 2 +- DESIGN.md | 4 +-- SYNTAX-REFERENCE.md | 2 +- integration_tests/debug.sh | 2 +- integration_tests/workflow/shared-cookie.yaml | 2 +- nuclei-jsonschema.json | 2 +- v2/cmd/integration-test/http.go | 2 +- v2/cmd/nuclei/main.go | 6 ++-- v2/cmd/tmc/main.go | 2 +- v2/gh_retry.sh | 4 +-- v2/internal/installer/template.go | 4 +-- v2/internal/installer/template_test.go | 2 +- v2/internal/installer/util.go | 4 +-- v2/internal/runner/cloud.go | 4 +-- v2/internal/runner/options.go | 18 +++++----- v2/internal/runner/proxy.go | 2 +- v2/internal/runner/templates.go | 4 +-- v2/pkg/catalog/aws/catalog.go | 2 +- v2/pkg/catalog/aws/catalog_test.go | 2 +- v2/pkg/catalog/config/constants.go | 2 +- v2/pkg/catalog/config/nucleiconfig.go | 12 +++---- v2/pkg/catalog/disk/find.go | 4 +-- v2/pkg/catalog/disk/path.go | 2 +- v2/pkg/catalog/loader/loader.go | 4 +-- v2/pkg/core/execute_options.go | 2 +- v2/pkg/core/inputs/hybrid/hmap.go | 2 +- v2/pkg/external/customtemplates/github.go | 34 +++++++++---------- .../external/customtemplates/github_test.go | 4 +-- v2/pkg/external/customtemplates/gitlab.go | 4 +-- .../customtemplates/templates_provider.go | 4 +-- v2/pkg/input/input.go | 2 +- v2/pkg/parsers/parser_test.go | 4 +-- v2/pkg/protocols/common/automaticscan/doc.go | 2 +- .../common/helpers/deserialization/java.go | 8 ++--- .../protocols/common/interactsh/interactsh.go | 2 +- v2/pkg/protocols/common/interactsh/options.go | 2 +- .../protocols/common/protocolstate/state.go | 4 +-- .../common/randomip/randomip_test.go | 2 +- v2/pkg/protocols/common/uncover/uncover.go | 2 +- v2/pkg/protocols/common/variables/doc.go | 2 +- v2/pkg/protocols/headless/request.go | 2 +- v2/pkg/protocols/http/build_request.go | 2 +- v2/pkg/protocols/http/raw/raw.go | 2 +- v2/pkg/protocols/http/request_annotations.go | 14 ++++---- v2/pkg/protocols/network/request.go | 6 ++-- v2/pkg/protocols/utils/http/requtils.go | 2 +- v2/pkg/protocols/utils/variables_test.go | 2 +- v2/pkg/protocols/websocket/websocket.go | 2 +- v2/pkg/templates/cluster.go | 2 +- v2/pkg/templates/templates.go | 2 +- v2/pkg/templates/templates_doc.go | 4 +-- v2/pkg/testutils/testutils.go | 4 +-- v2/pkg/types/types.go | 10 +++--- 54 files changed, 115 insertions(+), 115 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 599940d7a1..8173b810d2 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -25,7 +25,7 @@ jobs: - name: Check out code uses: actions/checkout@v3 - - name: Go Mod hygine + - name: Go Mod hygiene run: | go clean -modcache go mod tidy diff --git a/.github/workflows/dockerhub-push.yml b/.github/workflows/dockerhub-push.yml index 428add3e40..da0887e796 100644 --- a/.github/workflows/dockerhub-push.yml +++ b/.github/workflows/dockerhub-push.yml @@ -14,7 +14,7 @@ jobs: - name: Git Checkout uses: actions/checkout@v3 - - name: Get Github tag + - name: Get GitHub tag id: meta run: | curl --silent "https://api.github.com/repos/projectdiscovery/nuclei/releases/latest" | jq -r .tag_name | xargs -I {} echo TAG={} >> $GITHUB_OUTPUT diff --git a/DESIGN.md b/DESIGN.md index 969dc84ed2..b02067f24b 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -145,7 +145,7 @@ type Exporter interface { } ``` -Exporters include `Elasticsearch`, `markdown`, `sarif` . Trackers include `GitHub` , `Gitlab` and `Jira`. +Exporters include `Elasticsearch`, `markdown`, `sarif` . Trackers include `GitHub` , `GitLab` and `Jira`. Each exporter and trackers implement their own configuration in YAML format and are very modular in nature, so adding new ones is easy. @@ -484,7 +484,7 @@ $ go tool pprof -http=:8081 mem.pprof - [v2/pkg/reporting/exporters/markdown](./v2/pkg/reporting/exporters/markdown) - Markdown Result Exporter - [v2/pkg/reporting/exporters/es](./v2/pkg/reporting/exporters/es) - Elasticsearch Result Exporter - [v2/pkg/reporting/dedupe](./v2/pkg/reporting/dedupe) - Dedupe module for Results -- [v2/pkg/reporting/trackers/gitlab](./v2/pkg/reporting/trackers/gitlab) - Gitlab Issue Tracker Exporter +- [v2/pkg/reporting/trackers/gitlab](./v2/pkg/reporting/trackers/gitlab) - GitLab Issue Tracker Exporter - [v2/pkg/reporting/trackers/jira](./v2/pkg/reporting/trackers/jira) - Jira Issue Tracker Exporter - [v2/pkg/reporting/trackers/github](./v2/pkg/reporting/trackers/github) - GitHub Issue Tracker Exporter - [v2/pkg/reporting/format](./v2/pkg/reporting/format) - Result Formatting Functions diff --git a/SYNTAX-REFERENCE.md b/SYNTAX-REFERENCE.md index a0406daa62..9df9152c42 100755 --- a/SYNTAX-REFERENCE.md +++ b/SYNTAX-REFERENCE.md @@ -358,7 +358,7 @@ Variables contains any variables for the current request.
-Constants contains any scalar costant for the current template +Constants contains any scalar constant for the current template
diff --git a/integration_tests/debug.sh b/integration_tests/debug.sh index c3a968a824..57bfd03824 100755 --- a/integration_tests/debug.sh +++ b/integration_tests/debug.sh @@ -8,7 +8,7 @@ if [ $1 = "-h" ]; then printf " \$ ./debug.sh http self\n\n" printf "3. To run all integration tests of 'x' protocol that contains 'y' in template name and pass extra args to nuclei:\n" printf " \$ ./debug.sh http self -svd -debug-req\n\n" - printf "nuclei binary is created everytime script is run but integration-test binary is not" + printf "nuclei binary is created every time script is run but integration-test binary is not" exit 0 fi diff --git a/integration_tests/workflow/shared-cookie.yaml b/integration_tests/workflow/shared-cookie.yaml index f2d68be2cf..802be78189 100644 --- a/integration_tests/workflow/shared-cookie.yaml +++ b/integration_tests/workflow/shared-cookie.yaml @@ -11,5 +11,5 @@ workflows: - template: workflow/http-2.yaml # store cookie in native browser context - template: workflow/headless-1.yaml - # retrive 2 standard library cookies + headless cookie + # retrieve 2 standard library cookies + headless cookie - template: workflow/http-3.yaml \ No newline at end of file diff --git a/nuclei-jsonschema.json b/nuclei-jsonschema.json index bb6506ad89..579db7082f 100644 --- a/nuclei-jsonschema.json +++ b/nuclei-jsonschema.json @@ -1311,7 +1311,7 @@ } }, "type": "object", - "title": "payloads for the webosocket request", + "title": "payloads for the websocket request", "description": "Payloads contains any payloads for the current request" } }, diff --git a/v2/cmd/integration-test/http.go b/v2/cmd/integration-test/http.go index 75e80e1865..84e4c8d9b8 100644 --- a/v2/cmd/integration-test/http.go +++ b/v2/cmd/integration-test/http.go @@ -172,7 +172,7 @@ func (h *httpInteractshStopAtFirstMatchRequest) Execute(filePath string) error { if err != nil { return err } - // polling is asyncronous, so the interactions may be retrieved after the first request + // polling is asynchronous, so the interactions may be retrieved after the first request return expectResultsCount(results, 1) } diff --git a/v2/cmd/nuclei/main.go b/v2/cmd/nuclei/main.go index 301326c800..fa83b520e0 100644 --- a/v2/cmd/nuclei/main.go +++ b/v2/cmd/nuclei/main.go @@ -422,11 +422,11 @@ func printTemplateVersion() { if fileutil.FolderExists(cfg.CustomS3TemplatesDirectory) { gologger.Info().Msgf("Custom S3 templates location: %s\n", cfg.CustomS3TemplatesDirectory) } - if fileutil.FolderExists(cfg.CustomGithubTemplatesDirectory) { - gologger.Info().Msgf("Custom Github templates location: %s ", cfg.CustomGithubTemplatesDirectory) + if fileutil.FolderExists(cfg.CustomGitHubTemplatesDirectory) { + gologger.Info().Msgf("Custom GitHub templates location: %s ", cfg.CustomGitHubTemplatesDirectory) } if fileutil.FolderExists(cfg.CustomGitLabTemplatesDirectory) { - gologger.Info().Msgf("Custom Gitlab templates location: %s ", cfg.CustomGitLabTemplatesDirectory) + gologger.Info().Msgf("Custom GitLab templates location: %s ", cfg.CustomGitLabTemplatesDirectory) } if fileutil.FolderExists(cfg.CustomAzureTemplatesDirectory) { gologger.Info().Msgf("Custom Azure templates location: %s ", cfg.CustomAzureTemplatesDirectory) diff --git a/v2/cmd/tmc/main.go b/v2/cmd/tmc/main.go index c334372daf..850ef55298 100644 --- a/v2/cmd/tmc/main.go +++ b/v2/cmd/tmc/main.go @@ -90,7 +90,7 @@ type options struct { func main() { opts := options{} flagSet := goflags.NewFlagSet() - flagSet.SetDescription(`TemplateMan CLI is baisc utility built on the TemplateMan API to standardize nuclei templates.`) + flagSet.SetDescription(`TemplateMan CLI is basic utility built on the TemplateMan API to standardize nuclei templates.`) flagSet.CreateGroup("Input", "input", flagSet.StringVarP(&opts.input, "input", "i", "", "Templates to annotate"), diff --git a/v2/gh_retry.sh b/v2/gh_retry.sh index b8516ec92c..bf212e1290 100755 --- a/v2/gh_retry.sh +++ b/v2/gh_retry.sh @@ -17,7 +17,7 @@ LIMIT=30 BEFORE="30 mins ago" WORKFLOW="Build Test" -# You can add multiple patterns seperated by | +# You can add multiple patterns separated by | GREP_ERROR_PATTERN='Test "http/interactsh.yaml" failed' #Set fonts for Help. @@ -81,7 +81,7 @@ function retry_failed_jobs() { select ( .conclusion=="failure" ) | select ( .updatedAt > $date) ' --arg date "$date" --arg branch "$BRANCH" --arg workflow "$WORKFLOW" | jq .databaseId) - # convert line seperated by space to array + # convert line separated by space to array eval "arr=($workflowIds)" if [[ -z $arr ]] diff --git a/v2/internal/installer/template.go b/v2/internal/installer/template.go index b9eda1d0e5..22caa5d7fd 100644 --- a/v2/internal/installer/template.go +++ b/v2/internal/installer/template.go @@ -186,7 +186,7 @@ func (t *TemplateManager) summarizeChanges(old, new map[string]string) *template // getAbsoluteFilePath returns an absolute path where a file should be written based on given uri(i.e., files in zip) // if a returned path is empty, it means that file should not be written and skipped func (t *TemplateManager) getAbsoluteFilePath(templateDir, uri string, f fs.FileInfo) string { - // overwrite .nuclei-ignore everytime nuclei-templates are downloaded + // overwrite .nuclei-ignore every time nuclei-templates are downloaded if f.Name() == config.NucleiIgnoreFileName { return config.DefaultConfig.GetIgnoreFilePath() } @@ -206,7 +206,7 @@ func (t *TemplateManager) getAbsoluteFilePath(templateDir, uri string, f fs.File gologger.Warning().Msgf("failed to get directory name from uri: %s", uri) return filepath.Join(templateDir, uri) } - // seperator is also included in rootDir + // separator is also included in rootDir rootDirectory := uri[:index+1] relPath := strings.TrimPrefix(uri, rootDirectory) diff --git a/v2/internal/installer/template_test.go b/v2/internal/installer/template_test.go index e6b0345e24..95f44f8567 100644 --- a/v2/internal/installer/template_test.go +++ b/v2/internal/installer/template_test.go @@ -53,7 +53,7 @@ func TestTemplateInstallation(t *testing.T) { // we should have at least 1000 templates require.Greater(t, counter, 1000) - // everytime we install templates, it should override the ignore file with latest one + // every time we install templates, it should override the ignore file with latest one require.FileExists(t, config.DefaultConfig.GetIgnoreFilePath()) t.Logf("Installed %d templates", counter) } diff --git a/v2/internal/installer/util.go b/v2/internal/installer/util.go index c9b1b7c4b8..024202a340 100644 --- a/v2/internal/installer/util.go +++ b/v2/internal/installer/util.go @@ -36,7 +36,7 @@ func GetNewTemplatesInVersions(versions ...string) []string { continue } - arr, err := getNewAdditionsFileFromGithub(v) + arr, err := getNewAdditionsFileFromGitHub(v) if err != nil { gologger.Error().Msgf("failed to fetch new additions for %v got: %v", v, err) continue @@ -46,7 +46,7 @@ func GetNewTemplatesInVersions(versions ...string) []string { return allTemplates } -func getNewAdditionsFileFromGithub(version string) ([]string, error) { +func getNewAdditionsFileFromGitHub(version string) ([]string, error) { resp, err := retryableHttpClient.Get(fmt.Sprintf("https://raw.githubusercontent.com/projectdiscovery/nuclei-templates/%s/.new-additions", version)) if err != nil { return nil, err diff --git a/v2/internal/runner/cloud.go b/v2/internal/runner/cloud.go index 7076522270..4d173bf289 100644 --- a/v2/internal/runner/cloud.go +++ b/v2/internal/runner/cloud.go @@ -375,8 +375,8 @@ func (r *Runner) addCloudDataSource(source string) error { return err } case "github": - for _, repo := range r.options.GithubTemplateRepo { - if _, err := r.processDataSourceItem(repo, r.options.GithubToken, "github"); err != nil { + for _, repo := range r.options.GitHubTemplateRepo { + if _, err := r.processDataSourceItem(repo, r.options.GitHubToken, "github"); err != nil { return err } } diff --git a/v2/internal/runner/options.go b/v2/internal/runner/options.go index 914f72a8fa..f943dfef40 100644 --- a/v2/internal/runner/options.go +++ b/v2/internal/runner/options.go @@ -80,9 +80,9 @@ func ParseOptions(options *types.Options) { gologger.Fatal().Msgf("Could not initialize protocols: %s\n", err) } - // Set Github token in env variable. runner.getGHClientWithToken() reads token from env - if options.GithubToken != "" && os.Getenv("GITHUB_TOKEN") != options.GithubToken { - os.Setenv("GITHUB_TOKEN", options.GithubToken) + // Set GitHub token in env variable. runner.getGHClientWithToken() reads token from env + if options.GitHubToken != "" && os.Getenv("GITHUB_TOKEN") != options.GitHubToken { + os.Setenv("GITHUB_TOKEN", options.GitHubToken) } if options.UncoverQuery != nil { @@ -203,7 +203,7 @@ func validateCloudOptions(options *types.Options) error { case "s3": missing = validateMissingS3Options(options) case "github": - missing = validateMissingGithubOptions(options) + missing = validateMissingGitHubOptions(options) case "gitlab": missing = validateMissingGitLabOptions(options) case "azure": @@ -253,12 +253,12 @@ func validateMissingAzureOptions(options *types.Options) []string { return missing } -func validateMissingGithubOptions(options *types.Options) []string { +func validateMissingGitHubOptions(options *types.Options) []string { var missing []string - if options.GithubToken == "" { + if options.GitHubToken == "" { missing = append(missing, "GITHUB_TOKEN") } - if len(options.GithubTemplateRepo) == 0 { + if len(options.GitHubTemplateRepo) == 0 { missing = append(missing, "GITHUB_TEMPLATE_REPO") } return missing @@ -360,10 +360,10 @@ func readEnvInputVars(options *types.Options) { } options.CloudAPIKey = os.Getenv("NUCLEI_CLOUD_API") - options.GithubToken = os.Getenv("GITHUB_TOKEN") + options.GitHubToken = os.Getenv("GITHUB_TOKEN") repolist := os.Getenv("GITHUB_TEMPLATE_REPO") if repolist != "" { - options.GithubTemplateRepo = append(options.GithubTemplateRepo, stringsutil.SplitAny(repolist, ",")...) + options.GitHubTemplateRepo = append(options.GitHubTemplateRepo, stringsutil.SplitAny(repolist, ",")...) } // GitLab options for downloading templates from a repository diff --git a/v2/internal/runner/proxy.go b/v2/internal/runner/proxy.go index 5bf464b7a9..a4323eeba3 100644 --- a/v2/internal/runner/proxy.go +++ b/v2/internal/runner/proxy.go @@ -14,7 +14,7 @@ import ( proxyutils "github.com/projectdiscovery/utils/proxy" ) -// loadProxyServers load list of proxy servers from file or comma seperated +// loadProxyServers load list of proxy servers from file or comma separated func loadProxyServers(options *types.Options) error { if len(options.Proxy) == 0 { return nil diff --git a/v2/internal/runner/templates.go b/v2/internal/runner/templates.go index de667f7452..559448732f 100644 --- a/v2/internal/runner/templates.go +++ b/v2/internal/runner/templates.go @@ -57,7 +57,7 @@ func (r *Runner) listAvailableStoreTemplates(store *loader.Store) { path = aurora.Cyan(tpl.Path).String() tplBody, err = r.highlightTemplate(&tplBody) if err != nil { - gologger.Error().Msgf("Could not hihglight the template %s: %s", tpl.Path, err) + gologger.Error().Msgf("Could not highlight the template %s: %s", tpl.Path, err) continue } @@ -74,7 +74,7 @@ func (r *Runner) listAvailableStoreTemplates(store *loader.Store) { func (r *Runner) highlightTemplate(body *[]byte) ([]byte, error) { var buf bytes.Buffer - // YAML lexer, true color terminar formatter and monokai style + // YAML lexer, true color terminal formatter and monokai style err := quick.Highlight(&buf, string(*body), "yaml", "terminal16m", "monokai") if err != nil { return nil, err diff --git a/v2/pkg/catalog/aws/catalog.go b/v2/pkg/catalog/aws/catalog.go index 1303a4f497..5dfa86a56e 100644 --- a/v2/pkg/catalog/aws/catalog.go +++ b/v2/pkg/catalog/aws/catalog.go @@ -129,7 +129,7 @@ func (c Catalog) ResolvePath(templateName, second string) (string, error) { // if c second path is given, it's c folder and we join the two and check against keys if second != "" { - // Note: Do not replace `path` with `filepath` since filepath is aware of Os path seperator + // Note: Do not replace `path` with `filepath` since filepath is aware of Os path separator // and we only see `/` in s3 paths changing it to filepath cause build fail and other errors target := path.Join(path.Dir(second), templateName) for _, key := range keys { diff --git a/v2/pkg/catalog/aws/catalog_test.go b/v2/pkg/catalog/aws/catalog_test.go index fa19a14238..57dac391af 100644 --- a/v2/pkg/catalog/aws/catalog_test.go +++ b/v2/pkg/catalog/aws/catalog_test.go @@ -141,7 +141,7 @@ func TestCatalog_OpenFile(t *testing.T) { false, }, { - "non-existent key", + "nonexistent key", "something/that-doesnt-exist.yaml", true, }, diff --git a/v2/pkg/catalog/config/constants.go b/v2/pkg/catalog/config/constants.go index db104ec499..48553045ea 100644 --- a/v2/pkg/catalog/config/constants.go +++ b/v2/pkg/catalog/config/constants.go @@ -20,7 +20,7 @@ const ( Version = `v2.9.10` // Directory Names of custom templates CustomS3TemplatesDirName = "s3" - CustomGithubTemplatesDirName = "github" + CustomGitHubTemplatesDirName = "github" CustomAzureTemplatesDirName = "azure" CustomGitLabTemplatesDirName = "gitlab" ) diff --git a/v2/pkg/catalog/config/nucleiconfig.go b/v2/pkg/catalog/config/nucleiconfig.go index baf7acb43c..7dafbb8dcd 100644 --- a/v2/pkg/catalog/config/nucleiconfig.go +++ b/v2/pkg/catalog/config/nucleiconfig.go @@ -23,16 +23,16 @@ type Config struct { TemplatesDirectory string `json:"nuclei-templates-directory,omitempty"` // customtemplates exists in templates directory with the name of custom-templates provider - // below custom paths are absolute paths to respecitive custom-templates directories + // below custom paths are absolute paths to respective custom-templates directories CustomS3TemplatesDirectory string `json:"custom-s3-templates-directory"` - CustomGithubTemplatesDirectory string `json:"custom-github-templates-directory"` + CustomGitHubTemplatesDirectory string `json:"custom-github-templates-directory"` CustomGitLabTemplatesDirectory string `json:"custom-gitlab-templates-directory"` CustomAzureTemplatesDirectory string `json:"custom-azure-templates-directory"` TemplateVersion string `json:"nuclei-templates-version,omitempty"` NucleiIgnoreHash string `json:"nuclei-ignore-hash,omitempty"` - // Latestxxx are not meant to be used directly and is used as + // LatestXXX are not meant to be used directly and is used as // local cache of nuclei version check endpoint // these fields are only update during nuclei version check // TODO: move these fields to a separate unexported struct as they are not meant to be used directly @@ -83,7 +83,7 @@ func (c *Config) NeedsTemplateUpdate() bool { return !c.disableUpdates && (c.TemplateVersion == "" || IsOutdatedVersion(c.TemplateVersion, c.LatestNucleiTemplatesVersion) || !fileutil.FolderExists(c.TemplatesDirectory)) } -// NeedsIngoreFileUpdate returns true if Ignore file hash is different (aka ignore file is outdated) +// NeedsIgnoreFileUpdate returns true if Ignore file hash is different (aka ignore file is outdated) func (c *Config) NeedsIgnoreFileUpdate() bool { return c.NucleiIgnoreHash == "" || c.NucleiIgnoreHash != c.LatestNucleiIgnoreHash } @@ -111,7 +111,7 @@ func (c *Config) GetConfigDir() string { // GetAllCustomTemplateDirs returns all custom template directories func (c *Config) GetAllCustomTemplateDirs() []string { - return []string{c.CustomS3TemplatesDirectory, c.CustomGithubTemplatesDirectory, c.CustomGitLabTemplatesDirectory, c.CustomAzureTemplatesDirectory} + return []string{c.CustomS3TemplatesDirectory, c.CustomGitHubTemplatesDirectory, c.CustomGitLabTemplatesDirectory, c.CustomAzureTemplatesDirectory} } // GetReportingConfigFilePath returns the nuclei reporting config file path @@ -188,7 +188,7 @@ func (c *Config) SetTemplatesDir(dirPath string) { } c.TemplatesDirectory = dirPath // Update the custom templates directory - c.CustomGithubTemplatesDirectory = filepath.Join(dirPath, CustomGithubTemplatesDirName) + c.CustomGitHubTemplatesDirectory = filepath.Join(dirPath, CustomGitHubTemplatesDirName) c.CustomS3TemplatesDirectory = filepath.Join(dirPath, CustomS3TemplatesDirName) c.CustomGitLabTemplatesDirectory = filepath.Join(dirPath, CustomGitLabTemplatesDirName) c.CustomAzureTemplatesDirectory = filepath.Join(dirPath, CustomAzureTemplatesDirName) diff --git a/v2/pkg/catalog/disk/find.go b/v2/pkg/catalog/disk/find.go index 77ff0cb24b..98b8cf5be5 100644 --- a/v2/pkg/catalog/disk/find.go +++ b/v2/pkg/catalog/disk/find.go @@ -48,7 +48,7 @@ func (c *DiskCatalog) GetTemplatesPath(definitions []string) ([]string, map[stri } } } - // purge all falsepositivies + // purge all false positives filteredTemplates := []string{} for _, v := range allTemplates { // TODO: this is a temporary fix to avoid treating these files as templates @@ -129,7 +129,7 @@ func (c *DiskCatalog) convertPathToAbsolute(t string) (string, error) { // findGlobPathMatches returns the matched files from a glob path func (c *DiskCatalog) findGlobPathMatches(absPath string, processed map[string]struct{}) ([]string, error) { - // to support globbing on old paths we use bruteforce to find matches with exit on first match + // to support globbing on old paths we use brute force to find matches with exit on first match // trim templateDir if any relPath := strings.TrimPrefix(absPath, c.templatesDirectory) // trim leading slash if any diff --git a/v2/pkg/catalog/disk/path.go b/v2/pkg/catalog/disk/path.go index 1fbef23ced..18673db293 100644 --- a/v2/pkg/catalog/disk/path.go +++ b/v2/pkg/catalog/disk/path.go @@ -89,7 +89,7 @@ func BackwardsCompatiblePaths(templateDir string, oldPath string) string { // trim the template directory from the path return newPathCallback(tmp) case strings.Contains(oldPath, urlutil.SchemeSeparator): - // scheme seperator is used to identify the path as url + // scheme separator is used to identify the path as url // TBD: add support for url directories ?? return oldPath case strings.Contains(oldPath, "*"): diff --git a/v2/pkg/catalog/loader/loader.go b/v2/pkg/catalog/loader/loader.go index f3b84f4c95..8535b82334 100644 --- a/v2/pkg/catalog/loader/loader.go +++ b/v2/pkg/catalog/loader/loader.go @@ -59,7 +59,7 @@ type Store struct { preprocessor templates.Preprocessor // NotFoundCallback is called for each not found template - // This overrides error handling for not found templatesss + // This overrides error handling for not found templates NotFoundCallback func(template string) bool } @@ -187,7 +187,7 @@ func (store *Store) ValidateTemplates() error { if areTemplatesValid(store, filteredTemplatePaths) && areWorkflowsValid(store, filteredWorkflowPaths) { return nil } - return errors.New("errors occured during template validation") + return errors.New("errors occurred during template validation") } func areWorkflowsValid(store *Store, filteredWorkflowPaths map[string]struct{}) bool { diff --git a/v2/pkg/core/execute_options.go b/v2/pkg/core/execute_options.go index 6055d9cb67..4654e7928f 100644 --- a/v2/pkg/core/execute_options.go +++ b/v2/pkg/core/execute_options.go @@ -29,7 +29,7 @@ func (e *Engine) ExecuteWithResults(templatesList []*templates.Template, target return e.ExecuteScanWithOpts(templatesList, target, false) } -// ExecuteScanWithOpts executes scan with given scanStatergy +// ExecuteScanWithOpts executes scan with given scanStrategy func (e *Engine) ExecuteScanWithOpts(templatesList []*templates.Template, target InputProvider, noCluster bool) *atomic.Bool { results := &atomic.Bool{} selfcontainedWg := &sync.WaitGroup{} diff --git a/v2/pkg/core/inputs/hybrid/hmap.go b/v2/pkg/core/inputs/hybrid/hmap.go index 0d40b9768c..1fb2d73ad5 100644 --- a/v2/pkg/core/inputs/hybrid/hmap.go +++ b/v2/pkg/core/inputs/hybrid/hmap.go @@ -277,7 +277,7 @@ func (i *Input) setItem(metaInput *contextargs.MetaInput) { } } -// setHostMapStream sets iteam in stream mode +// setHostMapStream sets item in stream mode func (i *Input) setHostMapStream(data string) { if _, err := i.hostMapStream.Merge([][]byte{[]byte(data)}); err != nil { gologger.Warning().Msgf("%s\n", err) diff --git a/v2/pkg/external/customtemplates/github.go b/v2/pkg/external/customtemplates/github.go index 8a498b2593..dca234383a 100644 --- a/v2/pkg/external/customtemplates/github.go +++ b/v2/pkg/external/customtemplates/github.go @@ -17,9 +17,9 @@ import ( "gopkg.in/src-d/go-git.v4/plumbing/transport/http" ) -var _ Provider = &customTemplateGithubRepo{} +var _ Provider = &customTemplateGitHubRepo{} -type customTemplateGithubRepo struct { +type customTemplateGitHubRepo struct { owner string reponame string gitCloneURL string @@ -27,8 +27,8 @@ type customTemplateGithubRepo struct { } // This function download the custom github template repository -func (customTemplate *customTemplateGithubRepo) Download(ctx context.Context) { - clonePath := customTemplate.getLocalRepoClonePath(config.DefaultConfig.CustomGithubTemplatesDirectory) +func (customTemplate *customTemplateGitHubRepo) Download(ctx context.Context) { + clonePath := customTemplate.getLocalRepoClonePath(config.DefaultConfig.CustomGitHubTemplatesDirectory) if !fileutil.FolderExists(clonePath) { err := customTemplate.cloneRepo(clonePath, customTemplate.githubToken) @@ -41,8 +41,8 @@ func (customTemplate *customTemplateGithubRepo) Download(ctx context.Context) { } } -func (customTemplate *customTemplateGithubRepo) Update(ctx context.Context) { - downloadPath := config.DefaultConfig.CustomGithubTemplatesDirectory +func (customTemplate *customTemplateGitHubRepo) Update(ctx context.Context) { + downloadPath := config.DefaultConfig.CustomGitHubTemplatesDirectory clonePath := customTemplate.getLocalRepoClonePath(downloadPath) // If folder does not exits then clone/download the repo @@ -58,31 +58,31 @@ func (customTemplate *customTemplateGithubRepo) Update(ctx context.Context) { } } -// NewGithubProviders returns new instance of GitHub providers for downloading custom templates -func NewGithubProviders(options *types.Options) ([]*customTemplateGithubRepo, error) { - providers := []*customTemplateGithubRepo{} +// NewGitHubProviders returns new instance of GitHub providers for downloading custom templates +func NewGitHubProviders(options *types.Options) ([]*customTemplateGitHubRepo, error) { + providers := []*customTemplateGitHubRepo{} gitHubClient := getGHClientIncognito() if options.GitHubTemplateDisableDownload { return providers, nil } - for _, repoName := range options.GithubTemplateRepo { + for _, repoName := range options.GitHubTemplateRepo { owner, repo, err := getOwnerAndRepo(repoName) if err != nil { gologger.Error().Msgf("%s", err) continue } - githubRepo, err := getGithubRepo(gitHubClient, owner, repo, options.GithubToken) + githubRepo, err := getGitHubRepo(gitHubClient, owner, repo, options.GitHubToken) if err != nil { gologger.Error().Msgf("%s", err) continue } - customTemplateRepo := &customTemplateGithubRepo{ + customTemplateRepo := &customTemplateGitHubRepo{ owner: owner, reponame: repo, gitCloneURL: githubRepo.GetCloneURL(), - githubToken: options.GithubToken, + githubToken: options.GitHubToken, } providers = append(providers, customTemplateRepo) } @@ -104,7 +104,7 @@ func getOwnerAndRepo(reponame string) (owner string, repo string, err error) { } // returns *github.Repository if passed github repo name -func getGithubRepo(gitHubClient *github.Client, repoOwner, repoName, githubToken string) (*github.Repository, error) { +func getGitHubRepo(gitHubClient *github.Client, repoOwner, repoName, githubToken string) (*github.Repository, error) { var retried bool getRepo: repo, _, err := gitHubClient.Repositories.Get(context.Background(), repoOwner, repoName) @@ -123,7 +123,7 @@ getRepo: } // download the git repo to a given path -func (ctr *customTemplateGithubRepo) cloneRepo(clonePath, githubToken string) error { +func (ctr *customTemplateGitHubRepo) cloneRepo(clonePath, githubToken string) error { r, err := git.PlainClone(clonePath, false, &git.CloneOptions{ URL: ctr.gitCloneURL, Auth: getAuth(ctr.owner, githubToken), @@ -138,7 +138,7 @@ func (ctr *customTemplateGithubRepo) cloneRepo(clonePath, githubToken string) er } // performs the git pull on given repo -func (ctr *customTemplateGithubRepo) pullChanges(repoPath, githubToken string) error { +func (ctr *customTemplateGitHubRepo) pullChanges(repoPath, githubToken string) error { r, err := git.PlainOpen(repoPath) if err != nil { return err @@ -155,7 +155,7 @@ func (ctr *customTemplateGithubRepo) pullChanges(repoPath, githubToken string) e } // All Custom github repos are cloned in the format of 'reponame-owner' for uniqueness -func (ctr *customTemplateGithubRepo) getLocalRepoClonePath(downloadPath string) string { +func (ctr *customTemplateGitHubRepo) getLocalRepoClonePath(downloadPath string) string { return filepath.Join(downloadPath, ctr.reponame+"-"+ctr.owner) } diff --git a/v2/pkg/external/customtemplates/github_test.go b/v2/pkg/external/customtemplates/github_test.go index e21a62a90f..6c812f3769 100644 --- a/v2/pkg/external/customtemplates/github_test.go +++ b/v2/pkg/external/customtemplates/github_test.go @@ -22,8 +22,8 @@ func TestDownloadCustomTemplatesFromGitHub(t *testing.T) { config.DefaultConfig.SetTemplatesDir(templatesDirectory) options := testutils.DefaultOptions - options.GithubTemplateRepo = []string{"projectdiscovery/nuclei-templates", "ehsandeep/nuclei-templates"} - options.GithubToken = os.Getenv("GITHUB_TOKEN") + options.GitHubTemplateRepo = []string{"projectdiscovery/nuclei-templates", "ehsandeep/nuclei-templates"} + options.GitHubToken = os.Getenv("GITHUB_TOKEN") ctm, err := NewCustomTemplatesManager(options) require.Nil(t, err, "could not create custom templates manager") diff --git a/v2/pkg/external/customtemplates/gitlab.go b/v2/pkg/external/customtemplates/gitlab.go index db272c98cd..61dbca0a34 100644 --- a/v2/pkg/external/customtemplates/gitlab.go +++ b/v2/pkg/external/customtemplates/gitlab.go @@ -21,8 +21,8 @@ type customTemplateGitLabRepo struct { projectIDs []int } -// NewGitlabProviders returns a new list of GitLab providers for downloading custom templates -func NewGitlabProviders(options *types.Options) ([]*customTemplateGitLabRepo, error) { +// NewGitLabProviders returns a new list of GitLab providers for downloading custom templates +func NewGitLabProviders(options *types.Options) ([]*customTemplateGitLabRepo, error) { providers := []*customTemplateGitLabRepo{} if options.GitLabToken != "" && !options.GitLabTemplateDisableDownload { // Establish a connection to GitLab and build a client object with which to download templates from GitLab diff --git a/v2/pkg/external/customtemplates/templates_provider.go b/v2/pkg/external/customtemplates/templates_provider.go index 02a9794f59..6ae01e3bdf 100644 --- a/v2/pkg/external/customtemplates/templates_provider.go +++ b/v2/pkg/external/customtemplates/templates_provider.go @@ -41,7 +41,7 @@ func NewCustomTemplatesManager(options *types.Options) (*CustomTemplatesManager, } // Add GitHub providers - githubProviders, err := NewGithubProviders(options) + githubProviders, err := NewGitHubProviders(options) if err != nil { return nil, errorutil.NewWithErr(err).Msgf("could not create github providers for custom templates") } @@ -68,7 +68,7 @@ func NewCustomTemplatesManager(options *types.Options) (*CustomTemplatesManager, } // Add GitLab providers - gitlabProviders, err := NewGitlabProviders(options) + gitlabProviders, err := NewGitLabProviders(options) if err != nil { return nil, errorutil.NewWithErr(err).Msgf("could not create gitlab providers for custom templates") } diff --git a/v2/pkg/input/input.go b/v2/pkg/input/input.go index 5dadb2bf18..eb379a8604 100644 --- a/v2/pkg/input/input.go +++ b/v2/pkg/input/input.go @@ -18,7 +18,7 @@ type Helper struct { InputsHTTP *hybrid.HybridMap } -// NewHelper returns a new inpt helper instance +// NewHelper returns a new input helper instance func NewHelper() *Helper { helper := &Helper{} return helper diff --git a/v2/pkg/parsers/parser_test.go b/v2/pkg/parsers/parser_test.go index f8d1246f20..507eb367a0 100644 --- a/v2/pkg/parsers/parser_test.go +++ b/v2/pkg/parsers/parser_test.go @@ -70,7 +70,7 @@ func TestLoadTemplate(t *testing.T) { expectedErr: errors.New("field 'severity' is missing"), }, { - name: "template-without-serverity-with-correct-filter-id", + name: "template-without-severity-with-correct-filter-id", template: &templates.Template{ ID: "CVE-2021-27330", Info: model.Info{ @@ -84,7 +84,7 @@ func TestLoadTemplate(t *testing.T) { filter: filter.Config{IncludeIds: []string{"CVE-2021-27330"}}, }, { - name: "template-without-serverity-with-diff-filter-id", + name: "template-without-severity-with-diff-filter-id", template: &templates.Template{ ID: "CVE-2021-27330", Info: model.Info{ diff --git a/v2/pkg/protocols/common/automaticscan/doc.go b/v2/pkg/protocols/common/automaticscan/doc.go index b9756af764..02ff42f2ed 100644 --- a/v2/pkg/protocols/common/automaticscan/doc.go +++ b/v2/pkg/protocols/common/automaticscan/doc.go @@ -14,5 +14,5 @@ // detection. // // The logic is very simple and can be further improved to increase the coverage of -// this mode of nuclei exection. +// this mode of nuclei execution. package automaticscan diff --git a/v2/pkg/protocols/common/helpers/deserialization/java.go b/v2/pkg/protocols/common/helpers/deserialization/java.go index 68dda623dc..cde50d547b 100644 --- a/v2/pkg/protocols/common/helpers/deserialization/java.go +++ b/v2/pkg/protocols/common/helpers/deserialization/java.go @@ -75,7 +75,7 @@ func urlsafeBase64Encode(data []byte) string { } // generateCommonsCollections40Payload generates org.apache.commons:commons-collections4:4.0 -// deserialization paylaod for a command. +// deserialization payload for a command. func generateCommonsCollections40Payload(cmd string) []byte { buffer := &bytes.Buffer{} @@ -90,7 +90,7 @@ func generateCommonsCollections40Payload(cmd string) []byte { } // generateCommonsCollections440PPayload generates commons-collections 3.1 -// deserialization paylaod for a command. +// deserialization payload for a command. func generateCommonsCollections31Payload(cmd string) []byte { buffer := &bytes.Buffer{} @@ -105,7 +105,7 @@ func generateCommonsCollections31Payload(cmd string) []byte { } // generateGroovy1Payload generates org.codehaus.groovy:groovy:2.3.9 -// deserialization paylaod for a command. +// deserialization payload for a command. func generateGroovy1Payload(cmd string) []byte { buffer := &bytes.Buffer{} @@ -119,7 +119,7 @@ func generateGroovy1Payload(cmd string) []byte { return buffer.Bytes() } -// generateDNSPayload generates DNS interaction deserialization paylaod for a DNS Name. +// generateDNSPayload generates DNS interaction deserialization payload for a DNS Name. // Taken from ysoserial DNS gadget. func generateDNSPayload(URL string) []byte { parsed, err := url.Parse(URL) diff --git a/v2/pkg/protocols/common/interactsh/interactsh.go b/v2/pkg/protocols/common/interactsh/interactsh.go index 3c006f6610..6539915a79 100644 --- a/v2/pkg/protocols/common/interactsh/interactsh.go +++ b/v2/pkg/protocols/common/interactsh/interactsh.go @@ -128,7 +128,7 @@ func (c *Client) poll() error { return nil } -// requestShouldStopAtFirstmatch checks if furthur interactions should be stopped +// requestShouldStopAtFirstmatch checks if further interactions should be stopped // note: extra care should be taken while using this function since internalEvent is // synchronized all the time and if caller functions has already acquired lock its best to explicitly specify that // we could use `TryLock()` but that may over complicate things and need to differentiate diff --git a/v2/pkg/protocols/common/interactsh/options.go b/v2/pkg/protocols/common/interactsh/options.go index 22a745d376..48d536803e 100644 --- a/v2/pkg/protocols/common/interactsh/options.go +++ b/v2/pkg/protocols/common/interactsh/options.go @@ -43,7 +43,7 @@ type Options struct { DisableHttpFallback bool // NoInteractsh disables the engine NoInteractsh bool - // NoColor dissbles printing colors for matches + // NoColor disables printing colors for matches NoColor bool StopAtFirstMatch bool diff --git a/v2/pkg/protocols/common/protocolstate/state.go b/v2/pkg/protocols/common/protocolstate/state.go index 95293a519f..829c2ce346 100644 --- a/v2/pkg/protocols/common/protocolstate/state.go +++ b/v2/pkg/protocols/common/protocolstate/state.go @@ -106,14 +106,14 @@ func Init(options *types.Options) error { } // isIpAssociatedWithInterface checks if the given IP is associated with the given interface. -func isIpAssociatedWithInterface(souceIP, interfaceName string) (bool, error) { +func isIpAssociatedWithInterface(sourceIP, interfaceName string) (bool, error) { addrs, err := interfaceAddresses(interfaceName) if err != nil { return false, err } for _, addr := range addrs { if ipnet, ok := addr.(*net.IPNet); ok { - if ipnet.IP.String() == souceIP { + if ipnet.IP.String() == sourceIP { return true, nil } } diff --git a/v2/pkg/protocols/common/randomip/randomip_test.go b/v2/pkg/protocols/common/randomip/randomip_test.go index 2fcda223db..9cc9eb7b3c 100644 --- a/v2/pkg/protocols/common/randomip/randomip_test.go +++ b/v2/pkg/protocols/common/randomip/randomip_test.go @@ -45,7 +45,7 @@ func TestGetRandomIp(t *testing.T) { valid: true, }, { - name: "Negativ CIDR length", + name: "Negative CIDR length", cidr: []string{"10.11.12.13/-1"}, valid: false, errorMsg: "10.11.12.13/-1 is not a valid CIDR", diff --git a/v2/pkg/protocols/common/uncover/uncover.go b/v2/pkg/protocols/common/uncover/uncover.go index 7ba2fa9057..9a30590b13 100644 --- a/v2/pkg/protocols/common/uncover/uncover.go +++ b/v2/pkg/protocols/common/uncover/uncover.go @@ -53,7 +53,7 @@ func GetTargetsFromUncover(ctx context.Context, outputFormat string, opts *uncov return outputChan, nil } -// processUncoverOutput returns output strign depending on uncover field +// processUncoverOutput returns output string depending on uncover field func processUncoverOutput(result sources.Result, outputFormat string) string { if (result.IP == "" || result.Port == 0) && stringsutil.ContainsAny(outputFormat, "ip", "port") { // if ip or port is not present, fallback to using host diff --git a/v2/pkg/protocols/common/variables/doc.go b/v2/pkg/protocols/common/variables/doc.go index 74e7d9c31e..b0b54a87e6 100644 --- a/v2/pkg/protocols/common/variables/doc.go +++ b/v2/pkg/protocols/common/variables/doc.go @@ -22,6 +22,6 @@ package variables // Non-Linear Sources (need to re-evaluate) // 1. VariablesMap // 2. PayloadsMap -// Everytime Linear Sources are updated , Non-Linear Sources need to be re-evaluated +// Every time Linear Sources are updated , Non-Linear Sources need to be re-evaluated // Constants (no need to re-evaluate, should contain only scalars) diff --git a/v2/pkg/protocols/headless/request.go b/v2/pkg/protocols/headless/request.go index f9ce8e6a96..500deb18c3 100644 --- a/v2/pkg/protocols/headless/request.go +++ b/v2/pkg/protocols/headless/request.go @@ -227,7 +227,7 @@ func (request *Request) executeFuzzingRule(input *contextargs.Context, payloads return nil } -// getLastNaviationURL returns last successfully navigated URL +// getLastNavigationURL returns last successfully navigated URL func (request *Request) getLastNavigationURLWithLog(reqLog map[string]string) string { for i := len(request.Steps) - 1; i >= 0; i-- { if request.Steps[i].ActionType.ActionType == engine.ActionNavigate { diff --git a/v2/pkg/protocols/http/build_request.go b/v2/pkg/protocols/http/build_request.go index af551d09cc..921af02455 100644 --- a/v2/pkg/protocols/http/build_request.go +++ b/v2/pkg/protocols/http/build_request.go @@ -253,7 +253,7 @@ func (r *requestGenerator) generateHttpRequest(ctx context.Context, urlx *urluti return &generatedRequest{request: request, meta: generatorValues, original: r.request, dynamicValues: finalVars, interactshURLs: r.interactshURLs}, nil } -// generateRawRequest generates Raw Request from from request data from template and variables +// generateRawRequest generates Raw Request from request data from template and variables // finalVars = contains all variables including generator and protocol specific variables // generatorValues = contains variables used in fuzzing or other generator specific values func (r *requestGenerator) generateRawRequest(ctx context.Context, rawRequest string, baseURL *urlutil.URL, finalVars, generatorValues map[string]interface{}) (*generatedRequest, error) { diff --git a/v2/pkg/protocols/http/raw/raw.go b/v2/pkg/protocols/http/raw/raw.go index 46a6b562a7..58aae6cb82 100644 --- a/v2/pkg/protocols/http/raw/raw.go +++ b/v2/pkg/protocols/http/raw/raw.go @@ -53,7 +53,7 @@ func Parse(request string, inputURL *urlutil.URL, unsafe, disablePathAutomerge b return nil, errorutil.NewWithTag("raw", "could not automergepath for template path %v", urlx.GetRelativePath()).Wrap(parseErr) } rawrequest.Path = cloned.GetRelativePath() - // If unsafe changes must be made in raw request string iteself + // If unsafe changes must be made in raw request string itself case unsafe: prevPath := rawrequest.Path cloned := inputURL.Clone() diff --git a/v2/pkg/protocols/http/request_annotations.go b/v2/pkg/protocols/http/request_annotations.go index 5f0e26777b..6555957c8c 100644 --- a/v2/pkg/protocols/http/request_annotations.go +++ b/v2/pkg/protocols/http/request_annotations.go @@ -19,9 +19,9 @@ var ( // @tls-sni:target overrides the input target with the annotated one // special values: // request.host: takes the value from the host header - // target: overiddes with the specific value + // target: overrides with the specific value reSniAnnotation = regexp.MustCompile(`(?m)^@tls-sni:\s*(.+)\s*$`) - // @timeout:duration overrides the input timout with a custom duration + // @timeout:duration overrides the input timeout with a custom duration reTimeoutAnnotation = regexp.MustCompile(`(?m)^@timeout:\s*(.+)\s*$`) // @once sets the request to be executed only once for a specific URL reOnceAnnotation = regexp.MustCompile(`(?m)^@once\s*$`) @@ -36,15 +36,15 @@ const ( // parseFlowAnnotations and override requests flow func parseFlowAnnotations(rawRequest string) (flowMark, bool) { var fm flowMark - // parse request for known ovverride annotations - var hasFlowOveride bool + // parse request for known override annotations + var hasFlowOverride bool // @once if reOnceAnnotation.MatchString(rawRequest) { fm = Once - hasFlowOveride = true + hasFlowOverride = true } - return fm, hasFlowOveride + return fm, hasFlowOverride } type annotationOverrides struct { @@ -55,7 +55,7 @@ type annotationOverrides struct { // parseAnnotations and override requests settings func (r *Request) parseAnnotations(rawRequest string, request *retryablehttp.Request) (overrides annotationOverrides, modified bool) { - // parse request for known ovverride annotations + // parse request for known override annotations // @Host:target if hosts := reHostAnnotation.FindStringSubmatch(rawRequest); len(hosts) > 0 { diff --git a/v2/pkg/protocols/network/request.go b/v2/pkg/protocols/network/request.go index aecff19ea6..09d408115d 100644 --- a/v2/pkg/protocols/network/request.go +++ b/v2/pkg/protocols/network/request.go @@ -58,15 +58,15 @@ func (request *Request) ExecuteWithResults(input *contextargs.Context, metadata, variablesMap := request.options.Variables.Evaluate(variables) variables = generators.MergeMaps(variablesMap, variables, request.options.Constants) - visitedAddressess := make(mapsutil.Map[string, struct{}]) + visitedAddresses := make(mapsutil.Map[string, struct{}]) for _, kv := range request.addresses { actualAddress := replacer.Replace(kv.address, variables) - if visitedAddressess.Has(actualAddress) && !request.options.Options.DisableClustering { + if visitedAddresses.Has(actualAddress) && !request.options.Options.DisableClustering { continue } - visitedAddressess.Set(actualAddress, struct{}{}) + visitedAddresses.Set(actualAddress, struct{}{}) if err := request.executeAddress(variables, actualAddress, address, input.MetaInput.Input, kv.tls, previous, callback); err != nil { outputEvent := request.responseToDSLMap("", "", "", address, "") diff --git a/v2/pkg/protocols/utils/http/requtils.go b/v2/pkg/protocols/utils/http/requtils.go index 97bb49f6e6..4f2f860e7b 100644 --- a/v2/pkg/protocols/utils/http/requtils.go +++ b/v2/pkg/protocols/utils/http/requtils.go @@ -11,7 +11,7 @@ import ( var ( // TODO: adapt regex for cases where port is updated urlWithPortRegex = regexp.MustCompile(`^{{(BaseURL|RootURL)}}:(\d+)`) - // regex to detect traling slash in path (not applicable to raw requests) + // regex to detect trailing slash in path (not applicable to raw requests) trailingSlashregex = regexp.MustCompile(`^\Q{{\E[a-zA-Z]+\Q}}/\E`) // ErrNoMoreRequests is internal error to ) diff --git a/v2/pkg/protocols/utils/variables_test.go b/v2/pkg/protocols/utils/variables_test.go index a603137f3b..5c4e25efaf 100644 --- a/v2/pkg/protocols/utils/variables_test.go +++ b/v2/pkg/protocols/utils/variables_test.go @@ -12,7 +12,7 @@ import ( func TestHTTPVariables(t *testing.T) { baseURL := "http://localhost:9001/test/123" parsed, _ := urlutil.Parse(baseURL) - // trailingslash is only true when both target/inputURL and payload {{BaseURL}}/xyz both have slash + // trailing slash is only true when both target/inputURL and payload {{BaseURL}}/xyz both have slash values := GenerateVariables(parsed, false, nil) require.Equal(t, values["BaseURL"], parsed.String(), "incorrect baseurl") diff --git a/v2/pkg/protocols/websocket/websocket.go b/v2/pkg/protocols/websocket/websocket.go index 26468fd357..ab51478adc 100644 --- a/v2/pkg/protocols/websocket/websocket.go +++ b/v2/pkg/protocols/websocket/websocket.go @@ -64,7 +64,7 @@ type Request struct { // Payloads support both key-values combinations where a list // of payloads is provided, or optionally a single file can also // be provided as payload which will be read on run-time. - Payloads map[string]interface{} `yaml:"payloads,omitempty" json:"payloads,omitempty" jsonschema:"title=payloads for the webosocket request,description=Payloads contains any payloads for the current request"` + Payloads map[string]interface{} `yaml:"payloads,omitempty" json:"payloads,omitempty" jsonschema:"title=payloads for the websocket request,description=Payloads contains any payloads for the current request"` generator *generators.PayloadGenerator diff --git a/v2/pkg/templates/cluster.go b/v2/pkg/templates/cluster.go index 301d66a040..d1c8caf101 100644 --- a/v2/pkg/templates/cluster.go +++ b/v2/pkg/templates/cluster.go @@ -29,7 +29,7 @@ import ( // to the first individual request is compared for equality. // The equality check is performed as described below - // -// Cases where clustering is not perfomed (request is considered different) +// Cases where clustering is not performed (request is considered different) // - If request contains payloads,raw,body,unsafe,req-condition,name attributes // - If request methods,max-redirects,cookie-reuse,redirects are not equal // - If request paths aren't identical. diff --git a/v2/pkg/templates/templates.go b/v2/pkg/templates/templates.go index eec06055a6..e8d3420843 100644 --- a/v2/pkg/templates/templates.go +++ b/v2/pkg/templates/templates.go @@ -114,7 +114,7 @@ type Template struct { Variables variables.Variable `yaml:"variables,omitempty" json:"variables,omitempty" jsonschema:"title=variables for the http request,description=Variables contains any variables for the current request"` // description: | - // Constants contains any scalar costant for the current template + // Constants contains any scalar constant for the current template Constants map[string]interface{} `yaml:"constants,omitempty" json:"constants,omitempty" jsonschema:"title=constant for the template,description=constants contains any constant for the template"` // TotalRequests is the total number of requests for the template. diff --git a/v2/pkg/templates/templates_doc.go b/v2/pkg/templates/templates_doc.go index 992e5bed6f..fb490ffb53 100644 --- a/v2/pkg/templates/templates_doc.go +++ b/v2/pkg/templates/templates_doc.go @@ -141,8 +141,8 @@ func init() { TemplateDoc.Fields[16].Name = "constants" TemplateDoc.Fields[16].Type = "map[string]interface{}" TemplateDoc.Fields[16].Note = "" - TemplateDoc.Fields[16].Description = "Constants contains any scalar costant for the current template" - TemplateDoc.Fields[16].Comments[encoder.LineComment] = "Constants contains any scalar costant for the current template" + TemplateDoc.Fields[16].Description = "Constants contains any scalar constant for the current template" + TemplateDoc.Fields[16].Comments[encoder.LineComment] = "Constants contains any scalar constant for the current template" MODELInfoDoc.Type = "model.Info" MODELInfoDoc.Comments[encoder.LineComment] = " Info contains metadata information about a template" diff --git a/v2/pkg/testutils/testutils.go b/v2/pkg/testutils/testutils.go index 68e9e78fb8..26ffe70000 100644 --- a/v2/pkg/testutils/testutils.go +++ b/v2/pkg/testutils/testutils.go @@ -64,8 +64,8 @@ var DefaultOptions = &types.Options{ InteractionsEviction: 60, InteractionsCoolDownPeriod: 5, InteractionsPollDuration: 5, - GithubTemplateRepo: []string{}, - GithubToken: "", + GitHubTemplateRepo: []string{}, + GitHubToken: "", } // TemplateInfo contains info for a mock executed template. diff --git a/v2/pkg/types/types.go b/v2/pkg/types/types.go index c3842bbb6e..fe22ad3020 100644 --- a/v2/pkg/types/types.go +++ b/v2/pkg/types/types.go @@ -102,7 +102,7 @@ type Options struct { CloudURL string // CloudAPIKey is the api-key for the nuclei cloud endpoint CloudAPIKey string - // Scanlist feature to get all the scan ids for a user + // ScanList feature to get all the scan ids for a user ScanList bool // ListDatasources enables listing of datasources for user ListDatasources bool @@ -326,7 +326,7 @@ type Options struct { IncludeConditions goflags.StringSlice // Custom Config Directory CustomConfigDir string - // Enable uncover egine + // Enable uncover engine Uncover bool // Uncover search query UncoverQuery goflags.StringSlice @@ -345,9 +345,9 @@ type Options struct { // PublicTemplateDisableDownload disables downloading templates from the nuclei-templates public repository PublicTemplateDisableDownload bool // GitHub token used to clone/pull from private repos for custom templates - GithubToken string - // GithubTemplateRepo is the list of custom public/private templates GitHub repos - GithubTemplateRepo []string + GitHubToken string + // GitHubTemplateRepo is the list of custom public/private templates GitHub repos + GitHubTemplateRepo []string // GitHubTemplateDisableDownload disables downloading templates from custom GitHub repositories GitHubTemplateDisableDownload bool // GitLabServerURL is the gitlab server to use for custom templates