病毒扫描从Azure Web/Worker角色上传的文件 [英] Virus Scanning Uploaded files from Azure Web/Worker Role

查看:86
本文介绍了病毒扫描从Azure Web/Worker角色上传的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在设计一个Azure网站,该网站将允许用户上传可以访问的内容(MP4,Docx ... MSOffice文件).

We are designing an Azure Website which will allow users to Upload content(MP4,Docx...MSOffice Files) which can then be accessed.

我们将对某些视频内容进行编码以提供几种不同的质量格式,然后再对其进行流传输(使用 Azure媒体服务).

Some video content we will encode to provide several differing quality formats, before it will be streamed (using Azure Media Services).

我们需要添加一个中间步骤,以便我们可以扫描上传的文件以查看潜在的病毒风险. Azure(或第三方)是否内置了功能,可以让我们在处理内容之前调用API来扫描内容?理想情况下,我们正在寻找API,而不仅仅是在VM上的后台服务,因此我们可以获得潜在的反馈,可用于Web或工作角色.

We need to add an intermediate step so we can scan uploaded files for potential virus risk. Is there functionality built into azure (or third party) which will allow us to call an API to scan content before processing it? We are ideally looking for an API rather than just a background service on a VM, so we can get feedback potentially for use in a web or worker role.

快速浏览了Symantec Endpoint和Windows Defender,但不确定它们是否提供API

Had a quick look at Symantec Endpoint and Windows Defender but not sure these offer an API

推荐答案

我已经使用开源ClamAV成功地做到了这一点.您没有指定要使用的语言,但是由于是Azure,因此我假设使用.Net.

I have successfully done this using the open source ClamAV. You don't specify what languages you are using, but as it's Azure I'll assume .Net.

有一个.Net包装器,应提供您要查找的API:

There is a .Net wrapper that should provide the API that you are looking for:

https://github.com/tekmaven/nClam

以下是一些示例代码(注意:,该代码直接从nClam GitHub存储库页面复制并在此处复制,以防止链接腐烂)

Here is some sample code (note: this is copied directly from the nClam GitHub repo page and reproduced here just to protect against link rot)

using System;
using System.Linq;
using nClam;

class Program
{
    static void Main(string[] args)
    {

        var clam = new ClamClient("localhost", 3310);
        var scanResult = clam.ScanFileOnServer("C:\\test.txt");  //any file you would like!

        switch(scanResult.Result)
        {
            case ClamScanResults.Clean:
                Console.WriteLine("The file is clean!");
                break;
            case ClamScanResults.VirusDetected:
                Console.WriteLine("Virus Found!");
                Console.WriteLine("Virus name: {0}", scanResult.InfectedFiles.First().VirusName);
                break;
            case ClamScanResults.Error:
                Console.WriteLine("Woah an error occured! Error: {0}", scanResult.RawResult);
                break;
        }
    }
}

还有一些API可用于刷新病毒定义数据库.所有必需的ClamAV文件都可以包含在部署包中,并且任何配置都可以放入服务启动代码中.

There are also APIs available for refreshing the virus definition database. All the necessary ClamAV files can be included in the deployment package and any configuration can be put into the service start-up code.

这篇关于病毒扫描从Azure Web/Worker角色上传的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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