在MVC3中检查病毒上传文件 [英] Check upload file for virus in MVC3

查看:257
本文介绍了在MVC3中检查病毒上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前读过这个主题,但是我怎样才能做到这一点,并为用户返回结果呢?

/ b>


避免用户上传的任何文件出现问题的最佳方法是在服务器上安装命令行病毒扫描程序
,您使用
上传后扫描文件。如果扫描结果是肯定的,请删除
文件等等。


解决方案

查看Sophos API https://secure.sophos.com/partners/oem /integration/savdi.html

SAV动态接口(SAVDI)为Sophos检测引擎提供了一个易于集成的通用接口。它使得以任何语言编写的程序能够扫描恶意软件的文件和数据,并且在运行在.NET环境中的ISP / ASP特别受欢迎。另外一种方法是使用.NET环境中的ISPs / ASPs。进程类在服务器上启动防病毒扫描程序( http://www.dotnetperls.com/process-开始)并解析其结果。例如,以下是AVG的命令行参数列表: http:// www .avg.com / ww-en / faq.num-3604 。顺便说一句,当你开发你的解决方案时,你将需要测试如果您可以识别受感染的文件。但不建议使用真正的受感染文件。但是,您可以使用下面的字符串创建一个文本文件。此字符串通常被反病毒扫描程序识别为受感染的文件以用于测试目的(有关详细信息,请搜索EICAR标准反病毒测试文件)。

X5O !P%@ AP [4 \PZX54(P ^)7CC)7} $ EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$ H + H **


How can i check upload file for virus before store it?

I previously read this topic,but how can i do it programmatic and return result for user?

The best way to avoid problems with user uploaded files of any kind is to have a command line virus scanner on the server, which you use to scan the files after upload. If the scanner result is positive, delete the file and so on

解决方案

Take a look at Sophos API https://secure.sophos.com/partners/oem/integration/savdi.html

"SAV Dynamic Interface (SAVDI) provides an easy-to-integrate, general-purpose interface to the Sophos detection engine. It enables programs written in any language to scan files and data for malware and is particularly popular with ISPs/ASPs running in a .NET environment."

Another alternative is to use Process class to start an anti-virus scanner on the server (http://www.dotnetperls.com/process-start) and parse its results. For example, here's the list of command-line parameters for AVG: http://www.avg.com/ww-en/faq.num-3604.

By the way, as you develop your solution, you will need to test if you're able to identify an infected file. But it's not recommended to use a real infected file. However, you can create a text file with the string below. This string is commonly identified by anti-virus scanners as a infected file for testing purposes (for more information, search for EICAR Standard Anti-Virus Test File).

*X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H**

这篇关于在MVC3中检查病毒上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆