def __init__(self): self.random_key = base64.b64encode(os.urandom(64)) self.web_app_config = dict() self.web_app_config['save_window'] = [60 * 60, "Save window", "Number of seconds to save"] self.web_app_config['refresh_interval'] = [20, "Refresh interval", "Number of seconds between refresh"] self.web_app_config['allow_wireshark'] = [True, "Allow Wireshark", "Allow the client to launch Wireshark"] self.urls = ( '/', 'index', '', 'index', '/ajax_server', 'ajax_server', '/ajax_server/', 'ajax_server', '/config', 'config') self.client_status = 'stopped' self.next_immutable_config = dict() self.next_tweakable_config = dict() for opt, info in alice_options.items(): default, type, mutable, visible = info if visible: if mutable: self.next_tweakable_config[opt] = default else: self.next_immutable_config[opt] = default
def extract_options_for_api(self): """ AliceAPI will feed these to code that may want to know about options it can change """ self.tweakable = [] self.immutable = [] for opt, info in alice_options.items(): default, type, mutable, visible = info if visible: if mutable: self.tweakable.append((opt,type)) else: self.immutable.append((opt,type))
def extract_options_for_api(self): """ AliceAPI will feed these to code that may want to know about options it can change """ self.tweakable = [] self.immutable = [] for opt, info in alice_options.items(): default, type, mutable, visible = info if visible: if mutable: self.tweakable.append((opt, type)) else: self.immutable.append((opt, type))