Example Usage
- Use a value from one HTTP message in a following HTTP message
- Redirect a request to a different server
- Change a value in a returned response
- Auto-respond to requests without first sending a request to an external server (response mocking)
- Drop a request so it is not sent to an external server (Works on all supported tools: Proxy, Repeater, Intruder, Scanner, Target, Extender (other extensions))
- Share or backup/restore Global Variables and Rules
Use a value from one HTTP message in a following HTTP message:
In the example below, we are taking the Authorization header from www.example.org requests, storing it in a variable, and setting it on www.example.com requests.
- Open the
HTTP Rulestab. - Create a Rule.
- Set the
Rule NametoGet www.example.org Authorization. - Add When ->
Event Direction(if not already added). - Change
Event DirectiontoRequest. - Add When ->
Matches Text. - Change
Message ValuetoDestination Address. - Set
Match Texttowww.example.org. - Add Then ->
Set Variable. - Change
Source Message ValuetoRequest Header. - Set
Source IdentifiertoAuthorization. - Set
Destination Variable NametoexampleAuth. - At the bottom right of the window, check
Enabledand clickSave. - Create another Rule.
- Set the
Rule NametoSet www.example.com Authorization. - Add When ->
Event Direction(if not already added). - Change
Event DirectiontoRequest. - Add When ->
Matches Text. - Change
Message ValuetoDestination Address. - Set
Match Texttowww.example.com. - Add Then ->
Set Value. - Set
Textto{{global:exampleAuth}}. - Change
Destination Message ValuetoRequest Header. - Set
Destination IdentifiertoAuthorization. - At the bottom right of the window, check
Enabledand clickSave.
Redirect a request to a different server:
In the example below, we are redirecting from www.example.org to www.example.com by setting the URL and using a message variable to make sure we keep the page path.
- Open the
HTTP Rulestab. - Create or open a Rule.
- Set a
Rule Nameand add other Whens and Thens as needed. - Add When ->
Event Direction(if not already added). - Change
Event DirectiontoRequest. - Add Then ->
Set Value. - Set
Texttohttps://www.example.com. - Change
Destination Message ValuetoURL. - At the bottom right of the window, check
Enabledand clickSave.
Change a value in a returned response:
In the example below, we tell the browser to allow any origin by overriding the Access-Control-Allow-Origin response header.
- Open the
HTTP Rulestab. - Create or open a Rule.
- Set a
Rule Nameand add other Whens and Thens as needed. - Add When ->
Event Direction(if not already added). - Change
Event DirectiontoResponse. - Add Then ->
Set Value. - Set
Textto*. - Change
Destination Message ValuetoRequest Header. - Set
Destination IdentifiertoAccess-Control-Allow-Origin. - At the bottom right of the window, check
Enabledand clickSave.
Auto-respond to requests without first sending a request to an external server (response mocking):
- Open the
Global Variablestab. - Add a new Variable.
- Set a
Variable Name. We will usemockResponsefor this example. - Paste the full response text (including headers and body) in
Variable Text. - Open the
HTTP Rulestab. - Create or open a Rule.
- Set a
Rule Nameand add other Whens and Thens as needed. - Add When ->
Event Direction(if not already added). - Change
Event DirectiontoRequest. - Add Then ->
Set Event Direction. - Change
Event DirectiontoResponse. - Add Then ->
Set Value. - Set
Textto{{global:mockResponse}}. - Change
Destination Message ValuetoResponse Message. - At the bottom right of the window, check
Enabledand clickSave.
Drop a request so that it is not sent to an external server:
The example of drop requests below works on all supported tools: Proxy, Repeater, Intruder, Scanner, Target, Extender (other extensions).
- Open the
Settingstab. - Ensure the tool is selected under
Capture Traffic From: - Open the
HTTP Rulestab. - Create or open a Rule.
- Set a
Rule Nameand add other Whens and Thens as needed. - Add When ->
Event Direction(if not already added). - Change
Event DirectiontoRequest. - (Optional) If requests are being received from multiple tools:
- Add When ->
From Tool. - Set
Toolto the tool the request will come from.
- Add When ->
- Add Then ->
Drop. - Check
Drop Message. - At the bottom right of the window, check
Enabledand clickSave.
Share or backup/restore Global Variables and Rules:
Export the relevant items:
- Open the
Global Variablestab. - Ensure relevant all variables are checked as
Persistentand saved. - Open the
Settingstab. - In the
Exportsection, clickRefresh Lists. - Check the checkboxes next to the names of relevant Rules and Global Variables that you want to export. Uncheck any others.
- Click
Export Data. - Choose a save location and name for the export data file.
Import the exported data file:
- Open the
Settingstab. - (Optional) In the
Importsection, CheckOverride Duplicatesto overwrite any Rules or Global Variables that have the same name as those to be imported. - Click
Import Data. - Navigate to the location of the export data file, select it, and click
Open.