jsakamoto / AntiVirusScanner

Anti Virus Scanner for .NET (and COM)
Mozilla Public License 2.0
23 stars 8 forks source link

VirusFound always? #1

Closed miki-nis closed 1 year ago

miki-nis commented 5 years ago

I have tried it in a .net 4.7 project on 2 files (a PNG and a JPG image files) and in both cases the return value of ScanAndClean(filePath) method was "VirusFound". No other details. Is this package a joke?

jsakamoto commented 5 years ago

No, this package isn't a joke.

Anyway, it looks like that this library (and the "IAttachmentExecute" API in Windows OS) doesn't work well on your case.

I'll try to reproduce your problem.

jsakamoto commented 5 years ago

In my case, it looks works fine on my Windows 10 Pro v1809 64bit.

image

Could you attach the files those are reported as "VirusFound" to this thread?

bakamaru commented 5 years ago

image

Ive tried alot files with exe zip image file and always turn out to be a virus found and deletion of the file. Why?

adrius commented 2 years ago

Fails for me when the file is stored in a temporary location.

var originalFile = @"c:\temp\1.png"; var tempFile = Path.GetTempFileName(); var randomFile = Path.Combine(@"c:\temp", Path.GetRandomFileName());

// Copy the original file to a temporary file (at %TEMP% folder) File.Delete(tempFile); File.Copy(originalFile, tempFile);

// Copy the original to a random file in a well-known folder File.Copy(originalFile, randomFile);

// Scan all 3 files var scanner = new AntiVirus.Scanner(); var resultOriginal = scanner.ScanAndClean(originalFile); var resultTemp = scanner.ScanAndClean(tempFile); var resultRandom = scanner.ScanAndClean(randomFile);

// Output Console.WriteLine(resultOriginal); Console.WriteLine(resultTemp); Console.WriteLine(resultRandom);

Output:

VirusNotFound VirusFound VirusNotFound

JLMadsen commented 2 years ago

@adrius I think the error occurs when your file does not contain an extension. I tried with and without an extension and got VirusFound on the one without and VirusNotFound on the one with an extension.

Path.GetTempFileName() does not give your file an extension.

Boogier commented 2 years ago

I have "VirusFound" result on multiple files (without viruses for sure). And they are cleaned away.

Also sometimes I get 0x80004005 hResult which is by the Internet E_FAIL - Returned if an anti-virus product reports an infection in the file. In this case the file is also cleaned away.

Windows 2016 Server x64, Windows Defender.

Boogier commented 2 years ago

fixed issues https://github.com/jsakamoto/AntiVirusScanner/pull/4

1Jesper1 commented 1 year ago

This issue can be closed I think? As the PR is merged.

jsakamoto commented 1 year ago

@1Jesper1 Thanks, I'll close this issue.