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

Method Execute

cmd/integration-test/library.go:21–62  ·  view source on GitHub ↗

Execute executes a test case and returns an error if occurred Execute the docs at ../README.md if the code stops working for integration.

()

Source from the content-addressed store, hash-verified

19// Execute executes a test case and returns an error if occurred
20// Execute the docs at ../README.md if the code stops working for integration.
21func (h *goIntegrationTest) Execute() error {
22 var crawledURLs []string
23
24 options := &types.Options{
25 MaxDepth: 1,
26 FieldScope: "rdn",
27 BodyReadSize: math.MaxInt,
28 RateLimit: 150,
29 Verbose: debug,
30 Strategy: queue.DepthFirst.String(),
31 OnResult: func(r output.Result) {
32 crawledURLs = append(crawledURLs, r.Request.URL)
33 },
34 }
35 crawlerOptions, err := types.NewCrawlerOptions(options)
36 if err != nil {
37 return err
38 }
39 defer func() {
40 if err := crawlerOptions.Close(); err != nil {
41 fmt.Printf("Error closing crawler options: %v\n", err)
42 }
43 }()
44 crawler, err := standard.New(crawlerOptions)
45 if err != nil {
46 return err
47 }
48 defer func() {
49 if err := crawler.Close(); err != nil {
50 fmt.Printf("Error closing crawler: %v\n", err)
51 }
52 }()
53 var input = "https://public-firing-range.appspot.com"
54 err = crawler.Crawl(input)
55 if err != nil {
56 return err
57 }
58 if len(crawledURLs) == 0 {
59 return fmt.Errorf("no URLs crawled")
60 }
61 return nil
62}

Callers

nothing calls this directly

Calls 6

CloseMethod · 0.95
NewCrawlerOptionsFunction · 0.92
NewFunction · 0.92
CloseMethod · 0.65
CrawlMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected