Overview of secpod_reg.inc

Automatic Includes

These files are automatically included by the library.

Public Function Summary

Public functions are intended to be called by the code that imports this library.

Name Summary
hotfix_check_domain_controler
hotfix_check_exchange_installed
hotfix_check_iis_installed
hotfix_check_nt_server
hotfix_check_sp
hotfix_missing

Public Function Details

hotfix_check_domain_controler

Named Parameters

Code

function hotfix_check_domain_controler()
{
  local_var product_options;
  product_options = get_kb_item("SMB/Registry/HKLM/SYSTEM/CurrentControlSet/Control/ProductOptions");
  if(!product_options){
    return -1;
  }
  if("LanmanNT" >< product_options)
    return 1;
  else return 0;
}

function hotfix_check_nt_server()

		
top

hotfix_check_exchange_installed

Named Parameters

Code

function hotfix_check_exchange_installed()
{
  local_var vers;
  vers = get_kb_item("SMB/Registry/HKLM/SOFTWARE/Microsoft/Exchange/Setup/ServicePackBuild");
  if(!vers)
    return NULL;
  else return vers;
}

function hotfix_check_iis_installed()

		
top

hotfix_check_iis_installed

Named Parameters

Code

function hotfix_check_iis_installed()
{
  local_var w3svc;
  w3svc = get_kb_item("SMB/Registry/HKLM/SYSTEM/CurrentControlSet/Services/W3SVC/ImagePath");
  if(!w3svc){
    return -1;
  }
  if("inetinfo" >!< w3svc)
    return 0;
  else return 1;
}


		
top

hotfix_check_nt_server

Named Parameters

Code

function hotfix_check_nt_server()
{
  local_var product_options;
  product_options = get_kb_item("SMB/Registry/HKLM/SYSTEM/CurrentControlSet/Control/ProductOptions");
  if(!product_options){
    return -1;
  }
  if("WinNT" >< product_options)
    return 0;
  else return 1;
}

function hotfix_check_exchange_installed()

		
top

hotfix_check_sp

Named Parameters

nt
win10
win10x64
win2003
win2003x64
win2008
win2008r2
win2012
win2012R2
win2k
win7
win7x64
win8
win8_1
win8_1x64
win8x64
winVista
xp
xpx64

Code

 function hotfix_check_sp(nt, win2k, xp, xpx64, win2003, win2003x64, winVista,
                         win7, win7x64, win2008, win2008r2, win8, win8x64, win2012, 
                         win2012R2, win8_1, win8_1x64, win10, win10x64)
 {
 	local_var winVer, SvPk;

  	winVer = get_kb_item("SMB/WindowsVersion");
        winName = get_kb_item("SMB/WindowsName");
        arch = get_kb_item("SMB/Windows/Arch");
  	if(!winVer){
		return -1;
	}

   	if(nt && ("4.0" >< winVer))
  	{
    		SvPk = get_kb_item("SMB/WinNT4/ServicePack");
		if(SvPk){
    			SvPk = int(ereg_replace(string:SvPk, replace:"\1",
			 	        pattern:".*Service Pack ([0-9]).*"));
		}
    		else {
			SvPk = 0;
		}

    		if(SvPk < nt){
			return 1;
		}
		else {
			return 0;
		}
  	}

  	else if(win2k && ("5.0" >< winVer) && ("Microsoft Windows 2000" >< winName))
  	{
    		SvPk = get_kb_item("SMB/Win2K/ServicePack");
    		if(SvPk){
			SvPk = int(ereg_replace(string:SvPk, replace:"\1",
			 		pattern:".*Service Pack ([0-9]).*"));
		}
    		else {
			SvPk = 0;
		}

		if(SvPk < win2k ){
			return 1;
		}
    		else {
			return 0;
		}
  	}

	else if(xp && ("5.1" >< winVer) && ("Microsoft Windows XP" >< winName))
	{
		SvPk = get_kb_item("SMB/WinXP/ServicePack");
		if(SvPk){
			SvPk = int(ereg_replace(string:SvPk, replace:"\1",
					pattern:".*Service Pack ([0-9]).*"));
		}
    		else {
			SvPk = 0;
		}

		if(SvPk < xp){
			return 1;
		}
		else {
			return 0;
		}
  	}

        else if(xpx64 && ("5.2" >< winVer) && ("Microsoft Windows XP" >< winName) && (arch == "x64"))
        {
                SvPk = get_kb_item("SMB/WinXPx64/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < xpx64){
                        return 1;
                }
                else {
                        return 0;
                }
        }

  	else if(win2003 &&  ("5.2" >< winVer) && ("Microsoft Windows Server 2003" >< winName) && (arch == "x86"))
  	{
    		SvPk = get_kb_item("SMB/Win2003/ServicePack");
    		if(SvPk){
			SvPk = int(ereg_replace(string:SvPk, replace:"\1",
				 	pattern:".*Service Pack ([0-9]).*"));
		}
		else {
			SvPk = 0;
		}

    		if(SvPk < win2003){
			return 1;
		}
		else {
			return 0;
		}
  	}

        else if(win2003x64 && ("5.2" >< winVer) && ("Microsoft Windows Server 2003" >< winName) && (arch == "x64"))
        {
                SvPk = get_kb_item("SMB/Win2003x64/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < win2003x64){
                        return 1;
                }
                else {
                        return 0;
                }
        }

        else if(winVista &&  ("6.0" >< winVer) && ("Windows Vista" >< winName))
        {
                SvPk = get_kb_item("SMB/WinVista/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < winVista){
                        return 1;
                }
                else {
                        return 0;
                }

        }

        else if(win7 &&  ("6.1" >< winVer) && ("Windows 7" >< winName) && (arch == "x86"))
        {
                SvPk = get_kb_item("SMB/Win7/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < win7){
                        return 1;
                }
                else {
                        return 0;
                }

        }

        else if(win7x64 &&  ("6.1" >< winVer) && ("Windows 7" >< winName) && (arch == "x64"))
        {
                SvPk = get_kb_item("SMB/Win7x64/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < win7x64){
                        return 1;
                }
                else {
                        return 0;
                }

        }

        else if(win2008 &&  ("6.0" >< winVer) && ("Windows Server (R) 2008" >< winName))
        {
                SvPk = get_kb_item("SMB/Win2008/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < win2008){
                        return 1;
                }
                else {
                        return 0;
                }

        }

	else if(win2008r2 &&  ("6.1" >< winVer) && ("Windows Server 2008 R2" >< winName) && (arch == "x64"))
        {
                SvPk = get_kb_item("SMB/Win2008R2/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < win2008r2){
                        return 1;
                }
                else {
                        return 0;
                }
        }
        
        else if(win8 &&  ("6.2" >< winVer) && ("Windows 8" >< winName) && (arch == "x86"))
        {
                SvPk = get_kb_item("SMB/Win8/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < win8){
                        return 1;
                }
                else {
                        return 0;
                }
        }

        else if(win8x64 &&  ("6.2" >< winVer) && ("Windows 8" >< winName) && (arch == "x64"))
        {
                SvPk = get_kb_item("SMB/Win8x64/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < win8x64){
                        return 1;
                }
                else {
                        return 0;
                }
        }
        
        else if(win2012 &&  ("6.2" >< winVer) && ("Windows Server 2012" >< winName) && (arch == "x64"))
        {
                SvPk = get_kb_item("SMB/Win2012/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < win2012){
                        return 1;
                }
                else {
                        return 0;
                }
        }

        else if(win2012R2 &&  ("6.3" >< winVer) && ("Windows Server 2012 R2" >< winName) && (arch == "x64"))
        {
                SvPk = get_kb_item("SMB/Win2012R2/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < win2012R2){
                        return 1;
                }
                else {
                        return 0;
                }
        }

        else if(win8_1 &&  ("6.3" >< winVer) && ("Windows 8.1" >< winName) && (arch == "x86"))
        {
                SvPk = get_kb_item("SMB/Win8.1/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < win8_1){
                        return 1;
                }
                else {
                        return 0;
                }
        }

        else if(win8_1x64 &&  ("6.3" >< winVer) && ("Windows 8.1" >< winName) && (arch == "x64"))
        {
                SvPk = get_kb_item("SMB/Win8.1x64/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }
 
                if(SvPk < win8_1x64){
                        return 1;
                }
                else {
                        return 0;
                }
        }

       else if(win10 &&  ("6.3" >< winVer) && ("Windows 10" >< winName) && (arch == "x86"))
        {
                SvPk = get_kb_item("SMB/Win10/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < win10){
                        return 1;
                }
                else {
                        return 0;
                }
        }

        else if(win10x64 &&  ("6.3" >< winVer) && ("Windows 10" >< winName) && (arch == "x64"))
        {
                SvPk = get_kb_item("SMB/Win10x64/ServicePack");
                if(SvPk){
                        SvPk = int(ereg_replace(string:SvPk, replace:"\1",
                                        pattern:".*Service Pack ([0-9]).*"));
                }
                else {
                        SvPk = 0;
                }

                if(SvPk < win10x64){
                        return 1;
                }
                else {
                        return 0;
                }
        }
   
       return -1;
 }

 #-----------------------------------------------------------------------------

		
top

hotfix_missing

Named Parameters

name

Code

 function hotfix_missing(name)
 {
       local_var KB, key;

      KB = get_kb_list("SMB/Registry/*");
      if(isnull(KB) || max_index(make_list(keys(KB))) == 0){
 		return -1;
 	}

 	if("KB" >< name){
		name -= "KB";
 	}
 	else if("Q" >< name){
		name -= "Q";
 	}
 	else if("M" >< name){
		name -= "M";
	}

 	foreach key (keys(KB))
 	{
                if(ereg(pattern:"SMB/Registry/HKLM/SOFTWARE/Microsoft/(Updates/.*|" +
                                "Windows NT/CurrentVersion/HotFix)/(KB|Q|M)" + name,
                        string:key) ){
                        return 0;
                }
                else if(ereg(pattern:"SMB/Registry/HKLM/SOFTWARE/Microsoft/Windows/" +
                                     "CurrentVersion/Component Based Servicing/" +
                                     "Packages/[P|P]ackage.?[0-9].?for.?KB.*" + name, string:key)){
                     return 0;
                }
  	}
      return 1;
}


function hotfix_check_domain_controler()

		
top