This commit is contained in:
Adrien MALINGREY 2024-10-18 14:47:02 +02:00
parent a773e8b8d9
commit c3ed9f9fc2
12 changed files with 30 additions and 23 deletions

View File

@ -3,14 +3,14 @@
$BASEDIR = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}" . dirname($_SERVER['REQUEST_URI']);
$SCANSDIR = 'scans';
$NMAPDIR = dirname(`which nmap`) . "/../share/nmap";
$DATADIR = ".";
$DATADIR = "datadir";
$presets = [
"lan" => [
'-PS' => 'microsoft-ds',
'-F' => true,
'-T5' => true,
'--stylesheet' => "$BASEDIR/xslt/hostsTable.xsl",
'--stylesheet' => "$BASEDIR/templates/hostsTable.xsl",
'refreshPeriod' => 60,
'sudo' => false,
],
@ -19,8 +19,8 @@ $presets = [
'-F' => true,
'-sV' => true,
'-T5' => true,
'--datadir' => "$DATADIR",
'--stylesheet' => "$BASEDIR/xslt/servicesTable.xsl",
'--script' => "http-info,smb-shares-size",
'--stylesheet' => "$BASEDIR/templates/servicesTable.xsl",
'refreshPeriod' => 60,
'sudo' => true,
],

View File

@ -117,5 +117,7 @@ if ($preset && isset($presets[$preset])) {
'compareWith' => FILTER_VALIDATE_URL,
'refreshPeriod' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
'sudo' => FILTER_VALIDATE_BOOLEAN,
], false);
], false) ?: $preset["lan"];
}
$options["--datadir"] = $DATADIR;

View File

@ -473,16 +473,21 @@ foreach (scandir($SCANSDIR) as $filename) {
<datalist id='servicesList'>
<?php
$nmap_services = file("$NMAPDIR/nmap-services");
$services = [];
foreach ([$DATADIR, $NMAPDIR] as $dir) {
echo "<!-- $nmap_services -->\n";
if (file_exists("$dir/nmap-services")) {
$nmap_services = file("$dir/nmap-services");
foreach ($nmap_services as $service) {
if (0 !== strpos($service, '#')) {
[$name, $port] = explode("\t", $service);
$services[$name] = explode("/", $port);
}
}
}
}
foreach ($services as $name => [$portid, $protocol]) {
echo " <option value='$name'>$portid</option>\n";
echo " <option value='$name'></option>\n";
}
?>
</datalist>
@ -514,7 +519,7 @@ foreach ($services as $name => [$portid, $protocol]) {
<option value="vuln"></option>
<!-- names -->
<?php
foreach ([$NMAPDIR, $DATADIR] as $dir) {
foreach ([$DATADIR, $NMAPDIR] as $dir) {
foreach (scandir("$dir/scripts") as $filename) {
if (substr($filename, -4) === '.nse') {
$name = substr($filename, 0, -4);

View File

@ -41,7 +41,7 @@ main {
margin-top: 0;
}
.ui.header {
.toast-container .ui.header {
text-transform: capitalize;
}

View File

@ -268,7 +268,7 @@ function hostScanning(link) {
<xsl:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:sort select="@portid" order="ascending"/>
<xsl:sort select="number(@portid)" order="ascending"/>
</xsl:apply-templates>
</div>
</div>

View File

@ -272,7 +272,7 @@ function hostScanning(link) {
<xsl:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:sort select="@portid" order="ascending"/>
<xsl:sort select="number(@portid)" order="ascending"/>
</xsl:apply-templates>
</div>
</div>

View File

@ -283,11 +283,11 @@ function hostScanning(link) {
<xsl:value-of select="address[@addrtype='mac']/@vendor"/>
</td>
<td>
<xsl:apply-templates select="$currentHost/ports/port | $initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')]">
<xsl:apply-templates select="$initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')] | $currentHost/ports/port">
<xsl:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:sort select="@portid" order="ascending"/>
<xsl:sort select="number(@portid)" order="ascending"/>
</xsl:apply-templates>
</td>
<td>

View File

@ -262,7 +262,7 @@ function hostScanning(link) {
<xsl:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:sort select="@portid" order="ascending"/>
<xsl:sort select="number(@portid)" order="ascending"/>
</xsl:apply-templates>
</tbody>
</table>