From b95501e64141d6960d41db862a950142fa420b18 Mon Sep 17 00:00:00 2001 From: Ice3man Date: Wed, 7 Dec 2022 22:28:45 +0530 Subject: [PATCH] Misc --- v2/cmd/generate-checksum/main.go | 1 + v2/cmd/nuclei/main.go | 2 +- v2/internal/runner/enumerate.go | 4 ++-- v2/internal/runner/nucleicloud/types.go | 4 +--- v2/internal/runner/nucleicloud/utils.go | 6 +++++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/v2/cmd/generate-checksum/main.go b/v2/cmd/generate-checksum/main.go index 6990e86d..a381387f 100644 --- a/v2/cmd/generate-checksum/main.go +++ b/v2/cmd/generate-checksum/main.go @@ -30,6 +30,7 @@ func main() { return nil } pathIndex := path[strings.Index(path, "nuclei-templates/")+17:] + pathIndex = strings.TrimPrefix(pathIndex, "nuclei-templates/") // Ignore items starting with dots if strings.HasPrefix(pathIndex, ".") { return nil diff --git a/v2/cmd/nuclei/main.go b/v2/cmd/nuclei/main.go index c222261b..e5ff6600 100644 --- a/v2/cmd/nuclei/main.go +++ b/v2/cmd/nuclei/main.go @@ -294,7 +294,7 @@ on extensive configurability, massive extensibility and ease of use.`) flagSet.CreateGroup("cloud", "Cloud", flagSet.BoolVar(&options.Cloud, "cloud", false, "run scan on nuclei cloud"), - flagSet.StringVarEnv(&options.CloudURL, "cloud-server", "cs", "http://cloud-dev.nuclei.sh", "NUCLEI_CLOUD_SERVER", "nuclei cloud server to use (NUCLEI_CLOUD_SERVER)"), + flagSet.StringVarEnv(&options.CloudURL, "cloud-server", "cs", "https://cloud-dev.nuclei.sh", "NUCLEI_CLOUD_SERVER", "nuclei cloud server to use (NUCLEI_CLOUD_SERVER)"), flagSet.StringVarEnv(&options.CloudAPIKey, "cloud-api-key", "ak", "", "NUCLEI_CLOUD_APIKEY", "api-key for the nuclei cloud server (NUCLEI_CLOUD_APIKEY)"), flagSet.BoolVarP(&options.ScanList, "list-scan", "ls", false, "list previous cloud scans"), flagSet.BoolVarP(&options.NoStore, "no-store", "ns", false, "disable scan/output storage on cloud"), diff --git a/v2/internal/runner/enumerate.go b/v2/internal/runner/enumerate.go index 865a7700..f6030267 100644 --- a/v2/internal/runner/enumerate.go +++ b/v2/internal/runner/enumerate.go @@ -85,9 +85,9 @@ func (r *Runner) runCloudEnumeration(store *loader.Store, nostore bool) (*atomic // TODO: Add payload file and workflow support for private templates catalogChecksums := nucleicloud.ReadCatalogChecksum() - targets := make([]*contextargs.MetaInput, 0, r.hmapInputProvider.Count()) + targets := make([]string, 0, r.hmapInputProvider.Count()) r.hmapInputProvider.Scan(func(value *contextargs.MetaInput) bool { - targets = append(targets, value) + targets = append(targets, value.Input) return true }) templates := make([]string, 0, len(store.Templates())) diff --git a/v2/internal/runner/nucleicloud/types.go b/v2/internal/runner/nucleicloud/types.go index 9510f966..889b003d 100644 --- a/v2/internal/runner/nucleicloud/types.go +++ b/v2/internal/runner/nucleicloud/types.go @@ -2,14 +2,12 @@ package nucleicloud import ( "time" - - "github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/contextargs" ) // AddScanRequest is a nuclei scan input item. type AddScanRequest struct { // RawTargets is a list of raw target URLs for the scan. - RawTargets []*contextargs.MetaInput `json:"raw_targets,omitempty"` + RawTargets []string `json:"raw_targets,omitempty"` // PublicTemplates is a list of public templates for the scan PublicTemplates []string `json:"public_templates,omitempty"` // PrivateTemplates is a map of template-name->contents that diff --git a/v2/internal/runner/nucleicloud/utils.go b/v2/internal/runner/nucleicloud/utils.go index 36d2a1c3..611e4afa 100644 --- a/v2/internal/runner/nucleicloud/utils.go +++ b/v2/internal/runner/nucleicloud/utils.go @@ -30,7 +30,11 @@ func ReadCatalogChecksum() map[string]string { if len(text) < 2 { continue } - checksums[text[0]] = text[1] + path := strings.TrimPrefix(text[0], "nuclei-templates/") + if strings.HasPrefix(path, ".") { + continue + } + checksums[path] = text[1] } return checksums }