Merge branch 'master' of https://github.com/Ice3man543/subfinder into passive-engine-rewrite

master
mzack 2018-05-17 20:49:14 +02:00
commit 79df4435e3
4 changed files with 46 additions and 28 deletions

View File

@ -38,9 +38,9 @@ This will display help for the tool. Here are all the switches it supports.
| -dL | List of domains to find subdomains for | ./subfinder -dl hosts.txt |
| -nW | Remove wildcard subdomains | ./subfinder -nw |
| -o | Name of the output file (Optional) | ./subfinder -o output.txt |
| -oA | Write output in JSON format (Required -nW) | ./subfinder -o output.txt -nw -oA |
| -oD | Output to directory (When using multiple hosts) | ./subfinder -od ~/misc/out/ |
| -oT | Write output in Aquatone style JSON format (Required -nW) | ./subfinder -o output.txt -nw -oA |
| -oJ | Write output in JSON format | ./subfinder -o output.json -oJ |
| -oD | Output to directory (When using multiple hosts) | ./subfinder -od ~/misc/out/ |
| -r | Comma-separated list of resolvers to use | ./subfinder -r 8.8.8.8,1.1.1.1 |
| -rL | File containing list of resolvers to use | ./subfinder -rL resolvers.txt |
| --recursive | Use recursive subdomain finding (default: true) | ./subfinder --recursive |

View File

@ -233,14 +233,17 @@ func discover(state *helper.State, domain string, sourceConfig *Source) (subdoma
state.IsWildcard, state.WildcardIP = helper.InitWildcard(domain)
if state.IsWildcard == true {
if state.Silent != true {
fmt.Printf("\n[~] Wildcard IPs found at %s IP(s) %s", domain, state.WildcardIP)
fmt.Printf("\nFound Wildcard DNS at %s", domain)
for _, ip := range state.WildcardIP {
fmt.Printf("\n - %s", ip)
}
}
}
ch := make(chan helper.Result, sourceConfig.nbrActive())
if state.Silent != true {
fmt.Printf("\n[+] Finding subdomains for : %s", domain)
fmt.Printf("\nRunning enumeration on %s", domain)
}
// Create goroutines for added speed and recieve data via channels
@ -329,15 +332,18 @@ func discover(state *helper.State, domain string, sourceConfig *Source) (subdoma
var PassiveSubdomains []string
if state.Alive == true {
if state.Alive || state.AquatoneJSON {
// Nove remove all wildcard subdomains
PassiveSubdomains = resolver.Resolve(state, validPassiveSubdomains)
if state.Silent != true {
fmt.Printf("\nResolving %s%d%s Unique Hosts found", helper.Info, len(validPassiveSubdomains), helper.Reset)
}
} else {
PassiveSubdomains = validPassiveSubdomains
}
if state.AquatoneJSON == true {
if state.Silent != true {
if state.AquatoneJSON {
if !state.Silent {
fmt.Printf("\n[-] Writing Aquatone Style output to %s", state.Output)
}
@ -347,9 +353,10 @@ func discover(state *helper.State, domain string, sourceConfig *Source) (subdoma
// Sort the subdomains found alphabetically
sort.Strings(PassiveSubdomains)
if state.Silent != true {
if !state.Silent {
fmt.Printf("\n\n[~] Total %d Unique subdomains found for %s\n\n", len(PassiveSubdomains), domain)
}
for _, subdomain := range PassiveSubdomains {
fmt.Println(subdomain)
}
@ -419,6 +426,19 @@ func Enumerate(state *helper.State) []string {
passivePool.Stop()
if state.Output != "" {
if !state.IsJSON {
if !state.AquatoneJSON {
err := output.WriteOutputToFile(state, allSubdomains)
if err != nil {
if state.Silent {
fmt.Printf("\n%s-> %v%s\n", helper.Bad, err, helper.Reset)
}
}
}
}
}
return allSubdomains
}

View File

@ -11,10 +11,11 @@ package helper
// Use like this
// fmt.Printf("[%sCRTSH%s] %s", r, rs, subdomain)
var (
Red = "\033[31;1;4m" // red color
Cyan = "\033[36;6;2m" // cyan color
Green = "\033[32;6;3m" // Green color
Reset = "\033[0m" // reset for default color
Red = "\033[31;1;4m" // red color
Cyan = "\033[36;6;2m" // cyan color
Green = "\033[32;6;3m" // Green color
Yellow = "\033[0;33m"
Reset = "\033[0m" // reset for default color
Info = "\033[33;1;1m"
Que = "\033[34;1;1m"

29
main.go
View File

@ -25,11 +25,12 @@ import (
)
var banner = `
____ __ _____ __
/ __/_ __/ / / __(_)__ ___/ /__ ____
_\ \/ // / _ \/ _// / _ \/ _ / -_) __/
/___/\_,_/_.__/_/ /_/_//_/\_,_/\__/_/
`
__ _____ __
_______ __/ /_ / __(_)___ ____/ /__ _____
/ ___/ / / / __ \/ /_/ / __ \/ __ / _ \/ ___/
(__ ) /_/ / /_/ / __/ / / / / /_/ / __/ /
/____/\__,_/_.___/_/ /_/_/ /_/\__,_/\___/_/
v0.1.1 - by @ice3man `
// Parses command line arguments into a setting structure
func ParseCmdLine() (state *helper.State, err error) {
@ -41,7 +42,7 @@ func ParseCmdLine() (state *helper.State, err error) {
}
flag.BoolVar(&s.Verbose, "v", false, "Verbose output")
flag.BoolVar(&s.Color, "c", true, "Use colour in outpout")
flag.BoolVar(&s.Color, "no-color", true, "Don't Use colors in output")
flag.IntVar(&s.Threads, "t", 10, "Number of concurrent threads")
flag.IntVar(&s.Timeout, "timeout", 180, "Timeout for passive discovery services")
flag.StringVar(&s.Domain, "d", "", "Domain to find subdomains for")
@ -59,7 +60,7 @@ func ParseCmdLine() (state *helper.State, err error) {
flag.StringVar(&s.OutputDir, "oD", "", "Directory to output results to ")
flag.StringVar(&s.ComResolver, "r", "", "Comma-separated list of resolvers to use")
flag.StringVar(&s.ListResolver, "rL", "", "Text file containing list of resolvers to use")
flag.BoolVar(&s.AquatoneJSON, "oA", false, "Use aquatone style json output format")
flag.BoolVar(&s.AquatoneJSON, "oT", false, "Use aquatone style json output format")
flag.Parse()
return &s, nil
@ -75,8 +76,6 @@ func main() {
if state.Silent != true {
fmt.Println(banner)
fmt.Printf("\nSubFinder v0.1.0 Made with %s❤%s by @Ice3man", helper.Green, helper.Reset)
fmt.Printf("\n==================================================\n")
}
if state.SetConfig != "none" {
@ -115,7 +114,7 @@ func main() {
os.Exit(1)
}
fmt.Printf("[-] Successfully configured %s=>%s\n", object[0], object[1])
fmt.Printf("Successfully configured %s%s%s=>%s\n", helper.Info, object[0], helper.Reset, object[1])
}
os.Exit(0)
@ -131,7 +130,7 @@ func main() {
reflect.ValueOf(&state.CurrentSettings).Elem().FieldByName(object[0]).SetString(object[1])
if state.Silent != true {
if state.Verbose == true {
fmt.Printf("[-] Successfully Set %s=>%s\n", object[0], object[1])
fmt.Printf("Successfully Set %s%s%s=>%s\n", helper.Info, object[0], helper.Reset, object[1])
}
}
}
@ -175,20 +174,18 @@ func main() {
dir := filepath.Dir(state.Output)
exists, _ := helper.Exists(dir)
if exists == false {
fmt.Printf("\n[!] The specified output directory does not exists !\n")
os.Exit(1)
fmt.Printf("\n%s-> The specified output directory does not exists !%s\n", helper.Yellow, helper.Reset)
}
} else if state.OutputDir != "" {
exists, _ := helper.Exists(state.OutputDir)
if exists == false {
fmt.Printf("\n[!] The specified output directory does not exists !\n")
os.Exit(1)
fmt.Printf("\n%s-> The specified output directory does not exists !%s\n", helper.Yellow, helper.Reset)
}
}
if state.Domain == "" && state.DomainList == "" {
if state.Silent != true {
fmt.Printf("\n\nsubfinder: Missing domain argument\nTry './subfinder -h' for more information\n")
fmt.Printf("\n\n%s-> Missing \"domain\" argument %s\nTry %s'./subfinder -h'%s for more information\n", helper.Bad, helper.Reset, helper.Info, helper.Reset)
}
os.Exit(1)
}