以下这段代码是用来监视系统IE进程,防止病毒假冒,用路径的方式来判断,但我需要把以下系统进程都按路径来判断,如何写成完整的?麻烦帮忙写出来,谢谢!~
Dim strComputer, strPath, strExePath
Dim objWMI, objFSO
Dim colProcesses
Dim objProcess, objFile
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
strComputer = "."
nCount = 0
strPath = CreateObject("WScript.Shell").ExpandEnvironmentStrings _
( "%ProgramFiles%\Internet Explorer\iexplore.exe" )
Set objFile = objFSO.GetFile( strPath )
strPath = objFile.ShortPath
Set objFile = Nothing
Set objWMI = GetObject( "winmgmts:{impersonationLevel=impersonate}\\" & _
strComputer & "\root\cimv2" )
Set colProcesses = objWMI.ExecQuery( "SELECT * FROM Win32_Process" & _
" WHERE Name=''iexplore.exe''" )
For Each objProcess In colProcesses
Set objFile = objFSO.GetFile( objProcess.ExecutablePath )
strExePath = objFile.ShortPath
Set objFile = Nothing
If StrComp(strExePath, strPath, 1) Then
objProcess.Terminate
Else
End If
Next
C:\WINDOWS\System32\smss.exe
C:\WINDOWS\system32\csrss.exe
C:\WINDOWS\system32\winlogon.exe
C:\WINDOWS\system32\services.exe
C:\WINDOWS\system32\lsass.exe
C:\WINDOWS\system32\svchost.exe
C:\WINDOWS\Explorer.EXE
C:\WINDOWS\System32\alg.exe
C:\WINDOWS\System32\ctfmon.exe
这是需要监视的进程
另外需要写个VBS专门杀掉除以上判断为路径正确的进程,以外的所有进程,希望有人帮忙写出来!~谢谢了先!~
Dim strComputer, strPath, strExePath
Dim objWMI, objFSO
Dim colProcesses
Dim objProcess, objFile
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
strComputer = "."
nCount = 0
strPath = CreateObject("WScript.Shell").ExpandEnvironmentStrings _
( "%ProgramFiles%\Internet Explorer\iexplore.exe" )
Set objFile = objFSO.GetFile( strPath )
strPath = objFile.ShortPath
Set objFile = Nothing
Set objWMI = GetObject( "winmgmts:{impersonationLevel=impersonate}\\" & _
strComputer & "\root\cimv2" )
Set colProcesses = objWMI.ExecQuery( "SELECT * FROM Win32_Process" & _
" WHERE Name=''iexplore.exe''" )
For Each objProcess In colProcesses
Set objFile = objFSO.GetFile( objProcess.ExecutablePath )
strExePath = objFile.ShortPath
Set objFile = Nothing
If StrComp(strExePath, strPath, 1) Then
objProcess.Terminate
Else
End If
Next
C:\WINDOWS\System32\smss.exe
C:\WINDOWS\system32\csrss.exe
C:\WINDOWS\system32\winlogon.exe
C:\WINDOWS\system32\services.exe
C:\WINDOWS\system32\lsass.exe
C:\WINDOWS\system32\svchost.exe
C:\WINDOWS\Explorer.EXE
C:\WINDOWS\System32\alg.exe
C:\WINDOWS\System32\ctfmon.exe
这是需要监视的进程
另外需要写个VBS专门杀掉除以上判断为路径正确的进程,以外的所有进程,希望有人帮忙写出来!~谢谢了先!~
