From 07662d9403eb85b39e1ffcf91014bbf36efd1c5a Mon Sep 17 00:00:00 2001 From: s Date: Thu, 13 Nov 2025 22:25:02 -0500 Subject: refactor: break down large osint.go file into separate command modules and add helper functions --- cmd/crawl.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 cmd/crawl.go (limited to 'cmd/crawl.go') diff --git a/cmd/crawl.go b/cmd/crawl.go new file mode 100644 index 0000000..3587eb0 --- /dev/null +++ b/cmd/crawl.go @@ -0,0 +1,37 @@ +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) +} + +func runCrawl(cmd *cobra.Command, args []string) error { + c, err := newUnauthenticatedClient() + if err != nil { + return err + } + + err = c.CrawlDomain(args[0], func(line string) error { + fmt.Println(line) + return nil + }) + + if err != nil { + return err + } + + return nil +} -- cgit v1.2.3