1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
var crawlCmd = &cobra.Command{
Use: "crawl [domain]",
Short: "Crawl domain",
Long: `Resolves a domain using httpx and crawls it using katana. Returns discovered links as plain text, one per line, streamed in real-time. Supports both http:// and https:// URLs.`,
Args: cobra.ExactArgs(1),
RunE: runCrawl,
}
func init() {
rootCmd.AddCommand(crawlCmd)
crawlCmd.Flags().Bool("subdomains", false, "Also discover and crawl all subdomains using subfinder")
}
func runCrawl(cmd *cobra.Command, args []string) error {
subdomains, _ := cmd.Flags().GetBool("subdomains")
c, err := newUnauthenticatedClient()
if err != nil {
return err
}
err = c.CrawlDomain(args[0], subdomains, func(line string) error {
fmt.Println(line)
return nil
})
if err != nil {
return err
}
return nil
}
|