dalfox-rs
Available on Crates.io: https://crates.io/crates/dalfox-rs
A strictly-typed, asynchronous Rust binding for the Dalfox XSS Scanner (v3+).
dalfox-rs wraps the Dalfox binary, parses its JSON output into typed Rust structs, and makes XSS scanning composable inside fuzzers, proxies, or CI/CD pipelines.
Features
- Dalfox v3 CLI — scan, file, and pipe modes with typed builder flags
- Dalfox v3 finding shape — parses v3 JSON without legacy
poc; usefinding.poc_url()orfinding.data - Streaming callbacks —
*_streamingmethods use--format jsonland emit findings as lines when present - Stored XSS —
--sxss/--sxss-urlondalfox scan - Multi-format output — JSON, CSV, Markdown, and plain text via
format_as() - Diagnostic capture — stderr, parse errors, exit codes, structured Dalfox error JSON
- Result filtering — query by severity, event type, or verified status
Not yet wired
These upstream Dalfox v3 flags are not exposed by the builder or argv helpers today:
--input-type raw-http/--input-type har(file mode scans URL lists only; seescan_file_raw()docs)- Blind OOB variants beyond
--blind(--blind-oob*, custom blind payloads) --format sarif/--format toml--config,--dry-run,--encoders,--force-waf,--include-request,--max-concurrent-targets--retry-delay,--stream-findings,--waf-bypass--sxss-method,--sxss-retries
Gap tests in tests/gap.rs pin each cluster until wired or explicitly rejected.
Installation
[]
= "0.5.5"
= { = "1", = ["full"] }
Prerequisite: Dalfox v3 (major ≥ 3) must be in your system $PATH or specified via .binary_path().
MSRV: rust-version in Cargo.toml is the minimum to build the library (cargo check). Running the full test suite may require a newer stable toolchain because of dev-dependencies (see CI).
Dalfox binary (required)
From crates.io (recommended): install the upstream scanner separately:
From a git checkout of this repo: the repo includes setup.sh (not shipped in the crates.io tarball):
# or: ./setup.sh --binary # download to ~/.local/bin
Homebrew: brew install dalfox
Pipe mode and Docker shims
scan_pipe() writes URLs to Dalfox stdin. If you wrap the binary with Docker, the shim must keep stdin open (docker run -i or equivalent). A non-interactive docker run without -i drops stdin and Dalfox may return NO_TARGETS.
Quick Start
use ;
async
Streaming Output
*_streaming methods pass --format jsonl to Dalfox. Each verified finding line is parsed and forwarded to your callback as it arrives (meta-only lines are ignored):
let result = runner.scan_url_streaming.await?;
Stored XSS (sxss mode)
Detect persistent XSS via separate injection and trigger URLs:
let result = runner.scan_sxss.await?;
Advanced Configuration
let runner = builder
.waf_evasion
.cookie
.header
.delay
.rate_limit
.scan_timeout
.retries
.insecure
.param // repeated --param id --param q --param lang
.payload // file path for --custom-payload
.blind_callback
.follow_redirects
.ignore_return
.binary_path
.build;
Result Filtering
let verified = result.verified_findings;
let critical = result.high_severity_findings;
if result.has_parse_errors
Execution Modes
| Mode | Method | Description |
|---|---|---|
| URL | scan_url() |
Scan a single target URL |
| File | scan_file_raw() |
Scan targets from a newline-separated URL list file |
| Pipe | scan_pipe() |
Pipeline multiple URLs via stdin |
| Stored XSS | scan_sxss() |
Detect persistent XSS |
All modes have _streaming variants for jsonl finding callbacks.
License
MIT License