home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 June / PCpro_2006_06.ISO / files / mstools / MBaslineSASetup-EN.msi / Data.Cab / cmdDetailReport_v.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2005-06-29  |  10.3 KB  |  289 lines

  1. <?xml version="1.0"?> 
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3.  
  4. <xsl:variable name="ScoreLookup">
  5.     <c score="0" text="Check Not Performed"/>
  6.     <c score="1" text="Unable to scan"/>
  7.     <c score="2" text="Check failed (critical)"/>
  8.     <c score="3" text="Check failed (non-critical)"/>
  9.     <c score="4" text="Best practice"/>
  10.     <c score="5" text="Check passed"/>
  11.     <c score="6" text="Check not performed"/>
  12.     <c score="7" text="Additional information"/>
  13.     <c score="8" text="Not approved"/>
  14. </xsl:variable>
  15.     
  16. <xsl:variable name="Assessment">
  17.     <c score="1" text="Incomplete Scan"/>
  18.     <c score="2" text="Severe Risk"/>
  19.     <c score="3" text="Potential Risk"/>
  20.     <c score="4" text="Security FYIs"/>
  21.     <c score="5" text="Strong Security"/>
  22.     <c score="6" text="Check Not Performed"/>
  23.     <c score="7" text="Additional Information"/>
  24.     <c score="8" text="Security FYIs"/>
  25. </xsl:variable>
  26. <xsl:variable name="CR" select="'
  27. '"/>
  28. <xsl:variable name="FileName">FileNameHere</xsl:variable>
  29.  
  30.     <xsl:variable name="SeverityLookup">
  31.         <c value="4" text="Critical"/>
  32.         <c value="3" text="Important"/>
  33.         <c value="2" text="Moderate"/>
  34.         <c value="1" text="Low"/>
  35.         <c value="0" text=""/>
  36.     </xsl:variable>
  37.  
  38. <xsl:template match="SecScan">
  39.  
  40. <xsl:param name="assess" select="@Grade"/>
  41. Computer name: <xsl:value-of select="@Domain"/>\<xsl:value-of select="@Machine"/>
  42. IP address: <xsl:value-of select="@IP"/>
  43. Security report name: <xsl:value-of select="$FileName" />
  44. <xsl:if test="@SUSServer and @SUSServer != ''">
  45. Update Services server: <xsl:value-of select="@SUSServer" />
  46. </xsl:if>
  47. Scan date: <xsl:value-of select="@LDate"/>
  48. Scanned with MBSA version: <xsl:value-of select="@MbsaToolVersion"/><xsl:if test="NewerVersions/@MbsaVer">  ** Newer version <xsl:value-of select="NewerVersions/@MbsaVer"/> is available **</xsl:if>
  49. <xsl:if test="@WUSSource and @WUSSource != ''">
  50. Security update catalog: <xsl:value-of select="@WUSSource" />
  51. </xsl:if>
  52. <xsl:choose><xsl:when test="@HotfixDataVersion">
  53. Catalog synchronization date: <xsl:value-of select="@HotfixDataVersion"/>
  54. <xsl:if test="NewerVersions/@XmlVer"> ** New security updates are available; rescan to use security update database version <xsl:value-of select="NewerVersions/@XmlVer"/> **</xsl:if>
  55. </xsl:when></xsl:choose>
  56. <xsl:for-each select="//Check[@DataVersionName and @DataVersion]">
  57. <xsl:value-of select="$CR"/>
  58. <xsl:value-of select="@DataVersionName"/><xsl:text> </xsl:text><xsl:value-of select="@DataVersion"/>
  59. </xsl:for-each>
  60. Security assessment: <xsl:value-of select="document('')/*/xsl:variable[@name='Assessment']/c[@score=$assess]/@text"/>
  61.  
  62. <xsl:choose>
  63. <xsl:when test="Check[@Type='5']">
  64.  
  65.   Security Updates Scan Results
  66.     <xsl:choose>
  67.     <xsl:when test="Check[@Type='5'][@Cat='1']">
  68.             <xsl:apply-templates select="Check[@ID='500']" mode="wus"/>
  69.             <xsl:apply-templates select="Check[@ID!='500' and @Type='5'][@Cat='1']"/>
  70.     </xsl:when>
  71.     </xsl:choose>
  72. </xsl:when>
  73. </xsl:choose>
  74. <xsl:choose>
  75. <xsl:when test="Check[@Type='1']">
  76.  
  77.   Operating System Scan Results 
  78.     <xsl:choose>
  79.     <xsl:when test="Check[@Type='1'][@Cat='1']">
  80.     Administrative Vulnerabilities
  81.         <xsl:for-each select=".">
  82.             <xsl:apply-templates select="Check[@Type='1'][@Cat='1']">
  83.             </xsl:apply-templates>
  84.         </xsl:for-each>    
  85.     </xsl:when>
  86.     </xsl:choose>
  87.     <xsl:choose>
  88.     <xsl:when test="Check[@Type='1'][@Cat='2']">
  89.     Additional System Information
  90.         <xsl:for-each select=".">
  91.             <xsl:apply-templates select="Check[@Type='1'][@Cat='2']">
  92.             </xsl:apply-templates>
  93.         </xsl:for-each>
  94.     </xsl:when>
  95.     </xsl:choose>
  96. </xsl:when>
  97. </xsl:choose>
  98. <xsl:choose>
  99. <xsl:when test="Check[@Type='3']">
  100.  
  101.   Internet Information Services (IIS) Scan Results
  102.     <xsl:choose>
  103.         <xsl:when test="Check[@Type='3'][@Cat='4']">
  104.         <xsl:for-each select=".">
  105.             <xsl:value-of select="Check[@Type='3'][@Cat='4']/Advice" />
  106.         </xsl:for-each>
  107.     </xsl:when>
  108.     <xsl:when test="Check[@Type='3'][@Cat='1']">
  109.     Administrative Vulnerabilities
  110.         <xsl:for-each select=".">
  111.             <xsl:apply-templates select="Check[@Type='3'][@Cat='1']">    
  112.             </xsl:apply-templates>
  113.         </xsl:for-each>
  114.     </xsl:when>
  115.     </xsl:choose>
  116.     <xsl:choose>
  117.     <xsl:when test="Check[@Type='3'][@Cat='2']">
  118.     Additional System Information
  119.         <xsl:for-each select=".">
  120.             <xsl:apply-templates select="Check[@Type='3'][@Cat='2']">
  121.             </xsl:apply-templates>
  122.         </xsl:for-each>
  123.     </xsl:when>
  124.     </xsl:choose>
  125. </xsl:when>
  126. </xsl:choose>
  127. <!-- One tag per SQL Instance, MBSA V1.1 and later -->
  128. <xsl:choose>
  129.     <xsl:when test="SQLInstance">
  130.  
  131.   SQL Server Scan Results<xsl:for-each select="."><xsl:apply-templates select="SQLInstance"/></xsl:for-each>
  132.     </xsl:when>
  133. </xsl:choose>
  134. <xsl:choose>
  135. <xsl:when test="Check[@Type='2']">
  136.  
  137.   SQL Server Scan Results
  138.     <xsl:choose>
  139.     <xsl:when test="Check[@Type='2'][@Cat='4']">
  140.         <xsl:for-each select=".">
  141.             <xsl:value-of select="Check[@Type='2'][@Cat='4']/Advice" />
  142.         </xsl:for-each>
  143.     </xsl:when>
  144.     <xsl:when test="Check[@Type='2'][@Cat='1']">
  145.     Administrative Vulnerabilities
  146.         <xsl:for-each select=".">
  147.             <xsl:apply-templates select="Check[@Type='2'][@Cat='1']">        
  148.             </xsl:apply-templates>
  149.         </xsl:for-each>    
  150.     </xsl:when>
  151.     </xsl:choose>
  152.     <xsl:choose>
  153.     <xsl:when test="Check[@Type='2'][@Cat='2']">
  154.     Additional System Information
  155.         <xsl:for-each select=".">
  156.             <xsl:apply-templates select="Check[@Type='2'][@Cat='2']">    
  157.             </xsl:apply-templates>
  158.         </xsl:for-each>    
  159.     </xsl:when>
  160.     </xsl:choose>
  161. </xsl:when>
  162. </xsl:choose>
  163. <xsl:choose>
  164. <xsl:when test="Check[@Type='4']">
  165.  
  166.   Desktop Application Scan Results
  167.     <xsl:choose>
  168.     <xsl:when test="Check[@Type='4'][@Cat='1']">
  169.     Administrative Vulnerabilities
  170.         <xsl:for-each select=".">
  171.             <xsl:apply-templates select="Check[@Type='4'][@Cat='1']">
  172.             </xsl:apply-templates>
  173.         </xsl:for-each>
  174.     </xsl:when>
  175.     </xsl:choose>
  176.     <xsl:choose>
  177.     <xsl:when test="Check[@Type='4'][@Cat='2']">
  178.     Additional System Information
  179.         <xsl:for-each select=".">
  180.             <xsl:apply-templates select="Check[@Type='4'][@Cat='2']">
  181.             </xsl:apply-templates>
  182.         </xsl:for-each>
  183.     </xsl:when>
  184.     </xsl:choose>
  185. </xsl:when>
  186. </xsl:choose>
  187. <xsl:value-of select="$CR"/>
  188. </xsl:template>
  189.     
  190. <!-- SQL Instance section -->
  191. <xsl:template match="SQLInstance">
  192.  
  193.    Instance <xsl:value-of select="@Name"/>
  194.     <xsl:choose>
  195.     <xsl:when test="Check[@Type='2'][@Cat='1']">
  196.  
  197.     Administrative Vulnerabilities
  198.         <xsl:for-each select=".">
  199.             <xsl:apply-templates select="Check[@Type='2'][@Cat='1']">
  200.             </xsl:apply-templates>
  201.         </xsl:for-each>
  202.     </xsl:when>
  203.     </xsl:choose>
  204.     <xsl:choose>
  205.     <xsl:when test="Check[@Type='2'][@Cat='2']">
  206.  
  207.     Additional System Information
  208.         <xsl:for-each select=".">
  209.             <xsl:apply-templates select="Check[@Type='2'][@Cat='2']">
  210.             </xsl:apply-templates>
  211.         </xsl:for-each>
  212.     </xsl:when>
  213.     </xsl:choose>
  214. </xsl:template>
  215.  
  216. <xsl:template match="Check">
  217. <xsl:param name="score" select="@Grade"/>
  218.         Issue:  <xsl:value-of select="@Name"/>
  219.        Score:  <xsl:value-of select="document('')/*/xsl:variable[@name='ScoreLookup']/c[@score=$score]/@text"/>
  220.        Result: <xsl:value-of select="Advice"/><xsl:value-of select="$CR"/>
  221.        <xsl:if test="Detail">
  222.           Detail:
  223.             | <xsl:for-each select="Detail/Head/Col"><xsl:value-of select="."/> | </xsl:for-each>
  224.             <xsl:for-each select="Detail/Row">
  225.  
  226.             <xsl:choose>
  227.             
  228.             <xsl:when test="Col[1]=' ' and Col[2]=' ' and Col[3]!=' '">
  229.             | | <xsl:value-of select="Col[3]"/> | |</xsl:when>
  230.             
  231.             <xsl:otherwise>
  232.             | <xsl:for-each select="Col"><xsl:value-of disable-output-escaping="yes" select="."/><xsl:if test="@REQUIREDNAME"> (This update requires <xsl:value-of select="@REQUIREDNAME"/>  to be installed first.) </xsl:if> | </xsl:for-each>
  233.             </xsl:otherwise>
  234.             
  235.             </xsl:choose>
  236.  
  237.             <xsl:if test="SETTINGS">
  238.             Sub-Detail:
  239.                 | <xsl:for-each select="SETTINGS/Head/Col"><xsl:value-of select="."/> | </xsl:for-each>
  240.                 <xsl:for-each select="SETTINGS/Row">
  241.                 | <xsl:for-each select="Col"><xsl:value-of select="."/> | </xsl:for-each>
  242.                 </xsl:for-each>
  243.             </xsl:if>
  244.             </xsl:for-each> 
  245.         </xsl:if>
  246. </xsl:template>
  247.  
  248. <xsl:template match="Check" mode="wus">
  249. <xsl:param name="score" select="@Grade"/>
  250.         Issue:  <xsl:value-of select="@Name"/>
  251.        Score:  <xsl:value-of select="document('')/*/xsl:variable[@name='ScoreLookup']/c[@score=$score]/@text"/>
  252.        Result: <xsl:value-of select="Advice"/><xsl:value-of select="$CR"/>
  253.  
  254.     <!-- 1st section: Missing critical updates -->
  255.     <xsl:if test="count(Detail/UpdateData[(@IsInstalled='false' or @RestartRequired='true') and @Type=1]) > 0">
  256.         Security Updates            
  257.         <xsl:apply-templates select="Detail/UpdateData[(@IsInstalled='false' or @RestartRequired='true') and @Type=1]" />
  258.         <xsl:value-of select="$CR"/>
  259.     </xsl:if>
  260.     <!-- 2nd section: Missing rollups and service packs -->
  261.     <xsl:if test="count(Detail/UpdateData[(@IsInstalled='false' or @RestartRequired='true') and @Type!=1]) > 0">
  262.         Update Rollups and Service Packs
  263.         <xsl:apply-templates select="Detail/UpdateData[(@IsInstalled='false' or @RestartRequired='true') and @Type!=1]" />
  264.         <xsl:value-of select="$CR"/>
  265.     </xsl:if>
  266.     <!-- 3rd section: Installed items -->
  267.     <xsl:if test="count(Detail/UpdateData[@IsInstalled='true' and (not(@RestartRequired) or @RestartRequired='false')]) > 0">
  268.         Current Update Compliance
  269.         <xsl:apply-templates select="Detail/UpdateData[@IsInstalled='true' and (not(@RestartRequired) or @RestartRequired='false')]" />
  270.         <xsl:value-of select="$CR"/>
  271.     </xsl:if>    
  272. </xsl:template>
  273.  
  274. <xsl:template match="UpdateData">
  275. <xsl:param name="score" select="@Grade"/>
  276.     <xsl:variable name="SevValue"><xsl:value-of select="@Severity"/></xsl:variable>
  277.     <xsl:variable name="Approved"><xsl:value-of select="@WUSApproved"/></xsl:variable>
  278.     <xsl:variable name="GradeText">
  279.         <xsl:choose>
  280.             <xsl:when test="@IsInstalled='true'">Installed</xsl:when>
  281.             <xsl:when test="@IsInstalled='false' and not(@WUSApproved)">Missing</xsl:when>
  282.             <xsl:when test="@IsInstalled='false' and @WUSApproved='true'">Missing</xsl:when>
  283.             <xsl:when test="@IsInstalled='false' and @WUSApproved='false'">Not Approved</xsl:when>
  284.             <xsl:otherwise></xsl:otherwise>
  285.         </xsl:choose>
  286.     </xsl:variable>
  287.             | <xsl:value-of select="@ID"/> | <xsl:value-of select="$GradeText"/> | <xsl:value-of select="Title"/> | <xsl:value-of select="document('')/*/xsl:variable[@name='SeverityLookup']/c[@value=$SevValue]/@text"/> | </xsl:template>
  288. </xsl:stylesheet>
  289.