Пример #1
0
        private void CheckStatus()
        {
            // Check if installed clam files exist
            if (ClamConfig.IsInstalled())
            {
                if (ClamWinUpgradeAvailable())
                {
                    SetUpgrade();
                }
                else
                {
                    SetRemove();
                }
            }
            else if (DownloadOkay())
            {
                SetInstall();
            }
            else
            {
                SetDownload();
            }

            if (client.IsBusy)
            {
                SetCancel();
            }

            CheckEnabled();
        }
Пример #2
0
 public MainTabUserControl()
 {
     InitializeComponent();
     ClamAVConfig = new ClamConfig();
     pInfo        = new WHSInfoClass();
     pInfo.Init("WHSClamAV");
     PopulateSharesMenuItem();
 }
Пример #3
0
        private void LoadProxySettings()
        {
            ClamConfig config = new ClamConfig();

            ProxyServerTextBox.Text   = config.ReadClamConfigKey("host");
            ProxyPortTextBox.Text     = config.ReadClamConfigKey("port");
            ProxyUserTextBox.Text     = config.ReadClamConfigKey("user");
            ProxyPasswordTextBox.Text = config.ReadClamConfigKey("password");
        }
Пример #4
0
        private void ProxySaveButton_Click(object sender, EventArgs e)
        {
            ClamConfig config = new ClamConfig();

            // Check if config file exists
            if (!File.Exists(config.ClamConfigFile))
            {
                ThrowError.Throw("ClamAV Config File does not exist\nHave you installed ClamAV?");
                return;
            }

            // Check Fields
            if (String.IsNullOrEmpty(ProxyServerTextBox.Text.Trim()) && !String.IsNullOrEmpty(ProxyUserTextBox.Text.Trim()))
            {
                ProxyServerTextBox.BackColor = Color.Red;
                return;
            }

            if (String.IsNullOrEmpty(ProxyUserTextBox.Text.Trim()) && !String.IsNullOrEmpty(ProxyPasswordTextBox.Text.Trim()))
            {
                ProxyUserTextBox.BackColor = Color.Red;
                return;
            }

            if (!String.IsNullOrEmpty(ProxyPortTextBox.Text))
            {
                try
                {
                    Int32 port = Int32.Parse(ProxyPortTextBox.Text);
                    if (port < 0 || port > 65535)
                    {
                        ProxyPortTextBox.BackColor = Color.Red;
                        return;
                    }
                }
                catch (Exception)
                {
                    ProxyPortTextBox.BackColor = Color.Red;
                    return;
                }
            }

            // All okay so clear all errors
            ProxyServerTextBox.BackColor   = Color.White;
            ProxyPortTextBox.BackColor     = Color.White;
            ProxyUserTextBox.BackColor     = Color.White;
            ProxyPasswordTextBox.BackColor = Color.White;

            // Save Fields
            config.WriteClamConfigKey("host", ProxyServerTextBox.Text.ToString().Trim());
            config.WriteClamConfigKey("port", ProxyPortTextBox.Text.ToString().Trim());
            config.WriteClamConfigKey("user", ProxyUserTextBox.Text.ToString().Trim());
            config.WriteClamConfigKey("password", ProxyPasswordTextBox.Text.ToString().Trim());

            //Disable Save Button
            ProxySaveButton.Enabled = false;
        }
Пример #5
0
        private void CheckEnabled()
        {
            UpdateServiceStatus();

            ClamConfig config = new ClamConfig();

            // Enable save button if we have clam config file
            ProxySaveButton.Enabled = File.Exists(config.ClamConfigFile);
        }
Пример #6
0
        private void DoInstall()
        {
            DownloadButton.Text    = "Installing";
            DownloadButton.Enabled = false;

            // NOTB - no ask toolbaar
            string command = ClamConfig.ClamAVInstallFile;
            string args    = "/sp- /silent /norestart /NOTB";

            System.Diagnostics.Process installer = new System.Diagnostics.Process();
            installer.StartInfo.FileName  = command;
            installer.StartInfo.Arguments = args;
            installer.Start();

            UpdateInstallLabel("Waiting to Kill Process FreshClam   ");

            // Thread.Sleep(3000);

            while (ClamConfig.WaitForProcess(installer.ProcessName))
            {
                ClamConfig.FindAndKillProcess("freshclam");
            }

            installer.WaitForExit();

            UpdateInstallLabel("Waiting to Kill Process ClamTray   ");

            while (ClamConfig.WaitForProcess("ClamTray"))
            {
                ClamConfig.FindAndKillProcess("ClamTray");
            }

            // Remove automatic start of ClamAV
            ClamConfig.RemoveRegistryKeys();

            // Set Quarantine option
            // Also remove warning for update
            try
            {
                ClamConfig clamConfig = new ClamConfig();
                clamConfig.WriteClamConfigKey("moveinfected", "1");
                clamConfig.WriteClamConfigKey("warnoutofdate", "0");
            }
            catch (Exception ex)
            {
                ThrowError.Throw(ex.Message);
            }

            CheckStatus();
        }
Пример #7
0
        private void StopToolBarButton_Click(object sender, EventArgs e)
        {
            ScanLogUpdateTimer.Stop();
            UpdateLogUpdateTimer.Stop();

            KillServiceThreads(ClamConfig.Services.Scan);
            KillServiceThreads(ClamConfig.Services.Update);

            System.Threading.Thread.Sleep(1000);

            ClamConfig.FindAndKillProcess("clamav");
            ClamConfig.FindAndKillProcess("clamscan");
            ClamConfig.FindAndKillProcess("freshclam");
            ClamConfig.FindAndKillProcess("clamwin");
            ClamConfig.FindAndKillProcess("clamtray");
        }
Пример #8
0
        private void CheckClamAVComponentStatusTimer_Tick(object sender, EventArgs e)
        {
            if (Directory.Exists(@"E:\"))
            {
                ScanBackupToolBarButton.Enabled = true;
            }
            else
            {
                ScanBackupToolBarButton.Enabled = false;
            }

            // Update Warning in top right of window
            LogStatusCheck();

            if (ClamConfig.FindProcess("freshclam") || ClamConfig.FindProcess("clamscan"))
            {
                EnableToolbarButtons(false);
                if (ClamConfig.FindProcess("clamscan"))
                {
                    ClamScanStatusLabel.Text    = "Scanner Running";
                    ClamScanStatusLabel.Image   = CommonImages.GreenIcon32;
                    ClamScanStatusLabel.Enabled = true;

                    // If clamscan is running but we did not start it in the console then update the output
                    if (!ScanLogUpdateTimer.Enabled)
                    {
                        ScanLogUpdateTimer.Start();
                    }
                }
                else
                {
                    ClamScanStatusLabel.Text    = "Scanner Idle";
                    ClamScanStatusLabel.Image   = CommonImages.GrayIcon32;
                    ClamScanStatusLabel.Enabled = false;
                    ScanLogUpdateTimer.Stop();
                }
                if (ClamConfig.FindProcess("freshclam"))
                {
                    ClamUpdateStatusLabel.Text    = "Updater Running";
                    ClamUpdateStatusLabel.Image   = CommonImages.GreenIcon32;
                    ClamUpdateStatusLabel.Enabled = true;

                    // If freshclam is running but we did not start it in the console then update the output
                    if (!UpdateLogUpdateTimer.Enabled)
                    {
                        UpdateLogUpdateTimer.Start();
                    }
                }
                else
                {
                    ClamUpdateStatusLabel.Text    = "Updater Idle";
                    ClamUpdateStatusLabel.Image   = CommonImages.GrayIcon32;
                    ClamUpdateStatusLabel.Enabled = false;
                    UpdateLogUpdateTimer.Stop();
                }
            }
            else
            {
                EnableToolbarButtons(true);
                ClamScanStatusLabel.Text      = "Scanner Idle";
                ClamScanStatusLabel.Image     = CommonImages.GrayIcon32;
                ClamScanStatusLabel.Enabled   = false;
                ClamUpdateStatusLabel.Text    = "Updater Idle";
                ClamUpdateStatusLabel.Image   = CommonImages.GrayIcon32;
                ClamUpdateStatusLabel.Enabled = false;
                UpdateLogUpdateTimer.Stop();
                ScanLogUpdateTimer.Stop();
            }
            ClamUpdateStatusLabel.Visible = true;
            ClamScanStatusLabel.Visible   = true;
        }
Пример #9
0
 private void LogStatusCheck()
 {
     QuarantineToolBarButton.Enabled = ClamConfig.IsInstalled();
     UpdateToolBarButton.Enabled     = ClamConfig.IsInstalled();
     ScanToolBarButton.Enabled       = ClamConfig.IsInstalled();
 }