⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 753.html

📁 里面收集的是发表在www.xfocus.org上的文章
💻 HTML
📖 第 1 页 / 共 4 页
字号:
Next<br />
<br />
任务16:检查 Office 宏的安全性<br />
<br />
Microsoft Office 让用户自己决定如何运行嵌入文件中的宏。你可以选择:<br />
<br />
&amp;#8226; 高。只允许运行来自受信任来源的宏。所有其它经过签署的和未经签署的宏都将被禁用。<br />
 <br />
&amp;#8226; 中。你可以选择是否运行可能不安全的宏。<br />
 <br />
&amp;#8226; 低。允许运行所有宏。<br />
 <br />
<br />
在将宏安全性设置为高的情况下,你可以在其它时间中阻止自动运行的宏(当你打开一个文档或者运行某个程序的时候自动运行的那些宏)对你的计算机做些不好的事情。毫无疑问,一开始就将 Office 设置成为高安全性是个不错的主意,如果能够经常检查高安全性是否还在运行将会更好。<br />
<br />
检查宏安全性级别可能会有点灵活,因为指向你所要更改的注册值可能会因为你安装的 Office 版本的不同而相差很大。我们没有精力来讨论如何判断 Office 的版本(提示:使用 WMI 组的Win32_Product)然后决定合适的注册表路径,但是至少这里有一段能够从 Outlook 2000 中检索出宏安全级别的脚本。你应该能够轻易地根据你的需要和所安装的 Office 版本来改进这段脚本:<br />
<br />
Const HKEY_CURRENT_USER = &amp;H80000001<br />
strComputer = &quot;.&quot;<br />
Set objReg=GetObject(&quot;winmgmts:\\&quot; &amp; strComputer &amp;<br />
&quot;\root\default:StdRegProv&quot;)<br />
strKeyPath = &quot;Software\Microsoft\Office\10.0\Outlook\Security&quot;<br />
strValueName = &quot;Level&quot;<br />
objReg.GetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName,<br />
dwValue<br />
If dwValue = 3 Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;Outlook macro security is set to high.&quot;<br />
ElseIf dwValue = 2 Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;Outlook macro security is set to medium.&quot;<br />
Else<br />
&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;Outlook macro security is set to low.&quot;<br />
End If&nbsp;&nbsp;&nbsp;&nbsp;<br />
<br />
上述这段脚本是用来检测 Outlook 的宏安全性级别的。那么,如果你想要检测 Word、Excel、PowerPoint 或者 Access的宏安全级别的时候该怎么办?好吧,你只需要根据需要更改注册表路径即可:<br />
<br />
strKeyPath = &quot;Software\Microsoft\Office\10.0\Word\Security&quot;<br />
strKeyPath = &quot;Software\Microsoft\Office\10.0\Excel\Security&quot;<br />
strKeyPath = &quot;Software\Microsoft\Office\10.0\PowerPoint\Security&quot;<br />
strKeyPath = &quot;Software\Microsoft\Office\10.0\Access\Security&quot;<br />
<br />
任务17:检查 IE 安全区域<br />
<br />
为了保护用户不受恶意网站的攻击,Internet Explorer 使用安全区域来管理在你访问某个网站时可能完成或无法完成的行为(比如运行脚本、安装 ActiveX 控件等等)。在默认设置下,这些安全区域提供不同的安全级别:你可以在本地内部网络区域执行在受限网站区域中不能执行的程序(比如运行脚本)。<br />
<br />
如果你想要了解更多有关安全区域的情况,我们建议你阅读Internet Explorer 增强安全性设置白皮书(此白皮书是针对 Windows 2003 编写的,但是其中的内容对于其它 Windows 版本同样适用。)在这里,我们有一段能够报告本地内部网络区域(区域1)安全级别的脚本:<br />
<br />
Const HKEY_CURRENT_USER = &amp;H80000001<br />
strComputer = &quot;.&quot;<br />
Set objReg=GetObject(&quot;winmgmts:\\&quot; &amp; strComputer &amp;<br />
&quot;\root\default:StdRegProv&quot;)<br />
strKeyPath = &quot;Software\Microsoft\Windows\CurrentVersion\Internet<br />
Settings\Zones\1&quot;<br />
strValueName = &quot;CurrentLevel&quot;<br />
objReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue<br />
Select Case dwValue<br />
&nbsp;&nbsp;&nbsp;&nbsp;Case 73728<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;The security zone is set to high security.&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Case 69632<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;The security zone is set to medium security.&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Case 66816<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;The security zone is set to medium-low security.&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Case 65536<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;The security zone is set to low security.&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Case Else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;The security zone is set to custom security.&quot;<br />
End Select<br />
<br />
你也可以通过此段脚本检索有关受信任站点(区域2)、Internet(区域3)以及受限制站点(区域4)的安全信息。只需要相应更改注册表路径:<br />
<br />
Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2<br />
Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3<br />
Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4<br />
<br />
在绝大多数情况下,这个方法能够向你提供所需的信息。唯一会碰到的问题是用户是否已经更改了安全区域的一项或者多项设置。在那样的情况下,安全级别将会被报告为&quot;用户自定义&quot;,但是你就无从知道这个新的用户自定义的安全级别是比原来的默认级别更加严格还是更加宽松。这也就是脚本再次派上用场的地方:你可以使用一段脚本来决定(或者配置)各个安全区域的安全设置。有关这方面的更多信息,请参阅Internet Explorer 增强安全性设置白皮书或者擦亮你的眼睛看看 Tweakomatic。(不,这不是拼写错误。我们真的将要发布一款名叫Tweakomatic的东西。你一定要相信我们迟早会这么做的。)<br />
<br />
任务18:检查 Outlook 安全区域<br />
<br />
Microsoft Outlook 同样使用 Internet Explorer 的安全区域来决定是否运行来自于 HTML 格式信息的脚本和活动内容。要避免在计算机上运行嵌入了 HTML 信息的脚本,你需要做两件事情:<br />
<br />
&amp;#8226; 确保在 Internet Explorer 安全区域内运行脚本的功能已经被禁用(特别是在受限制的站点区域内)。<br />
 <br />
&amp;#8226; 确保 Outlook 使用那个安全区域<br />
 <br />
<br />
Outlook 安全区域记录在注册表中;同样,指向那个注册表值的确切路径取决于你在计算机上安装的 Office 版本。如果你使用 Office 2000,你可以使用以下脚本来决定 Outlook 的安全区域:<br />
<br />
Const HKEY_CURRENT_USER = &amp;H80000001<br />
strComputer = &quot;.&quot;<br />
Set objReg=GetObject(&quot;winmgmts:\\&quot; &amp; strComputer &amp;<br />
&quot;\root\default:StdRegProv&quot;)<br />
strKeyPath = &quot;Software\Microsoft\Office\10.0\Outlook\Options\General&quot;<br />
strValueName = &quot;Security Zone&quot;<br />
objReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue<br />
Select Case dwValue<br />
&nbsp;&nbsp;&nbsp;&nbsp;Case 4<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo _<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Outlook is using settings from the Restricted Sites zone.&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Case 3<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;Outlook is using settings from the Internet<br />
zone.&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Case 2<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;Outlook is using settings from the Trusted Sites<br />
zone.&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Case 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;Outlook is using settings from the Local Intranet<br />
zone.&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Case Else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;The Outlook security zone could not be<br />
determined.&quot;<br />
End Select<br />
<br />
在绝大多数计算机上,受限制的站点区域有最严格的安全限制。正因为如此,你可能会更进一步来为所有用户配置 Outlook 设置,以保证 Outlook 在 HTML 安全上使用受限制的站点。这里正好是一段实现以上功能的脚本:<br />
<br />
Const HKEY_CURRENT_USER = &amp;H80000001<br />
strComputer = &quot;.&quot;<br />
Set objReg=GetObject(&quot;winmgmts:\\&quot; &amp; strComputer &amp;<br />
&quot;\root\default:StdRegProv&quot;)<br />
strKeyPath = &quot;Software\Microsoft\Office\10.0\Outlook\Options\General&quot;<br />
strValueName = &quot;Security Zone&quot;<br />
dwValue = 4<br />
objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue<br />
<br />
返回页首<br />
最后的思考<br />
这里我们想再次强调一点:如果 Security Analyzer 能够符合你的需求,那么你就没有必要再写那些和 Security Analyzer 实现同样功能的脚本。(Scripting Guys 绝对坚持认为你不必去做你完全没有必要做的事情。)但是从另外一方面来说,Security Analyzer 只能够实现它编写设计的功能是它的一个局限性。之所以会如此是因为你觉得还有其他一些很重要的安全检查,而这些检查是 Security Analyzer 所不能做到的。例如,也许你想确定一下所有用户是否都使用受密码保护的屏保程序。Security Analyzer 能够做到吗?不能,但是你却可以通过编写一段很简单的脚本来实现:<br />
<br />
Const HKEY_CURRENT_USER = &amp;H80000001<br />
strComputer = &quot;.&quot;<br />
Set objReg =GetObject(&quot;winmgmts:\\&quot; &amp; strComputer &amp;<br />
&quot;\root\default:StdRegProv&quot;)<br />
strKeyPath = &quot;Control Panel\Desktop&quot;<br />
ValueName = &quot;ScreenSaverIsSecure&quot;<br />
objReg.GetStringValue HKEY_CURRENT_USER, strKeyPath, ValueName,<br />
strValue<br />
If strValue = &quot;1&quot; Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;The screen saver is password protected.&quot;<br />
Else<br />
&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Echo &quot;The screen saver is not password protected.&quot;<br />
End If<br />
<br />
然后,当然了,你也可以再进一步对屏保程序进行密码保护:<br />
<br />
Const HKEY_CURRENT_USER = &amp;H80000001<br />
strComputer = &quot;.&quot;<br />
Set objReg =GetObject(&quot;winmgmts:\\&quot; &amp; strComputer &amp;<br />
&quot;\root\default:StdRegProv&quot;)<br />
strKeyPath = &quot;Control Panel\Desktop&quot;<br />
ValueName = &quot;ScreenSaverIsSecure&quot;<br />
strValue = &quot;1&quot;<br />
objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, ValueName,<br />
strValue<br />
<br />
所以,也许你使用 Security Analyzer 来完成某些任务同时使用脚本来完成其它一些任务。问题的重点在于,你不应该用非此即彼的主张来看待安全问题:不是使用 Security Analyzer 就是通过编写脚本。相反,无论使用哪个都能起到很好的效果。毕竟,脚本通常用来辅助已经使用的工具而不是完全取代这些工具。选择你应该干的工作。<br />
<br />
或者,至少随便做一些能够让你的管家去做的事情。<br />
<br />
你对栏目有什么问题或意见吗?请写信到 scripter@microsoft.com。找 Bentley。
	</td>
  </tr>
</table>
<div class="footer">
  Copyright &copy; 1998-2003 XFOCUS Team. All Rights Reserved
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -