• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python moth.get_moth_http函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中w3af.core.controllers.ci.moth.get_moth_http函数的典型用法代码示例。如果您正苦于以下问题:Python get_moth_http函数的具体用法?Python get_moth_http怎么用?Python get_moth_http使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_do_req_through_proxy

    def test_do_req_through_proxy(self):
        resp_body = self.proxy_opener.open(get_moth_http()).read()

        # Basic check
        self.assertTrue(len(resp_body) > 0)

        # Get response using the proxy
        proxy_resp = self.proxy_opener.open(get_moth_http())
        # Get it without any proxy
        direct_resp = urllib2.urlopen(get_moth_http())

        # Must be equal
        self.assertEqual(direct_resp.read(), proxy_resp.read())

        # Have to remove the Date header because in some cases they differ
        # because one request was sent in second X and the other in X+1, which
        # makes the test fail
        direct_resp_headers = dict(direct_resp.info())
        proxy_resp_headers = dict(proxy_resp.info())

        # Make sure that a change in the seconds returned in date doesn't break
        # the test
        del direct_resp_headers['date']
        del proxy_resp_headers['date']

        del direct_resp_headers['transfer-encoding']
        del proxy_resp_headers['content-length']

        self.assertEqual(direct_resp_headers, proxy_resp_headers)
开发者ID:RON313,项目名称:w3af,代码行数:29,代码来源:test_proxy.py


示例2: test_cache

    def test_cache(self):
        url = URL(get_moth_http())
        http_response = self.uri_opener.GET(url)
        self.assertIn(self.MOTH_MESSAGE, http_response.body)

        url = URL(get_moth_http())
        http_response = self.uri_opener.GET(url)
        self.assertIn(self.MOTH_MESSAGE, http_response.body)
开发者ID:0x554simon,项目名称:w3af,代码行数:8,代码来源:test_xurllib.py


示例3: test_qs_params

    def test_qs_params(self):
        url = URL(get_moth_http('/audit/xss/simple_xss.py?text=123456abc'))
        http_response = self.uri_opener.GET(url, cache=False)
        self.assertIn('123456abc', http_response.body)

        url = URL(get_moth_http('/audit/xss/simple_xss.py?text=root:x:0'))
        http_response = self.uri_opener.GET(url, cache=False)
        self.assertIn('root:x:0', http_response.body)
开发者ID:0x554simon,项目名称:w3af,代码行数:8,代码来源:test_xurllib.py


示例4: test_blacklist_handler_pass

 def test_blacklist_handler_pass(self):
     """Verify that the blacklist handler works as expected"""
     opener = urllib2.build_opener(BlacklistHandler)
     
     request = urllib2.Request(get_moth_http())
     request.url_object = URL(get_moth_http())
     response = opener.open(request)
     
     self.assertEqual(response.code, 200)
开发者ID:0x554simon,项目名称:w3af,代码行数:9,代码来源:test_blacklist.py


示例5: test_history_access

 def test_history_access(self):
     self.count_plugin.loops = 1
     self.w3afcore.start()
     
     history_item = HistoryItem() 
     self.assertTrue(history_item.load(1))
     self.assertEqual(history_item.id, 1)
     self.assertEqual(history_item.get_request().get_uri().url_string,
                      get_moth_http())
     self.assertEqual(history_item.get_response().get_uri().url_string,
                      get_moth_http())
开发者ID:0x554simon,项目名称:w3af,代码行数:11,代码来源:test_history_access.py


示例6: test_proxy_req_ok

 def test_proxy_req_ok(self):
     """Test if self._proxy.stop() works as expected. Note that the check
     content is the same as the previous check, but it might be that this
     check fails because of some error in start() or stop() which is run
     during setUp and tearDown."""
     # Get response using the proxy
     proxy_resp = self.proxy_opener.open(get_moth_http()).read()
     # Get it the other way
     resp = urllib2.urlopen(get_moth_http()).read()
     # They must be very similar
     self.assertEqual(resp, proxy_resp)
开发者ID:RON313,项目名称:w3af,代码行数:11,代码来源:test_proxy.py


示例7: test_request_trapped_send

 def test_request_trapped_send(self):
     def send_request(proxy_opener, result_queue):
         response = proxy_opener.open(get_moth_http())
         result_queue.put(response)
     
     self._proxy.set_trap(True)
     
     result_queue = Queue.Queue()
     send_thread = threading.Thread(target=send_request, args=(self.proxy_opener,
                                                               result_queue))
     send_thread.start()
     time.sleep(0.5)
     
     request = self._proxy.get_trapped_request()
     
     self.assertEqual(request.get_url().url_string, get_moth_http())
     self.assertEqual(request.get_method(), 'GET')
     
     self._proxy.send_raw_request(request, request.dump_request_head(),
                                  request.get_data())
     
     response = result_queue.get()
     
     self.assertEqual(response.code, 200)
     self.assertIn(self.MOTH_MESSAGE, response.read())
开发者ID:3rdDegree,项目名称:w3af,代码行数:25,代码来源:test_localproxy.py


示例8: test_found_exploit_blind_sqli_form_GET

    def test_found_exploit_blind_sqli_form_GET(self):
        """
        Reproduce bug https://github.com/andresriancho/w3af/issues/262
        "it appears that you have provided tainted parameter values"
        """
        target = get_moth_http('/audit/blind_sqli/blind_where_integer_form_get.py')
        cfg = self._run_configs['blind_sqli']
        self._scan(target, cfg['plugins'])

        # Assert the general results
        vulns = self.kb.get('blind_sqli', 'blind_sqli')

        self.assertEquals(1, len(vulns))
        vuln = vulns[0]

        self.assertEquals("Blind SQL injection vulnerability", vuln.get_name())
        self.assertEquals('q', vuln.get_mutant().get_token_name())
        self.assertEquals('blind_where_integer_form_get.py',
                          vuln.get_url().get_file_name())

        vuln_to_exploit_id = vuln.get_id()

        #
        #   Execute the exploit.
        #
        plugin = self.w3afcore.plugins.get_plugin_inst('attack', 'sqlmap')

        #   Assert success
        self.assertTrue(plugin.can_exploit(vuln_to_exploit_id))
        exploit_result = plugin.exploit(vuln_to_exploit_id)
        self.assertEqual(len(exploit_result), 1, exploit_result)
开发者ID:ElAleyo,项目名称:w3af,代码行数:31,代码来源:test_sqlmap.py


示例9: get_test_profile

def get_test_profile(profile=FAST_TEST_PROFILE):
    moth = get_moth_http('/')

    target_url = PROFILE_URL.replace('http://127.0.0.1:8000/', moth)
    profile = profile.replace('http://127.0.0.1:8000/', moth)

    return profile, target_url
开发者ID:0x554simon,项目名称:w3af,代码行数:7,代码来源:test_profile.py


示例10: send_request

 def send_request(proxy_opener, result_queue):
     try:
         proxy_opener.open(get_moth_http())
     except urllib2.HTTPError, he:
         # Catch the 403 from the local proxy when the user
         # drops the HTTP request.
         result_queue.put(he)
开发者ID:ZionOps,项目名称:w3af,代码行数:7,代码来源:test_intercept_proxy.py


示例11: send

 def send(uri_opener, output):
     url = URL(get_moth_http())
     try:
         http_response = uri_opener.GET(url)
         output.put(http_response)
     except:
         output.put(None)
开发者ID:0x554simon,项目名称:w3af,代码行数:7,代码来源:test_xurllib.py


示例12: test_deflate

    def test_deflate(self):
        url = URL(get_moth_http('/core/deflate/deflate.html'))
        res = self.uri_opener.GET(url, cache=False)
        headers = res.get_headers()
        content_encoding, _ = headers.iget('content-encoding', '')

        self.assertIn('deflate', content_encoding)
        self.assertIn('View HTTP response headers.', res.get_body())
开发者ID:kamael,项目名称:w3af,代码行数:8,代码来源:test_xurllib_integration.py


示例13: prepare_script

 def prepare_script(self):
     fhandler = tempfile.NamedTemporaryFile(prefix='spider_long-',
                                            suffix='.w3af',
                                            dir=tempfile.tempdir,
                                            delete=False)
     fhandler.write(file(self.SCRIPT).read() % {'moth': get_moth_http()})
     fhandler.close()
     return fhandler.name
开发者ID:0x554simon,项目名称:w3af,代码行数:8,代码来源:test_ctrl_c.py


示例14: test_basic

 def test_basic(self):
     url = URL(get_moth_http())
     http_response = self.uri_opener.GET(url, cache=False)
     
     self.assertIn(self.MOTH_MESSAGE, http_response.body)
     
     self.assertGreaterEqual(http_response.id, 1)
     self.assertNotEqual(http_response.id, None)
开发者ID:0x554simon,项目名称:w3af,代码行数:8,代码来源:test_xurllib.py


示例15: test_post

    def test_post(self):
        url = URL(get_moth_http('/audit/xss/simple_xss_form.py'))

        data = URLEncodedForm()
        data['text'] = ['123456abc']

        http_response = self.uri_opener.POST(url, data, cache=False)
        self.assertIn('123456abc', http_response.body)
开发者ID:0x554simon,项目名称:w3af,代码行数:8,代码来源:test_xurllib.py


示例16: test_gzip

 def test_gzip(self):
     url = URL(get_moth_http('/core/gzip/gzip.html'))
     res = self.uri_opener.GET(url, cache=False)
     headers = res.get_headers()
     content_encoding, _ = headers.iget('content-encoding', '')
     test_res = 'gzip' in content_encoding or \
                'compress' in content_encoding
     self.assertTrue(test_res, content_encoding)
开发者ID:Adastra-thw,项目名称:Tortazo,代码行数:8,代码来源:test_xurllib_integration.py


示例17: test_http_port_specification_via_proxy

    def test_http_port_specification_via_proxy(self):
        self.assertEqual(self._proxy.total_handled_requests, 0)

        url = URL(get_moth_http())
        http_response = self.uri_opener.GET(url, cache=False)

        self.assertIn(self.MOTH_MESSAGE, http_response.body)
        self.assertEqual(self._proxy.total_handled_requests, 1)
开发者ID:0x554simon,项目名称:w3af,代码行数:8,代码来源:test_xurllib_proxy.py


示例18: test_get_wait_time

 def test_get_wait_time(self):
     """
     Asserts that all the responses coming out of the extended urllib have a
     get_wait_time different from the default.
     """
     url = URL(get_moth_http())
     http_response = self.uri_opener.GET(url, cache=False)
     self.assertNotEqual(http_response.get_wait_time(), DEFAULT_WAIT_TIME)
开发者ID:0x554simon,项目名称:w3af,代码行数:8,代码来源:test_xurllib.py


示例19: test_post_special_chars

    def test_post_special_chars(self):
        url = URL(get_moth_http('/audit/xss/simple_xss_form.py'))
        test_data = u'abc<def>"-á-'

        data = URLEncodedForm()
        data['text'] = [test_data]

        http_response = self.uri_opener.POST(url, data, cache=False)
        self.assertIn(test_data, http_response.body)
开发者ID:0x554simon,项目名称:w3af,代码行数:9,代码来源:test_xurllib.py


示例20: test_redirect_handler

 def test_redirect_handler(self):
     """Test the redirect handler using urllib2"""
     redirect_url = URL(get_moth_http('/audit/global_redirect/redirect-header-302.py?url=/'))
     opener = urllib2.build_opener(HTTP30XHandler)
     
     request = urllib2.Request(redirect_url.url_string)
     response = opener.open(request)
     
     self.assertEqual(response.code, FOUND)
开发者ID:andresriancho,项目名称:w3af-kali,代码行数:9,代码来源:test_redirect.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python fingerprint_404.is_404函数代码示例发布时间:2022-05-26
下一篇:
Python w1thermsensor.W1ThermSensor类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap