-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New source: DomainsProject #1663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA new passive subdomain source "domainsproject" is added and registered; it implements a Source that uses BasicAuth to query the DomainsProject API, decodes JSON responses, emits subdomain results, and tracks simple scrape statistics. Changes
Sequence DiagramsequenceDiagram
participant Client
participant Source
participant DomainsProjectAPI as DomainsProject API
participant Results
Client->>Source: Run(ctx, domain, session)
activate Source
Source->>Source: pickRandomApiKey()
alt no API key
Source->>Results: emit skipped result
else API key present
Source->>DomainsProjectAPI: GET /domains?domain=... (BasicAuth)
activate DomainsProjectAPI
DomainsProjectAPI-->>Source: 200 JSON {domains: [...]} / {error: "..."}
deactivate DomainsProjectAPI
alt response.error present
Source->>Results: emit Error result
else valid domains list
loop for each domain
alt domain doesn't start with "."
Source->>Results: emit Subdomain result
end
end
end
Source->>Results: emit Statistics
end
deactivate Source
Results-->>Client: results channel receives events
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
pkg/subscraping/sources/domainsproject/domainsproject.go (2)
84-84: Use%sformat specifier for string.Using
%vfor a string value is non-idiomatic. Use%sinstead, or directly wrap witherrors.New().Apply this diff:
- Source: s.Name(), Type: subscraping.Error, Error: fmt.Errorf("%v", response.Error), + Source: s.Name(), Type: subscraping.Error, Error: fmt.Errorf("%s", response.Error),
90-95: Consider adding a comment for the subdomain filtering logic.The filtering of subdomains starting with "." could benefit from a brief comment explaining why these are excluded (e.g., wildcard entries or malformed data from the API).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
pkg/passive/sources.go(2 hunks)pkg/subscraping/sources/domainsproject/domainsproject.go(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
pkg/passive/sources.go (1)
pkg/subscraping/sources/domainsproject/domainsproject.go (1)
Source(16-22)
pkg/subscraping/sources/domainsproject/domainsproject.go (2)
pkg/subscraping/types.go (3)
Session(71-78)BasicAuth(23-26)Statistics(29-34)pkg/subscraping/utils.go (2)
PickRandom(12-20)CreateApiKeys(22-30)
🔇 Additional comments (6)
pkg/passive/sources.go (2)
28-28: LGTM!The import is correctly positioned in alphabetical order and follows the project's import path conventions.
75-75: LGTM!The new source is correctly registered in alphabetical order within the AllSources array, consistent with the existing pattern.
pkg/subscraping/sources/domainsproject/domainsproject.go (4)
1-13: LGTM!Package declaration and imports are clean and appropriate for the source implementation.
15-32: LGTM!The struct definitions are well-designed and align with the subscraping framework patterns. The response struct appropriately handles both success and error cases from the API.
35-50: LGTM!The initialization and API key selection logic correctly follows the established subscraping patterns. The skipped flag is properly set when credentials are unavailable.
101-131: LGTM!All interface methods are correctly implemented:
- Returns appropriate source name
- Correctly indicates it needs API keys (matching PR description)
- Properly uses the
CreateApiKeysutility for username/password pairs- Statistics method correctly maps all tracked metrics
|
@coderabbitai create and link github issue to this PR |
|
Tip For best results, initiate chat on the files or code changes. @ehsandeep: I'd be happy to create and link a GitHub issue to this PR. Could you please provide more details about what the issue should contain? For example:
Once you provide these details, I'll create the issue and link it to this PR. |
|
Thanks for the PR and for your contributions to the OSS! I'm trying to get an API key, but ran into an error (http 502) when accessing the API subdomain. Could you add instructions on how to get one? |
|
Yes, this is a private API that I offer to my subscribers through Patreon: https://patreon.com/tb0hdan -> Memberships @dogancanbakir I've sent you test credentials to your email that I've extracted from your GitHub account. |
|
@tb0hdan Thanks for the info! I've tried with credentials you sent over email but it didn't work. $ go run . -s domainsproject -d vulnerabletarget.com -v
__ _____ __
_______ __/ /_ / __(_)___ ____/ /__ _____
/ ___/ / / / __ \/ /_/ / __ \/ __ / _ \/ ___/
(__ ) /_/ / /_/ / __/ / / / / /_/ / __/ /
/____/\__,_/_.___/_/ /_/_/ /_/\__,_/\___/_/
projectdiscovery.io
[INF] Current subfinder version v2.9.0 (latest)
[INF] Loading provider config from /Users/dogancanbakir/Library/Application Support/subfinder/provider-config.yaml
[DBG] API key(s) found for domainsproject.
[DBG] Selected source(s) for this search: domainsproject
[INF] Enumerating subdomains for vulnerabletarget.com
[DBG] Response for failed request against https://api.domainsproject.org/api/tld/search?domain=vulnerabletarget.com:
Unauthorized
[WRN] Encountered an error with source domainsproject: unexpected status code 401 received from https://api.domainsproject.org/api/tld/search?domain=vulnerabletarget.com
[INF] Found 0 subdomains for vulnerabletarget.com in 344 milliseconds 351 microseconds |
|
Had some wires crossed there. Fixed. |
|
This time I got 500: $ go run . -s domainsproject -d vulnerabletarget.com -v
__ _____ __
_______ __/ /_ / __(_)___ ____/ /__ _____
/ ___/ / / / __ \/ /_/ / __ \/ __ / _ \/ ___/
(__ ) /_/ / /_/ / __/ / / / / /_/ / __/ /
/____/\__,_/_.___/_/ /_/_/ /_/\__,_/\___/_/
projectdiscovery.io
[INF] Current subfinder version v2.9.0 (latest)
[INF] Loading provider config from /Users/dogancanbakir/Library/Application Support/subfinder/provider-config.yaml
[DBG] API key(s) found for domainsproject.
[DBG] Selected source(s) for this search: domainsproject
[INF] Enumerating subdomains for vulnerabletarget.com
[DBG] Response for failed request against https://api.domainsproject.org/api/tld/search?domain=vulnerabletarget.com:
no subdomains found for vulnerabletarget.com
[WRN] Encountered an error with source domainsproject: unexpected status code 500 received from https://api.domainsproject.org/api/tld/search?domain=vulnerabletarget.com
[INF] Found 0 subdomains for vulnerabletarget.com in 4 seconds 141 milliseconds |
|
That was by design: "no subdomains found for vulnerabletarget.com". I've updated the API to return an empty domains list and 200 instead. |
Summary by CodeRabbit
New Features
Tests