Moved debug mode to json file
This commit is contained in:
parent
008fac7376
commit
65a5e7b577
11
hcra.php
11
hcra.php
|
@ -12,12 +12,6 @@ if( count($argv) < 2 ){
|
|||
exit();
|
||||
}
|
||||
|
||||
if( count($argv) == 3 ){
|
||||
if( $argv[2] == 'DEBUG' ){
|
||||
$debug = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( !file_exists($argv[1]) ){
|
||||
usage();
|
||||
echo $colors->getColoredString('
|
||||
|
@ -43,9 +37,10 @@ It does not seems a good JSON file!', 'green').'
|
|||
exit();
|
||||
}
|
||||
|
||||
$debug = $requests['configuration']['debug'];
|
||||
|
||||
// Loop through URLs :-)
|
||||
echo $pointer." Found ".$colors->getColoredString( count($requests), 'yellow')." requests!\n\n";
|
||||
echo $pointer." Found ".$colors->getColoredString( count($requests['urls']), 'yellow')." requests!\n\n";
|
||||
|
||||
|
||||
|
||||
|
@ -55,7 +50,7 @@ $s = 1;
|
|||
// Placeholder for values extracted by regexp
|
||||
$all_values = [];
|
||||
|
||||
foreach ($requests as $request) {
|
||||
foreach ($requests['urls'] as $request) {
|
||||
$new_values = [];
|
||||
|
||||
// Apply regexp substitution on url, body and headers with previous values
|
||||
|
|
135
params.json
135
params.json
|
@ -1,66 +1,73 @@
|
|||
[
|
||||
{
|
||||
"configuration":
|
||||
{
|
||||
"url": "http://localhost/mysite/",
|
||||
"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>/"
|
||||
}
|
||||
]
|
||||
"debug": false
|
||||
}
|
||||
]
|
||||
,
|
||||
"urls": [
|
||||
{
|
||||
"url": "http://localhost/mysite/",
|
||||
"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>/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue