1
0
mirror of https://github.com/loviuz/http-chained-requests-automator.git synced 2024-12-21 12:29:50 +01:00

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(); exit();
} }
if( count($argv) == 3 ){
if( $argv[2] == 'DEBUG' ){
$debug = true;
}
}
if( !file_exists($argv[1]) ){ if( !file_exists($argv[1]) ){
usage(); usage();
echo $colors->getColoredString(' echo $colors->getColoredString('
@ -43,9 +37,10 @@ It does not seems a good JSON file!', 'green').'
exit(); exit();
} }
$debug = $requests['configuration']['debug'];
// Loop through URLs :-) // 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 // Placeholder for values extracted by regexp
$all_values = []; $all_values = [];
foreach ($requests as $request) { foreach ($requests['urls'] as $request) {
$new_values = []; $new_values = [];
// Apply regexp substitution on url, body and headers with previous values // Apply regexp substitution on url, body and headers with previous values

View File

@ -1,4 +1,10 @@
[ {
"configuration":
{
"debug": false
}
,
"urls": [
{ {
"url": "http://localhost/mysite/", "url": "http://localhost/mysite/",
"method": "GET", "method": "GET",
@ -63,4 +69,5 @@
} }
] ]
} }
] ]
}