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').' 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! // Execute the request!
$client = new \GuzzleHttp\Client(); $client = new \GuzzleHttp\Client();
$response = $client->request( $response = $client->request(
$request['method'], $request['method'],
replace_values($request['url'], $all_values), replace_values($request['url'], $all_values),
[ $guzzle_options
'body' => $request['body'],
'headers' => $headers,
]
); );
// Get values from regexp on headers // Get values from regexp on headers

View File

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