private void StackScanner(ConcurrentQueue <string> queue)
        {
            while (true)
            {
                queue.TryDequeue(out var changedObjectPath);

                if (string.IsNullOrEmpty(changedObjectPath))
                {
                    continue;
                }

                PluginResult scanResult = PluginProxy.Instance(_config).Scan(changedObjectPath, PluginType.File);

                if (scanResult.RiskRate != ThreatRiskRates.NoRisk)
                {
                    bool?sendCommandResult = _pipeServer?.SendCommandToUI(new BeSafePipeCommand
                    {
                        CommandId        = Guid.NewGuid(),
                        Command          = PipeCommands.PluginScanResult,
                        PluginScanResult = scanResult
                    });

                    // Log threat
                    ThreatLog.Log(scanResult);
                }

                Thread.Sleep(500);
            }
        }
        private void StackScanner(ConcurrentQueue <ChangedValueInfo> queue)
        {
            while (true)
            {
                queue.TryDequeue(out var valueInfo);

                if (valueInfo == null)
                {
                    continue;
                }

                PluginResult scanResult = PluginProxy.Instance(_config).Scan(valueInfo, PluginType.Registry);

                if (scanResult.RiskRate != ThreatRiskRates.NoRisk)
                {
                    bool?sendCommandResult = _pipeServer?.SendCommandToUI(new BeSafePipeCommand
                    {
                        CommandId        = Guid.NewGuid(),
                        Command          = PipeCommands.PluginScanResult,
                        PluginScanResult = scanResult
                    });

                    // Log threat
                    ThreatLog.Log(scanResult);
                }

                Thread.Sleep(500);
            }
        }
Exemple #3
0
        private ThreatRiskRates OnFileAccessRequestEvent(string filePath)
        {
            PluginResult scanResult = PluginProxy.Instance(_config).Scan(filePath, PluginType.File);

            if (scanResult.RiskRate != ThreatRiskRates.NoRisk)
            {
                bool?sendCommandResult = _pipeServer?.SendCommandToUI(new BeSafePipeCommand
                {
                    CommandId        = Guid.NewGuid(),
                    Command          = PipeCommands.PluginScanResult,
                    PluginScanResult = scanResult
                });

                // Log threat
                ThreatLog.Log(scanResult);
            }

            return(scanResult.RiskRate);
        }