diff --git a/filter_inputs.php b/filter_inputs.php index 0cd379c..90595c3 100644 --- a/filter_inputs.php +++ b/filter_inputs.php @@ -15,12 +15,12 @@ $host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['optio if ($lan) { $targets = $lan; - $inputs = $LANSCAN_OPTIONS; + $args = $LANSCAN_OPTIONS; } else if ($host) { $targets = $host; - $inputs = $HOSTSCAN_OPTIONS; + $args = $HOSTSCAN_OPTIONS; } else { - $inputs = filter_input_array(INPUT_GET, [ + $args = filter_input_array(INPUT_GET, [ 'iR' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]], 'exclude' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]], diff --git a/options.php b/options.php index 9d74daf..27f94b6 100755 --- a/options.php +++ b/options.php @@ -64,13 +64,13 @@ Exemples: /24 10.
"> + pattern="[a-zA-Z0-9._\/,\-]*" value="">
"> + value="">
@@ -81,7 +81,7 @@ Exemples: /24 10.
- /> + />
@@ -89,21 +89,21 @@ Exemples: /24 10.
" + pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="" title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
" + pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="" title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
" + pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="" title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
@@ -112,19 +112,19 @@ Exemples: /24 10.
- /> + />
- /> + />
- /> + />
@@ -134,20 +134,20 @@ Exemples: /24 10.
" + pattern="[0-9,\-]+" value="" title="[num de protocole]">
- /> + />
- /> + />
@@ -156,13 +156,13 @@ Exemples: /24 10.
- /> + />
- /> + />
@@ -171,7 +171,7 @@ Exemples: /24 10.
" + pattern="[a-zA-Z0-9._,\-]*" value="" title="serv1[,serv2],...">
@@ -185,19 +185,19 @@ Exemples: /24 10.
- /> + />
- /> + />
- /> + />
@@ -206,19 +206,19 @@ Exemples: /24 10.
- /> + />
- /> + />
- /> + />
@@ -227,19 +227,19 @@ Exemples: /24 10.
- /> + />
- /> + />
- /> + />
@@ -248,27 +248,27 @@ Exemples: /24 10.
" + pattern="(URG|ACK|PSH|RST|SYN|FIN|,)+|[1-9]?[0-9]|[1-2][0-9][0-9]" value="" title="Mélanger simplement les drapeaux URG, ACK, PSH, RST, SYN et FIN.">
" + pattern="[a-zA-Z0-9._\-]+(:[0-9]+)?" value="" title="zombie host[:probeport]">
" + pattern="([a-zA-Z0-9._\-]+(:.+)?@)?[a-zA-Z0-9._\-]+(:[0-9]+)?" value="" title="[[:]@][:]">
- /> + />
@@ -282,14 +282,14 @@ Exemples: /24 10.
- /> + />
- + onchange="pInput.disabled = FCheckbox.checked" />
@@ -297,14 +297,14 @@ Exemples: /24 10.
- - pattern="(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*" value="" + + pattern="(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*" value="" title="Liste de ports ex: ssh,ftp,U:53,111,137,T:21-25,80,139,8080">
- /> + />
@@ -317,13 +317,13 @@ Exemples: /24 10.
- "> $name\n"; } else { echo " \n"; diff --git a/scan.php b/scan.php index a4b36b5..0cc6f33 100755 --- a/scan.php +++ b/scan.php @@ -4,8 +4,8 @@ include_once 'filter_inputs.php'; if (!file_exists($SCANSDIR)) mkdir($SCANSDIR); -$args = ''; -foreach ($inputs as $arg => $value) { +$command = ($sudo? "sudo " : "") . "nmap"; +foreach ($args as $arg => $value) { if (is_null($value)) { http_response_code(400); $errorMessage = "Valeur incorecte pour le paramètre $arg : " . filter_input(INPUT_GET, $arg, FILTER_SANITIZE_FULL_SPECIAL_CHARS); @@ -13,18 +13,18 @@ foreach ($inputs as $arg => $value) { die(); } else if ($value) { if ($value === true) { - if (strlen($arg) <= 2) $args .= " -$arg"; - else $args .= " --$arg"; + if (strlen($arg) <= 2) $command .= " -$arg"; + else $command .= " --$arg"; } else { - if (strlen($arg) <= 2) $args .= " -$arg$value"; - else $args .= " --$arg $value"; + if (strlen($arg) <= 2) $command .= " -$arg$value"; + else $command .= " --$arg $value"; } } } $tempPath = tempnam(sys_get_temp_dir(), 'scan_').".xml"; -$command = ($sudo? "sudo " : "") . "nmap$args -oX '$tempPath' $targets 2>&1"; +$command .= " -oX '$tempPath' $targets 2>&1"; exec($command, $stderr, $retcode);