Compare commits
2 Commits
a773e8b8d9
...
b6900bc76a
Author | SHA1 | Date | |
---|---|---|---|
b6900bc76a | |||
c3ed9f9fc2 |
@ -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,
|
||||
],
|
||||
|
@ -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;
|
15
options.php
15
options.php
@ -397,10 +397,10 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
|
||||
<label for="stylesheetSelect" title="--stylesheet">Feuille de style</label>
|
||||
<select class="ui dropdown" id="stylesheetSelect" name="--stylesheet" value="<?= $options["--stylesheet"] ?? ""?>">
|
||||
<?php
|
||||
foreach (scandir('xslt') as $filename) {
|
||||
foreach (scandir('templates') as $filename) {
|
||||
if (substr($filename, -4) === '.xsl') {
|
||||
$name = substr($filename, 0, -4);
|
||||
$URL = htmlentities("$BASEDIR/xslt/$filename", ENT_QUOTES);
|
||||
$URL = htmlentities("$BASEDIR/templates/$filename", ENT_QUOTES);
|
||||
if (isset($options["--stylesheet"]) && $URL == $options["--stylesheet"]) {
|
||||
echo " <option value='$URL' selected>$name</option>\n";
|
||||
} else {
|
||||
@ -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);
|
||||
|
@ -41,7 +41,7 @@ main {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.ui.header {
|
||||
.toast-container .ui.header {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
@ -310,8 +310,8 @@ function hostScanning(link) {
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=400">orange</xsl:when>
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=200">green</xsl:when>
|
||||
<xsl:when test="$currentPort/state/@state='open'">green</xsl:when>
|
||||
<xsl:when test="$currentPort/state/@state='filtered'">orange disabled</xsl:when>
|
||||
<xsl:otherwise>red disabled</xsl:otherwise>
|
||||
<xsl:when test="$currentPort/state/@state='filtered'">orange</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table"> mini dropdown button share-size</xsl:when>
|
||||
@ -327,22 +327,21 @@ function hostScanning(link) {
|
||||
<xsl:value-of select="@portid"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="service/@name='ms-wbt-server'">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>rdp.php?v=</xsl:text>
|
||||
<xsl:value-of select="$hostAddress"/>
|
||||
<xsl:text>&p=</xsl:text>
|
||||
<xsl:value-of select="@portid"/>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:value-of select="@portid"/>/<xsl:value-of select="@protocol"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="service/@name"/>
|
||||
<div class="detail">
|
||||
<xsl:choose>
|
||||
<xsl:when test="service/@name='unknown'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@protocol='tcp'">:</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="substring(@protocol, 1, 1)"/>:</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:value-of select="@portid"/>
|
||||
</div>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="service/@name"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:for-each select="$currentHost/hostscript/script[@id='smb-shares-size']/table">
|
@ -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>
|
||||
@ -301,27 +301,11 @@ function hostScanning(link) {
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=400">orange</xsl:when>
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=200">green</xsl:when>
|
||||
<xsl:when test="$currentPort/state/@state='open'">green</xsl:when>
|
||||
<xsl:when test="$currentPort/state/@state='filtered'">orange disabled</xsl:when>
|
||||
<xsl:otherwise>red disabled</xsl:otherwise>
|
||||
<xsl:when test="$currentPort/state/@state='filtered'">orange</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table"> dropdown share-size</xsl:if>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@protocol='tcp'">:</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="substring(@protocol, 1, 1)"/>:</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:value-of select="@portid"/>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https'">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="service/@name"/>
|
||||
<xsl:text>://</xsl:text>
|
||||
<xsl:value-of select="$hostAddress"/>
|
||||
<xsl:text>:</xsl:text>
|
||||
<xsl:value-of select="@portid"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="service/@name='ms-wbt-server'">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>rdp.php?v=</xsl:text>
|
||||
@ -330,7 +314,21 @@ function hostScanning(link) {
|
||||
<xsl:value-of select="@portid"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:value-of select="@portid"/>/<xsl:value-of select="@protocol"/>
|
||||
</xsl:attribute>
|
||||
<xsl:choose>
|
||||
<xsl:when test="service/@name='unknown'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@protocol='tcp'">:</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="substring(@protocol, 1, 1)"/>:</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:value-of select="@portid"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="service/@name"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:for-each select="$currentHost/hostscript/script[@id='smb-shares-size']/table">
|
@ -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>
|
||||
@ -330,8 +330,8 @@ function hostScanning(link) {
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=400">orange</xsl:when>
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=200">green</xsl:when>
|
||||
<xsl:when test="$currentPort/state/@state='open'">green</xsl:when>
|
||||
<xsl:when test="$currentPort/state/@state='filtered'">orange disabled</xsl:when>
|
||||
<xsl:otherwise>red disabled</xsl:otherwise>
|
||||
<xsl:when test="$currentPort/state/@state='filtered'">orange</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table"> mini dropdown button share-size</xsl:when>
|
||||
@ -355,14 +355,21 @@ function hostScanning(link) {
|
||||
<xsl:value-of select="@portid"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="service/@name"/>
|
||||
<div class="detail" style="">
|
||||
<xsl:attribute name="title">
|
||||
<xsl:value-of select="@portid"/>/<xsl:value-of select="@protocol"/>
|
||||
</xsl:attribute>
|
||||
<xsl:choose>
|
||||
<xsl:when test="service/@name='unknown'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@protocol='tcp'">:</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="substring(@protocol, 1, 1)"/>:</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:value-of select="@portid"/>
|
||||
</div>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="service/@name"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="(service/@name='microsoft-ds' or service/@name='netbios-ssn') and ../../hostscript/script[@id='smb-shares-size']/table">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:for-each select="$currentHost/hostscript/script[@id='smb-shares-size']/table">
|
@ -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>
|
Reference in New Issue
Block a user