";
}
else {
strSDDLObjectTitle = "
";
}
strSDDLObjectTitle += "
";
strSDDLObjectTitle += "
";
strSDDLObjectTitle += strTitle;
strSDDLObjectTitle += "";
return strSDDLObjectTitle ;
}
function BuildSDDLTable(strSDDL, strTitle, ObjectType, startupMode)
{
var strReturn = "";
if( strSDDL && (strSDDL.length > 0) )
{
var objtype = 0;
switch(ObjectType)
{
case "FileObject":
objtype = 1;
break;
case "RegistryKey":
objtype = 2;
break
case "ServiceObject":
objtype = 3;
break;
default:
break;
}
if( 0 == objtype ) //invalid SDDL type
{
strReturn = "
invalid SDDL type
";
return strReturn;
}
if( m_SDDL.init(objtype, strSDDL)!=0 )
{
strReturn = "
" + strTitle;
if( 3 == objtype )
{
strReturn = strReturn + BuildServiceView(startupMode);
}
else
{
strReturn = strReturn + BuildACLView();
}
strReturn = strReturn + "
";
}
}
else
{
strReturn = "";
}
return strReturn;
}
function BuildSDDLNodeView(parentNode, sectionType)
{
var strReturn = "";
if( null == parentNode )
{
strReturn = "";
return strReturn;
}
var strSDDL = "";
var strTitle = "";
var strStartupMode = "";
var startModeNode ;
var SDDLnode ;
switch(sectionType)
{
case "ServiceObject":
SDDLnode = parentNode.selectSingleNode("./PropertyGroup[@Key='BaselineValue']/Property[@Key='SecurityDescriptor']/Field");
startModeNode = parentNode.selectSingleNode("./PropertyGroup[@Key='BaselineValue']/Property[@Key='StartupType']/Field");
break;
default:
SDDLnode = parentNode.selectSingleNode("./Property[@Key='BaselineValue']/Field");
break;
}
if( null == SDDLnode )
{
strReturn = "";
}
else
{
if( startModeNode )
{
strStartupMode = startModeNode.text;
}
strSDDL = SDDLnode.text;
strTitle = getString("SecurityResults/Sections/SCETemplate/FileSystem/PolicySetting", "SCWAnaLocStrings.xml");
strReturn = BuildSDDLTable(strSDDL, strTitle, sectionType, strStartupMode);
}
//select system setting SDDL node
strStartupMode = "";
startModeNode = null;
switch(sectionType)
{
case "ServiceObject":
SDDLnode = parentNode.selectSingleNode("./PropertyGroup[@Key='SystemValue']/Property[@Key='SecurityDescriptor']/Field");
startModeNode = parentNode.selectSingleNode("./PropertyGroup[@Key='SystemValue']/Property[@Key='StartupType']/Field");
break;
default:
SDDLnode = parentNode.selectSingleNode("./Property[@Key='SystemValue']/Field");
break;
}
if( SDDLnode != null )
{
if( startModeNode )
{
strStartupMode = startModeNode.text;
}
strSDDL = SDDLnode.text;
strTitle = getString("SecurityResults/Sections/SCETemplate/FileSystem/CurrentSetting", "SCWAnaLocStrings.xml");
strReturn = strReturn + BuildSDDLTable(strSDDL, strTitle, sectionType, strStartupMode);
}
return strReturn;
}
function BuildServiceView(startupMode)
{
var strReturn = "
";
var permission = 1;
var auditing = 2;
//Get Service Startup Mode
strReturn = strReturn + "
";
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/Service/StartupMode", "SCWAnaLocStrings.xml");
strReturn = strReturn + "
";
var strTemp = startupMode;
if( strTemp.length > 0 )
{
strReturn = strReturn + "
";
switch(strTemp)
{
case "Automatic":
strReturn = strReturn + getString("SecurityResults/Sections/Services/Table/Automatic", "SCWAnaLocStrings.xml");
break;
case "Manual":
strReturn = strReturn + getString("SecurityResults/Sections/Services/Table/Manual", "SCWAnaLocStrings.xml");
break;
case "Disabled":
strReturn = strReturn + getString("SecurityResults/Sections/Services/Table/Disabled", "SCWAnaLocStrings.xml");
break;
default:
break;
}
strReturn = strReturn + " |
";
}
if( m_SDDL.IsPermissionsPresent() )
{
strACETable = BuildACEsTable(permission);
if ( strACETable.length > 0 ) {
//Get permission ACE table
strReturn = strReturn + "
";
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/Permissions", "SCWAnaLocStrings.xml");
strReturn = strReturn + "
";
strReturn = strReturn + strACETable;
}
}
if( m_SDDL.IsAuditingsPresent() )
{
//Get Auditing ACE table
strACETable = BuildACEsTable(auditing);
if ( strACETable.length > 0 ) {
strReturn = strReturn + "
";
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/Auditings", "SCWAnaLocStrings.xml");
strReturn = strReturn + "
";
strReturn = strReturn + strACETable;
}
}
strReturn = strReturn + "
";
return strReturn;
}
function BuildACLView()
{
var strReturn = "
";
var permission = 1;
var auditing = 2;
//Get ACL owner
var strTemp = m_SDDL.GetOwner();
if (strTemp.length > 0)
{
strReturn = strReturn + "
";
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/Owner", "SCWAnaLocStrings.xml");
strReturn = strReturn + "
";
strReturn = strReturn + "
";
strReturn = strReturn + strTemp;
strReturn = strReturn + " |
";
}
//Get ACL group
strTemp = m_SDDL.GetGroup();
if (strTemp.length > 0 )
{
strReturn = strReturn + "
";
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/Group", "SCWAnaLocStrings.xml");
strReturn = strReturn + "
";
strReturn = strReturn + "
";
strReturn = strReturn + strTemp;
strReturn = strReturn + " |
";
}
if( m_SDDL.IsPermissionsPresent() )
{
//Get permission ACE table
strACETable = BuildACEsTable(permission);;
if ( strACETable.length > 0 ) {
strReturn = strReturn + "
";
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/Permissions", "SCWAnaLocStrings.xml");
strReturn = strReturn + "
";
strReturn = strReturn + strACETable;
}
//Get permission inherit info
strReturn = strReturn + "
";
var bTemp = false;
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/PermissionInherit", "SCWAnaLocStrings.xml") + " | ";
strReturn = strReturn + ""
bTemp = m_SDDL.IsDACLInherited();
if( bTemp )
{
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/Enabled", "SCWAnaLocStrings.xml");
}
else
{
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/Disabled", "SCWAnaLocStrings.xml");
}
strReturn = strReturn + " |
";
}
if( m_SDDL.IsAuditingsPresent() )
{
//Get Auditing ACE table
strACETable = BuildACEsTable(auditing);
if ( strACETable.length > 0 ) {
strReturn = strReturn + "
";
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/Auditings", "SCWAnaLocStrings.xml");
strReturn = strReturn + "
";
strReturn = strReturn + strACETable;
}
//Get auditing inherit info
strReturn = strReturn + "
";
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/InheritanceFlags", "SCWAnaLocStrings.xml");
strReturn = strReturn + "
";
strReturn = strReturn + "
";
var bTemp = false;
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/AuditingInherit", "SCWAnaLocStrings.xml") + " | ";
strReturn = strReturn + ""
bTemp = m_SDDL.IsSACLInherited();
if( bTemp )
{
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/Enabled", "SCWAnaLocStrings.xml");
}
else
{
strReturn = strReturn + getString("SecurityResults/Sections/SCETemplate/FileSystem/Disabled", "SCWAnaLocStrings.xml");
}
strReturn = strReturn + " |
";
}
strReturn = strReturn + "
";
return strReturn;
}
function BuildACEsTable(ACLtype)
{
var strReturn = "
";
strReturn = strReturn + "";
strReturn = strReturn + "";
strReturn = strReturn + "";
if( 3 != m_SDDL.GetObjectType() )
{
strReturn = strReturn + "";
}
strReturn = strReturn + "";
var ACEcount = 0;
if( m_SDDL )
{
ACEcount = m_SDDL.GetACEsCount(ACLtype);
}
if( ACEcount <= 0 )
{
strReturn = "";
return strReturn;
}
var index = 0;
var type = 0;
m_SDDL.MoveToFirstACE(ACLtype);
var strTemp = "";
for(index=0; index";
switch(type)
{
case 1:
strTemp = strTemp + getString("SecurityResults/Sections/SCETemplate/FileSystem/SuccessType","SCWAnaLocStrings.xml");
break;
case 2:
strTemp = strTemp + getString("SecurityResults/Sections/SCETemplate/FileSystem/FailureType","SCWAnaLocStrings.xml");
break;
case 3:
strTemp = strTemp + getString("SecurityResults/Sections/SCETemplate/FileSystem/BothType","SCWAnaLocStrings.xml");
break;
case 4:
strTemp = strTemp + getString("SecurityResults/Sections/SCETemplate/FileSystem/AllowType","SCWAnaLocStrings.xml");
break;
case 5:
strTemp = strTemp + getString("SecurityResults/Sections/SCETemplate/FileSystem/DenyType","SCWAnaLocStrings.xml");
break;
default:
break;
}
strTemp = strTemp + "";
//Get ACE Name
strTemp = strTemp + "";
strTemp = strTemp + m_SDDL.GetCurACEName(ACLtype);
strTemp = strTemp + " | ";
//Get ACE permission
strTemp = strTemp + "";
// permission = 1 auditing = 2;
// permission ACE uses standard permission, but if the standard is empty then uses special.
// auditing ACE uses special permission
if( 1 == ACLtype )
{
var per = m_SDDL.GetCurACEStandardPermission(ACLtype);
if( per.length <= 0 )
{
per = m_SDDL.GetCurACESpecialPermission(ACLtype);
}
strTemp = strTemp + per;
}
else
{
strTemp = strTemp + m_SDDL.GetCurACESpecialPermission(ACLtype);
}
strTemp = strTemp + " | ";
//Get ACE applyto
if( 3 != m_SDDL.GetObjectType() )
{
strTemp = strTemp + "";
strTemp = strTemp + m_SDDL.GetCurACEApplyTo(ACLtype);
strTemp = strTemp + " | ";
}
strTemp = strTemp + "";
strReturn = strReturn + strTemp;
m_SDDL.MoveToNextACE(ACLtype);
}
strReturn = strReturn + "
";
return strReturn;
}
function getACETypeString(nod, strFile)
{
var nIndex = 0;
if(m_strArray)
{
for(nIndex = 0; nIndex < m_strArray.length; nIndex++)
{
if(strFile == m_strArray[nIndex])
{
break;
}
}
}
else
{
m_strArray = new Array(strFile);
m_arrObjs = new Array(1);
}
if(null == m_arrObjs[nIndex])
{
m_strArray[nIndex] = strFile;
m_arrObjs[nIndex] = new localization();
m_arrObjs[nIndex].loadXML(strFile);
}
if(!m_arrObjs[nIndex].isLoaded())
return "";
var strID = getNodeTextFromNode(nod);
var strPath;
switch(strID)
{
case "1":
strPath = "SecurityResults/Sections/SCETemplate/FileSystem/SuccessType";
break;
case "2":
strPath = "SecurityResults/Sections/SCETemplate/FileSystem/FailureType";
break;
case "3":
strPath = "SecurityResults/Sections/SCETemplate/FileSystem/BothType";
break;
case "4":
strPath = "SecurityResults/Sections/SCETemplate/FileSystem/AllowType";
break;
case "5":
strPath = "SecurityResults/Sections/SCETemplate/FileSystem/DenyType";
break;
default:
strPath = "";
}
return m_arrObjs[nIndex].getLocString(strPath);
}
function getACLInheritType(strID, strFile)
{
var nIndex = 0;
if(m_strArray)
{
for(nIndex = 0; nIndex < m_strArray.length; nIndex++)
{
if(strFile == m_strArray[nIndex])
{
break;
}
}
}
else
{
m_strArray = new Array(strFile);
m_arrObjs = new Array(1);
}
if(null == m_arrObjs[nIndex])
{
m_strArray[nIndex] = strFile;
m_arrObjs[nIndex] = new localization();
m_arrObjs[nIndex].loadXML(strFile);
}
if(!m_arrObjs[nIndex].isLoaded())
return "";
var strPath;
switch(strID)
{
case "True":
case "TRUE":
strPath = "SecurityResults/Sections/SCETemplate/FileSystem/Enabled";
break;
case "False":
case "FALSE":
strPath = "SecurityResults/Sections/SCETemplate/FileSystem/Disabled";
break;
default:
strPath = "";
}
return m_arrObjs[nIndex].getLocString(strPath);
}
function BuildServiceSection(tempNode, bNotInstalled)
{
strReturn = "";
ServiceItemsNode = tempNode.nextNode();
if ( bNotInstalled == 1) {
xPath = "./Item[./PropertyGroup[@Key='BaselineValue' and Property/Field='Disabled'] and not ( ./PropertyGroup/@Key='SystemValue')]";
}
else {
xPath = "./Item[not (./PropertyGroup[@Key='BaselineValue' and Property/Field='Disabled'] and not ( ./PropertyGroup/@Key='SystemValue')) ]";
}
ServiceItemNodes = ServiceItemsNode.selectNodes(xPath);
if ( ( ServiceItemNodes != null) && ( ServiceItemNodes.length > 0 ) )
{
strReturn += "";
if ( bNotInstalled == 1 ) {
strReturn += "
";
}
else {
strReturn += "
";
}
strReturn += "
";
// Build the Actual Table
strReturn += BuildServiceTable(ServiceItemNodes);
strReturn += "
";
}
return strReturn;
}
function BuildServiceTable(nodelist)
{
function ServiceClass ( strServiceName, strBaseStartup, strSystemStartup)
{
this.m_strServiceName = strServiceName;
this.m_strBaseStartup = strBaseStartup;
this.m_strSystemStartup = strSystemStartup;
}
function SortServiceClass(first, second) {
return first.m_strServiceName.localeCompare(second.m_strServiceName );
}
var ServiceArray = new Array();
strReturn = "";
if ( ( nodelist != null ) && (nodelist.length > 0 ))
{
strServiceHTML = getTableHeaderForPropertyGroup();
/* Create the Header*/
strServiceHTML += getRow(
getCell(getString("SecurityResults/Sections/Services/Table/ServiceName", "SCWAnaLocStrings.xml"),
"'OBJECTLISTSUBHEADER'", "width='50%'" ),
getCell(getString("SecurityResults/Sections/Services/Table/BaseMode", "SCWAnaLocStrings.xml"),
"'OBJECTLISTSUBHEADER'" , "width='25%'" ),
getCell(getString("SecurityResults/Sections/Services/Table/SystemMode", "SCWAnaLocStrings.xml"),
"'OBJECTLISTSUBHEADER'" , "width='25%'" ));
for( iServiceIndex = 0; iServiceIndex < nodelist.length; iServiceIndex++)
{
ServiceNode = nodelist.item(iServiceIndex);
BaselineStartupNode = ServiceNode.selectSingleNode("PropertyGroup[@Key='BaselineValue']/Property[@Key='StartupType']/Field");
SystemStartupNode = ServiceNode.selectSingleNode("PropertyGroup[@Key='SystemValue']/Property[@Key='StartupType']/Field");
strServiceName = getServiceName(ServiceNode);
strBaseLineValue = getServiceStartupMode(BaselineStartupNode);
strSystemValue = getServiceStartupMode(SystemStartupNode);
ServiceArray[iServiceIndex] = new ServiceClass(strServiceName, strBaseLineValue, strSystemValue );
}
ServiceArray.sort(SortServiceClass);
for( iServiceIndex = 0; iServiceIndex < ServiceArray.length; iServiceIndex++) {
strServiceHTML += getRow(getCell(ServiceArray[iServiceIndex].m_strServiceName, "'OBJECT'"),
getCell(ServiceArray[iServiceIndex].m_strBaseStartup, "'OBJECT'"),
getCell(ServiceArray[iServiceIndex].m_strSystemStartup, "'OBJECT'"));
}
strServiceHTML += getTableFooterForPropertyGroup();
strReturn = strServiceHTML;
}
return strReturn;
}
function getRegKeyString(strKey, strSub)
{
var strReturn = "";
if( null == strKey || strKey.length == 0 )
{
return strReturn;
}
var bFirst = false;
var strTemp = "";
var strWidth = 60;
if( null == strSub || strSub.length == 0 )
{
bFirst = true;
strTemp = strKey;
if( strTemp.length <=strWidth )
{
return strTemp;
}
}
else if( strSub.length >= strKey.length )
{
return strReturn;
}
else
{
strTemp = strKey.substr(strSub.length);
strReturn = "
";
}
var index = strWidth;
var startpos = 0;
while( strTemp.length - startpos > strWidth )
{
while( index > 0 )
{
if( strTemp.charAt(startpos + index)=='\\' )
{
strReturn += strTemp.substr(startpos, index+1);
if( !bFirst )
{
strReturn += "
";
}
startpos = startpos + index + 1;
index = strWidth;
break;
}
index = index - 1;
}
if( 0 == index )
{
index = strWidth;
strReturn += strTemp.substr(startpos, index+1);
if( !bFirst )
{
strReturn += "
";
}
startpos = startpos + index + 1;
}
if( bFirst )
{
break;
}
}
if( !bFirst && startpos < strTemp.length )
{
strReturn += strTemp.substr(startpos);
}
return strReturn;
}
function BuildRegistrySection(RegistryItemsNode)
{
var strReturn = "";
var tempNode = RegistryItemsNode.nextNode();
var nodelist = tempNode.selectNodes("./Item");
if( nodelist != null || nodelist.length > 0 )
{
for(index=0; index
0 )
{
for(index=0; index 0 )
strReturn = getString(strxPath, "SCWAnaLocStrings.xml");
if ( (strReturn == null) || ( strReturn.length == 0 ) ){
strReturn = strAuditType;
}
return strReturn;
}
function getTableHeaderForPropertyGroup()
{
strReturn = "";
strReturn += "";
return strReturn;
}
function getTableFooterForPropertyGroup()
{
strReturn = "
";
return strReturn;
}
var m_pDomDocument;
var m_bLookupFileFound;
var m_ServiceInfoArray = new Array();
function InitializeLookup()
{
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 GetHeaderRow(strHeaderXPath, bSubHeader)
{
strReturn = "";
if ( bSubHeader == 1 )
{
strReturn = "