Create LSR files manually
This document describes how to create .lsr files in Invicti Platform manually. For an overview of the LSR files, refer to the LSR files overview document.
Creating LSR files manually involves these five simple steps:
- Step 1: Navigate to the target application
- Step 2: Open the login form (if necessary)
- Step 3: Identify login elements
- Step 4: Construct JSON file
- Step 5: Save and upload
Step 1: Navigate to the target application
- Open Google Chrome and navigate to the login page of your target application.
- Copy the URL of the login page as it is needed in the LSR file.
Step 2: Click to open the login form (if necessary)
- If the login form is behind a button or a menu (for example, a "Sign In" link on the homepage), locate the button.
- Right-click the button, select Inspect, then copy the XPath or CSS selector.
Step 3: Identify login elements using Chrome DevTools
- Right-click on the username input field and select Inspect.
- Locate the XPath or CSS selector of the input field.
- Right-click the highlighted HTML element, hover over Copy, and select Copy XPath or Copy selector.
- Repeat this process for the password field and login button.
- If the login process includes additional steps (for example, OTP input), capture those elements as well.
Step 4: Construct the JSON file
Using a text editor, create a new file and structure it as follows:
{
"actions": [
{
"parameters": {
"friendly": "http://yourdomain.com"
},
"target": "http://yourdomain.com",
"timeout": 22000,
"type": "navigate"
},
{
"parameters": {
"friendly": "A with text \"Your profile\"",
"alt_targets": [
{
"type": "xpath",
"value": "//a[@href='userinfo.php' and contains(text(), 'Your profile')]"
},
{
"type": "css",
"value": "#sectionLinks > ul > li:nth-child(5) > a"
}
]
},
"target": "//a[@href='userinfo.php' and contains(text(), 'Your profile')]",
"timeout": 20000,
"type": "click"
},
{
"parameters": {
"value": "test",
"friendly": "INPUT named uname",
"alt_targets": [
{
"type": "xpath",
"value": "//input[@name='uname' and @type='text']"
},
{
"type": "css",
"value": "#content > div:nth-child(1) > form > table > tbody > input[type=\"text\"]"
}
]
},
"target": "//input[@name='uname' and @type='text']",
"timeout": 20000,
"type": "change"
},
{
"parameters": {
"value": "test",
"friendly": "INPUT named pass",
"password": true,
"alt_targets": [
{
"type": "xpath",
"value": "//input[@name='pass' and @type='password']"
},
{
"type": "css",
"value": "#content > divinput[type=\"password\"]"
}
]
},
"target": "//input[@name='pass' and @type='password']",
"timeout": 20000,
"type": "change"
},
{
"parameters": {
"friendly": "login",
"alt_targets": [
{
"type": "xpath",
"value": "//input[@type='submit' and @value='login']"
},
{
"type": "css",
"value": "#content > input[type=\"submit\"]"
}
]
},
"target": "//input[@type='submit' and @value='login']",
"timeout": 20000,
"type": "click"
}
],
"detection": {
"type": "statusis",
"pattern": "200",
"request": "GET http://yourdomain.com/userinfo.php HTTP/1.1\n\n",
"headers": []
},
"restrictions": [
"GET http://yourdomain.com/logout.php HTTP/1.1"
],
"config": {
"viewport": {
"width": 688,
"height": 612,
"screenWidth": 2560,
"screenHeight": 1440
},
"restrictedElements": [
{
"path": "//a[@href='logout.php']",
"source": "auto",
"ref": "GET http://yourdomain.com/logout.php HTTP/1.1"
}
]
}
}
Step 5: Save and upload the JSON file
- Save the file with a .lsr extension (for example,
my_login.lsr). - Select Inventory > Targets from the left-side menu.
- Select three-dot menu (⋮) > Edit target by the specific target you want to edit.
- In the Authentication section select Login Sequence Recorder from drop-down.
- Select Upload sequence to select and import your saved .lsr file.
Additional configuration options
- Timeouts: Adjust
timeoutvalues to prevent premature failures. - Viewports: Define
viewportsizes to simulate different screen resolutions.
Need help?
Invicti Support team is ready to provide you with technical help. Go to Help Center
Was this page useful?