Moved debug mode to json file

This commit is contained in:
loviuz 2021-02-05 00:02:51 +01:00
parent 008fac7376
commit 65a5e7b577
2 changed files with 74 additions and 72 deletions

View File

@ -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

View File

@ -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>/"
}
]
}
]
}