Scan file(s) for the virus before uploading to server

  1. Static file(s) directly upload to server(on-premise or cloud)
  2. Static file converts to Base 64 String and Upload to Database
  1. Using up to date antivirus system.
  2. Or if you don't have third-party AV software Can use Windows Defender software.
  1. Using ClamAV Antivirus software solution (Free and Open Source Software)
  2. Before upload to server exact path upload to a temporary location in the server.
  3. Using CLI wrappers for virus scan.

Clam AV

ClamAV Trademark
ASP.NET MVC Sample Application

TempLocation in Server

Normally in servers have antivirus software installed, so before upload to the exact physical location, if upload to a temporary location, then server antivirus software can do a real-time scan. after the scan, if it's not a malicious file then those files can move to the exact location.

CLI Wrappers

Sample Project With Windows Defender
CMD showing result of Windows Defender Scan result
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Press enter to scan");
Console.ReadLine();
var sw = Stopwatch.StartNew();
var exeLocation = @"C:\Program Files\WindowsDefender\MpCmdRun.exe";
var fileToScan = @"D:\ML\wildfire.exe";
var scanner = new WindowsDefenderScanner(exeLocation);
var result = scanner.Scan(fileToScan, 10000);
sw.Stop();
Console.WriteLine(result);
Console.WriteLine($"Completed scan in {sw.ElapsedMilliseconds}ms");
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
var exeLocation = @"C:\Program Files\AVAST Software\Avast\ashcmd.exe";
var scanner = new AvastScanner(exeLocation);
var result = scanner.Scan(@"C:\virus.txt");
Console.WriteLine(result);
var exeLocation = @"C:\Program Files (x86)\AVG\Av\avgscanx.exe";
var scanner = new AVGScanner(exeLocation);
var result = scanner.Scan(@"C:\virus.txt");
Console.WriteLine(result);
var exeLocation = @"C:\Program Files\ESET\ESET Endpoint  Antivirus\ecls.exe";
var scanner = new EsetScanner(exeLocation);
var result = scanner.Scan(@"C:\virus.txt");
Console.WriteLine(result);

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store