338 Commits

Author SHA1 Message Date
ChrisJr404 292032eef4 fix(crtsh): drop unused certificate metadata from SQL query (#1773) (#1787)
The Postgres query inherited the verbatim form crt.sh's web UI uses to
render its certificate browser. subfinder consumes NAME_VALUE only, so
GROUP BY sub.CERTIFICATE on multi-KB DER blobs, the four x509_*
function calls per group, the correlated LEFT JOIN LATERAL into
ct_log_entry, and the trailing ORDER BY ENTRY_TIMESTAMP are all
discarded.

Replacing the WITH/JOIN with a direct DISTINCT NAME_VALUE preserves the
result set (verified parity on iana.org: 24 unique names from both
queries) and lets the LIMIT 10000 clause bound unique subdomains
instead of raw certificate rows. The downstream SplitSeq + Extractor
path is unchanged.

Co-authored-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>
2026-06-16 15:29:27 +02:00
Dogan Can Bakir 2a8ce2f3e6 feat: add shodanct passive source (#1796)
* feat: add shodanct passive source

* fix lint

---------

Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
2026-06-16 15:24:59 +02:00
Dwi Siswanto 4a45eedd9b chore(runner): bump version to v2.14.0
Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-04-25 16:36:27 +07:00
Dogan Can Bakir 1cdef03a90 Merge pull request #1776 from x-stp/fix/netlas-community-cap
fix(netlas): cap dl size to Community limits.
2026-04-20 08:29:53 +03:00
x-stp 3206a8b244 fix(netlas): close body on err path, drop unreachable status checks
Addresses CodeRabbit review.
2026-04-18 15:37:55 +02:00
x-stp c61d1e9be6 fix(chinaz): accept empty arrays, check ValueType over truthiness
Addresses CodeRabbit review: jsoniter's ToBool returns false for empty arrays as well as missing keys, so a valid response with ContributingSubdomainList: [] would incorrectly trip the shape-mismatch branch. Switch to ValueType() != ArrayValue; the iteration loop handles empty arrays naturally (0 results, no error emitted).
2026-04-18 15:29:57 +02:00
Pepijn van der Stap 664f5b740f Merge branch 'dev' into fix/mortal-combat-round-one 2026-04-18 14:57:34 +02:00
x-stp b9ef679344 fix(chinaz): check ReadAll err, report shape mismatch instead of stale nil
Two bugs in one spot: io.ReadAll's error was never checked, so a partial/empty body fell into the else branch unnoticed; and that else branch emitted Error: err where err was whatever ReadAll returned — almost always nil. The real signal ("response didn't contain Result.ContributingSubdomainList") was lost. Check ReadAll up front and synthesize a real error for the shape-mismatch case. Also flattens the happy path.
2026-04-18 14:55:16 +02:00
x-stp 01569ae344 fix(c99): surface transport errors to results channel
Same bug as shodan: SimpleGet error path returned without sending an Error result. Emit it and increment s.errors.
2026-04-18 14:55:16 +02:00
x-stp 9760a965dd fix(shodan): surface transport errors to results channel
On session.SimpleGet failure the source returned without emitting an Error result, so stats under-reported and callers saw a silent zero. Emit the error and bump s.errors like every other source does.
2026-04-18 14:55:16 +02:00
x-stp 75f3c283f0 fix(intelx): remove dead read after decoder drained body
jsoniter.NewDecoder(resp.Body).Decode(...) drains the body, so the subsequent io.ReadAll read 0 bytes and its error branch was unreachable. Delete the dead read and drop the now-unused io import.
2026-04-18 14:55:16 +02:00
x-stp 14103b5433 fix(hackertarget): drop duplicate apikey query param 2026-04-18 14:50:35 +02:00
Pepijn van der Stap d58cda0aec Merge branch 'dev' into fix/netlas-community-cap 2026-04-18 14:42:13 +02:00
x-stp 7fc6da453d fix(netlas): cap dl size to Community limits.
Widens two 429-only branches to any non-200, moves status status check before ReadAll, and addresses "ressponse" typos; no compat breaking introductions; see #1765.
2026-04-18 14:37:51 +02:00
x-stp d6282b0a89 refactor(submd): extract ctx-aware send helpers, flatten Run() 2026-04-13 13:45:46 +02:00
x-stp 9ea2b18e41 fix(submd): guard non-200 response, ctx-aware error send 2026-04-13 08:54:58 +02:00
x-stp c64aa32dbd Merge branch 'dev' of github.com:x-stp/subfinder into feat/submd-dev
# Conflicts:
#	pkg/passive/sources.go
#	pkg/passive/sources_test.go
2026-04-09 09:29:37 +02:00
x-stp ae1c9a6e32 feat: intro sub.md passive sub dm source
Works anonymously out of the box; can work with api for more parallel req
2026-04-09 08:32:04 +02:00
Pontus Lindblom 4d9e07828b Remove dead facebook source (#1727) (#1732)
The Meta CT API has been discontinued.
2026-03-20 23:40:42 +01:00
Charles Wong 240305b985 test: add edge case coverage for resolveSourceRateLimit
- PerSourceExceedsGlobal: per-source limit > global should be honoured
  (verifies sourceRateLimitOrDefault returns source, not global)
- CaseInsensitive: source names stored lowercase must match mixed-case
  lookups (documents and verifies the ToLower normalization contract)
2026-03-11 09:21:31 -07:00
Charles Wong cf0b8017c4 test: remove dead math.MaxUint32 no-op and unused math import
Per CodeRabbit nitpick: the blank identifier assignment and math import
in TestBuildMultiRateLimiter_UnlimitedWhenNoLimits served no purpose.
The test already verifies correct behavior via NoError + NotNil assertions.
2026-03-11 09:12:06 -07:00
Charles Wong cca10d8c9c fix: initialize CustomRateLimit maps to prevent nil map panic
CodeRabbit identified that the zero-valued CustomRateLimit struct
left Custom.Map and CustomDuration.Map as nil, which could cause
a panic when resolveSourceRateLimit calls .Get() on these maps.

Mirror the initialization pattern from runner.go by explicitly
creating the underlying maps.
2026-03-11 04:06:42 -07:00
Charles Wong 6f0e11ef05 refactor: rename misleading test per review feedback 2026-03-10 14:09:07 -07:00
Charles Wong c1ce78eac9 fix(ratelimit): honour -rl global fallback and -rls duration (#1434)
Two bugs in rate limit handling:

1. Global -rl flag was ignored for sources without a per-source override.
   Only sources explicitly listed in -rls got rate-limited; all others
   ran unlimited, defeating the purpose of -rl.

2. Per-source duration from -rls (e.g. hackertarget=2/m) was silently
   dropped. runner.go stored MaxCount but discarded Duration, so all
   sources defaulted to per-second regardless of the /m or /s suffix.

Root cause: runner.go converted goflags.RateLimitMap → CustomRateLimit
but only copied MaxCount. buildMultiRateLimiter only checked per-source
limits, never falling back to the global rate.

Changes:
- Add CustomDuration field to CustomRateLimit struct
- Store both MaxCount and Duration from -rls in runner.go
- Add resolveSourceRateLimit() with clear priority:
  per-source > global > unlimited
- Guard against nil rateLimit in buildMultiRateLimiter
- Add 9 unit tests covering all combinations

Fixes #1434
2026-03-10 09:47:09 -07:00
Doğan Can Bakır 13e5db7500 bump version 2026-03-05 14:48:23 +03:00
Dogan Can Bakir 2d4f804894 Merge pull request #1723 from recepgunes1/fix/timeout-flag-not-working
Fix/timeout flag not working
2026-02-05 10:47:00 +03:00
Dogan Can Bakir a740540b8c Merge pull request #1709 from spameier/fix/leakix-require-key
fix: mark LeakIX as requiring an API key
2026-02-04 16:35:01 +03:00
Doğan Can Bakır ab19329f86 Merge branch 'dev' into fix/sources-in-alphabetical-order
Resolve conflict by adding urlscan source in alphabetical order.
2026-02-04 15:04:45 +03:00
Recep Gunes 3286f09e73 Merge branch 'projectdiscovery:dev' into fix/timeout-flag-not-working 2026-02-03 21:01:21 +03:00
Recep Gunes fba1cc3d27 fix timeout flag not working for crtsh source 2026-02-02 18:13:11 +03:00
Jigardjain 58c1e5ac82 refactor: simplify urlscan source to use session rate limiting
Remove custom pagination delay and retry logic since the session
already handles rate limiting via MultiRateLimiter. This aligns
with how other sources (shodan, virustotal) are implemented.
2026-01-30 18:05:47 +05:30
Jigardjain 675be65d47 test: skip flaky sources in TestSourcesWithoutKeys
Add leakix, reconeer, and sitedossier to ignored sources list:
- leakix: now requires API key (returns 401)
- reconeer: now requires API key (returns 401)
- sitedossier: flaky, returns no results in CI
2026-01-30 17:57:10 +05:30
Jigardjain e8c0e16d6d fix: replace deprecated errorutil with fmt.Errorf in facebook source
Replace deprecated github.com/projectdiscovery/utils/errors package
with standard Go error wrapping using fmt.Errorf to fix staticcheck
SA1019 linter errors.
2026-01-30 17:42:20 +05:30
Jigardjain 978addb8bd feat: add URLScan.io as passive subdomain source
Add URLScan.io as a new passive subdomain enumeration source with full
pagination support and robust rate limiting handling.

Features:
- Fetches subdomains from URLScan.io Search API
- Implements cursor-based pagination using search_after parameter
- Extracts domains from task.domain, task.url, page.domain, page.url fields
- Requires API key (free tier available at urlscan.io)

Rate Limiting:
- Conservative pagination delay (10s between pages) to respect strict burst limits
- Exponential backoff retry logic for 429/503 responses
- Respects X-Rate-Limit-Reset-After header for dynamic backoff
- Limited to 5 pages max (500 results) to avoid quota exhaustion

Configuration:
- Max 5 pages per enumeration (configurable via maxPages constant)
- 100 results per page (configurable via maxPerPage constant)
- 2 retry attempts for rate-limited requests
- 20 second initial backoff, doubles on each retry

Changes:
- pkg/subscraping/sources/urlscan/urlscan.go: New URLScan source implementation
- pkg/passive/sources.go: Register URLScan source
- pkg/passive/sources_test.go: Add URLScan to test lists
- pkg/runner/options.go: Add urlscan to source options
- .github/workflows/build-test.yml: Add URLSCAN_API_KEY secret

Closes: Feature request for URLScan.io integration
2026-01-30 17:02:44 +05:30
PontusLindblom b71a21bd9b Sort sources alphabetically
Ensure the order of -ls matches provider-config.yaml to
avoid confusion when comparing them.
2026-01-29 18:04:58 +01:00
spameier 1eac4a2b13 fix: mark LeakIX as requiring an API key 2026-01-21 21:38:35 +01:00
Mzack9999 4bba544dfe Merge branch 'dev' into feature/request-tracking-stats 2026-01-07 18:07:37 +04:00
Doğan Can Bakır 1ca2a67f92 add optional API key support for sources
- add KeyRequirement enum with three states: NoKey, OptionalKey, RequiredKey
- add KeyRequirement() method to Source interface
- update config generation to include optional sources
- update env var loading for optional sources
- update source listing with ~ marker for optional sources
- mark hackertarget, leakix, reconeer as OptionalKey
- fix hackertarget and reconeer to work without API key

closes #1695
2026-01-05 15:00:59 +03:00
Doğan Can Bakır 9b4705252e fix race condition in github and gitlab sources
use atomic.Int32 for counter fields to prevent data races when
multiple goroutines concurrently increment requests/results/errors
2026-01-05 14:23:20 +03:00
Doğan Can Bakır e96320ec38 add request tracking to -stats flag
Adds request counting to all sources to help users monitor API usage
and debug quota consumption issues like #1562.

Changes:
- Add Requests field to Statistics struct
- Track HTTP requests in all 53 sources
- Display request count in stats output

Closes #1698
2026-01-05 14:14:20 +03:00
Dogan Can Bakir c1977c0315 Merge pull request #1694 from projectdiscovery/add_reconeer
add reconeer
2026-01-05 17:29:41 +07:00
Doğan Can Bakır 8eacfb143a bump version 2026-01-05 11:42:17 +03:00
Dogan Can Bakir e5a61a6db7 Merge branch 'dev' into 1576_add_apikey_support_for_hackertarget 2026-01-04 22:26:01 +07:00
Doğan Can Bakır fe41f49040 add reconeer 2026-01-04 15:56:45 +03:00
nohehf 322a4336ed Merge branch 'dev' into main 2025-12-19 17:33:49 +01:00
nohehf e2d7ecfd14 fix: tests 2025-12-19 17:06:04 +01:00
Doğan Can Bakır 79a426007b bump version 2025-12-18 15:28:48 +03:00
Doğan Can Bakır 692e30a592 add thc 2025-12-18 12:24:51 +03:00
nohehf e18ed93e52 fix: implement feedback 2025-12-16 18:03:34 +01:00
nohehf 7ac8b6cfcc feat: skip merklemap if no api key 2025-12-16 17:55:13 +01:00