Ejemplo n.º 1
0
 private void KillScan()
 {
     ClamConfig.FindAndKillProcess("clamav");
     ClamConfig.FindAndKillProcess("clamscan");
     ClamConfig.FindAndKillProcess("freshclam");
     ClamConfig.FindAndKillProcess("clamwin");
     ClamConfig.FindAndKillProcess("clamtray");
 }
Ejemplo n.º 2
0
        public WHSClamAVUpdate()
        {
            InitializeComponent();
            ClamAVConfig = new ClamConfig();
            // Set up WHSInfo and register for notifications
            pInfo = new WHSInfo();
            pInfo.RegisterForNotifications(this);

            timer = new System.Timers.Timer();

            lastUpdate = DateTime.Now;
        }
Ejemplo n.º 3
0
        public WHSClamAVScan()
        {
            InitializeComponent();

            ClamAVConfig = new ClamConfig();

            timer          = new System.Timers.Timer(60000); // check every minute
            timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);

            pInfo = new WHSInfoClass();
            pInfo.Init("WHSClamAVService");

            pInfo.RegisterForNotifications(this);
        }
Ejemplo n.º 4
0
        private void LogStatusCheck()
        {
            if (!ClamConfig.IsInstalled())
            {
                LogStatusInstall();
            }
            else
            {
                if (hasAlertNotInstalled)
                {
                    pInfo.RemoveNotification("WHSClamAV-ClamWinNotInstalled");
                    hasAlertNotInstalled = false;
                }
            }

            // If virus found
            string quarDir = ClamAVConfig.ReadClamConfigKey("quarantinedir");

            if (Directory.Exists(quarDir))
            {
                if (Directory.GetFiles(quarDir).Length > 0)
                {
                    LogStatusVirus();
                }
                else if (hasAlertVirusFound)
                {
                    pInfo.RemoveNotification("WHSClamAV-Virus-Found");
                    hasAlertVirusFound = false;
                }
            }
            else if (hasAlertVirusFound)
            {
                pInfo.RemoveNotification("WHSClamAV-Virus-Found");
                hasAlertVirusFound = false;
            }

            // If not updated for more than 24 hours
            string defDir = ClamAVConfig.ReadClamConfigKey("database");

            if (Directory.Exists(defDir))
            {
                string[] files      = Directory.GetFiles(defDir);
                DateTime lastAccess = DateTime.MinValue;
                foreach (string file in files)
                {
                    FileInfo fileInfo = new FileInfo(file);
                    if (fileInfo.LastWriteTime > lastAccess)
                    {
                        lastAccess = fileInfo.LastWriteTime;
                    }
                }
                // If definition are more than 3 days old then raise the error
                if (lastAccess < DateTime.Now.AddDays(-3.0))
                {
                    LogStatusDefinitionsUpdate();
                }
                else if (hasAlertDefinitionsOutOfDate)
                {
                    pInfo.RemoveNotification("WHSClamAV-Definitions-OutOfDate");
                    hasAlertDefinitionsOutOfDate = false;
                }
            }
            else if (hasAlertDefinitionsOutOfDate)
            {
                pInfo.RemoveNotification("WHSClamAV-Definitions-OutOfDate");
                hasAlertDefinitionsOutOfDate = false;
            }

            // REMOVEBEFOREBUILD

            WebCheckInterval--;
            if (WebCheckInterval < 1)
            {
                WebCheckInterval = DEFAULT_WEB_CHECK_INTERVAL * 10000; // Ensure we don't fire until the next interval has passed
                DoWebCheck();
            }
        }