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 all preserved
- Result filtering — query by severity, event type, or verified status
Installation
[]
= "0.5.1"
= { = "1", = ["full"] }
Prerequisite: Dalfox v3 (^3.1) must be in your system $PATH or specified via .binary_path().
Setup (one-command)
Option A: Setup script (auto-detects Go/Homebrew or downloads binary)
Option B: Go install
Option C: Homebrew
Option D: Pre-built binary
# installs to ~/.local/bin/dalfox
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
.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() |
Analyze a raw HTTP request 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