这是indexloc提供的服务,不要输入任何密码
Skip to content

"Active Subdomains only" seems not to work in library mode #778

@paweloque

Description

@paweloque

Describe the bug
I'm using subfinder as a go library. I want to use the "-nW" option to only get a list of active subdomains. For that purpose, I use the RemoveWildcard: true parameter. The results of the library are, however, active but also old inactive subdomain. How do I need to configure Subfinder to only get active subdomains?

As a reference, this is how I use subfinder and only get active subdomains:

subfinder -d orbit7.ch -nW

As a library, I configure subfinder as follows:

func subfinderCall(domain string, resultCallback runner.OnResultCallback) (message string) {
    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
        RemoveWildcard:       true,
        Resolvers:            resolve.DefaultResolvers, // Use the default list of resolvers by marshaling it to the config
        ResultCallback:       resultCallback,           // Callback function to execute for available host
    })
    ...

The resultCallback is responsible for collecting the results:

subdomains := make(map[string]common.SubdomainResult)

// list all subdomains for the root target domain
subfinderCall(domain, func(s *resolve.HostEntry) {
    subdomainResult := common.SubdomainResult{}
    subdomainResult.Host = *s
    subdomainResult.HttpxResult = httpxrunner.Result{Failed: true}
    subdomains[s.Host] = subdomainResult
})

As a I result, the callback receives the full list of subdomains, i.e. also the inactive ones.

Subfinder version
v2.5.6

Complete command you used to reproduce this
Correct results:

subfinder -d orbit7.ch -nW

All subdomains, even the inactive ones:

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
    RemoveWildcard:       true,
    Resolvers:            resolve.DefaultResolvers, // Use the default list of resolvers by marshaling it to the config
    ResultCallback:       resultCallback,           // Callback function to execute for available host
})

Metadata

Metadata

Assignees

Labels

Status: CompletedNothing further to be done with this issue. Awaiting to be closed.investigationinvestigation

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions