Skip to content

Fix/attack cookies option - #48

Merged
HC-ONLINE merged 2 commits into
mainfrom
fix/attack-cookies-option
Aug 11, 2026
Merged

Fix/attack cookies option#48
HC-ONLINE merged 2 commits into
mainfrom
fix/attack-cookies-option

Conversation

@HC-ONLINE

Copy link
Copy Markdown
Owner

Description
Fixes the --cookies CLI/API option being silently ignored by the attack service, and unifies how cookies are passed across all services (session jar in the HTTPClient constructor instead of mixed per-request kwargs).
Fix:

  • HTTPClient.init now accepts cookies: dict[str, str] | None and passes them to the underlying httpx.Client cookie jar.
  • attack_service passes AttackOptions.cookies into the constructor — the attack modules were previously sending requests without the session cookies, causing authenticated targets to redirect to login (e.g. DVWA).
    Unification (analyze + scrape services):
  • analyze_service: _analyze_headers and _fingerprint now pass cookies=options.cookies or None to the HTTPClient constructor instead of per-request client.get(url, cookies=...).
  • scrape_service: _build_http_client accepts cookies; _get_static_scraper_with_proxy builds a dedicated client (with cookie jar) when cookies are present; ScrapeConfig.cookies no longer set from the service to avoid double-sending.
  • Result: all four services (attack, analyze, scrape, quick) follow the same pattern — cookies configured once at client construction. Core ScrapeConfig.cookies (per-request) remains supported for direct core-level users (documented API, unchanged behavior).
    Tests: test_scrape_service.py updated to expect cookies=None in the HTTPClient construction assertion.
    Related Issue
    N/A — discovered during live validation against DVWA (authenticated scan redirected to login because cookies were never sent).
    Type of Change
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
    Checklist
  • I have followed the style guidelines of this project (Ruff & Pyright)
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes (108 tests: analyze 39, scrape service 17, quick 22, static core 30)
  • I have updated the documentation accordingly

@HC-ONLINE
HC-ONLINE merged commit d581d7b into main Aug 11, 2026
0 of 3 checks passed
@HC-ONLINE
HC-ONLINE deleted the fix/attack-cookies-option branch August 11, 2026 18:20
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.

1 participant