Ejemplo n.º 1
0
 def test_iputils (self):
     host = "www.golem.de"
     ips = iputil.resolve_host(host)
     self.assertTrue(len(ips) > 0)
     obfuscated = iputil.obfuscate_ip(ips.pop())
     self.assertTrue(iputil.is_obfuscated_ip(obfuscated))
     hosts = iputil.lookup_ips([obfuscated])
     self.assertTrue(host in hosts)
Ejemplo n.º 2
0
 def test_iputils (self):
     # note: need a hostname whose reverse lookup of the IP is the same host
     host = "dinsdale.python.org"
     ips = iputil.resolve_host(host)
     self.assertTrue(len(ips) > 0)
     obfuscated = iputil.obfuscate_ip(ips[0])
     self.assertTrue(iputil.is_obfuscated_ip(obfuscated))
     hosts = iputil.lookup_ips([obfuscated])
     self.assertTrue(host in hosts)
Ejemplo n.º 3
0
 def test_iputils(self):
     # note: need a hostname whose reverse lookup of the IP is the same host
     host = "dinsdale.python.org"
     ips = iputil.resolve_host(host)
     self.assertTrue(len(ips) > 0)
     obfuscated = iputil.obfuscate_ip(ips[0])
     self.assertTrue(iputil.is_obfuscated_ip(obfuscated))
     hosts = iputil.lookup_ips([obfuscated])
     self.assertTrue(host in hosts)
Ejemplo n.º 4
0
 def obfuscate_test (self):
     if os.name != "posix" or sys.platform != 'linux2':
         return
     host = "www.heise.de"
     ip = iputil.resolve_host(host)[0]
     url = u"http://%s/" % iputil.obfuscate_ip(ip)
     rurl = u"http://%s/" % ip
     resultlines = [
         u"url %s" % url,
         u"cache key %s" % rurl,
         u"real url %s" % rurl,
         u"info Access denied by robots.txt, checked only syntax.",
         u"warning URL %s has obfuscated IP address %s" % (url, ip),
         u"valid",
     ]
     self.direct(url, resultlines, recursionlevel=0)
Ejemplo n.º 5
0
 def obfuscate_test(self):
     if os.name != "posix" or sys.platform != "linux2":
         return
     host = "www.google.de"
     ip = iputil.resolve_host(host).pop()
     url = u"http://%s/" % iputil.obfuscate_ip(ip)
     rurl = u"http://%s/" % host
     resultlines = [
         u"url %s" % url,
         u"cache key %s" % url,
         u"real url %s" % rurl,
         u"info Redirected to `%s'." % rurl,
         u"warning URL %s has obfuscated IP address %s" % (url, ip),
         u"valid",
     ]
     self.direct(url, resultlines, recursionlevel=0)
Ejemplo n.º 6
0
 def obfuscate_test(self):
     if os.name != "posix" or sys.platform != 'linux2':
         return
     host = "www.google.de"
     ip = iputil.resolve_host(host).pop()
     url = u"http://%s/" % iputil.obfuscate_ip(ip)
     rurl = u"http://%s/" % host
     resultlines = [
         u"url %s" % url,
         u"cache key %s" % url,
         u"real url %s" % rurl,
         u"info Redirected to `%s'." % rurl,
         u"warning URL %s has obfuscated IP address %s" % (url, ip),
         u"valid",
     ]
     self.direct(url, resultlines, recursionlevel=0)
Ejemplo n.º 7
0
 def obfuscate_test(self):
     if os.name != "posix" or sys.platform != 'linux2':
         return
     host = "www.heise.de"
     for tentative_ip in iputil.resolve_host(host):
         if iputil.is_valid_ipv4(tentative_ip):
             ip = tentative_ip
             break
     else:
         raise NotImplementedError("no IPv4 address detected for test host")
     url = u"http://%s/" % iputil.obfuscate_ip(ip)
     rurl = u"http://%s/" % ip
     resultlines = [
         u"url %s" % url,
         u"cache key %s" % rurl,
         u"real url %s" % rurl,
         u"info Access denied by robots.txt, checked only syntax.",
         u"warning URL %s has obfuscated IP address %s" % (url, ip),
         u"valid",
     ]
     self.direct(url, resultlines, recursionlevel=0)