Features • Install • Usage • API Setup • Library • Join Discord
--- Subfinder is a subdomain discovery tool that discovers valid subdomains for websites by using passive online sources. It has a simple modular architecture and is optimized for speed. subfinder is built for doing one thing only - passive subdomain enumeration, and it does that very well. We have designed subfinder to comply with all passive sources licenses, and usage restrictions, as well as maintained a consistently passive model to make it useful to both penetration testers and bug bounty hunters alike. # Features## Subfinder with docker You can use the official dockerhub image at [subfinder](https://hub.docker.com/r/projectdiscovery/subfinder). Simply run - ```sh ▶ docker pull projectdiscovery/subfinder ``` The above command will pull the latest tagged release from the dockerhub repository. If you want to build the container yourself manually, git clone the repo, then build and run the following commands - Clone the repo using `git clone https://github.com/projectdiscovery/subfinder.git` - Build your docker container ```sh docker build -t projectdiscovery/subfinder . ``` If you are using docker, you need to first create your directory structure holding subfinder configuration file. After modifying the default config.yaml file, you can run: ```sh ▶ mkdir -p $HOME/.config/subfinder ▶ cp config.yaml $HOME/.config/subfinder/config.yaml ▶ nano $HOME/.config/subfinder/config.yaml ``` After that, you can pass it as a volume using the following sample command. ```sh ▶ docker run -v $HOME/.config/subfinder:/root/.config/subfinder -it projectdiscovery/subfinder -d example.com ``` For example, this runs the tool against example.com and output the results to your host file system: ```sh docker run -v $HOME/.config/subfinder:/root/.config/subfinder -it projectdiscovery/subfinder -d example.com > example.com.txt ``` |
## Subfinder Go library Usage example: ``` go package main import ( "bytes" "context" "fmt" "io" "io/ioutil" "log" "github.com/projectdiscovery/subfinder/v2/pkg/passive" "github.com/projectdiscovery/subfinder/v2/pkg/resolve" "github.com/projectdiscovery/subfinder/v2/pkg/runner" ) func main() { config := runner.ConfigFile{ // Use the default list of resolvers by marshaling it to the config Resolvers: resolve.DefaultResolvers, // Use the default list of passive sources Sources: passive.DefaultSources, // Use the default list of all passive sources AllSources: passive.DefaultAllSources, // Use the default list of recursive sources Recursive: passive.DefaultRecursiveSources, } runnerInstance, err := runner.NewRunner(&runner.Options{ Threads: 10, // Thread controls the number of threads to use for active enumerations Timeout: 30, // Timeout is the seconds to wait for sources to respond MaxEnumerationTime: 10, // MaxEnumerationTime is the maximum amount of time in mins to wait for enumeration YAMLConfig: config, }) buf := bytes.Buffer{} err = runnerInstance.EnumerateSingleDomain(context.Background(), "projectdiscovery.io", []io.Writer{&buf}) if err != nil { log.Fatal(err) } data, err := ioutil.ReadAll(&buf) if err != nil { log.Fatal(err) } fmt.Printf("%s", data) } ``` |