def showWizard(): """ Provides a series of prompts, allowing the user to spawn a customized tor instance. """ if not sysTools.isAvailable("tor"): msg = "Unable to run the setup wizard. Is tor installed?" log.log(log.WARN, msg) return # gets tor's version torVersion = None try: versionQuery = sysTools.call("tor --version") for line in versionQuery: if line.startswith("Tor version "): torVersion = torTools.parseVersion(line.split(" ")[2]) break except IOError, exc: log.log(log.INFO, "'tor --version' query failed: %s" % exc)
systemOpt.setValidator( functools.partial(_toggleEnabledAction, startupOpt, True)) _toggleEnabledAction(startupOpt, systemOpt, not systemOpt.getValue()) # remembers the last selection made on the type prompt page controller = cli.controller.getController() manager = controller.getTorManager() relaySelection = RelayType.RESUME if manager.isTorrcAvailable( ) else RelayType.RELAY # excludes options that are either disabled or for a future tor version disabledOpt = list(CONFIG["wizard.disabled"]) for opt, optVersion in VERSION_REQUIREMENTS.items(): if not torVersion or not torTools.isVersion( torVersion, torTools.parseVersion(optVersion)): disabledOpt.append(opt) # the port forwarding option would only work if tor-fw-helper is in the path if not Options.PORTFORWARD in disabledOpt: if not sysTools.isAvailable("tor-fw-helper"): disabledOpt.append(Options.PORTFORWARD) # If we haven't run 'resources/torrcOverride/override.py --init' or lack # permissions then we aren't able to deal with the system wide tor instance. # Also drop the option if we aren't installed since override.py won't be at # the expected path. if not os.path.exists(os.path.dirname( SYSTEM_DROP_PATH)) or not os.path.exists(OVERRIDE_SCRIPT): disabledOpt.append(Options.SYSTEM)
# disables otherwise systemOpt = config[Options.SYSTEM] startupOpt = [config[Options.STARTUP]] systemOpt.setValidator(functools.partial(_toggleEnabledAction, startupOpt, True)) _toggleEnabledAction(startupOpt, systemOpt, not systemOpt.getValue()) # remembers the last selection made on the type prompt page controller = cli.controller.getController() manager = controller.getTorManager() relaySelection = RelayType.RESUME if manager.isTorrcAvailable() else RelayType.RELAY # excludes options that are either disabled or for a future tor version disabledOpt = list(CONFIG["wizard.disabled"]) for opt, optVersion in VERSION_REQUIREMENTS.items(): if not torVersion or not torTools.isVersion(torVersion, torTools.parseVersion(optVersion)): disabledOpt.append(opt) # the port forwarding option would only work if tor-fw-helper is in the path if not Options.PORTFORWARD in disabledOpt: if not sysTools.isAvailable("tor-fw-helper"): disabledOpt.append(Options.PORTFORWARD) # If we haven't run 'resources/torrcOverride/override.py --init' or lack # permissions then we aren't able to deal with the system wide tor instance. # Also drop the option if we aren't installed since override.py won't be at # the expected path. if not os.path.exists(os.path.dirname(SYSTEM_DROP_PATH)) or not os.path.exists(OVERRIDE_SCRIPT): disabledOpt.append(Options.SYSTEM) # TODO: The STARTUP option is currently disabled in the 'settings.cfg', and I