def __init__(self): super(WhonixConnectionWizard, self).__init__() translation = _translations(Common.translations_path, 'whonixsetup') self._ = translation.gettext self.steps = Common.wizard_steps self.connection_main_page = ConnectionMainPage() self.addPage(self.connection_main_page) self.bridge_wizard_page_1 = BridgesWizardPage1() self.addPage(self.bridge_wizard_page_1) self.bridge_wizard_page_2 = BridgesWizardPage2() self.addPage(self.bridge_wizard_page_2) self.proxy_wizard_page_1 = ProxyWizardPage1() self.addPage(self.proxy_wizard_page_1) self.proxy_wizard_page_2 = ProxyWizardPage2() self.addPage(self.proxy_wizard_page_2) self.tor_status_page = TorStatusPage() self.addPage(self.tor_status_page) #self.bootstrap_thread = TorBootstrap(self) #self.bootstrap_thread.finished.connect(app.exit) #self.connect(self.bootstrap_thread, self.bootstrap_thread.signal, self.update_bootstrap) self.bridges = [] self.proxy_type = '' self.tor_status = '' self.bootstrap_done = False self.setupUi()
def __init__(self): super(ProxyWizardPage2, self).__init__() Common.use_proxy = True translation = _translations(Common.translations_path, 'whonixsetup') self._ = translation.gettext self.steps = Common.wizard_steps self.layout = QtGui.QVBoxLayout(self) self.label = QtGui.QLabel(self) self.layout.addWidget(self.label) self.groupBox = QtGui.QGroupBox(self) self.label_3 = QtGui.QLabel(self.groupBox) self.comboBox = QtGui.QComboBox(self.groupBox) self.label_2 = QtGui.QLabel(self.groupBox) self.label_5 = QtGui.QLabel(self.groupBox) self.label_6 = QtGui.QLabel(self.groupBox) self.lineEdit = QtGui.QLineEdit(self.groupBox) self.label_7 = QtGui.QLabel(self.groupBox) self.lineEdit_2 = QtGui.QLineEdit(self.groupBox) self.lineEdit_3 = QtGui.QLineEdit(self.groupBox) self.lineEdit_4 = QtGui.QLineEdit(self.groupBox) self.label_8 = QtGui.QLabel(self.groupBox) self.label_4 = QtGui.QLabel(self.groupBox) self.layout.addWidget(self.groupBox) self.setupUi()
def __init__(self): super(ProxyWizardPage2, self).__init__() Common.use_proxy = True translation = _translations(Common.translations_path, 'whonixsetup') self._ = translation.gettext self.steps = Common.wizard_steps self.proxies = ['-', 'SOCKS4', 'SOCKS5', 'HTTP / HTTPS'] self.layout = QtWidgets.QVBoxLayout(self) self.label = QtWidgets.QLabel(self) self.layout.addWidget(self.label) self.groupBox = QtWidgets.QGroupBox(self) self.label_3 = QtWidgets.QLabel(self.groupBox) self.comboBox = QtWidgets.QComboBox(self.groupBox) self.label_2 = QtWidgets.QLabel(self.groupBox) self.label_5 = QtWidgets.QLabel(self.groupBox) self.label_6 = QtWidgets.QLabel(self.groupBox) self.lineEdit = QtWidgets.QLineEdit(self.groupBox) # IP TODO: An inputmask() will make user more clear about what to input: https://doc.qt.io/qt-4.8/qlineedit.html#displayText-prop self.label_7 = QtWidgets.QLabel(self.groupBox) self.lineEdit_2 = QtWidgets.QLineEdit(self.groupBox) # Port self.lineEdit_3 = QtWidgets.QLineEdit(self.groupBox) # Username self.lineEdit_4 = QtWidgets.QLineEdit(self.groupBox) # Password TODO: password should be covered: https://doc.qt.io/qt-4.8/qlineedit.html#displayText-prop self.label_8 = QtWidgets.QLabel(self.groupBox) self.label_4 = QtWidgets.QLabel(self.groupBox) self.layout.addWidget(self.groupBox) self.setupUi()
def __init__(self, file_path, section): super(gui_message, self).__init__() tr = translations._translations(file_path, section) self.icon = tr.section.get('icon') self.button = tr.section.get('button') if tr.section.get('position') == 'topleft': self.move(0, 0) self._ = tr.gettext self.initUI()
def __init__(self): super(WhonixSetupWizard, self).__init__() translation = _translations(Common.translations_path, 'whonixsetup') self._ = translation.gettext self.steps = Common.wizard_steps if Common.argument == 'repository': self.repository_wizard_page_1 = RepositoryWizardPage1() self.addPage(self.repository_wizard_page_1) self.repository_wizard_page_2 = RepositoryWizardPage2() self.addPage(self.repository_wizard_page_2) self.repository_wizard_finish = RepositoryWizardfinish() self.addPage(self.repository_wizard_finish) if Common.argument == 'setup': self.disclaimer_1 = DisclaimerPage1() self.addPage(self.disclaimer_1) self.disclaimer_2 = DisclaimerPage2() self.addPage(self.disclaimer_2) self.first_use_notice = FirstUseNotice() self.addPage(self.first_use_notice) self.whonix_repo_page = WhonixRepositoryPage() self.addPage(self.whonix_repo_page) self.repository_wizard_page_1 = RepositoryWizardPage1() self.addPage(self.repository_wizard_page_1) self.repository_wizard_page_2 = RepositoryWizardPage2() self.addPage(self.repository_wizard_page_2) self.repository_wizard_finish = RepositoryWizardfinish() self.addPage(self.repository_wizard_finish) self.finish_page = FinishPage() self.addPage(self.finish_page) if Common.argument == 'locale_settings': self.locale_settings = LocaleSettings() self.addPage(self.locale_settings) self.locale_settings_finish = LocaleSettingsFinish() self.addPage(self.locale_settings_finish) self.setupUi()
def __init__(self): super(repository_dist_wizard, self).__init__() self.resize(500, 330) self.setWindowTitle(project + ' Repository Wizard') icon = "/usr/share/icons/anon-icon-pack/whonix.ico" self.setWindowIcon(QtGui.QIcon(icon)) translation = _translations(common.tr_file, 'repository-dist') # gettext like. self._ = translation.gettext # When run a root, Qt is not granted access to all its functionalities (seemingly). # Set a transparent (default dialog) background for the widget. palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(244, 244, 244)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) self.setPalette(palette) self.page_enable = QWizardPage() self.enable_group = QGroupBox(self.page_enable) self.enable_button = QRadioButton(self.enable_group) self.disable_button = QRadioButton(self.enable_group) self.addPage(self.page_enable) self.page_repos = QWizardPage() self.repo_text = QLabel(self.page_repos) self.repo_group = QGroupBox(self.page_repos) self.repo1 = QRadioButton(self.repo_group) self.repo2 = QRadioButton(self.repo_group) self.repo3 = QRadioButton(self.repo_group) self.repo4 = QRadioButton(self.repo_group) self.addPage(self.page_repos) self.page_finish = QWizardPage() self.finish_text = QLabel(self.page_finish) self.addPage(self.page_finish) self.one_shot = True self.setupUi()
def __init__(self): super(whonix_repository_wizard, self).__init__() self.resize(470, 310) self.setWindowTitle('Whonix Repository Wizard') icon = "/usr/share/icons/anon-icon-pack/whonix.ico" self.setWindowIcon(QtGui.QIcon(icon)) translation = _translations(common.tr_file, 'whonix_repository') # gettext like. self._ = translation.gettext # When run a root, Qt is not granted access to all its functionalities (seemingly). # Set a transparent (default dialog) background for the widget. palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(244, 244, 244)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) self.setPalette(palette) self.page_enable = QWizardPage() self.enable_group = QGroupBox(self.page_enable) self.enable_button = QRadioButton(self.enable_group) self.disable_button = QRadioButton(self.enable_group) self.addPage(self.page_enable) self.page_repos = QWizardPage() self.repo_text = QLabel(self.page_repos) self.repo_group = QGroupBox(self.page_repos) self.repo1 = QRadioButton(self.repo_group) self.repo2 = QRadioButton(self.repo_group) self.repo3 = QRadioButton(self.repo_group) self.addPage(self.page_repos) self.page_finish = QWizardPage() self.finish_text = QLabel(self.page_finish) self.addPage(self.page_finish) self.one_shot = True self.setupUi()
def __init__(self, file_path, section): super(gui_message, self).__init__() tr = translations._translations(file_path, section) stream = open(file_path, 'r') data = yaml.safe_load(stream) section = data[section] self.icon = section.get('icon', None) self.button = section.get('button', None) #if tr.section.get('position') == 'topleft': #self.move(0,0) self._ = tr.gettext self.initUI()
def __init__(self): super(setup_wizard_dist, self).__init__() translation = _translations(Common.translations_path, 'setup-dist') self._ = translation.gettext self.steps = Common.wizard_steps self.env = Common.environment if Common.show_disclaimer: self.disclaimer_1 = DisclaimerPage1() self.addPage(self.disclaimer_1) self.disclaimer_2 = DisclaimerPage2() self.addPage(self.disclaimer_2) self.finish_page = FinishPage() self.addPage(self.finish_page) self.setupUi()
def __init__(self): super(WhonixSetupWizard, self).__init__() translation = _translations(Common.translations_path, 'whonixsetup') self._ = translation.gettext self.steps = Common.wizard_steps self.env = Common.environment if Common.show_disclaimer: self.disclaimer_1 = DisclaimerPage1() self.addPage(self.disclaimer_1) self.disclaimer_2 = DisclaimerPage2() self.addPage(self.disclaimer_2) self.finish_page = FinishPage() self.addPage(self.finish_page) self.setupUi()
def __init__(self): super(ConnectionPage, self).__init__() translation = _translations(Common.translations_path, 'whonixsetup') self._ = translation.gettext self.Common = Common() self.steps = self.Common.wizard_steps self.env = self.Common.environment self.text = QtWidgets.QTextBrowser(self) self.layout = QtWidgets.QGridLayout() self.connection_group = QtWidgets.QGroupBox(self) self.enable = QtWidgets.QRadioButton(self.connection_group) self.disable = QtWidgets.QRadioButton(self.connection_group) self.censored = QtWidgets.QRadioButton(self.connection_group) self.use_proxy = QtWidgets.QRadioButton(self.connection_group) self.layout = QtWidgets.QVBoxLayout() self.setupUi()
def __init__(self): super(ConnectionPage, self).__init__() translation = _translations(Common.translations_path, 'whonixsetup') self._ = translation.gettext self.Common = Common() self.steps = self.Common.wizard_steps self.env = self.Common.environment self.text = QtGui.QTextBrowser(self) self.layout = QtGui.QGridLayout() self.connection_group = QtGui.QGroupBox(self) self.enable = QtGui.QRadioButton(self.connection_group) self.disable = QtGui.QRadioButton(self.connection_group) self.censored = QtGui.QRadioButton(self.connection_group) self.use_proxy = QtGui.QRadioButton(self.connection_group) self.layout = QtGui.QVBoxLayout() self.setupUi()
def __init__(self): super(BridgesWizardPage1, self).__init__() translation = _translations(Common.translations_path, 'whonixsetup') self._ = translation.gettext self.steps = Common.wizard_steps self.layout = QtGui.QVBoxLayout(self) self.label = QtGui.QLabel(self) self.layout.addWidget(self.label) self.label_2 = QtGui.QLabel(self) self.layout.addWidget(self.label_2) self.group_box = QtGui.QGroupBox(self) self.yes_button = QtGui.QRadioButton(self.group_box) self.no_button = QtGui.QRadioButton(self.group_box) self.label_3 = QtGui.QLabel(self.group_box) self.label_4 = QtGui.QLabel(self.group_box) self.layout.addWidget(self.group_box) self.setupUi()
def __init__(self): super(WhonixSetupWizard, self).__init__() translation = _translations(Common.translations_path, 'whonixsetup') self._ = translation.gettext self.steps = Common.wizard_steps self.env = Common.environment if Common.argument == 'repository': self.repository_wizard_page_1 = RepositoryWizardPage1() self.addPage(self.repository_wizard_page_1) self.repository_wizard_page_2 = RepositoryWizardPage2() self.addPage(self.repository_wizard_page_2) self.repository_wizard_finish = RepositoryWizardfinish() self.addPage(self.repository_wizard_finish) if Common.argument == 'setup': if Common.show_disclaimer: self.disclaimer_1 = DisclaimerPage1() self.addPage(self.disclaimer_1) self.disclaimer_2 = DisclaimerPage2() self.addPage(self.disclaimer_2) if Common.run_whonixcheck_only: self.finish_page = FinishPage() self.addPage(self.finish_page) else: if self.env == 'gateway': self.connection_page = ConnectionPage() self.addPage(self.connection_page) self.tor_status_page = TorStatusPage() self.addPage(self.tor_status_page) self.whonix_repo_page = WhonixRepositoryPage() self.addPage(self.whonix_repo_page) self.repository_wizard_page_1 = RepositoryWizardPage1() self.addPage(self.repository_wizard_page_1) self.repository_wizard_page_2 = RepositoryWizardPage2() self.addPage(self.repository_wizard_page_2) self.repository_wizard_finish = RepositoryWizardfinish() self.addPage(self.repository_wizard_finish) self.finish_page = FinishPage() self.addPage(self.finish_page) if self.env == 'gateway' and Common.first_use_notice: self.first_use_notice = FirstUseNotice() self.addPage(self.first_use_notice) if Common.argument == 'locale_settings': self.locale_settings = LocaleSettings() self.addPage(self.locale_settings) self.locale_settings_finish = LocaleSettingsFinish() self.addPage(self.locale_settings_finish) self.setupUi()
def global_files(): home_folder = str(Path.home()) home_folder_split = os.path.split(Path.home()) if home_folder_split[0] == "/home": # Required for support of running as users other than sdwdate. sdwdate_status_files_folder = home_folder + "/sdwdate" sdwdate_persistent_files_folder = sdwdate_status_files_folder # example sdwdate_status_files_folder: # /home/user/sdwdate else: # home folder for user "sdwdate" is set to /run/sdwdate sdwdate_status_files_folder = home_folder sdwdate_persistent_files_folder = "/var/lib/sdwdate" # example sdwdate_status_files_folder: # /run/sdwdate # Sanity test. sdwdate_status_files_folder_split = os.path.split( sdwdate_status_files_folder) # Workaround for an apparmor issue. # See /etc/apparmor.d/usr.bin.sdwdate # for /run/sdwdate/forbidden-temp sdwdate_forbidden_temp_files_folder = (sdwdate_status_files_folder + "/forbidden-temp") global status_first_success_path status_first_success_path = sdwdate_status_files_folder + "/first_success" global status_success_path status_success_path = sdwdate_status_files_folder + "/success" global status_file_path status_file_path = sdwdate_status_files_folder + "/status" global sleep_long_file_path sleep_long_file_path = \ sdwdate_status_files_folder + "/sleep_long" global fail_file_path fail_file_path = sdwdate_status_files_folder + "/fail" global clock_jump_do_once_file clock_jump_do_once_file = (sdwdate_status_files_folder + "/clock_jump_do_once") # Read by systemcheck. global msg_path msg_path = sdwdate_status_files_folder + "/msg" global sdwdate_time_replay_protection_utc_unixtime sdwdate_time_replay_protection_utc_unixtime = ( sdwdate_persistent_files_folder + "/time-replay-protection-utc-unixtime") global sdwdate_time_replay_protection_utc_humanreadable sdwdate_time_replay_protection_utc_humanreadable = ( sdwdate_persistent_files_folder + "/time-replay-protection-utc-humanreadable") translations_path = "/usr/share/translations/sdwdate.yaml" translation = _translations(translations_path, "sdwdate") global translate_object translate_object = translation.gettext if not sdwdate_status_files_folder_split[-1] == "sdwdate": print("ERROR: home folder does not end with /sdwdate") print("ERROR: home_folder_split: " + str(home_folder_split)) print("ERROR: sdwdate_status_files_folder_split: " + str(sdwdate_status_files_folder_split)) print("ERROR: sdwdate_status_files_folder: " + sdwdate_status_files_folder) reason = "home folder does not end with /sdwdate" exit_code = 1 exit_handler(exit_code, reason) Path(sdwdate_status_files_folder).mkdir(parents=True, exist_ok=True) # Sanity test. Should be already created by systemd-tmpfiles. Path(sdwdate_persistent_files_folder).mkdir(parents=True, exist_ok=True) # Sanity test. Should be already created by systemd-tmpfiles. Path(sdwdate_forbidden_temp_files_folder).mkdir(parents=True, exist_ok=True) # Without this python-requests (url_to_unixtime) would try to write to # for example "/xb2e9wyl" instead of # "/run/sdwdate/forbidden-temp/xb2e9wyl" # which looks even worse in logs and cannot be deny'd in the apparmor # profile. os.chdir(sdwdate_forbidden_temp_files_folder)
def __init__(self): super(WhonixSetupWizard, self).__init__() translation = _translations(Common.translations_path, 'whonixsetup') self._ = translation.gettext self.steps = Common.wizard_steps self.env = Common.environment if Common.argument == 'repository': self.repository_wizard_page_1 = RepositoryWizardPage1() self.addPage(self.repository_wizard_page_1) self.repository_wizard_page_2 = RepositoryWizardPage2() self.addPage(self.repository_wizard_page_2) self.repository_wizard_finish = RepositoryWizardfinish() self.addPage(self.repository_wizard_finish) if Common.argument == 'setup': if Common.show_disclaimer: self.disclaimer_1 = DisclaimerPage1() self.addPage(self.disclaimer_1) self.disclaimer_2 = DisclaimerPage2() self.addPage(self.disclaimer_2) if Common.run_whonixcheck_only: self.finish_page = FinishPage() self.addPage(self.finish_page) else: if self.env == 'gateway': self.connection_page = ConnectionPage() self.addPage(self.connection_page) self.tor_status_page = TorStatusPage() self.addPage(self.tor_status_page) self.whonix_repo_page = WhonixRepositoryPage() self.addPage(self.whonix_repo_page) self.repository_wizard_page_1 = RepositoryWizardPage1() self.addPage(self.repository_wizard_page_1) self.repository_wizard_page_2 = RepositoryWizardPage2() self.addPage(self.repository_wizard_page_2) self.repository_wizard_finish = RepositoryWizardfinish() self.addPage(self.repository_wizard_finish) self.finish_page = FinishPage() self.addPage(self.finish_page) if self.env == 'gateway'and Common.first_use_notice: self.first_use_notice = FirstUseNotice() self.addPage(self.first_use_notice) if Common.argument == 'locale_settings': self.locale_settings = LocaleSettings() self.addPage(self.locale_settings) self.locale_settings_finish = LocaleSettingsFinish() self.addPage(self.locale_settings_finish) self.setupUi()