diff --git a/README.md b/README.md index e11bca5..6fa0f00 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ## 01-项目功能修改 -- [x] 将config和nuclei-templates目录自动下载解压到程序本目录。 +- [x] 将config和nuclei-templates目录自动下载解压到程序本目录pocs文件夹。 - [config.go](https://github.com/Goqi/Ernuclei/blob/main/pkg/catalog/config/config.go) - [template_path.go](https://github.com/Goqi/Ernuclei/blob/main/pkg/utils/template_path.go) - [ ] 将nuclei-templates打包到程序中。 diff --git a/pkg/catalog/config/config.go b/pkg/catalog/config/config.go index c170f10..029acdb 100644 --- a/pkg/catalog/config/config.go +++ b/pkg/catalog/config/config.go @@ -31,7 +31,7 @@ type Config struct { const nucleiConfigFilename = ".templates-config.json" // Version is the current version of nuclei -const Version = `0.2` +const Version = `1.0` var customConfigDirectory string diff --git a/pkg/utils/template_path.go.txt b/pkg/utils/template_path.go.txt deleted file mode 100644 index 4a4b5d1..0000000 --- a/pkg/utils/template_path.go.txt +++ /dev/null @@ -1,43 +0,0 @@ -package utils - -import ( - "path/filepath" - "strings" - - "github.com/mitchellh/go-homedir" - "Ernuclei/pkg/catalog/config" -) - -const ( - // TemplatesRepoURL is the URL for files in nuclei-templates repository - TemplatesRepoURL = "https://github.com/projectdiscovery/nuclei-templates/blob/master/" -) - -var configData *config.Config - -func init() { - configData, _ = config.ReadConfiguration() -} - -// TemplatePathURL returns the Path and URL for the provided template -func TemplatePathURL(fullPath string) (string, string) { - var templateDirectory string - if configData != nil && configData.TemplatesDirectory != "" && strings.HasPrefix(fullPath, configData.TemplatesDirectory) { - templateDirectory = configData.TemplatesDirectory - } else { - return "", "" - } - - finalPath := strings.TrimPrefix(strings.TrimPrefix(fullPath, templateDirectory), "/") - templateURL := TemplatesRepoURL + finalPath - return finalPath, templateURL -} - -// GetDefaultTemplatePath on default settings -func GetDefaultTemplatePath() (string, error) { - home, err := homedir.Dir() - if err != nil { - return "", err - } - return filepath.Join(home, "nuclei-templates"), nil -}