Skip to content

Improved Subfinder SDK Usability#1466

Merged
ehsandeep merged 4 commits intoprojectdiscovery:devfrom
mielverkerken:dev
Jan 14, 2025
Merged

Improved Subfinder SDK Usability#1466
ehsandeep merged 4 commits intoprojectdiscovery:devfrom
mielverkerken:dev

Conversation

@mielverkerken
Copy link
Copy Markdown
Contributor

Improved Subfinder SDK Usability

The current subfinder Go module has limited functionality as an SDK. While it allows configuring the runner and performing enumerations, obtaining results requires passing through writers and parsing the output again, which is inefficient for programmatic use.

This pull request introduces a change to make the subfinder module more SDK-friendly by directly returning the sourceMap. The sourceMap contains the enumerated subdomains along with the sources that identified them, eliminating the need to reprocess the output.

Key Changes

  • Modified the enumeration logic to return the sourceMap as a result.
  • Kept changes minimal to minimize the impact on other parts of the codebase.
  • Modified example code to use subfinder Go module to use the sourceMap.

@mielverkerken mielverkerken changed the title Make subfinder go module more useful Improved Subfinder SDK Usability Dec 6, 2024
var sourceMap map[string]map[string]struct{}
// To run subdomain enumeration on a single domain
if err = subfinder.EnumerateSingleDomainWithCtx(context.Background(), "hackerone.com", []io.Writer{output}); err != nil {
if sourceMap, err = subfinder.EnumerateSingleDomainWithCtx(context.Background(), "hackerone.com", []io.Writer{output}); err != nil {

Check failure

Code scanning / CodeQL

Incomplete regular expression for hostnames

This regular expression has an unescaped dot before 'com', so it might match more hosts than expected when [the regular expression is used](1).
@GeorginaReeder
Copy link
Copy Markdown

Thanks for your contribution @mielverkerken , we appreciate it! :)

@ehsandeep ehsandeep merged commit 1620aaa into projectdiscovery:dev Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants