mirror of
https://github.com/volodymyrsmirnov/MalwareMultiScan.git
synced 2025-08-25 05:52:23 +00:00
refactoring and adding clamav scanning backend
This commit is contained in:
@@ -11,9 +11,9 @@ namespace MalwareMultiScan.Backends.Backends.Abstracts
|
||||
public abstract class AbstractScanBackend : IScanBackend
|
||||
{
|
||||
public virtual string Name => throw new NotImplementedException();
|
||||
|
||||
|
||||
public virtual DateTime DatabaseLastUpdate => throw new NotImplementedException();
|
||||
|
||||
|
||||
public virtual Task<string[]> ScanAsync(string path, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -23,14 +23,14 @@ namespace MalwareMultiScan.Backends.Backends.Abstracts
|
||||
{
|
||||
using var httpClient = new HttpClient();
|
||||
await using var uriStream = await httpClient.GetStreamAsync(uri);
|
||||
|
||||
|
||||
return await ScanAsync(uriStream, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<string[]> ScanAsync(IFormFile file, CancellationToken cancellationToken)
|
||||
{
|
||||
await using var fileStream = file.OpenReadStream();
|
||||
|
||||
|
||||
return await ScanAsync(fileStream, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,9 @@ namespace MalwareMultiScan.Backends.Backends.Abstracts
|
||||
try
|
||||
{
|
||||
await using (var tempFileStream = File.OpenWrite(tempFile))
|
||||
{
|
||||
await stream.CopyToAsync(tempFileStream, cancellationToken);
|
||||
}
|
||||
|
||||
return await ScanAsync(tempFile, cancellationToken);
|
||||
}
|
||||
|
Reference in New Issue
Block a user