544 Commits

Author SHA1 Message Date
Ayan Rajpoot 7fd08b7f8d Add support for duplicate custom request headers (#2504)
* refactor: change CustomHeaders to support multiple values per header

* fix: clear existing header values before setting custom headers

* harden headers

* expand tests

---------

Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
2026-06-04 14:21:55 +02:00
Kral d0081af3ec fix: improve error handling and fix bugs (#2499)
* code quality: improve error handling and fix bugs

- Fix bug: return err instead of closeErr in DecodeData error path (httpx.go)
- Improve error handling for strconv.Atoi calls in multiple locations
- Change hammingDistanceThreshold from var to const since it's never modified
- Fix redundant return statement in ListFilesWithPattern
- Improve port parsing to handle empty port strings explicitly

* runner: keep input counters incrementing under -skip-dedupe

Revert the defensive strconv.Atoi guard around the SkipDedupe branches:
values stored in r.hm are always integer strings written by this same
code path, so the parseErr/cnt>0 check is unreachable in practice, and
when taken literally it skipped the numHosts/numTargets increment for
duplicate inputs.

---------

Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
2026-05-20 06:41:57 +02:00
Dogan Can Bakir 6c34d93168 feat: honor HTTP_PROXY/HTTPS_PROXY env vars when -proxy is unset (#2493)
Falls back to http.ProxyFromEnvironment for the HTTP transport and
reads the same vars manually for the headless launcher (chromedp
does not read env).

Closes #2492
2026-05-13 21:24:40 +02:00
Dogan Can Bakir 0dc2c9fe61 fix(db): persist CPE column in postgres and mysql writers (#2494)
* fix(db): persist CPE in postgres and mysql (#2487)

Adds cpe column to both SQL schemas, idempotent migration for
existing tables, and JSON binding in InsertBatch.

* adding comment note

* fixing lint

---------

Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
2026-05-13 21:22:02 +02:00
Doğan Can Bakır 98e6af00f0 Merge remote-tracking branch 'origin/dev' into pr-2462
# Conflicts:
#	runner/runner_test.go
2026-05-06 16:22:17 +03:00
Mzack9999 7d765f4372 adding ip aware dedup 2026-03-22 13:59:22 +01:00
Mzack9999 3adf9cef13 fixing output writing 2026-03-22 13:35:16 +01:00
Mzack9999 2e901d06e9 adding tests 2026-03-20 23:51:54 +01:00
usernametooshort 5fbde5afd9 fix(runner): add mutex to testAndSet to prevent race condition
testAndSet performs a non-atomic read-then-write sequence:
1. seen(k) - check if key exists
2. setSeen(k) - set the key

Without synchronization, two concurrent goroutines can both pass the
seen() check before either calls setSeen(), causing duplicate
processing of the same target.

This race can occur in processTargets() where multiple goroutines
call testAndSet() for discovered TLS SubjectAN/SubjectCN values.

The fix adds a sync.Mutex to serialize testAndSet operations.
2026-03-06 09:33:09 +01:00
Dogan Can Bakir ed0f6af683 Merge pull request #2344 from ayuxsec/feat-add-md-output-support
Add Markdown output support
2026-03-05 14:16:46 +03:00
Doğan Can Bakır 91c489e75d bump version 2026-03-05 14:12:46 +03:00
Dogan Can Bakir 3f1541a94c Merge pull request #2351 from projectdiscovery/2350_fix_resolver_parsing
fix resolver parsing
2026-03-05 14:08:10 +03:00
Doğan Can Bakır 0e3ceee5d0 fix: use fmt.Fprintf instead of WriteString(fmt.Sprintf) in healthcheck 2026-03-03 21:03:32 +03:00
Doğan Can Bakır b97e22b6ae fix: address PR review feedback
- Add Deprecated comment to OutputFilterErrorPage field
- Coerce PageType to string for safe type assertion
2026-03-03 21:03:32 +03:00
Doğan Can Bakır f4272cbc0f refactor: lazy init dit classifier, prefer headless body for classification 2026-03-03 21:03:32 +03:00
Doğan Can Bakır 8d99c3034f fix: suppress errcheck lint for deferred file close 2026-03-03 21:03:32 +03:00
Doğan Can Bakır 1c4561ba07 feat: replace page classifier with dit, add -fpt flag
Closes #2403
2026-03-03 21:03:32 +03:00
Dogan Can Bakir 4311f8b736 Merge pull request #2363 from projectdiscovery/feature/database-output
feat: add database output support for storing scan results
2026-03-03 21:01:43 +03:00
ayuxsec c52b709976 Merge branch 'dev' into feat-add-md-output-support 2026-02-05 19:51:42 +05:30
ayuxsec@proton.me 299cb60871 merge: reconcile Result struct md tags with dev fields 2026-02-05 19:45:14 +05:30
Adel Assakaf fa950239f2 fix: prevent data loss on interrupt by implementing graceful shutdown 2026-02-05 05:03:40 +01:00
Doğan Can Bakır 8080434e71 warn when resolver looks like file path but doesn't exist 2026-02-04 15:58:16 +03:00
Dogan Can Bakir 412eb2d533 bump version to v1.8.1 (#2381)
* bump version to v1.8.1

* version update

---------

Co-authored-by: PDTeamX <8293321+ehsandeep@users.noreply.github.com>
2026-01-22 14:09:18 +05:30
Dogan Can Bakir 96ac054c2c Merge branch 'dev' into feature/database-output 2026-01-19 21:18:38 +07:00
Mzack9999 fb1ea1c9aa Merge branch 'dev' into feature/secret-file-auth 2026-01-12 15:41:54 +04:00
Dogan Can Bakir f6aa1590eb Merge pull request #2372 from projectdiscovery/feature/input-mode-burp
feat: add burp xml input mode support (-im flag)
2026-01-12 18:39:15 +07:00
Mzack9999 f445b0aa72 docs update + flags validation + debug logging 2026-01-12 15:34:24 +04:00
Doğan Can Bakır 430e33f9a1 fix: address coderabbit review comments
- Handle error from format.Parse in streamInput
- Add InputMode validation to ValidateOptions for early error detection
- Extract duplicate format validation to getInputFormat helper
- Fix shadow variable err in loadFromFormat callback
- Add bounds check in test before index access
- Add test for malformed XML input
- Run go mod tidy to fix dependency marking
2026-01-12 14:23:54 +03:00
Doğan Can Bakır 0f5141b0d7 feat: add burp xml input mode support (-im flag) 2026-01-12 14:13:31 +03:00
Doğan Can Bakır b60bfa24db feat: add secret file authentication support (-sf flag) 2026-01-12 14:03:07 +03:00
Doğan Can Bakır c1c1fd0a76 refactor: use batcher utility and StringVarEnv 2026-01-12 12:29:38 +03:00
Doğan Can Bakır 2ea576f175 feat: add database output support for storing scan results
Add support for storing httpx scan results directly to databases with
both CLI flags and YAML config file options.

Supported databases:
- MongoDB
- PostgreSQL
- MySQL

Features:
- Batched writes for performance (configurable batch size)
- Auto-flush with configurable interval
- Individual columns for each Result field (not JSON blob)
- Support for environment variable HTTPX_DB_CONNECTION_STRING
- Option to omit raw request/response data (-rdbor)

New CLI flags under OUTPUT group:
- -rdb, -result-db: enable database storage
- -rdbc, -result-db-config: path to YAML config file
- -rdbt, -result-db-type: database type (mongodb, postgres, mysql)
- -rdbcs, -result-db-conn: connection string
- -rdbn, -result-db-name: database name (default: httpx)
- -rdbtb, -result-db-table: table/collection name (default: results)
- -rdbbs, -result-db-batch-size: batch size (default: 100)
- -rdbor, -result-db-omit-raw: omit raw data

Closes #1973
Closes #2360
Closes #2361
Closes #2362
2026-01-12 12:25:22 +03:00
Wlayzz f144424bb8 fix: update Host header for favicon requests after redirects
When FollowRedirects is enabled and the target redirects to a different host
(e.g., hackerone.com -> www.hackerone.com), the favicon URL is correctly
resolved to the final host, but the cloned request's Host header still
contains the original host. This causes the server to return 404 because
the Host header doesn't match the URL.

This fix updates the Host header to match the resolved URL host before
making the favicon request.
2026-01-11 23:50:45 +01:00
Mzack9999 048c43f2d0 Merge branch 'dev' into pr/2226 2026-01-09 20:48:49 +04:00
Mzack9999 07b45faf94 fixing index generation 2026-01-09 20:47:11 +04:00
Doğan Can Bakır 81461d35e8 feat: add passive CPE and WordPress detection
Add support for passive detection of CPE (Common Platform Enumeration)
identifiers and WordPress plugins/themes using awesome-search-queries.

CPE Detection (-cpe flag):
- Matches response title, body, and favicon hash against patterns
- Extracts product, vendor, and generates CPE 2.3 identifiers
- Uses patterns from Shodan, FOFA, Google dorks

WordPress Detection (-wp flag):
- Detects plugins via /wp-content/plugins/[name]/ patterns
- Detects themes via /wp-content/themes/[name]/ patterns
- Validates against known plugins/themes list

New CLI flags in PROBES group:
- -cpe: display CPE based on awesome-search-queries
- -wp, -wordpress: display WordPress plugins and themes

Both are automatically included in JSON/CSV output.

Closes #1975
2026-01-06 13:22:43 +03:00
Doğan Can Bakır 822257198b fix resolver parsing 2026-01-03 18:45:09 +03:00
Doğan Can Bakır 6399f78080 refactor: dynamic markdown header/row generation from struct tags 2026-01-03 18:05:13 +03:00
Doğan Can Bakır bad939e139 refactor: make MarkdownHeader a method on Result 2026-01-03 17:51:16 +03:00
Doğan Can Bakır 3bcbe1b3b1 fix: handle errcheck lint errors 2026-01-03 17:44:30 +03:00
majiayu000 7cfcff31be fix: probe-all-ips now works correctly when URL contains port
Use URL.Hostname() instead of URL.Host to extract the hostname for DNS
resolution. This ensures the port number is not included in the DNS
query when probing all IPs for a URL like http://example.com:8080.

Fixes #2346

Signed-off-by: majiayu000 <1835304752@qq.com>
2026-01-02 11:59:10 +08:00
ayuxsec b1f4809c2c fix(mdoutput): Fix duplicate “.md” extension when using -o with -md flag
* Consolidate output‑type checks into a single `jsonOrCsvOrMD` variable.
* Adjust file‑opening logic to add the “.md” suffix only when needed.
* Update related conditionals to respect the new combined flag handling.
* Ensure markdown output is correctly written without creating “.md.md” files.
2025-12-27 04:54:56 +05:30
ayuxsec cabc1aef20 fix(md output): always include Title & CDN columns and escape URLs. 2025-12-27 00:44:57 +05:30
ayuxsec 15177106a4 fix(md output): emit markdown table header only once per run
- Split Markdown generation into `MarkdownHeader` and `MarkdownRow` for clearer separation.
- Remove body‑preview block from Markdown rows.
- Add guard in runner to write the header only once per run.
2025-12-27 00:31:56 +05:30
ayuxsec f53b945a5c Add Markdown output support
- Introduce `MarkDownOutput` flag and CLI option (`-markdown` / `-md`).
- Implement `Result.MarkdownOutput` to generate a formatted Markdown table with optional title and CDN columns, and a response body preview.
- Add markdown escaping helper.
- Update runner to create `.md` output file, handle markdown generation per result, and write to file or stdout.
- Adjust option parsing and related logic to include markdown handling.
2025-12-26 17:37:29 +05:30
Mzack9999 7e6003ca51 fixing comment 2025-12-24 15:11:53 +04:00
Mzack9999 78bf9c393a restoring original logic + limiting read to 512Mb + lint 2025-12-24 15:00:10 +04:00
Connor Larson 2773b08d8b changed max response to save and read to 10MB, the common/httpx default 2025-12-22 12:29:06 -07:00
PDTeamX ebce9e7301 version update 2025-12-09 00:51:06 +05:30
PDTeamX b3d1fd23f9 fix: use net.JoinHostPort for IPv6 support in protocol fallback
String concatenation doesn't properly handle IPv6 addresses which need brackets.
Example: [::1]:443 would become ::1:80 instead of [::1]:80

Uses net.JoinHostPort() which correctly formats IPv6 addresses.
2025-12-09 00:47:36 +05:30