Scripting
rwalk supports scripting with the rhai (opens in a new tab) scripting language. You can use scripting to implement custom directory detection functions, custom filters, or any other custom logic you need.
Directory detection
You can provide a custom directory detection script to rwalk in the form of a rhai script. The script must return a boolean value indicating whether a path is a directory or not.
It can be passed to rwalk using the --directory-script (--dr) option.
Here is an example of a custom directory detection script:
if response.headers.get("content-type") == "text/html" {
return true;
}
return false;rwalk example.com --directory-script custom_directory_detection.rhaiYou have access to the following variables:
| Variable | Description | Type |
|---|---|---|
response | The response data (compact version of reqwest's Response) | ScriptingResponse (opens in a new tab) |
opts | The options passed to rwalk | Opts (opens in a new tab) |
Filters
Custom filters can also be implemented using rhai. Filters must return a boolean value indicating whether a response should be kept or not.
To pass a custom filter script to rwalk, use it's path with the --filter (-f) option.
rwalk example.com --filter custom_filter.rhai:argumentHere is an example of a custom filter script:
if response.body.contains(input) {
return true;
}
return false;You have access to the following variables:
| Variable | Description | Type |
|---|---|---|
response | The response data (compact version of reqwest's Response) | ScriptingResponse (opens in a new tab) |
opts | The options passed to rwalk | Opts (opens in a new tab) |
input | The argument passed to the filter | String (opens in a new tab) |
Interactive mode
Scripting is available through the eval command in the interactive mode (--interactive, -i). You can use this to easily analyze the reponses or run custom logic.
Here are the available variables:
| Variable | Description | Type |
|---|---|---|
tree | If the scan is complete, the tree of found URLs | TreeNode<TreeData> (opens in a new tab) |
opts | The options passed to rwalk | Opts (opens in a new tab) |