来源:安全中国
检测注册表中的ProgID信息 例如输入wscript.shell就可以查询
’要用到regtool.ocx,用前请regsvr32 regtool.ocx
’ 我们需要这个对象来访问注册表! set wshshell = CreateObject("WScript.Shell") ’我们需要这个自定义对象列举子键,确定你安装了这个com对象 set registry = CreateObject("regtool.tob") ’我们需要这个对象创建一份文本文件 ’ 输出调查结果: set fs = CreateObject("Scripting.FileSystemObject") name = InputBox("Type in the ProgID of the Object you are interestedin!") keyA = "HKCR\" & name & "\" ’ 检查这个对象是否注册 objectname = ReadKey(keyA, ok) if not ok then MsgBox name & " was not found." WScript.Quit end if ’ 创建一个记录文件: outputfile = "C:\OBJECT.TXT" set output = fs.CreateTextFile(outputfile, true) Print name & ": " & objectname ’ 找出当前版本 curver = ReadKey(keyA & "CurVer\", ok) clsid = ReadKey(keyA & "CLSID\", ok) keyB = "HKCR\CLSID\" & clsid & "\" physfile = ReadKey(keyB & "InprocServer32\", ok) vidpid = ReadKey(keyB & "VersionIndependentProgID\", ok) typelib = ReadKey(keyB & "TypeLib\", ok) Print "Generic ProgID: " & vidpid Print "Physical File: " & physfile Print "File Version Information: " & GetVersion(physfile) Print "Current Version: " & curver Print "Class-ID: " & clsid Print "TypeLibrary ClassID: " & typelib keyC = "HKCR\Component Categories\" Print "Kind of Object:" cats = ReadKey(keyB & "Implemented Categories\", ok) if ok then set categories = registry.RegEnum(keyB _ & "Implemented Categories\") for each cat in categories catKey = keyC & cat & "\" if KeyExists(catKey) then set entries = registry.ListChildNames(catKey) for each entry in entries if entry<>"" then Print ReadKey(catKey _ & entry, ok) next else Print "Category information is missing!" end if next else Print "No Category Information" end if cats = ReadKey(keyB & "Required Categories\", ok) if ok then set categories = registry.RegEnum(keyB _ & "Required Categories\") for each cat in categories catKey = keyC & cat & "\" if KeyExists(catKey) then set entries = registry.ListChildNames(catKey) for each entry in entries if entry<>"" then Print ReadKey(catKey _ & entry, ok) next else Print "Category information is missing!" end if next else Print "No Required Categories" end if keyD = "HKCR\TypeLib\" & typelib & "\" if typelib="" then Print "No TypeLib available. Use physical file " _ & "and search application folder." else set typelibs = registry.RegEnum(keyD) for each typelib in typelibs if typelib<>"" then Print "TypeLib Version " _ & typelib & ": " & ReadKey(keyD & typelib _ & "\0\win32\", ok) next end if ’ 关闭记录并且显示 output.close wshshell.run outputfile function KeyExists(key) on error resume next check = wshshell.RegRead(key) if not err.Number=0 then KeyExists = false else KeyExists = true end if end function function ReadKey(key, status) on error resume next ReadKey = wshshell.RegRead(key) if not err.Number=0 then value="" err.clear status=false else status=true end if end function sub Print(text) ’写信息到记录文件 output.WriteLine text end sub function GetVersion(path) on error resume next GetVersion = fs.GetFileVersion(path) if not err=0 then err.clear GetVersion = -1 end if end function |