Added Text Output Feature

master
ice3man 2018-04-08 13:50:16 +05:30
parent 2caa74a201
commit acdf9c1be4
2 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,36 @@
//
// output.go : Contains different functions for reporting
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License
// Copyrights (C) 2018 Ice3man
//
package output
import (
"os"
"io"
"subfinder/libsubfinder/helper"
)
// Write output to a normal text file
func WriteOutputText(state *helper.State, subdomains []string) error {
file, err := os.Create(state.Output)
if err != nil {
return err
}
for _, subdomain := range subdomains {
_, err := io.WriteString(file, subdomain+"\n")
if err != nil {
return err
}
}
file.Close()
return nil
}

14
main.go
View File

@ -15,6 +15,7 @@ import (
"os"
"subfinder/libsubfinder/helper"
"subfinder/libsubfinder/output"
"subfinder/libsubfinder/engines/passive"
//"subfinder/libsubfinder/engines/bruteforce"
)
@ -40,6 +41,8 @@ func ParseCmdLine() (state *helper.State, err error) {
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")
flag.StringVar(&s.Output, "o", "", "Name of the output file (optional)")
flag.BoolVar(&s.IsJSON, "oJ", false, "Write output in JSON Format")
flag.BoolVar(&s.Recursive, "r", true, "Use recursion to find subdomains")
flag.StringVar(&s.Wordlist, "w", "", "Wordlist for doing subdomain bruteforcing")
flag.BoolVar(&s.Bruteforce, "b", false, "Use bruteforcing to find subdomains")
@ -68,6 +71,15 @@ func main() {
os.Exit(1)
}
passive.PassiveDiscovery(state)
passiveSubdomains := passive.PassiveDiscovery(state)
if state.Output != "" {
err := output.WriteOutputText(state, passiveSubdomains)
if err != nil {
fmt.Printf("\nerror : %v", err)
} else {
fmt.Printf("\n[#] Successfully Written Output to File : %s", state.Output)
}
}
//bruteforce.Bruteforce(state)
}