diff --git a/config.php b/config.php index cccc5ad..c0e94e3 100644 --- a/config.php +++ b/config.php @@ -5,5 +5,6 @@ $DEFAULT_ARGS = [ 'PS' => 'ssh,http,https,msrpc,microsoft-ds', 'F' => true, 'T5' => true, + 'stylesheet' => 'lanScan.xls' ]; $NMAP_DATADIR = '/usr/share/nmap'; diff --git a/filter_inputs.php b/filter_inputs.php index db5c658..04f20ae 100644 --- a/filter_inputs.php +++ b/filter_inputs.php @@ -1,5 +1,11 @@ :"\/|?]+$/'; + $targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, [ 'flags' => FILTER_NULL_ON_FAILURE, 'options' => ['regexp' => "/^[\da-zA-Z-. \/]+$/"], @@ -7,19 +13,14 @@ $targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, [ $saveAs = filter_input(INPUT_GET, 'saveAs', FILTER_VALIDATE_REGEXP, [ 'flags' => FILTER_NULL_ON_FAILURE, - 'options' => ['regexp' => '/^[^<>:"\/|?]+$/'], + 'options' => ['regexp' => $fileNameRegex], ]); $compareWith = filter_input(INPUT_GET, 'compareWith', FILTER_VALIDATE_REGEXP, [ 'flags' => FILTER_NULL_ON_FAILURE, - 'options' => ['regexp' => '/^[^<>:"\/|?]+$/'], + 'options' => ['regexp' => $fileNameRegex], ]); -$hostsListRegex = "/^[\da-zA-Z-.,:\/]+$/"; -$protocolePortsListRegex = "/^(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*$/"; -$portsListRegex = "/^([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*$/"; -$tempoRegex = "/^\d+[smh]?$/"; - $inputs = filter_input_array(INPUT_GET, [ 'iR' => ['filter' => FILTER_VALIDATE_INT], 'exclude' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]], @@ -110,4 +111,5 @@ $inputs = filter_input_array(INPUT_GET, [ 'V' => ['filter' => FILTER_VALIDATE_BOOLEAN], 'unprivileged' => ['filter' => FILTER_VALIDATE_BOOLEAN], 'h' => ['filter' => FILTER_VALIDATE_BOOLEAN], + 'stylesheet' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]], ], false) ?: $DEFAULT_ARGS; diff --git a/index.php b/index.php index b139abb..00e548b 100755 --- a/index.php +++ b/index.php @@ -19,40 +19,38 @@ include_once 'filter_inputs.php';
-