diff --git a/config.php b/config.php index 6504156..c40b31b 100644 --- a/config.php +++ b/config.php @@ -1,16 +1,16 @@ <?php -$BASEDIR = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}" . dirname($_SERVER['REQUEST_URI']); +$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", + '-PS' => 'microsoft-ds', + '-F' => true, + '-T5' => true, + '--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, ], diff --git a/scripts/README.md b/datadir/scripts/README.md similarity index 100% rename from scripts/README.md rename to datadir/scripts/README.md diff --git a/scripts/http-info.nse b/datadir/scripts/http-info.nse similarity index 100% rename from scripts/http-info.nse rename to datadir/scripts/http-info.nse diff --git a/scripts/smb-authentication.ini b/datadir/scripts/smb-authentication.ini similarity index 100% rename from scripts/smb-authentication.ini rename to datadir/scripts/smb-authentication.ini diff --git a/scripts/smb-shares-size.nse b/datadir/scripts/smb-shares-size.nse similarity index 100% rename from scripts/smb-shares-size.nse rename to datadir/scripts/smb-shares-size.nse diff --git a/filter_inputs.php b/filter_inputs.php index 68e528c..abba258 100644 --- a/filter_inputs.php +++ b/filter_inputs.php @@ -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); -} \ No newline at end of file + ], false) ?: $preset["lan"]; +} + +$options["--datadir"] = $DATADIR; \ No newline at end of file diff --git a/options.php b/options.php index 9b62915..20a6ac4 100755 --- a/options.php +++ b/options.php @@ -473,16 +473,21 @@ foreach (scandir($SCANSDIR) as $filename) { <datalist id='servicesList'> <?php -$nmap_services = file("$NMAPDIR/nmap-services"); $services = []; -foreach ($nmap_services as $service) { - if (0 !== strpos($service, '#')) { - [$name, $port] = explode("\t", $service); - $services[$name] = explode("/", $port); +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); diff --git a/style.css b/style.css index 6dac95b..093cff8 100644 --- a/style.css +++ b/style.css @@ -41,7 +41,7 @@ main { margin-top: 0; } -.ui.header { +.toast-container .ui.header { text-transform: capitalize; } diff --git a/xslt/cards.xsl b/templates/cards.xsl similarity index 99% rename from xslt/cards.xsl rename to templates/cards.xsl index 949d71d..efeef24 100755 --- a/xslt/cards.xsl +++ b/templates/cards.xsl @@ -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> diff --git a/xslt/compact.xsl b/templates/compact.xsl similarity index 99% rename from xslt/compact.xsl rename to templates/compact.xsl index 12649d5..fa6af4a 100755 --- a/xslt/compact.xsl +++ b/templates/compact.xsl @@ -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> diff --git a/xslt/hostsTable.xsl b/templates/hostsTable.xsl similarity index 98% rename from xslt/hostsTable.xsl rename to templates/hostsTable.xsl index 575068e..ca1a905 100755 --- a/xslt/hostsTable.xsl +++ b/templates/hostsTable.xsl @@ -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> diff --git a/xslt/servicesTable.xsl b/templates/servicesTable.xsl similarity index 99% rename from xslt/servicesTable.xsl rename to templates/servicesTable.xsl index f68a3ad..c440cfe 100755 --- a/xslt/servicesTable.xsl +++ b/templates/servicesTable.xsl @@ -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>