home *** CD-ROM | disk | FTP | other *** search
- Option Explicit
- Const MPF_CLSID_MPFAGENT_STR = "{C3E5EA7D-6CC4-4344-84EF-2BA9B63F3519}"
- Const MPF_AGENT_MODULE_NAME_STR = "MPFAgent.exe"
- Const MPF_MVTX_MODULE_NAME_STR = "MVTX.exe"
- Const MPF_CMDARG_SHUTDOWN_STR = "/INVOKE:Shutdown"
- Const MPF_CMDARG_START_STR = "/INVOKE:StartFirewall"
- Const MPF_CMDARG_VWEVTLOG_SUMMARY_STR = "/INVOKE:View:Summary"
- Const MPF_CMDARG_VWEVTLOG_INBOUND_STR = "/INVOKE:View:Inbound"
- Const MPF_CMDARG_VWEVTLOG_APPLICATION_STR = "/INVOKE:View:Applications"
- Const MPF_CMDARG_VWEVTLOG_STR = "/INVOKE:View:Summary"
- Const MPF_CMDARG_SETSECURITY_DISABLE_STR = "/INVOKE:SetSecurity:Open"
- Const MPF_CMDARG_SETSECURITY_ENABLE_STR = "/INVOKE:SetSecurity:Standard"
- Const MPF_CMDARG_TESTMYFIREWALL_STR = "/INVOKE:TestFirewall"
- Const MPF_CMDARG_TRACKATTACK_STR = "/T:"
- Const MPF_CMDARG_OPTIONS_STR = "/INVOKE:ShowOptions:General"
- Const MPF_CMDARG_ABOUT_STR = "/INVOKE:About"
- Const MPF_CMDARG_VERIFYSUBSCRIPTION_STR = "/INVOKE:VerifySubscription"
-
- Const MPF_MAINMODULE_STR = "MPFConsole.exe"
-
- Const MPF_CMDARG_SETSECURITYLEVEL_STR = "/INVOKE:SetSecurity"
- Const MPF_SECLEVEL_OPEN_STR = "Open"
- Const MPF_SECLEVEL_TRUSTING_STR = "Trusting"
- Const MPF_SECLEVEL_STANDARD_STR = "Standard"
- Const MPF_SECLEVEL_TIGHT_STR = "Tight"
- Const MPF_SECLEVEL_LOCKDOWN_STR = "Lockdown"
-
- 'Following Consts are required to check if perpetual product is installed...
- Const REG_MPF_KEY = "HKLM\Software\McAfee.com\Personal Firewall"
- Const REG_MPF_PRODUCTTYPE_NAME = "ProductType" '// Product information
- Const MPF_PRODUCT_INSTALL_TYPE_NODIE_NOUPDATES = &H00000200
-
- '0 == Application started
- '1 == Application could not be started
- Function LaunchProgram( szPath, szCmdLine, eResult )
- '{
- eResult = 1
-
- If False = IsObject( g_localObjOS ) Then
- LaunchProgram = eResult
- Exit Function
- End If
-
- If False = IsObject( g_localObjFS ) Then
- LaunchProgram = eResult
- Exit Function
- End If
-
- If g_localObjOS is nothing Or _
- g_localObjFS is nothing Then
- '{
- LaunchProgram = eResult
- Exit Function
- '}
- End If
-
- If "" <> szPath And "" <> szCmdLine Then
- '{
- If 0 = g_localObjOS.RunProgram( szPath, CStr(szCmdLine) ) Then
- eResult = 1
- Else
- eResult = 0
- End If
- '}
- End If
- LaunchProgram = eResult
- '}
- End Function
-
- Function SetSecurityLevel( szSecurityLevel )
- '{
- Dim eResult
- Dim szPath
- Dim szCmdLine
- szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
- szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
- szCmdLine = MPF_CMDARG_SETSECURITYLEVEL_STR + ":" + szSecurityLevel
- LaunchProgram szPath, szCmdLine, eResult
- '}
- End Function
-
- Function EnableMPF()
- '{
- EnableMPF = -1
-
- If False = IsObject( g_localObjOS ) Or g_localObjOS is nothing Then
- Exit Function
- End If
-
- Dim eResult
- Dim szPath
- szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
- szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
- LaunchProgram szPath, MPF_CMDARG_START_STR, eResult
-
- 'SetSecurityLevel MPF_SECLEVEL_STANDARD_STR
-
- EnableMPF = 0
- '}
- End Function
-
- Function DisableMPF()
- '{
- DisableMPF = -1
-
- If False = IsObject( g_localObjOS ) Or g_localObjOS is nothing Then
- Exit Function
- End If
-
- Dim eResult
- Dim szPath
- szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
- szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
- LaunchProgram szPath, MPF_CMDARG_SHUTDOWN_STR, eResult
-
- '// Check if process is running.
- 'SetSecurityLevel MPF_SECLEVEL_OPEN_STR
-
- DisableMPF = 0
- '}
- End Function
-
- Function ViewEventLogSummary()
- '{
- Dim eResult
- Dim szPath
- szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
- szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
- LaunchProgram szPath, MPF_CMDARG_VWEVTLOG_SUMMARY_STR, eResult
- '}
- End Function
-
- Function ViewEventLogInbound()
- '{
- Dim eResult
- Dim szPath
- szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
- szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
- LaunchProgram szPath, MPF_CMDARG_VWEVTLOG_INBOUND_STR, eResult
- '}
- End Function
-
- Function ViewEventLogApplications()
- '{
- Dim eResult
- Dim szPath
- szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
- szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
- LaunchProgram szPath, MPF_CMDARG_VWEVTLOG_APPLICATION_STR, eResult
- '}
- End Function
-
- Function TestMPF()
- '{
- Dim eResult
- Dim szPath
- szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
- szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
- LaunchProgram szPath, MPF_CMDARG_TESTMYFIREWALL_STR, eResult
- '}
- End Function
-
- Function IsMPFPlus()
- '{
- '1 = Plus, 0 = Standard
- IsMPFPlus = 0
-
- If False = IsObject( g_localObjOS ) Or g_localObjOS is nothing Then
- Exit Function
- End If
-
- If False = IsObject( g_localObjReg ) Or g_localObjReg is nothing Then
- Exit Function
- End If
-
- Dim bOldOfuscate
- bOldOfuscate = g_localObjReg.obfuscate
-
- g_localObjReg.obfuscate = FALSE
-
- Dim dwPlus
- dwPlus = 0
- dwPlus = g_localObjReg.RegQueryValue( CStr("HKLM\Software\McAfee.com\Personal Firewall"), CStr("Plus") )
-
- If 1 = dwPlus Then
- IsMPFPlus = 1
- End If
-
- g_localObjReg.obfuscate = bOldOfuscate
- '}
- End Function
-
- Function TrackAnAttack()
- '{
- Dim szIPAddr
-
- If IsMpfPlus() = 1 Then
- '//szIPAddr = window.showModalDialog( "trckattk.htm", "", "dialogheight:225px; dialogwidth:324px; center:yes; resizable:no; status:no; help:no; edge:raised;" )
- szIPAddr = window.showModalDialog( "trckattk.htm", "", "dialogheight:225px; dialogwidth:303px; center:yes; resizable:no; status:no; help:no; edge:raised;" )
- Else
- szIPAddr = "Standard"
- End If
-
- If "" <> szIPAddr Then
- '{
- Dim eResult
- Dim szPath
- Dim szCmdLine
- szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
- szPath = CStr(szPath & "\" & MPF_MVTX_MODULE_NAME_STR)
- szCmdLine = MPF_CMDARG_TRACKATTACK_STR + szIPAddr
- LaunchProgram szPath, szCmdLine, eResult
- '}
- End If
- '}
- End Function
-
- Function ShowOptions()
- '{
- Dim eResult
- Dim szPath
- Dim szCmdLine
- szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
- szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
- LaunchProgram szPath, MPF_CMDARG_OPTIONS_STR, eResult
- '}
- End Function
-
- Function ShowAbout()
- '{
- Dim eResult
- Dim szPath
- Dim szCmdLine
- szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
- szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
-
- LaunchProgram szPath, MPF_CMDARG_ABOUT_STR, eResult
- '}
- End Function
-
- '////////////////////////////////////////////////////////////////////////
- 'Functions doing the actual work may or may not have return values. But we don't want
- 'to return anything. So following wrapper functions are added...
-
- Function IsMPFEnabled()
- '{
- '-1 = Error, 0 = Not Running/Disabled, 1 = Enabled, 2 = Open
- IsMPFEnabled = -1
-
- If False = IsObject( g_localObjOS ) Or g_localObjOS is nothing Then
- Exit Function
- End If
-
- If False = IsObject( g_localObjReg ) Or g_localObjReg is nothing Then
- Exit Function
- End If
-
- Dim bOldOfuscate
- bOldOfuscate = g_localObjReg.obfuscate
-
- g_localObjReg.obfuscate = FALSE
-
- Dim dwSecurityLevel
- dwSecurityLevel = -1
- dwSecurityLevel = g_localObjReg.RegQueryValue( CStr("HKLM\Software\McAfee.com\Personal Firewall"), CStr("Security") )
- If 0 = dwSecurityLevel Then
- '{
- ' MPF is running but securitylevel set to "open"
- IsMPFEnabled = 2
- '}
- ElseIf dwSecurityLevel >= 1 And dwSecurityLevel <= 4 Then
- '{
- ' MPF is running and protecting
- IsMPFEnabled = 1
- '}
- Else 'If 255 = dwSecurityLevel Then
- '{
- ' MPF is not running
- IsMPFEnabled = 0
- '}
- End If
-
- g_localObjReg.obfuscate = bOldOfuscate
- '}
- End Function
-
- Function OnEnableMPF()
- '{
- EnableMPF()
-
- 'Now we have a Timer that calls GetNewMPFState every 1500 msec
- 'which in turn calls these functions, so we don't need to call it here...
- 'SetDocumentTitleString()
- '}
- End Function
-
- Function OnDisableMPF()
- '{
- DisableMPF()
-
- 'Now we have a Timer that calls GetNewMPFState every 1500 msec
- 'which in turn calls these functions, so we don't need to call it here...
- 'SetDocumentTitleString()
- '}
- End Function
-
- Function OnSetStdSecLevel()
- '{
- SetSecurityLevel MPF_SECLEVEL_STANDARD_STR
- '}
- End Function
-
- Function OnVerifyMPF()
- '{
- Dim eResult
- Dim szPath
- Dim szCmdLine
- szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
- szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
-
- LaunchProgram szPath, MPF_CMDARG_VERIFYSUBSCRIPTION_STR, eResult
- '}
- End Function
-
- Function OnViewEventLogSummary()
- '{
- ViewEventLogSummary()
- '}
- End Function
-
- Function OnViewEventLogInbound()
- '{
- ViewEventLogInbound()
- '}
- End Function
-
- Function OnViewEventLogApplications()
- '{
- ViewEventLogApplications()
- '}
- End Function
-
-
- Function OnTestMPF()
- '{
- TestMPF()
- '}
- End Function
-
- Function OnTrackAnAttack()
- '{
- TrackAnAttack()
- '}
- End Function
-
- Function OnShowOptions()
- '{
- ShowOptions()
- '}
- End Function
-
- Function OnShowAbout()
- '{
- ShowAbout()
- '}
- End Function
-
-
- Function GetInstalledMPFVersion( objReg, objOS, objFS )
- '{
- 'objReg Object has Obfuscate set to TRUE
- 'objOS is Operating Sysytem object
- 'objFS is File System object
-
- Const CLSID_MPF_2_X = "{06B8EBA6-9D9E-4cea-9301-AF7D3363E1FD}"
- Const CLSID_MPF_4_X = "{C3E5EA7D-6CC4-4344-84EF-2BA9B63F3519}"
-
- GetInstalledMPFVersion = -1
-
- If False = IsObject( objOS ) Then
- Exit Function
- End If
-
- If False = IsObject( objFS ) Then
- Exit Function
- End If
-
- If objOS is nothing Or _
- objFS is nothing Then
- '{
- Exit Function
- '}
- End If
-
- Dim szPath
- szPath = GetObjectPath( CLSID_MPF_2_X, objOS, objFS )
- If "" <> szPath Then
- '{
- szPath = szPath & CStr("\mpf.exe")
- If True = objFS.IsFile( szPath ) Then
- '{
- 'MPF 2.X is installed...
-
- GetInstalledMPFVersion = 2
-
- Exit Function
- '}
- End If
- '}
- End If
-
- szPath = GetObjectPath( CLSID_MPF_4_X, objOS, objFS )
- If "" <> szPath Then
- '{
- szPath = szPath + "\" + MPF_AGENT_MODULE_NAME_STR
- If True = objFS.IsFile( szPath ) Then
- '{
- 'MPF 4.X is installed...
-
- GetInstalledMPFVersion = 4
-
- Exit Function
- '}
- End If
- '}
- End If
-
- 'Neither 2.X nor 4.X is installed, Check if 3.X is installed by checking
- 'file version of MPF_MAINMODULE_STR
- 'Get Install Dir from the registry...
-
- Dim eResult
-
- 'NO OBFUSCATION REQUIRED HERE...
- Dim prevObfuscateVal
- prevObfuscateVal = objReg.obfuscate
-
- objReg.obfuscate = FALSE
-
- szPath = objReg.RegQueryValue( CStr("HKLM\Software\McAfee.com\Personal Firewall"), CStr("Install Dir") )
-
- 'Reset previous obfuscate value...
- objReg.obfuscate = prevObfuscateVal
-
- If "" <> szPath Then
- '{
- szPath = szPath + "\" + MPF_MAINMODULE_STR
-
- eResult = objOS.CheckVersion( szPath, "4,0,0,0" )
- 'CheckVersion returns MCINST_OS_OLDER_VERSION_EXISTS (1) if older version (3) exists...
- If 1 = eResult Then
- GetInstalledMPFVersion = 3
- Exit Function
- End If
- '}
- Else
- Exit Function
- End If
- '}
- End Function
-
- '1 = Expired, 0 = Not Expired
- Function IsMPFExpired()
- '{
- Dim szExpDate
-
- If g_localObjInstaller is nothing Or Not IsObject( g_localObjInstaller ) Then
- IsMPFExpired = 1
- Exit Function
- End If
-
- ' If Product type says its perpetual product return not expired...
- If False = WillMPFProductExpire() Then
- IsMPFExpired = 0
- Exit Function
- End If
-
- szExpDate = ""
- g_localObjInstaller.GetExpiryDate "HKLM\Software\McAfee.com\Personal Firewall", "Settings", szExpDate
-
- If Len(szExpDate) <> 8 Then
- IsMPFExpired = 1
- Exit Function
- End If
-
- Dim szExpYear, szExpMonth, szExpDay
- szExpYear = Left( szExpDate, 4 )
- szExpMonth = Mid( szExpDate, 5, 2 )
- szExpDay = Mid( szExpDate, 7, 2)
-
- Dim glExpYear, glExpMonth, glExpDay
-
- glExpYear = CStr( szExpYear )
- glExpMonth = CStr( szExpMonth )
- glExpDay = CStr( szExpDay )
-
- Dim actualExpiryDate
- actualExpiryDate = DateSerial( glExpYear, glExpMonth, glExpDay )
-
- If False = IsDate( actualExpiryDate ) Then
- '{
- 'Tampered Expiry setting
- IsMPFExpired = 1
- Exit Function
- '}
- End If
-
- If DateDiff( "d", Date, actualExpiryDate ) >= 0 Then
- IsMPFExpired = 0
- Else
- IsMPFExpired = 1
- End If
-
- '}
- End Function
-
- Function WillMPFProductExpire()
- '{
- Dim sTemp
-
- WillMPFProductExpire = True
-
- If IsObject(gobjReg) Then
- '{
- If not gobjReg is nothing Then
- '{
- gobjReg.Obfuscate = True
-
- sTemp = Trim(gobjReg.RegQueryValue(REG_MPF_KEY, REG_MPF_PRODUCTTYPE_NAME))
- If IsNumeric(sTemp) And Len(sTemp) > 0 Then
- If (CLng(sTemp) And MPF_PRODUCT_INSTALL_TYPE_NODIE_NOUPDATES) <> 0 Then
- WillMPFProductExpire = False
- End If
- End If
-
- gobjReg.Obfuscate = False
- '}
- End If
- '}
- End If
- '}
- End Function
-
-
- '--------------------------------------------------------------------------------
- ' To Support Retail products in Dashboard, we need to have a set of function
- ' that check for Retail product state (Expired/Enabled/Disabled) etc
-
- '1 = Installed, 0 = Not Installed, -1 = Error
- Function IsRetailMPFInstalled()
- '{
- Dim bOldOfuscate, bRetail
- If g_localObjReg Is Nothing Then
- IsRetailMPFInstalled = -1
- Exit Function
- End If
-
- bRetail = 0
- bOldOfuscate = g_localObjReg.obfuscate
- g_localObjReg.obfuscate = True
- bRetail = g_localObjReg.RegQueryValue( CStr("HKLM\Software\McAfee.com\Agent\Apps\MPF"), CStr("Retail") )
- If 1 = bRetail Then
- IsRetailMPFInstalled = 1
- Else
- IsRetailMPFInstalled = 0
- End If
- g_localObjReg.obfuscate = bOldOfuscate
- '}
- End Function
-
- '1 = Expired, 0 = Not Expired
- Function IsRetailMPFExpired()
- '{
- Dim szExpDate
-
- If g_localObjInstaller is nothing Or Not IsObject( g_localObjInstaller ) Then
- IsRetailMPFExpired = 1
- Exit Function
- End If
-
- ' If Product type says its perpetual product return not expired...
- If False = WillMPFProductExpire() Then
- IsRetailMPFExpired = 0
- Exit Function
- End If
-
- szExpDate = ""
- g_localObjInstaller.GetExpiryDate "HKLM\Software\McAfee.com\Personal Firewall", "Settings", szExpDate
-
- If Len(szExpDate) <> 8 Then
- IsRetailMPFExpired = 1
- Exit Function
- End If
-
- Dim szExpYear, szExpMonth, szExpDay
- szExpYear = Left( szExpDate, 4 )
- szExpMonth = Mid( szExpDate, 5, 2 )
- szExpDay = Mid( szExpDate, 7, 2)
-
- Dim glExpYear, glExpMonth, glExpDay
-
- glExpYear = CStr( szExpYear )
- glExpMonth = CStr( szExpMonth )
- glExpDay = CStr( szExpDay )
-
- Dim actualExpiryDate
- actualExpiryDate = DateSerial( glExpYear, glExpMonth, glExpDay )
-
- If False = IsDate( actualExpiryDate ) Then
- '{
- 'Tampered Expiry setting
- IsRetailMPFExpired = 1
- Exit Function
- '}
- End If
-
- If DateDiff( "d", Date, actualExpiryDate ) >= 0 Then
- IsRetailMPFExpired = 0
- Else
- IsRetailMPFExpired = 1
- End If
-
- '}
- End Function
-
- '//
- '// IsRetailMPFEnabled(): Return Values.
- '//
- '// -1: Error Code
- '// 0: Application is not running
- '// 1: Application is running.
- Function IsRetailMPFEnabled()
- '{
- Dim bOldOfuscate, dwState
- If g_localObjReg Is Nothing Then
- IsRetailMPFEnabled = -1
- Exit Function
- End If
-
- dwState = 0
- bOldOfuscate = g_localObjReg.obfuscate
- g_localObjReg.obfuscate = True
- dwState = g_localObjReg.RegQueryValue( CStr("HKLM\Software\McAfee.com\Agent\Apps\MPF"), CStr("State") )
- If 1 = dwState Then
- IsRetailMPFEnabled = 1
- Else
- IsRetailMPFEnabled = 0
- End If
- g_localObjReg.obfuscate = bOldOfuscate
- '}
- End Function
-
- '--------------------------------------------------------------------------------
-
-