views:

1286

answers:

6

I'm building a web application in which I need to scan the user-uploaded files for viruses.

Does anyone with experience in building something like this can provide information on how to get this up and running? I'm guessing antivirus software packages have APIs to access their functionality programatically, but it seems it's not easy to get a hand on the details.

FYI, the application is written in C#.

+2  A: 

I would probably just make a system call to run an independent process to do the scan. There are a number of command-line AV engines out there from various vendors.

Joe
http://www.clamwin.com/ and http://www.clamav.net/lang/en/ are a good start.
cofiem
A: 

From my experience you can use COM for interfacing with some anti-virus software. But what I would suggest is a bit easier, just parse scan results after scanning. All you need to do is to start the scanner process and point it to file/folder you want to scan, store scan results into file or redirect stdout to your application and parse results.

msuvajac
+2  A: 

Check this question. It should be of some help.

Shoban
+1  A: 

Various Virus scanners do have API's. One I have integrated with is Sophos. I am pretty sure Norton has an API also while McAfee doesn't (it used to). What virus software do you want to use? You may want to check out Metascan as it will allow integration with many different scanners, but there is an annual license cost. :-P

Craig
+1  A: 

Take a look at the Microsoft Antivirus API. It makes use of COM, which should be easy enough to interface with from .NET. It refers specifically to Internet Explorer and Microsoft Office, but I don't see why you wouldn't be able to use to to on-demand scan any file.

All modern scanners that run on Windows should understand this API.

Thorarin
A: 

OPSWAT has an SDK for integrating antivirus scanning into proprietary solutions. It is written in C++ with COM/Java wrappers. It is described at http://www.opswat.com/products/metascan

punahou1980