Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Virus Scanning of Binaries -- Blobs vs. Files [closed]

There has been a lot of discussion on SO about using blobs vs. files to store binaries, but the current issue I'm facing involves virus scanning. There are likely a lot of APIs that can be used to scan files saved to a file system. Are there any for blobs? Are there APIs that can be given streams or byte[]s and told to scan them for viruses and malware? If so, does anybody have any recommendations? Or is this yet another reason to steer clear of blobs?

FYI - I'm using C# and MongoDb right now for my blobs.

like image 520
carlbenson Avatar asked Dec 23 '11 16:12

carlbenson


2 Answers

I was in need of a solution that the question was asking about. I evaluated a lot of things and came to the conclusion that there was really not one good .NET library for this. So I made my own.

The library is called nClam, and it connects to a ClamAV server. It is open-source (Apache License 2.0) library which has a very simple API. You can obtain it here: https://github.com/tekmaven/nClam. There is also a nuget package: nClam. I also have some instructions on how to set up the ClamAV server on my blog, here: http://architectryan.com/2011/05/19/nclam-a-dotnet-library-to-virus-scan/.

like image 192
Ryan Hoffman Avatar answered Nov 06 '22 15:11

Ryan Hoffman


I don't know if APIs exist for scanning in-memory data (I haven't found any), but you can always put your binary data into a temporary file, scan the file (by calling an external program working in command line) and delete it when it's done.

like image 28
CedX Avatar answered Nov 06 '22 17:11

CedX