mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 21:25:27 +00:00
* use parsed options while signing * update project layout to v3 * fix .gitignore * remove example template * misc updates * bump tlsx version * hide template sig warning with env * js: retain value while using log * fix nil pointer derefernce * misc doc update --------- Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
28 lines
798 B
Go
28 lines
798 B
Go
package utils
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/catalog/config"
|
|
)
|
|
|
|
const (
|
|
// TemplatesRepoURL is the URL for files in nuclei-templates repository
|
|
TemplatesRepoURL = "https://templates.nuclei.sh/public/"
|
|
)
|
|
|
|
// TemplatePathURL returns the Path and URL for the provided template
|
|
func TemplatePathURL(fullPath, templateId string) (string, string) {
|
|
var templateDirectory string
|
|
configData := config.DefaultConfig
|
|
if configData.TemplatesDirectory != "" && strings.HasPrefix(fullPath, configData.TemplatesDirectory) {
|
|
templateDirectory = configData.TemplatesDirectory
|
|
} else {
|
|
return "", ""
|
|
}
|
|
|
|
finalPath := strings.TrimPrefix(strings.TrimPrefix(fullPath, templateDirectory), "/")
|
|
templateURL := TemplatesRepoURL + templateId
|
|
return finalPath, templateURL
|
|
}
|