def _start(self, start_tor, check_incoherences, create_input_store): self.netTests = self.getNetTests() if start_tor: yield self.start_tor(check_incoherences) no_geoip = config.global_options.get('no-geoip', False) if no_geoip: aux = [False] if config.global_options.get('annotations') is not None: annotations = [ k.lower() for k in config.global_options['annotations'].keys() ] aux = map(lambda x: x in annotations, ["city", "country", "asn"]) if not all(aux): log.msg( "You should add annotations for the country, city and ASN") else: yield probe_ip.lookup() self.notify(DirectorEvent("success", "Looked up probe IP")) self.notify(DirectorEvent("success", "Running system tasks")) yield run_system_tasks(no_input_store=not create_input_store) self.notify(DirectorEvent("success", "Ran system tasks"))
def _setup_ooni(self): yield probe_ip.lookup() for input_file in self.ooni['net_test_loader'].inputFiles: filename = Template(input_file['filename']).safe_substitute( probe_cc=probe_ip.geodata['countrycode'].lower()) file_path = resolve_file_path(filename, self.cwd) input_file['test_options'][input_file['key']] = file_path
def task(self): log.debug("Updating the inputs") yield probe_ip.lookup() log.debug("Updating the inputs for country %s" % probe_ip.geodata['countrycode']) yield resources.check_for_update(probe_ip.geodata['countrycode']) yield input_store.update(probe_ip.geodata['countrycode']) yield probe_ip.resolveGeodata()
def _setup_ooni(self): yield probe_ip.lookup() for input_file in self.ooni['net_test_loader'].inputFiles: filename = Template(input_file['filename']).safe_substitute( probe_cc=probe_ip.geodata['countrycode'].lower() ) file_path = resolve_file_path(filename, self.cwd) input_file['test_options'][input_file['key']] = file_path
def _start(self, start_tor, check_incoherences, create_input_store): self.netTests = self.getNetTests() if start_tor: yield self.start_tor(check_incoherences) no_geoip = config.global_options.get('no-geoip', False) if no_geoip: aux = [False] if config.global_options.get('annotations') is not None: annotations = [k.lower() for k in config.global_options['annotations'].keys()] aux = map(lambda x: x in annotations, ["city", "country", "asn"]) if not all(aux): log.msg("You should add annotations for the country, city and ASN") else: yield probe_ip.lookup() self.notify(DirectorEvent("success", "Looked up probe IP")) self.notify(DirectorEvent("success", "Running system tasks")) yield run_system_tasks(no_input_store=not create_input_store) self.notify(DirectorEvent("success", "Ran system tasks"))
def get_user_country_code(): yield probe_ip.lookup(include_country=True) defer.returnValue(probe_ip.geodata['countrycode'])