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


Python URL.from_parts方法代码示例

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


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

示例1: test_from_parts

# 需要导入模块: from w3af.core.data.parsers.url import URL [as 别名]
# 或者: from w3af.core.data.parsers.url.URL import from_parts [as 别名]
    def test_from_parts(self):
        u = URL.from_parts("http", "w3af.com", "/foo/bar.txt", None, "a=b", "frag")

        self.assertEqual(u.path, "/foo/bar.txt")
        self.assertEqual(u.scheme, "http")
        self.assertEqual(u.get_file_name(), "bar.txt")
        self.assertEqual(u.get_extension(), "txt")
开发者ID:masterapocalyptic,项目名称:Tortazo-spanishtranslate,代码行数:9,代码来源:test_url.py

示例2: test_from_parts

# 需要导入模块: from w3af.core.data.parsers.url import URL [as 别名]
# 或者: from w3af.core.data.parsers.url.URL import from_parts [as 别名]
 def test_from_parts(self):
     u = URL.from_parts('http', 'w3af.com', '/foo/bar.txt', None, 'a=b',
                        'frag')
     
     self.assertEqual(u.path, '/foo/bar.txt')
     self.assertEqual(u.scheme, 'http')
     self.assertEqual(u.get_file_name(), 'bar.txt')
     self.assertEqual(u.get_extension(), 'txt')
开发者ID:3rdDegree,项目名称:w3af,代码行数:10,代码来源:test_url.py

示例3: _create_file

# 需要导入模块: from w3af.core.data.parsers.url import URL [as 别名]
# 或者: from w3af.core.data.parsers.url.URL import from_parts [as 别名]
    def _create_file(self):
        """
        Create random name file php with random php content. To be used in the
        remote file inclusion test.

        :return: The file content to be served via the webserver.

        Please note that the generated code works both in PHP and JSP without
        any issues, since PHP will run everything between "<?" and "?>" and
        JSP will run code between "<%" and "%>".

        TODO: make this code compatible with: asp/aspx, jsp, js (nodejs), pl,
              py, rb, etc. Some code snippets that might help to achieve this
              task:

        asp_code = 'response.write("%s");\n response.write("%s");' % (
            rand1, rand2)
        asp_code = '<% \n '+asp_code+'\n %>'
        """
        with self._plugin_lock:
            # First, generate the php file to be included.
            rfi_result_part_1 = rand1 = rand_alnum(9)
            rfi_result_part_2 = rand2 = rand_alnum(9)
            rfi_result = rand1 + rand2

            filename = rand_alnum(8)
            php_jsp_code = '<?php echo "%(p1)s"; echo "%(p2)s"; ?>'
            php_jsp_code += '<? echo "%(p1)s"; echo "%(p2)s"; ?>'
            php_jsp_code += '<%% out.print("%(p1)s"); out.print("%(p2)s"); %%>'
            php_jsp_code = php_jsp_code % {'p1': rfi_result_part_1,
                                           'p2': rfi_result_part_2}


            # Define the required parameters
            netloc = self._listen_address + ':' + str(self._listen_port)
            path = '/' + filename
            rfi_url = URL.from_parts('http', netloc, path, None, None, None)

            rfi_data = RFIData(rfi_url, rfi_result_part_1,
                               rfi_result_part_2, rfi_result)

            return php_jsp_code, rfi_data
开发者ID:ElAleyo,项目名称:w3af,代码行数:44,代码来源:rfi.py


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