MCPcopy
hub / github.com/projectdiscovery/katana / validateScopeFunc

Function validateScopeFunc

pkg/engine/headless/headless.go:72–93  ·  view source on GitHub ↗
(h *Headless, URL string)

Source from the content-addressed store, hash-verified

70}
71
72func validateScopeFunc(h *Headless, URL string) browser.ScopeValidator {
73 parsedURL, err := url.Parse(URL)
74 if err != nil {
75 return func(string) bool { return true }
76 }
77 rootHostname := parsedURL.Hostname()
78
79 return func(s string) bool {
80 if h.options.ScopeManager == nil {
81 return true
82 }
83 parsed, err := url.Parse(s)
84 if err != nil {
85 return false
86 }
87 validated, err := h.options.ScopeManager.Validate(parsed, rootHostname)
88 if err != nil {
89 return false
90 }
91 return validated
92 }
93}
94
95// Crawl executes the headless crawling on a given URL
96func (h *Headless) Crawl(URL string) error {

Callers 1

CrawlMethod · 0.85

Calls 1

ValidateMethod · 0.80

Tested by

no test coverage detected