Docs
Scripting

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:

custom_directory_detection.rhai
if response.headers.get("content-type") == "text/html" {
    return true;
}
return false;
rwalk example.com --directory-script custom_directory_detection.rhai

You have access to the following variables:

VariableDescriptionType
responseThe response data (compact version of reqwest's Response)ScriptingResponse (opens in a new tab)
optsThe options passed to rwalkOpts (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:argument

Here is an example of a custom filter script:

custom_filter.rhai
if response.body.contains(input) {
    return true;
}
return false;

You have access to the following variables:

VariableDescriptionType
responseThe response data (compact version of reqwest's Response)ScriptingResponse (opens in a new tab)
optsThe options passed to rwalkOpts (opens in a new tab)
inputThe argument passed to the filterString (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:

VariableDescriptionType
treeIf the scan is complete, the tree of found URLsTreeNode<TreeData> (opens in a new tab)
optsThe options passed to rwalkOpts (opens in a new tab)