def step_config_monitor_password(self, curui): if curui.get_variable().get() == 'configureSetPassword': self._change_pwd = ui.VarString("", True) self._change_repwd = ui.VarString("", True) ipt = ui.Inputs() ipt.set_key("set_password") ipt.set_message(self._get_message('configurePassword')) ipt.add('password', self._get_message('password'), self._change_pwd, True) ipt.add('rePassword', self._get_message('rePassword'), self._change_repwd, True) ipt.prev_step(self.step_menu_monitor_password) ipt.next_step(self.step_config_monitor_password_procede) return ipt elif curui.get_variable().get() == 'configureRemovePassword': chs = ui.Chooser() chs.set_key("remove_password") chs.set_message( self._get_message('configureRemovePasswordQuestion')) chs.add("yes", self._get_message('yes')) chs.add("no", self._get_message('no')) chs.set_variable(ui.VarString("no")) chs.set_accept_key("yes") chs.prev_step(self.step_menu_monitor_password) chs.next_step(self.step_config_monitor_password_procede) return chs
def step_menu_monitor_desktop_notification(self, curui): try: chs = ui.Chooser() chs.set_message( self._get_message('configureDesktopNotification') + "\n\n" + self._get_message('warningSpyingTool')) chs.add("visible", self._get_message('desktopNotificationVisible')) chs.add("autohide", self._get_message('desktopNotificationAutoHide')) chs.add("none", self._get_message('desktopNotificationNone')) appv = self.get_config("monitor_desktop_notification") if appv == "autohide": chs.set_variable(ui.VarString("autohide")) elif appv == "none": chs.set_variable(ui.VarString("none")) else: chs.set_variable(ui.VarString("visible")) chs.prev_step(self.step_menu_monitor) chs.next_step(self.step_menu_monitor_desktop_notification_procede) return chs except: return ui.ErrorDialog( self._get_message('configureErrorConnection'))
def step_menu_monitor_selected(self, ui): try: chs = ui.Chooser() chs.set_message(self._get_message('configureChooseMonitorTrayIconVisibility')) chs.add("yes", self._get_message('yes')) chs.add("no", self._get_message('no')) if self.get_config("monitor_tray_icon")=="True": chs.set_variable(ui.VarString("yes")) else: chs.set_variable(ui.VarString("no")) chs.prev_step(self.step_menu_monitor) chs.next_step(self.step_menu_monitor_procede) return chs except: return ui.ErrorDialog(self._get_message('configureErrorConnection'))
def step_menu_monitor(self, curui): chs = ui.Chooser() chs.set_message(self._get_message('configureChooseOperation')) chs.add("configureTrayIconVisibility", self._get_message('configureTrayIconVisibility')) chs.set_variable(ui.VarString("configureTrayIconVisibility")) chs.prev_step(self.step_menu_main) chs.next_step(self.step_menu_monitor_selected) return chs
def step_password(self, curui): self._ins_pwd=ui.VarString("", True) ipt = ui.Inputs() ipt.set_key("insert_password") ipt.set_message(self._get_message('configureInsertPassword')) ipt.add('password', self._get_message('password'), self._ins_pwd, True) ipt.next_step(self.step_check_password) return ipt
def step_check_install_code(self, curui): if curui.get_key() is not None and curui.get_key() == 'tryAgain': if curui.get_variable().get() == 'configureLater': return self.step_menu_main(curui) elif curui.get_variable().get() == 'configProxy': curui.set_key("installCode") return self.step_configure_proxy_type(curui) elif curui.get_variable().get() == 'reEnterCode': return self.step_menu_agent_install_key_selected(curui) msg = self._get_message('checkInstallCode') self._uinterface.wait_message(msg) key = self._install_code.get() try: self.install_key(key) msg = ui.Message(self._get_message('configureKeyInstalled')) msg.next_step(self.step_menu_main) return msg except Exception as e: s = str(e) if s == "INVALID_CODE": chs = ui.Chooser() chs.set_key("tryAgain") chs.set_message(self._get_message('errorInvalidCode')) chs.add("reEnterCode", self._get_message('reEnterCode')) chs.add("configureLater", self._get_message('configureLater')) chs.set_variable(ui.VarString("reEnterCode")) chs.prev_step(self.step_menu_agent_install_key_selected) chs.next_step(self.step_check_install_code) return chs elif s == "CONNECT_ERROR": chs = ui.Chooser() chs.set_key("tryAgain") chs.set_message(self._get_message('errorConnectionQuestion')) chs.add("configProxy", self._get_message('yes')) chs.add("noTryAgain", self._get_message('noTryAgain')) chs.add("configureLater", self._get_message('configureLater')) chs.set_variable(ui.VarString("noTryAgain")) chs.prev_step(self.step_menu_agent_install_key_selected) chs.next_step(self.step_check_install_code) return chs elif s == "REQUEST_TIMEOUT": return ui.ErrorDialog( self._get_message('configureErrorConnection')) else: return ui.ErrorDialog(s)
def __init__(self): #self._config_port = 7950 #self._path_config='config.json' self._sharedmemclient=None self._install_code=ui.VarString() self._proxy_type=ui.VarString("SYSTEM") self._proxy_host=ui.VarString("") self._proxy_port=ui.VarString("") self._proxy_user=ui.VarString("") self._proxy_password=ui.VarString("", True) self._password="" self._main_menu_sel=ui.VarString("configureAgent") self._agent_menu_sel=ui.VarString("configureChangeInstallKey") self._password_menu_sel=ui.VarString("configureSetPassword") self._name=None
def step_menu_agent_disable(self, curui): chs = ui.Chooser() chs.set_message(self._get_message('configureDisableAgentQuestion')) chs.add("yes", self._get_message('yes')) chs.add("no", self._get_message('no')) chs.set_variable(ui.VarString("no")) chs.set_accept_key("yes") chs.prev_step(self.step_menu_agent) chs.next_step(self.step_menu_agent_disable_procede) return chs
def step_menu_agent_install_key(self, curui): chs = ui.Chooser() chs.set_message(self._get_message('configureUninstallKeyQuestion')) chs.add("yes", self._get_message('yes')) chs.add("no", self._get_message('no')) chs.set_variable(ui.VarString("no")) chs.set_accept_key("yes") chs.prev_step(self.step_menu_agent) chs.next_step(self.step_menu_agent_remove_key_selected) return chs
def step_configure_proxy_set(self, curui): ar = curui.get_key().split('_') curui.set_key(ar[0]) if len(ar) == 2 and ar[1] == 'tryAgain': if curui.get_variable() is not None and curui.get_variable().get( ) == 'configureLater': if curui.get_key() == "menuProxy": return self.step_menu_main(curui) elif curui.get_key() == "installCode": return self.step_menu_agent_install_key_selected(curui) try: if self._proxy_type.get() == 'HTTP' or self._proxy_type.get( ) == 'SOCKS4' or self._proxy_type.get( ) == 'SOCKS4A' or self._proxy_type.get() == 'SOCKS5': try: int(self._proxy_port.get()) except: return ui.ErrorDialog( self._get_message("validInteger").format( self._get_message('proxyPort'))) sret = self.send_req( "set_proxy", { 'type': self._proxy_type.get(), 'host': self._proxy_host.get(), 'port': self._proxy_port.get(), 'user': self._proxy_user.get(), 'password': self._proxy_password.get() }) if sret != "OK": raise Exception(sret[6:]) except: chs = ui.Chooser() chs.set_key(curui.get_key() + "_tryAgain") chs.set_message(self._get_message('errorConnectionConfig')) chs.add("noTryAgain", self._get_message('noTryAgain')) chs.add("configureLater", self._get_message('configureLater')) chs.set_variable(ui.VarString("noTryAgain")) if curui.get_key() == "menuProxy": chs.prev_step(self.step_menu_main) elif curui.get_key() == "installCode": chs.prev_step(self.step_menu_agent_install_key_selected) chs.next_step(self.step_configure_proxy_set) return chs if curui.get_key() == "menuProxy": msg = ui.Message(self._get_message('configureProxyEnd')) msg.next_step(self.step_menu_main) return msg elif curui.get_key() == "installCode": return self.step_check_install_code(curui)