Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/utils/template_path.go
2070 views
1
package utils
2
3
import (
4
"strings"
5
6
"github.com/projectdiscovery/nuclei/v3/pkg/catalog/config"
7
"github.com/projectdiscovery/nuclei/v3/pkg/keys"
8
)
9
10
const (
11
// TemplatesRepoURL is the URL for files in nuclei-templates repository
12
TemplatesRepoURL = "https://cloud.projectdiscovery.io/public/"
13
)
14
15
// TemplatePathURL returns the Path and URL for the provided template
16
func TemplatePathURL(fullPath, templateId, templateVerifier string) (path string, url string) {
17
configData := config.DefaultConfig
18
if configData.TemplatesDirectory != "" && strings.HasPrefix(fullPath, configData.TemplatesDirectory) {
19
path = strings.TrimPrefix(strings.TrimPrefix(fullPath, configData.TemplatesDirectory), "/")
20
}
21
if templateVerifier == keys.PDVerifier {
22
url = TemplatesRepoURL + templateId
23
}
24
return
25
}
26
27