当前位置: 首页>>代码示例>>Python>>正文


Python URL.get_domain方法代码示例

本文整理汇总了Python中core.data.parsers.url.URL.get_domain方法的典型用法代码示例。如果您正苦于以下问题:Python URL.get_domain方法的具体用法?Python URL.get_domain怎么用?Python URL.get_domain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core.data.parsers.url.URL的用法示例。


在下文中一共展示了URL.get_domain方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_set_domain

# 需要导入模块: from core.data.parsers.url import URL [as 别名]
# 或者: from core.data.parsers.url.URL import get_domain [as 别名]
    def test_set_domain(self):
        u = URL('http://w3af.com/def/jkl/')
        self.assertEqual(u.get_domain(), 'w3af.com')

        u.set_domain('host.tld')
        self.assertEqual(u.get_domain(), 'host.tld')

        u.set_domain('foobar')
        self.assertEqual(u.get_domain(), 'foobar')

        u.set_domain('foobar.')
        self.assertEqual(u.get_domain(), 'foobar.')
开发者ID:Adastra-thw,项目名称:w3af,代码行数:14,代码来源:test_url.py

示例2: search

# 需要导入模块: from core.data.parsers.url import URL [as 别名]
# 或者: from core.data.parsers.url.URL import get_domain [as 别名]
    def search(self, query, start, count=10):
        '''
        Search the web with Bing.

        This method is based from the msn.py file from the massive enumeration toolset,
        coded by pdp and released under GPL v2.
        '''
        url = 'http://www.bing.com/search?'
        query = urllib.urlencode({'q': query,
                                  'first': start + 1,
                                  'FORM': 'PERE'})
        url_instance = URL(url + query)
        response = self._uri_opener.GET(url_instance, headers=self._headers,
                                        cache=True, grep=False)

        # This regex might become outdated, but the good thing is that we have
        # test_bing.py which is going to fail and tell us that it's outdated
        re_match = re.findall('<a href="((http|https)(.*?))" h="ID=SERP,',
                              response.get_body())

        results = set()

        for url, _, _ in re_match:
            try:
                url = URL(url)
            except:
                pass
            else:
                
                if url.get_domain() not in self.BLACKLISTED_DOMAINS:
                    bing_result = BingResult(url)
                    results.add(bing_result)

        return results
开发者ID:Adastra-thw,项目名称:w3af,代码行数:36,代码来源:bing.py

示例3: test_default_proto

# 需要导入模块: from core.data.parsers.url import URL [as 别名]
# 或者: from core.data.parsers.url.URL import get_domain [as 别名]
 def test_default_proto(self):
     '''
     http is the default protocol, we can provide URLs with no proto
     '''
     u = URL('w3af.com')
     self.assertEqual(u.get_domain(), 'w3af.com')
     self.assertEqual(u.get_protocol(), 'http')
开发者ID:Adastra-thw,项目名称:w3af,代码行数:9,代码来源:test_url.py

示例4: do_ALL

# 需要导入模块: from core.data.parsers.url import URL [as 别名]
# 或者: from core.data.parsers.url.URL import get_domain [as 别名]
    def do_ALL(self):
        global global_first_request
        if global_first_request:
            global_first_request = False
            om.out.information("The user is navigating through the spider_man proxy.")

        # Convert to url_object
        path = URL(self.path)

        if path == TERMINATE_URL:
            om.out.information("The user terminated the spider_man session.")
            self._send_end()
            self._spider_man.stop_proxy()
            return

        om.out.debug("[spider_man] Handling request: %s %s" % (self.command, path))
        #   Send this information to the plugin so it can send it to the core
        freq = self._create_fuzzable_request()
        self._spider_man.append_fuzzable_request(freq)

        grep = True
        if path.get_domain() != self.server.w3afLayer.target_domain:
            grep = False

        try:
            response = self._send_to_server(grep=grep)
        except Exception, e:
            self._send_error(e)
开发者ID:zhuyue1314,项目名称:w3af,代码行数:30,代码来源:spider_man.py

示例5: endElement

# 需要导入模块: from core.data.parsers.url import URL [as 别名]
# 或者: from core.data.parsers.url.URL import get_domain [as 别名]
            def endElement(self, name):
                if name == 'phish_detail_url':
                    self.inside_detail = False
                if name == 'url':
                    self.inside_URL = False
                if name == 'entry':
                    self.inside_entry = False
                    #
                    #    Now I try to match the entry with an element in the
                    #    to_check_list
                    #
                    for target_host in self._to_check:
                        if target_host in self.url:
                            phish_url = URL(self.url)
                            target_host_url = URL(target_host)

                            if target_host_url.get_domain() == phish_url.get_domain() or \
                            phish_url.get_domain().endswith('.' + target_host_url.get_domain()):

                                phish_detail_url = URL(self.phish_detail_url)
                                ptm = PhishTankMatch(phish_url,
                                                     phish_detail_url)
                                self.matches.append(ptm)
开发者ID:Adastra-thw,项目名称:w3af,代码行数:25,代码来源:phishtank.py

示例6: test_set_domain_with_port

# 需要导入模块: from core.data.parsers.url import URL [as 别名]
# 或者: from core.data.parsers.url.URL import get_domain [as 别名]
 def test_set_domain_with_port(self):
     u = URL('http://w3af.com:443/def/jkl/')
     self.assertEqual(u.get_domain(), 'w3af.com')
     
     u.set_domain('host.tld')
     self.assertEqual(u.get_net_location(), 'host.tld:443')
开发者ID:Adastra-thw,项目名称:w3af,代码行数:8,代码来源:test_url.py


注:本文中的core.data.parsers.url.URL.get_domain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。