Skip to content

klyrek-cli

Status: built, not yet on PyPI (blocked on PyPI's new-project rate limit) — install from source

Ties every package into the klyrek crawl / klyrek dashboard commands — see the full CLI Reference for every flag.

Programmatically, the same pipeline is available directly:

from klyrek_cli.pipeline import PipelineOptions, run_scan

options = PipelineOptions(max_depth=4, run_js=True, run_assets=True, extra_hosts=["*.sandbox.klyrek.com"])
result = run_scan("https://shop.sandbox.klyrek.com", options=options)

See The Scan Pipeline for exactly what run_scan() does, stage by stage.

No CLI installed yet?

If you're running from source without the klyrek console script available, use the repo's klyrek.py wrapper instead — see Getting Started.

API reference

klyrek_cli.pipeline

Orchestrate every Klyrek recon package into a single scan pipeline.

PipelineOptions dataclass

PipelineOptions(max_pages: int = 100, max_depth: int = 3, rate_limit_per_host: float = 5.0, user_agent: str | None = None, extra_hosts: list[str] = list(), run_tech: bool = True, run_headers: bool = True, run_api: bool = True, run_auth: bool = True, run_js: bool = True, run_assets: bool = True)

Every CLI-tunable knob for a scan, decoupled from argument parsing for testability.

run_scan

run_scan(target_url: str, options: PipelineOptions | None = None, transport: BaseTransport | None = None) -> ScanResult

Run the full Klyrek recon pipeline against an authorized target URL.

Source code in klyrek_cli\pipeline.py
def run_scan(
    target_url: str,
    options: PipelineOptions | None = None,
    transport: httpx.BaseTransport | None = None,
) -> ScanResult:
    """Run the full Klyrek recon pipeline against an authorized target URL."""
    options = options or PipelineOptions()
    hostname = urlsplit(target_url).hostname
    if not hostname:
        raise ValueError(f"Could not determine a hostname from '{target_url}'")

    scope = AuthorizationScope(authorized_hosts=[hostname, f"*.{hostname}", *options.extra_hosts])
    target = Target(base_url=target_url, hosts=[hostname])

    with KlyrekHTTPClient(scope, config=_build_config(options), transport=transport) as client:
        result = Crawler(client, max_pages=options.max_pages, max_depth=options.max_depth).crawl(
            target
        )
        _enrich_pages(client, result, options)
        _enrich_scripts(client, result, options)
        _enrich_forms(result, options)
        _enrich_api(client, result, options)
        _enrich_assets(client, result, options)
        _enrich_discovered_endpoints(client, result, options)

    return result

klyrek_cli.main

CLI entry point: klyrek crawl <url> [options].