通过构建脚本对文件进行病毒检查
我希望能够调用病毒检查作为构建过程的最后阶段(请不要询问为什么开发机器会感染病毒,这只是避免被客户起诉的风险的一种安全措施......)。另外,我希望可以选择在计算机上安装 AV,但关闭自动文件系统保护(至少对于构建目录)。
我想要的是使用任何现有的 AV 系统扫描文件的通用方法。我假设有一个 Windows API 可以执行此操作,因为 Windows 会检测到 AV 系统的存在,并且每当下载文件时,Firefox 等浏览器都会调用病毒扫描。那么他们使用的 API 是什么?有 Microsoft AntiVirus API 但这似乎特定于办公文件。该方法是否涉及使用 WMI? (如果您可以从那里检测到 AV 提供程序,那么您如何调用它来扫描文件?)
我知道我可以编写脚本来手动调用我知道要安装的 AV 扫描仪,但作为一项智力练习我更感兴趣的是像 Firefox 这样的应用程序是如何做到这一点的。
I would like to be be able to invoke a virus check as the final stage of the build process (please don't question why a dev machine would get a virus, it's just a belt-and-braces approach to avoid the risk of getting sued by customers...). Also I'd like the option of having AV on a machine but switching the auto file system protection off (at least for the build directories).
What I would like is a generic way of scanning a file using whatever AV system is in place. I'm assuming that there's an Windows API to do this, given that Windows detects the presence of an AV system, and browsers such as Firefox invoke a virus scan whenever a file is downloaded. So what's the API that they're using? There's the Microsoft AntiVirus API but that seems to be specific to Office documents. Does the approach involve using WMI? (and if you can detect the AV provider from there, how do you then invoke it to scan a file?)
I know that I could write the script to manually call the AV scanner that I know to be installed, but as an intellectual exercise I'm more interested to know how apps like Firefox are doing this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,您可能想直接在 Firefox 源代码上查看
nsDownloadScanner
系统:正如该文件的注释所述:
可以在此处找到有关这些接口的文档:
如果您的软件
是开源的符合 MPL 许可证(感谢@MSalters),您也可以直接使用Firefox的代码,以避免重新发明轮子。Well, you may want to take a look at the
nsDownloadScanner
system directly on the Firefox source code:As told by the comments on that files:
Documentations on those interfaces can be found here:
If your software
is open-sourceis compliant with the MPL licence (thanks, @MSalters), you may also directly use Firefox' code, to avoid reinventing the wheel.Firefox 使用 IAttachmentExecute API。但是,您不想在构建脚本中使用它,因为它会添加备用流信息,告诉窗口在执行文件时显示恼人的警告窗口。
Firefox uses the IAttachmentExecute API. However, you don't want to use that in a build script since it will add alternate stream information telling windows to show an annoying warning window when executing the file.