";
}
function getLocStartupMode(strStartupMode) {
strReturn = "";
strTemp = strStartupMode.toUpperCase();
strxPath = "SCWPolicy/SCWKBLocSection/";
switch ( strTemp ) {
case "AUTOMATIC":
case "MANUAL":
case "DISABLED":
case "IGNORED":
strxPath += strStartupMode;
break;
default:
strxPath = "";
break;
}
strReturn = getString(strxPath, "SCWLocStrings.xml");
if ( (strReturn == null) || ( strReturn.length == 0 ) ){
strReturn = strStartupMode;
}
return strReturn;
}
function getRow()
{
var strReturn = "
";
//-------------------------------------------------------------------------
// For each argument passed in, append it to the return buffer
//-------------------------------------------------------------------------
for(nArgs = 0; nArgs < arguments.length; nArgs++)
{
strReturn += arguments[nArgs];
}
//-------------------------------------------------------------------------
// Return the result with a pad cell (for right whitespace) and a
//-------------------------------------------------------------------------
return strReturn + "";
}
function getNodeAttribute(nod, strNode, strAttr)
{
//-------------------------------------------------------------------------
// Select the node, or return null if not found
//-------------------------------------------------------------------------
var pNodeKey = nod;
if(strNode)
{
pNodeKey = nod.selectSingleNode(strNode);
if(null == pNodeKey)
return null;
}
//-------------------------------------------------------------------------
// Return the value or null if not found
//-------------------------------------------------------------------------
return pNodeKey.getAttribute(strAttr);
}
var m_pDomDocument;
var m_bLookupFileFound;
var m_ServiceInfoArray = new Array();
function InitializeLookup()
{
//-------------------------------------------------------------------------
// If a localization xml file exists, then use it.
//-------------------------------------------------------------------------
m_pDomDocument = new ActiveXObject("MSXML2.DOMDocument");
m_bLookupFileFound = false;
if(m_pDomDocument)
{
m_pDomDocument.async = false;
m_bLookupFileFound = m_pDomDocument.load("../kbs/main.xml");
}
if ( m_bLookupFileFound ) {
InitializeServiceInfoArray();
}
return "";
}
function ServiceInfo(name,DispName, Description)
{
this.ServiceName = name.toUpperCase();
this.ServiceDispName = DispName;
this.ServiceDescription = Description;
}
function SortServiceInfo(first, second)
{
if (first.ServiceName == second.ServiceName)
{
return 0 ;
}
else if ( first.ServiceName < second.ServiceName )
{
return -1;
}
else
{
return 1;
}
}
function InitializeServiceInfoArray()
{
strXPath = "SCWKnowledgeBase/ServiceLocalization/Service";
ServiceList = m_pDomDocument.selectNodes(strXPath);
if ( ServiceList != null )
{
for ( iServiceList = 0; iServiceList < ServiceList.length ; iServiceList++ )
{
ServiceNode = ServiceList.item(iServiceList);
if ( ServiceNode != null )
{
strServiceName = getNodeAttribute(ServiceNode, null, "Name");
strServiceDispName = getNodeTextFromString("DisplayName", ServiceNode);
strServiceDescription = getNodeTextFromString("Description", ServiceNode);
if ( strServiceDispName == null ) {
strServiceDispName = "";
}
if ( strServiceDescription == null) {
strServiceDescription = "";
}
m_ServiceInfoArray[iServiceList] = new ServiceInfo(strServiceName, strServiceDispName, strServiceDescription);
}
}
m_ServiceInfoArray.sort(SortServiceInfo);
}
}
function FindServiceInfoObject(Name)
{
Returnobj = null;
for ( iFindSrv = 0 ; iFindSrv < m_ServiceInfoArray.length ; iFindSrv ++ )
{
iComp = m_ServiceInfoArray[iFindSrv].ServiceName.localeCompare(Name.toUpperCase());
if ( iComp == 0 )
{
ReturnObj = m_ServiceInfoArray[iFindSrv];
break;
}
if ( iComp == 1 )
{
ReturnObj = null;
break;
}
}
return ReturnObj;
}
function getServicesTable(nodServicesRoot)
{
function ServiceObject(strDisplayName, strTableRow) {
this.m_strDisplayName = strDisplayName;
this.m_strTableRow = strTableRow;
}
function SortServiceObject(firstService, secondService) {
firstServiceName = firstService.m_strDisplayName.toUpperCase();
secondServiceName = secondService.m_strDisplayName.toUpperCase();
return firstServiceName.localeCompare(secondServiceName);
}
//-------------------------------------------------------------------------
// Show nothing on error
//-------------------------------------------------------------------------
var strReturn = "";
//-------------------------------------------------------------------------
// Get the headers
//-------------------------------------------------------------------------
var arrTableHeader = new Array(getString('SCWPolicy/Sections/Services/Table/ServiceName', 'KBLocFile'),
getString('SCWPolicy/Sections/Services/Table/StartupMode', 'KBLocFile'),
getString('SCWPolicy/Sections/Services/Table/Description', 'KBLocFile'));
//-------------------------------------------------------------------------
// Make sure the xsl:value-of select returned the services section
//-------------------------------------------------------------------------
if(null == nodServicesRoot)
return displayServicesTable();
//-------------------------------------------------------------------------
// Move past the hidden node
//-------------------------------------------------------------------------
var nodServices = nodServicesRoot.nextNode();
if(null == nodServices)
return displayServicesTable();
//-------------------------------------------------------------------------
// Select all of the services
//-------------------------------------------------------------------------
var strServices = "Parameters/Parameter/Service";
var nodServiceNodes = nodServices.selectNodes(strServices);
if(null == nodServiceNodes)
return displayServicesTable();
var strService;
var strDesc;
var strStartupMode;
var nodLookupService;
var strTemp;
//-------------------------------------------------------------------------
// Create a new array so we can sort the formatted services
//-------------------------------------------------------------------------
var arr = new Array(nodServiceNodes.length);
//-------------------------------------------------------------------------
// For each service
//-------------------------------------------------------------------------
for(nService = 0; nService < nodServiceNodes.length; nService++)
{
//---------------------------------------------------------------------
// Which service are we dealing with?
//---------------------------------------------------------------------
strService = getNodeAttribute(nodServiceNodes.item(nService),null,"Name");
//---------------------------------------------------------------------
// Remember its startup mode from the policy XML
//---------------------------------------------------------------------
strTemp = getLocStartupMode(getNodeAttribute(nodServiceNodes.item(nService),null,"StartupMode"));
strStartupMode = getCell(strTemp);
//---------------------------------------------------------------------
// If the the lookup file loaded, then locate this service
//---------------------------------------------------------------------
if(m_bLookupFileFound)
{
ServiceInfoObj = FindServiceInfoObject(strService);
}
else
{
ServiceInfoObj = null;
}
//---------------------------------------------------------------------
// If the service was found in the lookup file (some didn't during
// testing)
//---------------------------------------------------------------------
if(ServiceInfoObj)
{
//-----------------------------------------------------------------
// Get the friendly display name and description
//-----------------------------------------------------------------
strService = ServiceInfoObj.ServiceDispName;
strTemp = ServiceInfoObj.ServiceDescription;
if (strTemp == null)
strTemp = "";
strDesc = getCell(strTemp);
}
else
{
//-----------------------------------------------------------------
// Convert the service to uppercase to avoid sorting issues and
// leave the desc blank to give it a placeholder
//-----------------------------------------------------------------
strService = strService.toUpperCase();
strDesc = getCell("");
}
//---------------------------------------------------------------------
// Build the new service row
//---------------------------------------------------------------------
arr[nService] = new ServiceObject(strService, getRow(getCell(strService), strStartupMode, strDesc));
}
//-------------------------------------------------------------------------
// Use the default JScript ASCII sort
//-------------------------------------------------------------------------
arr.sort(SortServiceObject);
//-------------------------------------------------------------------------
// Convert the array into a string
//-------------------------------------------------------------------------
strReturn = "";
for ( nService = 0 ; nService < arr.length ; nService++ ) {
strReturn += arr[nService].m_strTableRow;
}
//-------------------------------------------------------------------------
// Return the formatted table
//-------------------------------------------------------------------------
function displayServicesTable()
{
return getTableStart(arrTableHeader) + strReturn + getTableEnd();
}
return displayServicesTable();
}
function getTitle(rootNodeList)
{
strText = "";
xPath = "SCWPolicy/Header/Title";
if ( rootNodeList != null ) {
rootNode = rootNodeList.nextNode();
}
if ( rootNode != null ) {
RoolbackAttribute = rootNode.attributes.getNamedItem("RollbackPolicy");
if ( RoolbackAttribute != null ) {
if ( RoolbackAttribute.value == "TRUE") {
xPath = "SCWPolicy/Header/RollbackTitle";
}
}
}
strText = getString(xPath, 'KBLocFile');
return strText;
}
function getDescription(rootNodeList)
{
strText = "";
xPath = "SCWPolicy/Header/Description";
if ( rootNodeList != null ) {
rootNode = rootNodeList.nextNode();
}
if ( rootNode != null ) {
RoolbackAttribute = rootNode.attributes.getNamedItem("RollbackPolicy");
if ( RoolbackAttribute != null ) {
if ( RoolbackAttribute.value == "TRUE") {
xPath = "SCWPolicy/Header/RollbackDescription";
}
}
}
strText = getString(xPath, 'KBLocFile');
return strText;
}
function getAuditValue(strAuditText)
{
strReturn = "";
strTemp = strAuditText.toUpperCase();
strxPath = "SCWPolicy/Sections/Audit/String/";
switch ( strTemp ) {
case "TRUE":
strxPath += "Audit_Enabled";
break;
case "FALSE":
strxPath += "Audit_Disabled";
break;
default:
strxPath = "";
break;
}
strReturn = getString(strxPath, "SCWLocStrings.xml");
if ( (strReturn == null) || ( strReturn.length == 0 ) ){
strReturn = strAuditText;
}
return strReturn;
}
function getAuditType(strAuditType)
{
strReturn = "";
strTemp = strAuditType.toUpperCase();
strxPath = "SCWPolicy/Sections/Audit/String/";
switch ( strTemp ) {
case "SYSTEM":
strxPath += "Audit_SYSTEM";
break;
case "LOGON":
strxPath += "Audit_LOGON";
break;
case "OBJECTACCESS":
strxPath += "Audit_OBJECTACCESS";
break;
case "PRIVILEGEUSE":
strxPath += "Audit_PRIVILEGEUSE";
break;
case "POLICYCHANGE":
strxPath += "Audit_POLICYCHANGE";
break;
case "ACCOUNTMANAGEMENT":
strxPath += "Audit_ACCOUNTMANAGEMENT";
break;
case "DETAILEDTRACKING":
strxPath += "Audit_DETAILEDTRACKING";
break;
case "DIRECTORYSERVICEACCESS":
strxPath += "Audit_DIRECTORYSERVICEACCESS";
break;
case "ACCOUNTLOGON":
strxPath += "Audit_ACCOUNTLOGON";
break;
default:
strxPath = "";
break;
}
strReturn = getString(strxPath, "SCWLocStrings.xml");
if ( (strReturn == null) || ( strReturn.length == 0 ) ){
strReturn = strAuditType;
}
return strReturn;
}
function getLocaleDate(strTemplateDate)
{
DateArr = strTemplateDate.split("/");
if (DateArr.length == 3 ) {
// The month stored in the xml file is of the type SYSTEMTIME, but jscript starts
// the date with 0 and not 1
month = parseInt(DateArr[0]) - 1;
Day = parseInt(DateArr[1]);
Year = parseInt(DateArr[2]);
dateObj = new Date(Year,month,Day);
strReturn = dateObj.toLocaleDateString();
}
else {
strReturn = strTemplateDate;
}
return strReturn;
}
function getLocaleTime(strTemplateTime)
{
TimeArr = strTemplateTime.split(":");
if (TimeArr.length == 3 )
{
hour = parseInt(TimeArr[0]);
min = parseInt(TimeArr[1]);
sec = parseInt(TimeArr[2]);
dateObj = new Date();
dateObj.setHours(hour,min,sec);
strReturn = dateObj.toLocaleTimeString();
}
else
{
strReturn = strTemplateTime;
}
return strReturn;
}
/////////////////////////
// //
// Firewall Section... //
// //
/////////////////////////
function getNodeAttr(node, attrName)
{
var strReturn = "";
if (node == null)
{
return strReturn;
}
var attributes = node.attributes;
var attribute = attributes.getNamedItem(attrName);
if (attribute != null)
{
strReturn = attribute.text;
}
return strReturn;
}
function Merge2Lists(list1, list2)
{
var strReturn = "";
if (list1 != null && list1 != "")
{
strReturn += list1;
}
if (list2 != null && list2 != "")
{
if (strReturn != "")
{
strReturn += ", ";
}
strReturn += list2;
}
return strReturn;
}
function MergeLists(list1, list2, list3, list4, list5, list6, list7, list8, list9, list10)
{
var strReturn = "";
strReturn = Merge2Lists(list1, list2);
strReturn = Merge2Lists(strReturn, list3);
strReturn = Merge2Lists(strReturn, list4);
strReturn = Merge2Lists(strReturn, list5);
strReturn = Merge2Lists(strReturn, list6);
strReturn = Merge2Lists(strReturn, list7);
strReturn = Merge2Lists(strReturn, list8);
strReturn = Merge2Lists(strReturn, list9);
strReturn = Merge2Lists(strReturn, list10);
return strReturn;
}
function getFirewallRules(requiredRules, allRules)
{
var strReturn = "";
if (requiredRules == null)
{
return strReturn;
}
for (var iRequiredRule = 0;
iRequiredRule < requiredRules.length;
++iRequiredRule)
{
var requiredRule = requiredRules.item(iRequiredRule);
var requiredRuleId = getNodeAttr(requiredRule, "Id");
for (var iRule = 0;
iRule < allRules.length;
++iRule)
{
var rule = allRules.item(iRule);
var ruleId = getNodeAttr(rule, "Id");
if (ruleId == requiredRuleId)
{
if (strReturn != "")
{
strReturn += ", ";
}
strReturn += getNodeAttr(rule, "Name");
}
}
}
return strReturn;
}
function getProfiles(nodeList)
{
var strReturn = "";
if (nodeList == null)
{
strReturn = "Domain, Public, Private";
return strReturn;
}
for (var i = 0; i < nodeList.length; ++i)
{
var node = nodeList.item(i);
if (strReturn != "")
{
strReturn += ", ";
}
strReturn += getNodeAttr(node, "Type");
}
return strReturn;
}
function getSpecialPorts(nodeList)
{
var strReturn = "";
if (nodeList == null)
{
return strReturn;
}
var node = nodeList.item(0);
if (node == null)
{
return strReturn;
}
strReturn = getNodeAttr(node, "SpecialPorts");
return strReturn;
}
function getSpecificPorts(nodeList)
{
var strReturn = "";
if (nodeList == null)
{
return strReturn;
}
for (var i = 0; i < nodeList.length; ++i)
{
var node = nodeList.item(i);
if (strReturn != "")
{
strReturn += ", ";
}
strReturn += getNodeAttr(node, "Value");
}
return strReturn;
}
function getCustomPorts(nodeList)
{
var strReturn = "";
if (nodeList == null)
{
return strReturn;
}
for (var i = 0; i < nodeList.length; ++i)
{
var node = nodeList.item(i);
if (strReturn != "")
{
strReturn += ", ";
}
strReturn += getNodeAttr(node, "ResultValue");
}
return strReturn;
}
function getSpecialAddresses(nodeList, keyword)
{
var strReturn = "";
if (nodeList == null)
{
return strReturn;
}
var node = nodeList.item(0);
if (node == null)
{
return strReturn;
}
if (getNodeAttr(node, keyword) == "True")
{
strReturn = keyword;
}
return strReturn;
}
function getAddresses(nodeList)
{
var strReturn = "";
if (nodeList == null)
{
return strReturn;
}
for (var i = 0; i < nodeList.length; ++i)
{
var node = nodeList.item(i);
if (strReturn != "")
{
strReturn += ", ";
}
strReturn += getNodeAttr(node, "Value");
}
return strReturn;
}
function getRanges(nodeList)
{
var strReturn = "";
if (nodeList == null)
{
return strReturn;
}
for (var i = 0; i < nodeList.length; ++i)
{
var node = nodeList.item(i);
if (strReturn != "")
{
strReturn += ", ";
}
strReturn += getNodeAttr(node, "Begin");
strReturn += " - ";
strReturn += getNodeAttr(node, "End");
}
return strReturn;
}
function getSubnets(nodeList)
{
var strReturn = "";
if (nodeList == null)
{
return strReturn;
}
for (var i = 0; i < nodeList.length; ++i)
{
var node = nodeList.item(i);
if (strReturn != "")
{
strReturn += ", ";
}
strReturn += getNodeAttr(node, "Address");
strReturn += "/";
strReturn += getNodeAttr(node, "PrefixLength");
}
return strReturn;
}
function getInterfaces(nodeList)
{
var strReturn = "";
if (nodeList == null)
{
return strReturn;
}
for (var i = 0; i < nodeList.length; ++i)
{
var node = nodeList.item(i);
if (strReturn != "")
{
strReturn += ", ";
}
strReturn += getNodeAttr(node, "Id");
}
return strReturn;
}
function getICMPs(nodeList)
{
var strReturn = "";
if (nodeList == null)
{
return strReturn;
}
for (var i = 0; i < nodeList.length; ++i)
{
var node = nodeList.item(i);
if (strReturn != "")
{
strReturn += ", ";
}
strReturn += getNodeAttr(node, "Type");
strReturn += "/";
strReturn += getNodeAttr(node, "Code");
}
return strReturn;
}
]]>