Skip to content

Commit

Permalink
print config dir with -version
Browse files Browse the repository at this point in the history
  • Loading branch information
tarunKoyalwar committed Oct 16, 2023
1 parent c7aa45e commit 808c2fc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 46 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ OUTPUT:
-oI, -ip include host IP in output (-active only)

CONFIGURATION:
-config string flag config file (default "$HOME/.config/subfinder/config.yaml")
-pc, -provider-config string provider config file (default "$HOME/.config/subfinder/provider-config.yaml")
-config string flag config file (default "$CONFIG/subfinder/config.yaml")
-pc, -provider-config string provider config file (default "$CONFIG/subfinder/provider-config.yaml")
-r string[] comma separated list of resolvers to use
-rL, -rlist string file containing list of resolvers to use
-nW, -active display active subdomains only
Expand Down Expand Up @@ -125,7 +125,7 @@ go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest

You can also use the `subfinder -ls` command to display all the available sources.

These values are stored in the `$HOME/.config/subfinder/provider-config.yaml` file which will be created when you run the tool for the first time. The configuration file uses the YAML format. Multiple API keys
These values are stored in the `$CONFIG/subfinder/provider-config.yaml` file which will be created when you run the tool for the first time. The configuration file uses the YAML format. Multiple API keys
can be specified for each of these services from which one of them will be used for enumeration.

Composite keys for sources like, `Censys`, `PassiveTotal`, `Fofa`, `Intellix` and `360quake`, need to be separated with a colon (`:`).
Expand Down Expand Up @@ -241,7 +241,7 @@ docker run projectdiscovery/subfinder:latest -d hackerone.com
Running `subfinder` using the docker image, with a local config file:

```sh
docker run -v $HOME/.config/subfinder:/root/.config/subfinder -t projectdiscovery/subfinder -d hackerone.com
docker run -v $CONFIG/subfinder:/root/.config/subfinder -t projectdiscovery/subfinder -d hackerone.com
```

</td>
Expand Down
19 changes: 0 additions & 19 deletions v2/pkg/runner/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,6 @@ import (
fileutil "github.com/projectdiscovery/utils/file"
)

// GetConfigDirectory gets the subfinder config directory for a user
func GetConfigDirectory() (string, error) {
var config string

directory, err := os.UserHomeDir()
if err != nil {
return config, err
}
config = directory + "/.config/subfinder"

// Create All directory for subfinder even if they exist
err = os.MkdirAll(config, os.ModePerm)
if err != nil {
return config, err
}

return config, nil
}

// createProviderConfigYAML marshals the input map to the given location on the disk
func createProviderConfigYAML(configFilePath string) error {
configFile, err := os.Create(configFilePath)
Expand Down
21 changes: 0 additions & 21 deletions v2/pkg/runner/config_test.go

This file was deleted.

6 changes: 4 additions & 2 deletions v2/pkg/runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import (
)

var (
defaultConfigLocation = filepath.Join(folderutil.AppConfigDirOrDefault(".", "subfinder"), "config.yaml")
defaultProviderConfigLocation = filepath.Join(folderutil.AppConfigDirOrDefault(".", "subfinder"), "provider-config.yaml")
configDir = folderutil.AppConfigDirOrDefault(".", "subfinder")
defaultConfigLocation = filepath.Join(configDir, "config.yaml")
defaultProviderConfigLocation = filepath.Join(configDir, "provider-config.yaml")
)

// Options contains the configuration options for tuning
Expand Down Expand Up @@ -169,6 +170,7 @@ func ParseOptions() *Options {

if options.Version {
gologger.Info().Msgf("Current Version: %s\n", version)
gologger.Info().Msgf("Subfinder Config Directory: %s", configDir)
os.Exit(0)
}

Expand Down

0 comments on commit 808c2fc

Please sign in to comment.