Skip to content

katanavscolly

MIT 18 6 16,499
Nov 07 2022 v1.5.0(2026-03-10 14:52:47 ago)
25,231 7 187 Apache-2.0
May 14 2018 v2.2.0(2025-03-27 10:47:28 ago)

Katana is a next-generation web crawling and spidering framework written in Go by ProjectDiscovery. It is designed for fast, comprehensive endpoint and asset discovery and is widely used in the security research and bug bounty communities.

Katana offers multiple crawling modes:

  • Standard mode Fast HTTP-based crawling without a browser. Parses HTML, JavaScript files, and other resources to discover endpoints and links.
  • Headless mode Uses a headless Chrome browser for crawling JavaScript-rendered pages and single-page applications (SPAs).
  • Passive mode Discovers URLs from external sources (Wayback Machine, CommonCrawl, etc.) without actively visiting the target.

Key features include:

  • Scope control Configurable crawl scope with regex patterns for including/excluding URLs, domains, and file extensions.
  • JavaScript parsing Extracts endpoints from JavaScript files, inline scripts, and AJAX requests even in standard (non-headless) mode.
  • Customizable output Filter and format output with field selection, JSON output, and custom templates.
  • Rate limiting Built-in rate limiting and concurrency control to avoid overwhelming targets.
  • Proxy support HTTP and SOCKS5 proxy support with rotation.
  • Form filling Can detect and auto-fill forms to discover endpoints behind form submissions.

While Katana was designed for security research and reconnaissance, its fast crawling capabilities and JavaScript parsing make it equally useful for web scraping discovery and sitemap generation.

Colly is a popular web scraping library for the Go programming language. It's designed to be fast and easy to use, and it provides a simple and flexible API for traversing and extracting information from websites.

Colly supports:

  • Concurrent scraping with a simple API
  • Automatic handling of cookies and sessions
  • Automatic handling of redirects
  • Support for parsing HTML and XML
  • Support for parsing JSON and binary data
  • Support for custom storage (e.g. scraping results to a database)
  • Simple JavaScript rendering with Colly's built-in rendering engine.

Colly also provides several optional features, such as support for user-agents, delay between requests, rate-limiting and proxy usage.

Colly's API is quite simple, and it is easy to get started with basic web scraping tasks. It's a good choice for scraping moderate to heavy sites, and it can be useful for a wide range of use cases, such as data mining, content extraction, and more.

Additionally, you can use it together with Goquery, a library that allow you to make jquery like queries on HTML documents and it is often used together with Colly to ease the way of parsing the HTML.

Highlights


fastpopularlarge-scale
popularcss-selectorsxpath-selectorscommunity-toolsoutput-pipelinesmiddlewaresasyncproductionlarge-scale

Example Use


```go package main import ( "context" "math" "github.com/projectdiscovery/katana/pkg/engine/standard" "github.com/projectdiscovery/katana/pkg/output" "github.com/projectdiscovery/katana/pkg/types" ) func main() { // Configure crawl options options := &types.Options{ MaxDepth: 3, FieldScope: "rdn", // restrict to root domain BodyReadSize: math.MaxInt, Timeout: 10, Concurrency: 10, Parallelism: 10, Delay: 0, RateLimit: 150, Strategy: "depth-first", OnResult: func(result output.Result) { // Process each discovered URL println(result.Request.URL) }, } // Create and run the crawler crawlerOptions, _ := types.NewCrawlerOptions(options) defer crawlerOptions.Close() crawler, _ := standard.New(crawlerOptions) defer crawler.Close() // Start crawling _ = crawler.Crawl("https://example.com") } ```
```go package main import ( "fmt" "github.com/gocolly/colly/v2" ) func main() { // Instantiate default collector c := colly.NewCollector( // Visit only domains: hackerspaces.org, wiki.hackerspaces.org colly.AllowedDomains("hackerspaces.org", "wiki.hackerspaces.org"), ) // On every a element which has href attribute call callback c.OnHTML("a[href]", func(e *colly.HTMLElement) { link := e.Attr("href") // Print link fmt.Printf("Link found: %q -> %s\n", e.Text, link) // Visit link found on page // Only those links are visited which are in AllowedDomains c.Visit(e.Request.AbsoluteURL(link)) }) // Before making a request print "Visiting ..." c.OnRequest(func(r *colly.Request) { fmt.Println("Visiting", r.URL.String()) }) // Start scraping on https://hackerspaces.org c.Visit("https://hackerspaces.org/") } ```

Alternatives / Similar


Was this page helpful?