Closed miki-nis closed 1 year 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.
In my case, it looks works fine on my Windows 10 Pro v1809 64bit.
Could you attach the files those are reported as "VirusFound" to this thread?
Ive tried alot files with exe zip image file and always turn out to be a virus found and deletion of the file. Why?
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
@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.
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.
fixed issues https://github.com/jsakamoto/AntiVirusScanner/pull/4
This issue can be closed I think? As the PR is merged.
@1Jesper1 Thanks, I'll close this issue.
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?