Updated Readme and usage
This commit is contained in:
parent
4a70df7ea6
commit
277ee484ac
156
README.md
156
README.md
|
@ -22,83 +22,107 @@ $ php composer.phar install
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ php hcra.php params.json [DEBUG]
|
$ php hcra.php params.json
|
||||||
```
|
```
|
||||||
|
|
||||||
- params.json: is the filename of the JSON file with specifications of the HTTP requests
|
- params.json: is the filename of the JSON file with specifications of the HTTP requests
|
||||||
- DEBUG: use only for debug purpose. It additionally prints out the body response of every HTTP request
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
To configure HTTP request you have to code your custom JSON file. You can start from the example in the repository:
|
To configure HTTP request you have to code your custom JSON file. You can start from the example in the repository:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
[
|
{
|
||||||
|
"configuration":
|
||||||
{
|
{
|
||||||
"url": "http://localhost/mysite/",
|
"verbose_level": 1
|
||||||
"method": "GET",
|
|
||||||
"headers": null,
|
|
||||||
"body": null,
|
|
||||||
"header-regexp": [
|
|
||||||
{
|
|
||||||
"cookie": "/Set-Cookie: (.+?)$/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"body-regexp": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "http://localhost/mysite/",
|
|
||||||
"method": "POST",
|
|
||||||
"headers": {
|
|
||||||
"Cookie": "§cookie§",
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded"
|
|
||||||
},
|
|
||||||
"body": "username=admin&password=s3cr3t",
|
|
||||||
"header-regexp": [
|
|
||||||
{
|
|
||||||
"next_url": "/Location: (.+)/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"body-regexp": null,
|
|
||||||
"extra_guzzle_options": [
|
|
||||||
{
|
|
||||||
"allow_redirects": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "http://localhost§next_url§",
|
|
||||||
"method": "GET",
|
|
||||||
"headers": {
|
|
||||||
"Cookie": "§cookie§"
|
|
||||||
},
|
|
||||||
"body": null,
|
|
||||||
"header-regexp": null,
|
|
||||||
"body-regexp": [
|
|
||||||
{
|
|
||||||
"email": "/<p>Your email is (.+)!<\\/p>/"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "http://localhost§next_url§?email=§email§",
|
|
||||||
"method": "GET",
|
|
||||||
"headers": {
|
|
||||||
"Cookie": "§cookie§"
|
|
||||||
},
|
|
||||||
"body": null,
|
|
||||||
"header-regexp": [
|
|
||||||
{
|
|
||||||
"flag1": "/Set-Cookie: flag2=(.+?);/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"body-regexp": [
|
|
||||||
{
|
|
||||||
"flag2": "/<p>Congratulations, the flag is: (.+?)<\\/p>/"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
,
|
||||||
|
"urls": [
|
||||||
|
{
|
||||||
|
"title": "First open to get the cookie",
|
||||||
|
"url": "http://localhost/mysite/",
|
||||||
|
"method": "GET",
|
||||||
|
"headers": null,
|
||||||
|
"body": null,
|
||||||
|
"header-regexp": [
|
||||||
|
{
|
||||||
|
"cookie": "/Set-Cookie: (.+?)$/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body-regexp": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Login",
|
||||||
|
"url": "http://localhost/mysite/",
|
||||||
|
"method": "POST",
|
||||||
|
"headers": {
|
||||||
|
"Cookie": "§cookie§",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded"
|
||||||
|
},
|
||||||
|
"body": "username=admin&password=s3cr3t",
|
||||||
|
"header-regexp": [
|
||||||
|
{
|
||||||
|
"next_url": "/Location: (.+)/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body-regexp": null,
|
||||||
|
"extra_guzzle_options": [
|
||||||
|
{
|
||||||
|
"allow_redirects": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Get the email",
|
||||||
|
"url": "http://localhost§next_url§",
|
||||||
|
"method": "GET",
|
||||||
|
"headers": {
|
||||||
|
"Cookie": "§cookie§"
|
||||||
|
},
|
||||||
|
"body": null,
|
||||||
|
"header-regexp": [
|
||||||
|
{
|
||||||
|
"content_type": "/Content-Type: (.+)/",
|
||||||
|
"pragma": "/Pragma: (.+)/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body-regexp": [
|
||||||
|
{
|
||||||
|
"email": "/<p>Your email is (.+)!<\\/p>/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"header-expected":
|
||||||
|
{
|
||||||
|
"content_type": "text/html; charset=UTF-8",
|
||||||
|
"pragma": "no-cache"
|
||||||
|
},
|
||||||
|
"body-expected":
|
||||||
|
{
|
||||||
|
"email": "dude@dudelang.com"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Get the flags",
|
||||||
|
"url": "http://localhost§next_url§?email=§email§",
|
||||||
|
"method": "GET",
|
||||||
|
"headers": {
|
||||||
|
"Cookie": "§cookie§"
|
||||||
|
},
|
||||||
|
"body": null,
|
||||||
|
"header-regexp": [
|
||||||
|
{
|
||||||
|
"flag1": "/Set-Cookie: flag2=(.+?);/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body-regexp": [
|
||||||
|
{
|
||||||
|
"flag2": "/<p>Congratulations, the flag is: (.+?)<\\/p>/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Every JSON object is an HTTP request with specific parameters:
|
Every JSON object is an HTTP request with specific parameters:
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
{
|
{
|
||||||
"configuration":
|
"configuration":
|
||||||
{
|
{
|
||||||
"verbose_level": 1
|
"verbose_level": 2
|
||||||
}
|
},
|
||||||
,
|
|
||||||
"urls": [
|
"urls": [
|
||||||
{
|
{
|
||||||
"title": "First open to get the cookie",
|
"title": "First open to get the cookie",
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 233 KiB |
Loading…
Reference in New Issue