commit 45cc771b7e240fc8ba411670d3533593e3165195 Merge: c85c627 3c632b4 Author: Arturo Filastò art@torproject.org Date: Mon Jul 9 16:40:19 2012 +0200
Merge branch 'master' into captiveportal
Conflicts: ooni/plugins/captiveportal.py
ooni/plugins/captiveportal.py | 413 +++++++++++++++++++---------------------- 1 files changed, 190 insertions(+), 223 deletions(-)
diff --cc ooni/plugins/captiveportal.py index ffa86c4,9b7bee3..f463fe4 --- a/ooni/plugins/captiveportal.py +++ b/ooni/plugins/captiveportal.py @@@ -138,17 -138,16 +138,14 @@@ class CaptivePortal(OONITest) or a list of strings. If nameserver is not given, use local DNS resolver, and if that fails try using 8.8.8.8. """ - log = self.logger -- if isinstance(hostname, str): hostname = [hostname] - + if nameserver is not None: res = resolver.Resolver(configure=False) res.nameservers = [nameserver] else: res = resolver.Resolver() - - response = [] answer = None
@@@ -191,7 -188,7 +186,6 @@@ else: log.debug("dns_resolve() for %s failed" % experiment_hostname) return None, experiment_address - - def get_auth_nameservers(self, hostname): """ Many CPs set a nameserver to be used. Let's query that @@@ -210,9 -207,9 +204,8 @@@ def hostname_to_0x20(self, hostname): """ MaKEs yOur HOsTnaME lOoK LiKE THis. -- - For more information, see: - D. Dagon, et. al. "Increased DNS Forgery Resistance + For more information, see: + D. Dagon, et. al. "Increased DNS Forgery Resistance Through 0x20-Bit Encoding". Proc. CSS, 2008. """ hostname_0x20 = '' @@@ -255,7 -251,7 +247,6 @@@ # Even when gevent monkey patching is on, the requests here # are sent without being 0x20'd, so we need to 0x20 them. hostname = self.hostname_to_0x20(hostname) - - for auth_ns in resolved_auth_ns: res = resolver.Resolver(configure=False) res.nameservers = [auth_ns] @@@ -309,7 -305,7 +300,6 @@@ length = 256
random_ascii = base64.urlsafe_b64encode(os.urandom(int(length))) - - while not random_ascii[:1].isalpha(): random_ascii = base64.urlsafe_b64encode(os.urandom(int(length)))
@@@ -336,7 -330,7 +324,6 @@@ # if it doesn't start with a letter, chuck it. while not random_sld[:1].isalpha(): random_sld = self.get_random_url_safe_string(length) - - tld_list = ['.com', '.net', '.org', '.info', '.test', '.invalid'] random_tld = urllib2.random.choice(tld_list) random_hostname = random_sld + random_tld
tor-commits@lists.torproject.org