Esempio n. 1
0
    def OnInit(self):
        wxInitAllImageHandlers()
        if self.mode == 'scanner':
            if pyc.isWow64():
                self.DisablefsRedirect()
            self.exit_code = wxDialogUtils.wxScan(parent=None, config=self.config, path=self.path, autoClose=self.autoClose)
        elif self.mode == 'update':
            self.exit_code = wxDialogUtils.wxUpdateVirDB(parent=None, config=self.config, autoClose=self.autoClose)
        elif self.mode == 'configure':
            wxDialogUtils.wxConfigure(parent=None, config=self.config)
        elif self.mode == 'configure_schedule':
            wxDialogUtils.wxConfigure(parent=None, config=self.config, switchToSchedule=True)
        elif self.mode == 'about':
            wxDialogUtils.wxAbout(parent=None, config=self.config)
        elif self.mode == 'viewlog':
            wxDialogUtils.wxShowLog(parent=None, logfile=self.path.strip('"'))
        elif self.mode == 'checkversion':
            if not wxDialogUtils.wxCheckUpdate(parent=None, config=self.config):
                self.exit_code = 1

        else: #  mode == 'main'
            if pyc.isWow64():
                self.DisablefsRedirect()
            self.main = wxFrameMain.create(parent=None, config=self.config)
            self.main.Show()
            #workaround for running in wxProcess
            self.SetTopWindow(self.main)
        return True
Esempio n. 2
0
    def OnInit(self):
        wxInitAllImageHandlers()
        if self.mode == 'scanner':
            if pyc.isWow64():
                self.DisablefsRedirect()
            self.exit_code = wxDialogUtils.wxScan(parent=None, config=self.config, path=self.path, autoClose=self.autoClose)
        elif self.mode == 'update':
            self.exit_code = wxDialogUtils.wxUpdateVirDB(parent=None, config=self.config, autoClose=self.autoClose)
        elif self.mode == 'configure':
            wxDialogUtils.wxConfigure(parent=None, config=self.config)
        elif self.mode == 'configure_schedule':
            wxDialogUtils.wxConfigure(parent=None, config=self.config, switchToSchedule=True)
        elif self.mode == 'about':
            wxDialogUtils.wxAbout(parent=None, config=self.config)
        elif self.mode == 'viewlog':
            wxDialogUtils.wxShowLog(parent=None, logfile=self.path.strip('"'))
        elif self.mode == 'checkversion':
            if not wxDialogUtils.wxCheckUpdate(parent=None, config=self.config):
                self.exit_code = 1

        else: #  mode == 'main'
            if pyc.isWow64():
                self.DisablefsRedirect()
            self.main = wxFrameMain.create(parent=None, config=self.config)
            self.main.Show()
            #workaround for running in wxProcess
            self.SetTopWindow(self.main)
        return True
Esempio n. 3
0
    def _UpdateState(self):
        try:
            # disable Run Command button if the configuration is invalid
            # or no item is selected in the tree
            configured = self._IsConfigured()
            if not configured:
                if wxID_YES == MsgBox.MessageBox(
                        None, 'Blindata Antivirus',
                        'Blindata Antivirus is not configured. Would you like to configure it now?',
                        wxYES_NO | wxICON_QUESTION):
                    wxDialogUtils.wxConfigure(None, self._config)
                    configured = self._IsConfigured()

            hasdb = Utils.CheckDatabase(self._config)
            if configured and not hasdb:
                if wxID_YES == MsgBox.MessageBox(
                        None, 'Blindata Antivirus',
                        'You have not yet downloaded Virus Definitions Database. Would you like to download it now?',
                        wxYES_NO | wxICON_QUESTION):
                    wxDialogUtils.wxUpdateVirDB(self, self._config)
                    hasdb = Utils.CheckDatabase(self._config)

            self.buttonScan.Enable(configured and hasdb)
            self.toolBar.EnableTool(wxID_WXMAINFRAMETOOLBARTOOLS_INETUPDATE,
                                    configured)
            self.toolBar.EnableTool(wxID_WXMAINFRAMETOOLBARTOOLS_SCAN,
                                    configured and hasdb)
            self.toolBar.EnableTool(wxID_WXMAINFRAMETOOLBARTOOLS_SCANMEM,
                                    configured and hasdb)

            # check if the db is current (not older than 3 days)
            if hasdb:
                dbpath = self._config.Get('ClamAV', 'Database')
                daily = os.path.join(dbpath, 'daily.cld')
                if not os.path.isfile(daily):
                    daily = os.path.join(dbpath, 'daily.cvd')
                ver, numv, updated = Utils.GetDBInfo(daily)

            # print updated, time.mktime(time.localtime()), time.mktime(time.localtime()) - updated
            if hasdb and self._config.Get(
                    'Updates', 'WarnOutOfDate') == '1' and (
                        time.mktime(time.localtime()) - updated > 86400 * 5):
                if wxID_YES == MsgBox.MessageBox(
                        None, 'Blindata Antivirus',
                        'Virus signature database is older than 5 days and may not offer the latest protection. Would you like to update it now?',
                        wxYES_NO | wxICON_QUESTION):
                    wxDialogUtils.wxUpdateVirDB(self, self._config)
                    hasdb = Utils.CheckDatabase(self._config)

        except Exception, e:
            print 'An Error occured while updating UI selection. %s' % str(e)
Esempio n. 4
0
 def OnToolsPreferences(self, event):
     wxDialogUtils.wxConfigure(self, self._config)
     self._UpdateState()