subfinder/main.go

68 lines
2.8 KiB
Go
Raw Normal View History

// subfinder : Subdomain discovery tool in golang
2018-04-04 11:33:16 +00:00
// Written By : @codingo
// @ice3man
//
// Distributed Under MIT License
// Copyrights (C) 2018 Ice3man
// Contains main driver classes for the tool
2018-04-04 11:33:16 +00:00
package main
import (
"flag"
"fmt"
2018-04-04 11:33:16 +00:00
"github.com/subfinder/subfinder/libsubfinder/helper"
2018-06-27 18:44:41 +00:00
"github.com/subfinder/subfinder/subf"
2018-04-04 11:33:16 +00:00
)
2018-06-23 04:46:03 +00:00
// ParseCmdLine ... Parses command line arguments into a setting structure
2018-06-27 18:44:41 +00:00
// ParseCmdLine ... Parses command line arguments into a setting structure
func ParseCmdLine() (s *subf.Subfinder) {
s = subf.NewSubfinder()
flag.BoolVar(&s.State.Verbose, "v", false, "Verbose output")
flag.BoolVar(&s.State.Color, "no-color", true, "Don't Use colors in output")
flag.IntVar(&s.State.Threads, "t", 10, "Number of concurrent threads")
flag.IntVar(&s.State.Timeout, "timeout", 180, "Timeout for passive discovery services")
flag.StringVar(&s.State.Domain, "d", "", "Domain to find subdomains for")
flag.StringVar(&s.State.Output, "o", "", "Name of the output file (optional)")
flag.BoolVar(&s.State.IsJSON, "oJ", false, "Write output in JSON Format")
flag.BoolVar(&s.State.Alive, "nW", false, "Remove Wildcard Subdomains from output")
flag.BoolVar(&s.State.NoPassive, "no-passive", false, "Do not perform passive subdomain enumeration")
flag.BoolVar(&s.State.Silent, "silent", false, "Show only subdomains in output")
flag.BoolVar(&s.State.Recursive, "recursive", false, "Use recursion to find subdomains")
flag.StringVar(&s.State.Wordlist, "w", "", "Wordlist for doing subdomain bruteforcing")
flag.StringVar(&s.State.Sources, "sources", "all", "Comma separated list of sources to use")
flag.BoolVar(&s.State.Bruteforce, "b", false, "Use bruteforcing to find subdomains")
flag.StringVar(&s.State.SetConfig, "set-config", "none", "Comma separated list of configuration details")
flag.StringVar(&s.State.SetSetting, "set-settings", "none", "Comma separated list of settings")
flag.StringVar(&s.State.DomainList, "dL", "", "List of domains to find subdomains for")
flag.StringVar(&s.State.OutputDir, "oD", "", "Directory to output results to ")
flag.StringVar(&s.State.ComResolver, "r", "", "Comma-separated list of resolvers to use")
flag.StringVar(&s.State.ListResolver, "rL", "", "Text file containing list of resolvers to use")
flag.StringVar(&s.State.ExcludeSource, "exclude-sources", "", "List of sources to exclude from enumeration")
flag.BoolVar(&s.State.AquatoneJSON, "oT", false, "Use aquatone style json output format")
2018-04-04 11:33:16 +00:00
flag.Parse()
2018-06-27 18:44:41 +00:00
return s
2018-04-04 11:33:16 +00:00
}
func main() {
2018-06-27 18:44:41 +00:00
subfinder := ParseCmdLine()
2018-04-04 11:33:16 +00:00
2018-06-27 18:44:41 +00:00
if !subfinder.State.Silent {
2018-06-26 13:41:54 +00:00
fmt.Println("===============================================")
fmt.Printf("%s%s-=Subfinder%s v1.1.3 github.com/subfinder/subfinder\n", helper.Info, helper.Cyan, helper.Reset)
2018-06-26 13:41:54 +00:00
fmt.Println("===============================================")
}
2018-06-27 18:44:41 +00:00
subfinder.Init()
2018-06-27 18:44:41 +00:00
_ = subfinder.PassiveEnumeration()
2018-04-04 11:33:16 +00:00
fmt.Printf("\n")
2018-04-04 11:52:46 +00:00
}