Set fdmax by default not as an option

master
Víctor Zamanillo 2020-09-19 23:30:58 +02:00
parent afcc4b0223
commit 7bcb744d2b
3 changed files with 7 additions and 10 deletions

View File

@ -3,11 +3,18 @@ package main
import (
"context"
"github.com/projectdiscovery/fdmax"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/subfinder/pkg/runner"
)
func main() {
// Increase the OS file descriptors
err := fdmax.Set(fdmax.UnixMax)
if err != nil {
gologger.Fatalf("Could not set the max file descriptors for the current process: %s\n", err)
}
// Parse the command line flags and read config files
options := runner.ParseOptions()

View File

@ -23,7 +23,6 @@ type Options struct {
RemoveWildcard bool // RemoveWildcard specifies whether to remove potential wildcard or dead subdomains from the results.
Stdin bool // Stdin specifies whether stdin input was given to the process
Version bool // Version specifies if we should just show version and exit
FdMax bool // FdMax automatically increases the maximum number of file descriptors
Recursive bool // Recursive specifies whether to use only recursive subdomain enumeration sources
All bool // All specifies whether to use all (slow) sources.
Threads int // Thread controls the number of threads to use for active enumerations
@ -76,7 +75,6 @@ func ParseOptions() *Options {
flag.BoolVar(&options.RemoveWildcard, "nW", false, "Remove Wildcard & Dead Subdomains from output")
flag.StringVar(&options.ConfigFile, "config", path.Join(config, "config.yaml"), "Configuration file for API Keys, etc")
flag.BoolVar(&options.Version, "version", false, "Show version of subfinder")
flag.BoolVar(&options.FdMax, "fdmax", false, "Automatically increases the maximum number of file descriptors")
flag.Parse()
// Check if stdin pipe was given

View File

@ -7,7 +7,6 @@ import (
"os"
"path"
"github.com/projectdiscovery/fdmax"
"github.com/projectdiscovery/subfinder/pkg/passive"
"github.com/projectdiscovery/subfinder/pkg/resolve"
)
@ -40,13 +39,6 @@ func NewRunner(options *Options) (*Runner, error) {
// RunEnumeration runs the subdomain enumeration flow on the targets specified
func (r *Runner) RunEnumeration(ctx context.Context) error {
// Increase the OS file descriptors
if r.options.FdMax {
err := fdmax.Set(fdmax.UnixMax)
if err != nil {
return err
}
}
// Check if only a single domain is sent as input. Process the domain now.
if r.options.Domain != "" {