def ooni_main(self, cmd): # We don't have the Command object so cheating for now. url = cmd.hostname # FIXME: validate that url is on the form scheme://host[:port]/path scheme, host, port, path = client._parse(url) ctrl_dest = self.endpoint(scheme, host, port) if not ctrl_dest: raise Exception('unsupported scheme %s in %s' % (scheme, url)) if cmd.controlproxy: assert scheme != 'https', "no support for proxied https atm, sorry" _, proxy_host, proxy_port, _ = client._parse(cmd.controlproxy) control = SOCKSWrapper(reactor, proxy_host, proxy_port, ctrl_dest) print "proxy: ", proxy_host, proxy_port else: control = ctrl_dest f = client.HTTPClientFactory(url) f.deferred.addCallback(lambda x: self.cb('control', x)) control.connect(f) exp_dest = self.endpoint(scheme, host, port) if not exp_dest: raise Exception('unsupported scheme %s in %s' % (scheme, url)) # FIXME: use the experiment proxy if there is one experiment = exp_dest f = client.HTTPClientFactory(url) f.deferred.addCallback(lambda x: self.cb('experiment', x)) experiment.connect(f) reactor.run()
def ooni_main(self): # We don't have the Command object so cheating for now. url = 'http://check.torproject.org/' self.controlproxy = 'socks4a://127.0.0.1:9050' self.experimentalproxy = '' if not re.match("[a-zA-Z0-9]+\:\/\/[a-zA-Z0-9]+", url): return None scheme, host, port, path = client._parse(url) ctrl_dest = self.endpoint(scheme, host, port) if not ctrl_dest: raise Exception('unsupported scheme %s in %s' % (scheme, url)) if self.controlproxy: _, proxy_host, proxy_port, _ = client._parse(self.controlproxy) control = SOCKSWrapper(reactor, proxy_host, proxy_port, ctrl_dest) else: control = ctrl_dest f = client.HTTPClientFactory(url) f.deferred.addCallback(lambda x: self.cb('control', x)) control.connect(f) exp_dest = self.endpoint(scheme, host, port) if not exp_dest: raise Exception('unsupported scheme %s in %s' % (scheme, url)) # FIXME: use the experiment proxy if there is one experiment = exp_dest f = client.HTTPClientFactory(url) f.deferred.addCallback(lambda x: self.cb('experiment', x)) experiment.connect(f) reactor.run()
def ooni_main(self, cmd): # We don't have the Command object so cheating for now. url = cmd.hostname # FIXME: validate that url is on the form scheme://host[:port]/path scheme, host, port, path = client._parse(url) ctrl_dest = self.endpoint(scheme, host, port) if not ctrl_dest: raise Exception('unsupported scheme %s in %s' % (scheme, url)) if cmd.controlproxy: assert scheme != 'https', "no support for proxied https atm, sorry" _, proxy_host, proxy_port, _ = client._parse(cmd.controlproxy) control = SOCKSWrapper(reactor, proxy_host, proxy_port, ctrl_dest) print "proxy: ", proxy_host, proxy_port else: control = ctrl_dest f = client.HTTPClientFactory(url) f.deferred.addCallback(lambda x: self.cb('control', x)) control.connect(f) exp_dest = self.endpoint(scheme, host, port) if not exp_dest: raise Exception('unsupported scheme %s in %s' % (scheme, url)) # FIXME: use the experiment proxy if there is one experiment = exp_dest f = client.HTTPClientFactory(url) f.deferred.addCallback(lambda x: self.cb('experiment', x)) experiment.connect(f) reactor.run()
def ooni_main(self): # We don't have the Command object so cheating for now. url = 'http://check.torproject.org/' self.controlproxy = 'socks4a://127.0.0.1:9050' self.experimentalproxy = '' if not re.match("[a-zA-Z0-9]+\:\/\/[a-zA-Z0-9]+", url): return None scheme, host, port, path = client._parse(url) ctrl_dest = self.endpoint(scheme, host, port) if not ctrl_dest: raise Exception('unsupported scheme %s in %s' % (scheme, url)) if self.controlproxy: _, proxy_host, proxy_port, _ = client._parse(self.controlproxy) control = SOCKSWrapper(reactor, proxy_host, proxy_port, ctrl_dest) else: control = ctrl_dest f = client.HTTPClientFactory(url) f.deferred.addCallback(lambda x: self.cb('control', x)) control.connect(f) exp_dest = self.endpoint(scheme, host, port) if not exp_dest: raise Exception('unsupported scheme %s in %s' % (scheme, url)) # FIXME: use the experiment proxy if there is one experiment = exp_dest f = client.HTTPClientFactory(url) f.deferred.addCallback(lambda x: self.cb('experiment', x)) experiment.connect(f) reactor.run()