use other stylesheets
This commit is contained in:
		| @ -5,5 +5,6 @@ $DEFAULT_ARGS = [ | |||||||
|     'PS' => 'ssh,http,https,msrpc,microsoft-ds', |     'PS' => 'ssh,http,https,msrpc,microsoft-ds', | ||||||
|     'F' => true, |     'F' => true, | ||||||
|     'T5' => true, |     'T5' => true, | ||||||
|  |     'stylesheet' => 'lanScan.xls' | ||||||
| ]; | ]; | ||||||
| $NMAP_DATADIR = '/usr/share/nmap'; | $NMAP_DATADIR = '/usr/share/nmap'; | ||||||
|  | |||||||
| @ -1,5 +1,11 @@ | |||||||
| <?php | <?php | ||||||
|  |  | ||||||
|  | $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]?$/"; | ||||||
|  | $fileNameRegex           = '/^[^<>:"\/|?]+$/'; | ||||||
|  |  | ||||||
| $targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, [ | $targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, [ | ||||||
|   'flags'   => FILTER_NULL_ON_FAILURE, |   'flags'   => FILTER_NULL_ON_FAILURE, | ||||||
|   'options' => ['regexp' => "/^[\da-zA-Z-. \/]+$/"], |   '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, [ | $saveAs = filter_input(INPUT_GET, 'saveAs', FILTER_VALIDATE_REGEXP, [ | ||||||
|   'flags'   => FILTER_NULL_ON_FAILURE, |   'flags'   => FILTER_NULL_ON_FAILURE, | ||||||
|   'options' => ['regexp' => '/^[^<>:"\/|?]+$/'], |   'options' => ['regexp' => $fileNameRegex], | ||||||
| ]); | ]); | ||||||
|  |  | ||||||
| $compareWith = filter_input(INPUT_GET, 'compareWith', FILTER_VALIDATE_REGEXP, [ | $compareWith = filter_input(INPUT_GET, 'compareWith', FILTER_VALIDATE_REGEXP, [ | ||||||
|   'flags'   => FILTER_NULL_ON_FAILURE, |   '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, [ | $inputs = filter_input_array(INPUT_GET, [ | ||||||
|   'iR'      => ['filter' => FILTER_VALIDATE_INT], |   'iR'      => ['filter' => FILTER_VALIDATE_INT], | ||||||
|   'exclude' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]], |   'exclude' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]], | ||||||
| @ -110,4 +111,5 @@ $inputs = filter_input_array(INPUT_GET, [ | |||||||
|   'V'            => ['filter' => FILTER_VALIDATE_BOOLEAN], |   'V'            => ['filter' => FILTER_VALIDATE_BOOLEAN], | ||||||
|   'unprivileged' => ['filter' => FILTER_VALIDATE_BOOLEAN], |   'unprivileged' => ['filter' => FILTER_VALIDATE_BOOLEAN], | ||||||
|   'h'            => ['filter' => FILTER_VALIDATE_BOOLEAN], |   'h'            => ['filter' => FILTER_VALIDATE_BOOLEAN], | ||||||
|  |   'stylesheet'   => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]], | ||||||
| ], false) ?: $DEFAULT_ARGS; | ], false) ?: $DEFAULT_ARGS; | ||||||
|  | |||||||
							
								
								
									
										54
									
								
								index.php
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								index.php
									
									
									
									
									
								
							| @ -19,40 +19,38 @@ include_once 'filter_inputs.php'; | |||||||
| </head> | </head> | ||||||
|  |  | ||||||
| <body> | <body> | ||||||
|   <form> |   <nav class="ui inverted teal fixed menu"> | ||||||
|     <nav class="ui inverted teal fixed menu"> |     <a class="ui teal button item" href="."> | ||||||
|       <button class="ui teal button item" type="submit" formmethod="get" formaction="." onclick="targetsInput.required=false"> |       lan<?php include 'logo.svg'; ?>can | ||||||
|         lan<?php include 'logo.svg'; ?>can |     </a> | ||||||
|       </button> |     <form class="right menu"> | ||||||
|       <div class="right menu"> |       <div class="ui category search item"> | ||||||
|         <div class="ui category search item"> |         <div id="targetsInputDiv" class="ui icon input"> | ||||||
|           <div id="targetsInputDiv" class="ui icon input"> |           <input class="prompt" type="text" id="targetsInput" name="targets" oninput="hiddenInput.value=this.value" required | ||||||
|             <input class="prompt" type="text" id="targetsInput" name="targets" oninput="hiddenInput.value=this.value" required |             pattern="[a-zA-Z0-9._\/ \-]+" value="<?= $targets; ?>" placeholder="Scanner un réseau..." | ||||||
|               pattern="[a-zA-Z0-9._\/ \-]+" value="<?= $targets; ?>" placeholder="Scanner un réseau..." |             title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc. | ||||||
|               title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc. |  | ||||||
| Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254" /> | Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254" /> | ||||||
|             <i class="satellite dish icon"></i> |           <i class="satellite dish icon"></i> | ||||||
|           </div> |         </div> | ||||||
| <?php | <?php | ||||||
| foreach($inputs as $name => $value) { | foreach($inputs as $name => $value) { | ||||||
|   echo "          <input type='hidden' name='$name' value='$value'/>\n"; | echo "          <input type='hidden' name='$name' value='$value'/>\n"; | ||||||
| } | } | ||||||
| ?> | ?> | ||||||
|           <button style="display: none;" type="submit" formmethod="get" formaction="scan.php" onsubmit="targetsInputDiv.classList.add('loading')"></button> |         <button style="display: none;" type="submit" formmethod="get" formaction="scan.php" onsubmit="targetsInputDiv.classList.add('loading')"></button> | ||||||
|         </div> |  | ||||||
|         <div class="item"> |  | ||||||
|           <button class="ui teal icon submit button" type="submit" formmethod="get" formaction="options.php" onclick="targetsInput.required=false"> |  | ||||||
|             <i class="sliders horizontal icon"></i> |  | ||||||
|           </button> |  | ||||||
|         </div> |  | ||||||
|         <div class="item"> |  | ||||||
|           <a class="ui teal icon button" href="https://nmap.org/man/fr/index.html" target="_blank"> |  | ||||||
|             <i class="question circle icon"></i> |  | ||||||
|           </a> |  | ||||||
|         </div> |  | ||||||
|       </div> |       </div> | ||||||
|     </nav> |       <div class="item"> | ||||||
|   </form> |         <button class="ui teal icon submit button" type="submit" formmethod="get" formaction="options.php" onclick="targetsInput.required=false"> | ||||||
|  |           <i class="sliders horizontal icon"></i> | ||||||
|  |         </button> | ||||||
|  |       </div> | ||||||
|  |       <div class="item"> | ||||||
|  |         <a class="ui teal icon button" href="https://nmap.org/man/fr/index.html" target="_blank"> | ||||||
|  |           <i class="question circle icon"></i> | ||||||
|  |         </a> | ||||||
|  |       </form> | ||||||
|  |     </div> | ||||||
|  |   </nav> | ||||||
|  |  | ||||||
|   <main class="ui main container"> |   <main class="ui main container"> | ||||||
|     <h1 class="ui header">Précédents scans</h1> |     <h1 class="ui header">Précédents scans</h1> | ||||||
|  | |||||||
| @ -19,8 +19,9 @@ | |||||||
|         </xsl:choose> |         </xsl:choose> | ||||||
|     </xsl:variable> |     </xsl:variable> | ||||||
|     <xsl:variable name="current" select="./nmaprun"/> |     <xsl:variable name="current" select="./nmaprun"/> | ||||||
|     <xsl:variable name="basedir" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href="'),'/stylesheet.xsl"')"/> |     <xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href="'),'"')"/> | ||||||
|     <xsl:variable name="init" select="document(concat($scansDir, '/', $compareWith, '.xml'))/nmaprun"/> |     <xsl:variable name="basedir" select="concat($stylesheetURL, '/..')"/> | ||||||
|  |     <xsl:variable name="init" select="document(concat($basedir, '/', $scansDir, '/', $compareWith, '.xml'))/nmaprun"/> | ||||||
| 
 | 
 | ||||||
|     <xsl:template match="nmaprun"> |     <xsl:template match="nmaprun"> | ||||||
|         <xsl:variable name="targets" select="substring-after(@args, '.xml ')"/> |         <xsl:variable name="targets" select="substring-after(@args, '.xml ')"/> | ||||||
| @ -65,87 +66,39 @@ | |||||||
|             </head> |             </head> | ||||||
| 
 | 
 | ||||||
|             <body> |             <body> | ||||||
|                 <form> |                 <nav class="ui inverted teal fixed menu"> | ||||||
|                     <nav class="ui inverted teal fixed menu"> |                     <a class="ui teal button item" href="."> | ||||||
|                         <button class="ui teal button item" type="submit" formmethod="get" formaction="{$basedir}"  onclick="targetsInput.required=false"> |                         <xsl:text>lan</xsl:text> | ||||||
|                             <xsl:text>lan</xsl:text> |                         <svg class="logo" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 24 24" xml:space="preserve" width="40" height="40" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"><defs id="defs206"/><g id="g998" transform="matrix(0,0.04687491,-0.04687491,0,24,2.2682373e-5)"><g id="g147"><g id="g145"><path d="m 322.065,92.046 c -46.24,0 -83.851,37.619 -83.851,83.857 v 168.712 c 0,25.224 -21.148,45.745 -46.372,45.745 -25.224,0 -46.372,-20.521 -46.372,-45.745 V 199.464 h -38.114 v 145.151 c 0,46.24 38.246,83.859 84.486,83.859 46.24,0 84.486,-37.619 84.486,-83.859 V 175.903 c 0,-25.223 20.514,-45.743 45.737,-45.743 25.223,0 45.737,20.521 45.737,45.743 v 134.092 h 38.114 V 175.903 c 0,-46.239 -37.611,-83.857 -83.851,-83.857 z" id="path143"/></g></g><g id="g153"><g id="g151"><path d="M 144.198,0 H 108.625 C 98.101,0 89.568,8.746 89.568,19.271 c 0,1.157 0.121,2.328 0.318,3.598 h 73.052 c 0.197,-1.27 0.318,-2.441 0.318,-3.598 C 163.256,8.746 154.723,0 144.198,0 Z" id="path149"/></g></g><g id="g159"><g id="g157"><path d="m 420.183,486.591 h -71.731 c -0.626,2.541 -0.978,4.077 -0.978,6.176 0,10.525 8.532,19.234 19.057,19.234 h 35.573 c 10.525,0 19.057,-8.709 19.057,-19.234 0,-2.098 -0.352,-3.635 -0.978,-6.176 z" id="path155"/></g></g><g id="g165"><g id="g163"><rect x="87.027" y="41.925999" width="80.040001" height="138.481" id="rect161"/></g></g><g id="g171"><g id="g169"><rect x="344.93301" y="329.052" width="80.040001" height="138.481" id="rect167"/></g></g><g id="g173"></g><g id="g175"></g><g id="g177"></g><g id="g179"></g><g id="g181"></g><g id="g183"></g><g id="g185"></g><g id="g187"></g><g id="g189"></g><g id="g191"></g><g id="g193"></g><g id="g195"></g><g id="g197"></g><g id="g199"></g><g id="g201"></g></g></svg> | ||||||
|                             <svg class="logo" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 24 24" xml:space="preserve" width="40" height="40" |                         <xsl:text>can</xsl:text> | ||||||
|                                 xmlns="http://www.w3.org/2000/svg" |                     </a> | ||||||
|                                 xmlns:svg="http://www.w3.org/2000/svg"> |                     <form class="right menu"> | ||||||
|                                 <defs id="defs206"/> |                         <div class="ui category search item"> | ||||||
|                                 <g id="g998" transform="matrix(0,0.04687491,-0.04687491,0,24,2.2682373e-5)"> |                             <div id="targetsInputDiv" class="ui icon input"> | ||||||
|                                     <g id="g147"> |                             <input class="prompt" type="text" id="targetsInput" name="targets" oninput="hiddenInput.value=this.value" required="" | ||||||
|                                         <g id="g145"> |                                 pattern="[a-zA-Z0-9._\/ \-]+" value="{$targets}" placeholder="Scanner un réseau..." | ||||||
|                                             <path d="m 322.065,92.046 c -46.24,0 -83.851,37.619 -83.851,83.857 v 168.712 c 0,25.224 -21.148,45.745 -46.372,45.745 -25.224,0 -46.372,-20.521 -46.372,-45.745 V 199.464 h -38.114 v 145.151 c 0,46.24 38.246,83.859 84.486,83.859 46.24,0 84.486,-37.619 84.486,-83.859 V 175.903 c 0,-25.223 20.514,-45.743 45.737,-45.743 25.223,0 45.737,20.521 45.737,45.743 v 134.092 h 38.114 V 175.903 c 0,-46.239 -37.611,-83.857 -83.851,-83.857 z" id="path143"/> |                                 title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc. | ||||||
|                                         </g> |  | ||||||
|                                     </g> |  | ||||||
|                                     <g id="g153"> |  | ||||||
|                                         <g id="g151"> |  | ||||||
|                                             <path d="M 144.198,0 H 108.625 C 98.101,0 89.568,8.746 89.568,19.271 c 0,1.157 0.121,2.328 0.318,3.598 h 73.052 c 0.197,-1.27 0.318,-2.441 0.318,-3.598 C 163.256,8.746 154.723,0 144.198,0 Z" id="path149"/> |  | ||||||
|                                         </g> |  | ||||||
|                                     </g> |  | ||||||
|                                     <g id="g159"> |  | ||||||
|                                         <g id="g157"> |  | ||||||
|                                             <path d="m 420.183,486.591 h -71.731 c -0.626,2.541 -0.978,4.077 -0.978,6.176 0,10.525 8.532,19.234 19.057,19.234 h 35.573 c 10.525,0 19.057,-8.709 19.057,-19.234 0,-2.098 -0.352,-3.635 -0.978,-6.176 z" id="path155"/> |  | ||||||
|                                         </g> |  | ||||||
|                                     </g> |  | ||||||
|                                     <g id="g165"> |  | ||||||
|                                         <g id="g163"> |  | ||||||
|                                             <rect x="87.027" y="41.925999" width="80.040001" height="138.481" id="rect161"/> |  | ||||||
|                                         </g> |  | ||||||
|                                     </g> |  | ||||||
|                                     <g id="g171"> |  | ||||||
|                                         <g id="g169"> |  | ||||||
|                                             <rect x="344.93301" y="329.052" width="80.040001" height="138.481" id="rect167"/> |  | ||||||
|                                         </g> |  | ||||||
|                                     </g> |  | ||||||
|                                     <g id="g173"></g> |  | ||||||
|                                     <g id="g175"></g> |  | ||||||
|                                     <g id="g177"></g> |  | ||||||
|                                     <g id="g179"></g> |  | ||||||
|                                     <g id="g181"></g> |  | ||||||
|                                     <g id="g183"></g> |  | ||||||
|                                     <g id="g185"></g> |  | ||||||
|                                     <g id="g187"></g> |  | ||||||
|                                     <g id="g189"></g> |  | ||||||
|                                     <g id="g191"></g> |  | ||||||
|                                     <g id="g193"></g> |  | ||||||
|                                     <g id="g195"></g> |  | ||||||
|                                     <g id="g197"></g> |  | ||||||
|                                     <g id="g199"></g> |  | ||||||
|                                     <g id="g201"></g> |  | ||||||
|                                 </g> |  | ||||||
|                             </svg> |  | ||||||
|                             <xsl:text>can</xsl:text> |  | ||||||
|                         </button> |  | ||||||
|                         <div class="right menu"> |  | ||||||
|                             <div class="ui category search item"> |  | ||||||
|                                 <div id="targetsInputDiv" class="ui icon input"> |  | ||||||
|                                 <input class="prompt" type="text" id="targetsInput" name="targets" oninput="hiddenInput.value=this.value" required="" |  | ||||||
|                                     pattern="[a-zA-Z0-9._\/ \-]+" value="{$targets}" placeholder="Scanner un réseau..." |  | ||||||
|                                     title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc. |  | ||||||
| Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/> | Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254"/> | ||||||
|                                     <i class="satellite dish icon"></i> |                                 <i class="satellite dish icon"></i> | ||||||
|                                 </div> |  | ||||||
|                                 <xsl:call-template name="optionsList"> |  | ||||||
|                                     <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' --stylesheet')"/> |  | ||||||
|                                 </xsl:call-template> |  | ||||||
|                                 <xsl:if test="string-length($name)"><input type="hidden" name="compareWith" value="{$name}"/></xsl:if> |  | ||||||
|                                 <button style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php" onsubmit="targetsInputDiv.classList.add('loading')"></button> |  | ||||||
|                             </div> |  | ||||||
|                             <div class="item"> |  | ||||||
|                                 <button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/options.php" onclick="targetsInput.required=false"> |  | ||||||
|                                     <i class="sliders horizontal icon"></i> |  | ||||||
|                                 </button> |  | ||||||
|                             </div> |  | ||||||
|                             <div class="item"> |  | ||||||
|                                 <a class="ui teal icon button" href="https://nmap.org/man/fr/index.html" target="_blank"> |  | ||||||
|                                 <i class="question circle icon"></i> |  | ||||||
|                                 </a> |  | ||||||
|                             </div> |                             </div> | ||||||
|  |                             <xsl:call-template name="optionsList"> | ||||||
|  |                                 <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' --stylesheet')"/> | ||||||
|  |                             </xsl:call-template> | ||||||
|  |                             <xsl:if test="string-length($name)"><input type="hidden" name="compareWith" value="{$name}"/></xsl:if> | ||||||
|  |                             <button style="display: none;" type="submit" formmethod="get" formaction="{$basedir}/scan.php" onsubmit="targetsInputDiv.classList.add('loading')"></button> | ||||||
|                         </div> |                         </div> | ||||||
|                     </nav> |                         <div class="item"> | ||||||
|                 </form> |                             <button class="ui teal icon submit button" type="submit" formmethod="get" formaction="{$basedir}/options.php" onclick="targetsInput.required=false"> | ||||||
|  |                                 <i class="sliders horizontal icon"></i> | ||||||
|  |                             </button> | ||||||
|  |                         </div> | ||||||
|  |                         <div class="item"> | ||||||
|  |                             <a class="ui teal icon button" href="https://nmap.org/man/fr/index.html" target="_blank"> | ||||||
|  |                             <i class="question circle icon"></i> | ||||||
|  |                             </a> | ||||||
|  |                         </div> | ||||||
|  |                     </form> | ||||||
|  |                 </nav> | ||||||
| 
 | 
 | ||||||
|                 <main class="ui main container"> |                 <main class="ui main container"> | ||||||
|                     <h1 class="ui header"> |                     <h1 class="ui header"> | ||||||
							
								
								
									
										22
									
								
								options.php
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								options.php
									
									
									
									
									
								
							| @ -21,13 +21,13 @@ include_once 'filter_inputs.php'; | |||||||
|  |  | ||||||
| <body> | <body> | ||||||
|   <nav class="ui inverted teal fixed menu"> |   <nav class="ui inverted teal fixed menu"> | ||||||
|     <a class="header item" href="."> |     <a class="ui teal button item" href="."> | ||||||
|       lan<?php include 'logo.svg'; ?>can |       lan<?php include 'logo.svg'; ?>can | ||||||
|     </a> |     </a> | ||||||
|   </nav> |   </nav> | ||||||
|  |  | ||||||
|   <main class="ui main container"> |   <main class="ui main container"> | ||||||
|     <h1 class="header">Scanner un réseau avec Nmap</h1> |     <h1 class="header">Scanner un réseau</h1> | ||||||
|  |  | ||||||
|     <form id="newScanForm" class="ui form" method="get" action="scan.php"> |     <form id="newScanForm" class="ui form" method="get" action="scan.php"> | ||||||
|       <div class="required field"> |       <div class="required field"> | ||||||
| @ -211,6 +211,24 @@ foreach (scandir($SCANS_DIR) as $filename) { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | ?> | ||||||
|  |             </select> | ||||||
|  |           </div> | ||||||
|  |  | ||||||
|  |           <div class="field" title="--stylesheet"> | ||||||
|  |             <label for="stylesheetSelect">Feuille de style</label> | ||||||
|  |             <select class="ui dropdown" id="stylesheetSelect" name="stylesheet" value="<?= $inputs["stylesheet"] ?? ""?>"> | ||||||
|  | <?php | ||||||
|  | foreach (scandir('.') as $filename) { | ||||||
|  |   if (substr($filename, -4) === '.xsl') { | ||||||
|  |     $name = substr($filename, 0, -4); | ||||||
|  |     if (isset($inputs["stylesheet"]) && $name == $inputs["stylesheet"]) { | ||||||
|  |       echo "              <option value='$name' selected>$name</option>\n"; | ||||||
|  |     } else { | ||||||
|  |       echo "              <option value='$name'>$name</option>\n"; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
| ?> | ?> | ||||||
|             </select> |             </select> | ||||||
|           </div> |           </div> | ||||||
|  | |||||||
							
								
								
									
										18
									
								
								scan.php
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								scan.php
									
									
									
									
									
								
							| @ -12,6 +12,11 @@ if (!file_exists($SCANS_DIR)) { | |||||||
|     mkdir($SCANS_DIR); |     mkdir($SCANS_DIR); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | if (isset($inputs["stylesheet"])) { | ||||||
|  |     $basedir = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}" . dirname($_SERVER['REQUEST_URI']); | ||||||
|  |     $inputs["stylesheet"] = "$basedir/{$inputs["stylesheet"]}.xsl"; | ||||||
|  | } | ||||||
|  |  | ||||||
| $args = ''; | $args = ''; | ||||||
| foreach ($inputs as $arg => $value) { | foreach ($inputs as $arg => $value) { | ||||||
|     if (is_null($value)) { |     if (is_null($value)) { | ||||||
| @ -19,19 +24,18 @@ foreach ($inputs as $arg => $value) { | |||||||
|         die("Valeur incorecte pour le paramètre $arg : " . filter_input(INPUT_GET, $arg, FILTER_SANITIZE_FULL_SPECIAL_CHARS)); |         die("Valeur incorecte pour le paramètre $arg : " . filter_input(INPUT_GET, $arg, FILTER_SANITIZE_FULL_SPECIAL_CHARS)); | ||||||
|     } else if ($value) { |     } else if ($value) { | ||||||
|         if ($value === true) { |         if ($value === true) { | ||||||
|             if (strlen($arg)<=2) $args .= " -$arg"; |             if (strlen($arg) <= 2) $args .= " -$arg"; | ||||||
|             else $arg = "--$arg"; |             else $args .= " --$arg"; | ||||||
|         } else { |         } else { | ||||||
|             if (strlen($arg)<=2) $args .= " -$arg" . ($value); |             if (strlen($arg) <= 2) $args .= " -$arg$value"; | ||||||
|             else $arg = "--$arg " . ($value); |             else $args .= " --$arg $value"; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| $basedir = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}" . dirname($_SERVER['REQUEST_URI']); |  | ||||||
|  |  | ||||||
| $tempPath = tempnam(sys_get_temp_dir(), 'scan_').".xml"; | $tempPath = tempnam(sys_get_temp_dir(), 'scan_').".xml"; | ||||||
| exec("nmap$args --stylesheet $basedir/stylesheet.xsl -oX '$tempPath' $targets 2>&1", $stderr, $code); |  | ||||||
|  | exec("nmap$args -oX '$tempPath' $targets 2>&1", $stderr, $code); | ||||||
| if ($code) { | if ($code) { | ||||||
|     http_response_code(500); |     http_response_code(500); | ||||||
|     die(implode("<br/>\n", $stderr)); |     die(implode("<br/>\n", $stderr)); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user