scan_url function is the primary entry point for WAF detection. It sends multiple probes to a target URL and analyzes the responses to identify WAF signatures.
Function signature
Parameters
The target URL to scan. Must be a valid HTTP or HTTPS URL.
Configuration for the scan behavior, including timeout, redirect handling, and proxy settings.See the Configuration page for details.
Optional callback function invoked after each probe completes.The callback receives a reference to the
ProbeResult and returns a bool:- Return
trueto continue with remaining probes - Return
falseto stop scanning immediately
Return type
Returns
Ok(Some(ProbeResult)) with the last probe result if scanning completes successfully.Returns Ok(None) if no probes were executed (unlikely in normal operation).Returns Err(ScanError) if an error occurs during scanning.Probe sequence
The function executes the following probes in order:- Plain request - Baseline request to the original URL
- XSS probe - Adds parameter
q=<script>alert(1)</script> - SQL injection probe - Adds parameter
id=' OR '1'='1' - LFI probe - Adds parameter
file=../../../../etc/passwd
ProbeResult with detected WAFs (if any).
Callback mechanism
The optional callback function allows you to:- Display progress during scanning
- Log each probe result
- Terminate scanning early when a WAF is detected
- Collect results for custom analysis
Callback example
Complete working example
Here’s a full example demonstrating different scan configurations:Error handling
The function can return the following errors:InvalidProxy- The proxy configuration is invalidClientBuild- Failed to build the HTTP clientRequest- A network request failed