share size script
This commit is contained in:
parent
6d4c579198
commit
d0de27c4a2
@ -4,5 +4,5 @@ $BASEDIR = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}$port
|
||||
$SCANSDIR = "scans";
|
||||
$STYLESHEETSDIR = "stylesheets";
|
||||
|
||||
$lanScanCmd = "sudo nmap -PSmicrosoft-ds -F -T5 -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/lanScan.xsl";
|
||||
$hostScanCmd = "sudo nmap -A -T5 -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/hostScan.xsl";
|
||||
$lanScanCmd = "sudo nmap -PSmicrosoft-ds -F -T5 --datadir . --script http-info,smb-shares-size --script-args-file script-args.ini -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/lanScan.xsl";
|
||||
$hostScanCmd = "sudo nmap -A -T5 --datadir . --script http-info,smb-shares-size --script-args-file script-args.ini -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/hostScan.xsl";
|
@ -1,3 +1,3 @@
|
||||
smbdomain = WORKGROUP
|
||||
smbuser =
|
||||
smbpassword =
|
||||
smbdomain = AUTH
|
||||
smbuser = application.drieat
|
||||
smbpassword = d+iFiWn4!cAzdr3KopiM>EA
|
||||
|
@ -68,9 +68,12 @@ body {
|
||||
transparent
|
||||
) !important;
|
||||
text-align: center !important;
|
||||
font-size: .64285714rem !important;
|
||||
}
|
||||
|
||||
.mini.share-size {
|
||||
font-size: 0.64285714rem !important;
|
||||
}
|
||||
|
||||
.ui.card .table {
|
||||
overflow-x: auto;
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ $('.ui.dropdown').dropdown()
|
||||
<xsl:if test="distance/@value">
|
||||
<td>
|
||||
<xsl:value-of select="distance/@value" />
|
||||
<xsl:text> rebonds</xsl:text>
|
||||
<xsl:text> rebond(s)</xsl:text>
|
||||
</td>
|
||||
</xsl:if>
|
||||
<xsl:if test="uptime/@lastboot">
|
||||
@ -203,9 +203,11 @@ $('.ui.dropdown').dropdown()
|
||||
class="ui inverted card {$color}">
|
||||
<div class="content">
|
||||
<div class="header">
|
||||
<div class="ui {$color} ribbon label" style="text-transform: uppercase">
|
||||
<xsl:value-of select="@protocol" />
|
||||
<xsl:text>:</xsl:text>
|
||||
<div class="ui {$color} ribbon label">
|
||||
<div class="detail" style="text-transform: uppercase">
|
||||
<xsl:value-of select="@protocol" />
|
||||
<xsl:text>:</xsl:text>
|
||||
</div>
|
||||
<xsl:value-of select="@portid" />
|
||||
|
||||
</div>
|
||||
@ -249,8 +251,8 @@ $('.ui.dropdown').dropdown()
|
||||
</div>
|
||||
<xsl:if
|
||||
test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https' or service/@name='ms-wbt-server'">
|
||||
<a class="ui {$color} button">
|
||||
<xsl:attribute name="href" target="_blank">
|
||||
<a class="ui {$color} button" target="_blank">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:choose>
|
||||
<xsl:when test="service/@name='ms-wbt-server'">
|
||||
<xsl:text>rdp.php?v=</xsl:text>
|
||||
@ -276,8 +278,34 @@ $('.ui.dropdown').dropdown()
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<i
|
||||
class="external alternate icon"></i> Ouvrir </a>
|
||||
<i class="external alternate icon"></i>
|
||||
<xsl:text>Ouvrir</xsl:text>
|
||||
</a>
|
||||
</xsl:if>
|
||||
<xsl:if test="$currentPort/script[@id='smb-shares-size']/table">
|
||||
<div class="ui {$color} center aligned dropdown share-size button">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:for-each select="$currentPort/script[@id='smb-shares-size']/table">
|
||||
<xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']"
|
||||
order="ascending" />
|
||||
<xsl:if test="position()=1">
|
||||
<xsl:text>--free: </xsl:text>
|
||||
<xsl:value-of select="elem[@key='FreeSize']" />
|
||||
<xsl:text>; --total: </xsl:text>
|
||||
<xsl:value-of
|
||||
select="elem[@key='TotalSize']" />
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:attribute>
|
||||
<i class="external alternate icon"></i>
|
||||
<xsl:text>Ouvrir</xsl:text>
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
<xsl:apply-templates select="$currentPort/script[@id='smb-shares-size']/table">
|
||||
<xsl:with-param name="hostAddress" select="$hostAddress" />
|
||||
</xsl:apply-templates>
|
||||
</div>
|
||||
</div>
|
||||
</xsl:if>
|
||||
</div>
|
||||
|
||||
@ -351,4 +379,13 @@ $('.ui.dropdown').dropdown()
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="table">
|
||||
<xsl:param name="hostAddress" />
|
||||
<a class="item share-size"
|
||||
href="file://///{$hostAddress}/{@key}" target="_blank" rel="noopener noreferrer"
|
||||
style="--free: {elem[@key='FreeSize']}; --total: {elem[@key='TotalSize']}">
|
||||
<xsl:value-of select="@key" />
|
||||
</a>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@ -5,23 +5,32 @@
|
||||
version="1.1">
|
||||
|
||||
<xsl:template match="port" mode="service">
|
||||
<xsl:param name="hostAddress"/>
|
||||
<xsl:param name="initHost"/>
|
||||
<xsl:param name="currentHost"/>
|
||||
<xsl:param name="class"/>
|
||||
<xsl:variable name="portid" select="@portid"/>
|
||||
<xsl:variable name="initPort" select="$initHost/ports/port[@portid=$portid]"/>
|
||||
<xsl:variable name="currentPort" select="$currentHost/ports/port[@portid=$portid]"/>
|
||||
<xsl:param name="hostAddress" />
|
||||
<xsl:param name="initHost" />
|
||||
<xsl:param name="currentHost" />
|
||||
<xsl:param
|
||||
name="class" />
|
||||
<xsl:variable name="portid" select="@portid" />
|
||||
<xsl:variable
|
||||
name="initPort" select="$initHost/ports/port[@portid=$portid]" />
|
||||
<xsl:variable
|
||||
name="currentPort" select="$currentHost/ports/port[@portid=$portid]" />
|
||||
|
||||
<a target="_blank">
|
||||
<a
|
||||
target="_blank">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:value-of select="$class"/>
|
||||
<xsl:value-of select="$class" />
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:if test="$currentPort/script[@id='smb-shares-size']/table">dropdown button share-size</xsl:if>
|
||||
<xsl:if
|
||||
test="$currentPort/script[@id='smb-shares-size']/table">dropdown button
|
||||
share-size </xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=500">red</xsl:when>
|
||||
<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/script[@id='http-info']/elem[@key='status']>=500">
|
||||
red</xsl:when>
|
||||
<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</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
@ -30,60 +39,66 @@
|
||||
<xsl:if test="$currentPort/script[@id='smb-shares-size']/table">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:for-each select="$currentPort/script[@id='smb-shares-size']/table">
|
||||
<xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']" order="ascending"/>
|
||||
<xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']"
|
||||
order="ascending" />
|
||||
<xsl:if test="position()=1">
|
||||
<xsl:text>--free: </xsl:text>
|
||||
<xsl:value-of select="elem[@key='FreeSize']"/>
|
||||
<xsl:value-of select="elem[@key='FreeSize']" />
|
||||
<xsl:text>; --total: </xsl:text>
|
||||
<xsl:value-of select="elem[@key='TotalSize']"/>
|
||||
<xsl:value-of
|
||||
select="elem[@key='TotalSize']" />
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https'">
|
||||
<xsl:if
|
||||
test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https'">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:choose>
|
||||
<xsl:when test="service/@name='http' and service/@tunnel='ssl'">
|
||||
<xsl:text>https</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="service/@name"/>
|
||||
<xsl:value-of select="service/@name" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>://</xsl:text>
|
||||
<xsl:value-of select="$hostAddress"/>
|
||||
<xsl:value-of
|
||||
select="$hostAddress" />
|
||||
<xsl:text>:</xsl:text>
|
||||
<xsl:value-of select="@portid"/>
|
||||
<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:value-of select="$hostAddress" />
|
||||
<xsl:text>&p=</xsl:text>
|
||||
<xsl:value-of select="@portid"/>
|
||||
<xsl:value-of
|
||||
select="@portid" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:value-of select="@protocol" />:<xsl:value-of select="@portid"/>
|
||||
<xsl:value-of select="@protocol" />:<xsl:value-of select="@portid" />
|
||||
</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:otherwise><xsl:value-of select="substring(@protocol, 1, 1)" />:</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:value-of select="@portid"/>
|
||||
<xsl:value-of
|
||||
select="@portid" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="service/@name"/>
|
||||
<xsl:value-of select="service/@name" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="$currentPort/script[@id='smb-shares-size']/table">
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
<xsl:apply-templates select="$currentPort/script[@id='smb-shares-size']/table">
|
||||
<xsl:with-param name="hostAddress" select="$hostAddress"/>
|
||||
<xsl:with-param name="hostAddress" select="$hostAddress" />
|
||||
</xsl:apply-templates>
|
||||
</div>
|
||||
</xsl:if>
|
||||
@ -91,9 +106,11 @@
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="table">
|
||||
<xsl:param name="hostAddress"/>
|
||||
<a class="item share-size" href="file://///{$hostAddress}/{@key}" target="_blank" rel="noopener noreferrer" style="--free: {elem[@key='FreeSize']}; --total: {elem[@key='TotalSize']}">
|
||||
<xsl:value-of select="@key"/>
|
||||
<xsl:param name="hostAddress" />
|
||||
<a class="item share-size"
|
||||
href="file://///{$hostAddress}/{@key}" target="_blank" rel="noopener noreferrer"
|
||||
style="--free: {elem[@key='FreeSize']}; --total: {elem[@key='TotalSize']}">
|
||||
<xsl:value-of select="@key" />
|
||||
</a>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
Loading…
x
Reference in New Issue
Block a user