2018-04-04 11:33:16 +00:00
|
|
|
//
|
|
|
|
// process.go : Contains main package drivers and stuff
|
|
|
|
// Written By : @codingo
|
|
|
|
// @ice3man
|
|
|
|
//
|
|
|
|
// Distributed Under MIT License
|
|
|
|
// Copyrights (C) 2018 Ice3man
|
|
|
|
//
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"flag"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"subfinder/libsubfinder/helper"
|
|
|
|
"subfinder/libsubfinder/engines/passive"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var banner = `
|
2018-04-04 11:52:46 +00:00
|
|
|
__ ___ __ __
|
|
|
|
.-----.--.--| |--.' _|__.-----.--| .-----.----.
|
|
|
|
|__ --| | | _ | _| | | _ | -__| _|
|
2018-04-04 11:54:56 +00:00
|
|
|
|_____|_____|_____|__| |__|__|__|_____|_____|__| `
|
2018-04-04 11:33:16 +00:00
|
|
|
|
|
|
|
// Parses command line arguments into a setting structure
|
|
|
|
func ParseCmdLine() (state *helper.State, err error) {
|
|
|
|
|
|
|
|
// Initialize current state and read Config file
|
|
|
|
s, err := helper.InitState()
|
|
|
|
if err != nil {
|
|
|
|
return &s, err
|
|
|
|
}
|
|
|
|
|
|
|
|
flag.BoolVar(&s.Verbose, "v", false, "Verbose output")
|
|
|
|
flag.BoolVar(&s.Color, "c", true, "Use colour in outpout")
|
|
|
|
flag.IntVar(&s.Threads, "t", 10, "Number of concurrent threads")
|
2018-04-05 10:11:46 +00:00
|
|
|
flag.IntVar(&s.Timeout, "timeout", 180, "Timeout for passive discovery services")
|
2018-04-04 11:33:16 +00:00
|
|
|
flag.StringVar(&s.Domain, "d", "", "Domain to find subdomains for")
|
|
|
|
flag.BoolVar(&s.Recursive, "r", true, "Use recursion to find subdomains")
|
|
|
|
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
return &s, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
|
|
|
fmt.Println(banner)
|
2018-04-04 16:21:42 +00:00
|
|
|
fmt.Printf("\nSubFinder v0.1.0 Made with ❤ by @Ice3man")
|
|
|
|
fmt.Printf("\n==================================================")
|
2018-04-04 11:33:16 +00:00
|
|
|
|
|
|
|
state, err := ParseCmdLine()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Improve Usage guide here
|
|
|
|
if state.Domain == "" {
|
|
|
|
fmt.Printf("\n\nsubfinder: Missing domain argument\nTry './subfinder -h' for more information\n")
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
passive.PassiveDiscovery(state)
|
2018-04-04 11:52:46 +00:00
|
|
|
}
|