Added support to Guzzle options

This commit is contained in:
loviuz 2021-01-23 15:26:56 +01:00
parent acbfee0e55
commit 09316776e5
2 changed files with 46 additions and 16 deletions

View File

@ -85,16 +85,21 @@ foreach ($requests as $request) {
echo $colors->getColoredString('[>]', 'red').' '.$colors->getColoredString('BODY :', 'cyan').' '.$colors->getColoredString($request['body'], 'yellow').'
';
$guzzle_options = [
'body' => $request['body'],
'headers' => $headers,
];
if( isset($request['extra_guzzle_options']) ){
$guzzle_options = array_merge( $guzzle_options, $request['extra_guzzle_options'][0] );
}
// Execute the request!
$client = new \GuzzleHttp\Client();
$response = $client->request(
$request['method'],
replace_values($request['url'], $all_values),
[
'body' => $request['body'],
'headers' => $headers,
]
$guzzle_options
);
// Get values from regexp on headers

View File

@ -1,19 +1,36 @@
[
{
"url": "http://localhost/mysite/login",
"method": "POST",
"url": "http://localhost/mysite/",
"method": "GET",
"headers": null,
"body": "username=admin&password=s3cr3t",
"body": null,
"header-regexp": [
{
"next_url": "/Location: (.+?)$/"
},
{
"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",
@ -24,18 +41,26 @@
"header-regexp": null,
"body-regexp": [
{
"email": "/<p>Your email is: (.+?)<\\/p>/"
"email": "/<p>Your email is (.+)!<\\/p>/"
}
]
},
{
"url": "http://localhost/mysite/sign-up",
"method": "POST",
"url": "http://localhost§next_url§?email=§email§",
"method": "GET",
"headers": {
"Cookie": "§cookie§"
},
"body": "op=signup&email=§email§",
"header-regexp": null,
"body-regexp": null
"body": null,
"header-regexp": [
{
"flag1": "/Set-Cookie: flag2=(.+?);/"
}
],
"body-regexp": [
{
"flag2": "/<p>Congratulations, the flag is: (.+?)<\\/p>/"
}
]
}
]