예제 #1
0
 public void Start(string virusTotalApiKey)
 {
     VirusTotalQueue.Start(virusTotalApiKey);
     _localStorage.Load();
     _shouldStopRunning = false;
     new Thread(ThreadMethod).Start();
 }
예제 #2
0
        public void Stop()
        {
            _shouldStopRunning = true;
            VirusTotalQueue.Stop();
            _localStorage.Save();

            SaveFoundVirusesDatabase();
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the virus scanner
 /// </summary>
 public VirusScanner()
 {
     LoadFoundVirusesDatabase();
     VirusTotalQueue = new VirusTotalQueue(OnVirusFound);
     _localStorage   = new CachedDefinitions();
     _fileQueue      = new ConcurrentBag <string>();
     VirusTotalQueue.NewDefinition += VirusTotalQueue_NewDefinition;
 }
예제 #4
0
        private void HandleFile(FileInfo fileInfo)
        {
            var sha256Hash = HashHelper.GetSHA256(fileInfo);

            if (_localStorage.Definitions.Exists(sr => sr.Hash == sha256Hash))
            {
                AlertOnPositive(sha256Hash, fileInfo.FullName);
            }
            else
            {
                VirusTotalQueue.Enqueue(fileInfo);
            }
        }