當前位置: 首頁>>代碼示例>>Python>>正文


Python history.HistoryItem類代碼示例

本文整理匯總了Python中core.data.db.history.HistoryItem的典型用法代碼示例。如果您正苦於以下問題:Python HistoryItem類的具體用法?Python HistoryItem怎麽用?Python HistoryItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了HistoryItem類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: toggle_bookmark

 def toggle_bookmark(self, cell, path, model):
     """Toggle bookmark."""
     model[path][1] = not model[path][1]
     historyItem = HistoryItem()
     historyItem.load(model[path][0])
     historyItem.toggle_mark(True)
     return
開發者ID:zhuyue1314,項目名稱:w3af,代碼行數:7,代碼來源:httpLogTab.py

示例2: __init__

    def __init__(self, w3af, request_id, enableWidget=None, withManual=True,
                 withFuzzy=True, withCompare=True, withAudit=True, editableRequest=False,
                 editableResponse=False, widgname="default"):

        # Create the window
        RememberingWindow.__init__(self, w3af, "reqResWin",
                                   _("w3af - HTTP Request/Response"),
                                   "Browsing_the_Knowledge_Base")

        # Create the request response viewer
        rrViewer = reqResViewer(w3af, enableWidget, withManual, withFuzzy,
                                withCompare, withAudit, editableRequest,
                                editableResponse, widgname)

        # Search the id in the DB
        historyItem = HistoryItem()
        historyItem.load(request_id)
        # Set
        rrViewer.request.show_object(historyItem.request)
        rrViewer.response.show_object(historyItem.response)
        rrViewer.show()
        self.vbox.pack_start(rrViewer)

        # Show the window
        self.show()
開發者ID:Adastra-thw,項目名稱:w3af,代碼行數:25,代碼來源:reqResViewer.py

示例3: edit_tag

 def edit_tag(self, cell, path, new_text, model):
     """Edit tag."""
     model[path][4] = new_text
     historyItem = HistoryItem()
     historyItem.load(model[path][0])
     historyItem.update_tag(new_text, True)
     return
開發者ID:zhuyue1314,項目名稱:w3af,代碼行數:7,代碼來源:httpLogTab.py

示例4: store_in_cache

    def store_in_cache(request, response):
        hi = HistoryItem()
        
        # Set the request
        headers = dict(request.headers)
        headers.update(request.unredirected_hdrs)
    
        req = createFuzzableRequestRaw(method=request.get_method(),
                                      url=request.url_object,
                                      postData=str(request.get_data() or ''),
                                      headers=headers)
        hi.request = req

        # Set the response
        resp = response
        code, msg, hdrs, url, body, id = (resp.code, resp.msg, resp.info(),
                                          resp.geturl(), resp.read(), resp.id)
        # BUGBUG: This is where I create/log the responses that always have
        # 0.2 as the time!
        url_instance = url_object( url )
        resp = httpResponse.httpResponse(code, body, hdrs, url_instance,
                                         request.url_object, msg=msg, id=id,
                                         alias=gen_hash(request))
        hi.response = resp

        # Now save them
        try:
            hi.save()
        except KeyboardInterrupt, k:
            raise k
開發者ID:adambaldwin2,項目名稱:test,代碼行數:30,代碼來源:localCache.py

示例5: logHttp

 def logHttp( self, request, response):
     historyItem = HistoryItem()
     try:
         historyItem.request = request
         historyItem.response = response
         historyItem.save()
     except KeyboardInterrupt, k:
         raise k
開發者ID:DavisHevin,項目名稱:sqli_benchmark,代碼行數:8,代碼來源:gtkOutput.py

示例6: 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,
                      'http://moth/')
     self.assertEqual(history_item.get_response().get_uri().url_string,
                      'http://moth/')
     
開發者ID:Adastra-thw,項目名稱:w3af,代碼行數:11,代碼來源:test_history_access.py

示例7: _impactDone

 def _impactDone(self, event, impact):
     # Keep calling this from timeout_add until isSet
     if not event.isSet():
         return True
     # We stop the throbber, and hide it
     self.throbber.hide()
     self.throbber.running(False)
     # Analyze the impact
     if impact.ok:
         #   Lets check if we found any vulnerabilities
         #
         #   TODO: I should actually show ALL THE REQUESTS generated by audit plugins...
         #               not just the ones with vulnerabilities.
         #
         for result in impact.result:
             for itemId in result.getId():
                 historyItem = HistoryItem()
                 historyItem.load(itemId)
                 historyItem.updateTag(historyItem.tag + result.plugin_name)
                 historyItem.info = result.getDesc()
                 historyItem.save()
     else:
         if impact.exception.__class__ == w3afException:
             msg = str(impact.exception)
         elif impact.exception.__class__ == w3afMustStopException:
             msg = "Stopped sending requests because " + str(impact.exception)
         else:
             raise impact.exception
         # We stop the throbber, and hide it
         self.throbber.hide()
         self.throbber.running(False)
         gtk.gdk.threads_enter()
         helpers.friendlyException(msg)
         gtk.gdk.threads_leave()
     return False
開發者ID:adambaldwin2,項目名稱:test,代碼行數:35,代碼來源:reqResViewer.py

示例8: test_mark

 def test_mark(self):
     mark_id = random.randint(1, 499)
     url = url_object('http://w3af.org/a/b/c.php')
     for i in xrange(0, 500):
         fr = FuzzReq(url, dc={'a': ['1']})
         res = httpResponse(200, '<html>',{'Content-Type':'text/html'}, url, url)
         h1 = HistoryItem()
         h1.request = fr
         res.setId(i)
         h1.response = res
         if i == mark_id:
             h1.toggleMark()
         h1.save()
     h2 = HistoryItem()
     h2.load(mark_id)
     self.assertTrue(h2.mark)
開發者ID:1d3df9903ad,項目名稱:w3af,代碼行數:16,代碼來源:test_history.py

示例9: __init__

 def __init__(self, w3af, kbbrowser, ifilter):
     super(FullKBTree, self).__init__(w3af, ifilter,
                                      'Knowledge Base', strict=False)
     self._historyItem = HistoryItem()
     self.kbbrowser = kbbrowser
     self.connect('cursor-changed', self._showDesc)
     self.show()
開發者ID:HamzaKo,項目名稱:w3af,代碼行數:7,代碼來源:scanrun.py

示例10: test_clear

    def test_clear(self):

        url = URL("http://w3af.com/a/b/c.php")
        request = HTTPRequest(url, data="a=1")
        hdr = Headers([("Content-Type", "text/html")])
        res = HTTPResponse(200, "<html>", hdr, url, url)

        h1 = HistoryItem()
        h1.request = request
        res.set_id(1)
        h1.response = res
        h1.save()

        table_name = h1.get_table_name()
        db = get_default_temp_db_instance()

        self.assertTrue(db.table_exists(table_name))

        clear_result = h1.clear()

        self.assertTrue(clear_result)
        self.assertFalse(os.path.exists(h1._session_dir), "%s exists." % h1._session_dir)

        # Changed the meaning of clear a little bit... now it simply removes
        # all rows from the table, not the table itself
        self.assertTrue(db.table_exists(table_name))
開發者ID:zhuyue1314,項目名稱:w3af,代碼行數:26,代碼來源:test_history.py

示例11: store_in_cache

    def store_in_cache(request, response):
        hi = HistoryItem()

        # Set the request
        req = create_fuzzable_request(request, add_headers=request.unredirected_hdrs)
        hi.request = req

        # Set the response
        resp = httpResponse.from_httplib_resp(response, original_url=request.url_object)
        resp.setId(response.id)
        resp.setAlias(gen_hash(request))
        hi.response = resp

        # Now save them
        try:
            hi.save()
        except KeyboardInterrupt, k:
            raise k
開發者ID:sanzomaldini,項目名稱:w3af,代碼行數:18,代碼來源:localCache.py

示例12: test_tag

    def test_tag(self):
        tag_id = random.randint(501, 999)
        tag_value = createRandAlNum(10)
        url = url_object('http://w3af.org/a/b/c.php')

        for i in xrange(501, 1000):
            fr = FuzzReq(url, dc={'a': ['1']})
            res = httpResponse(200, '<html>',{'Content-Type':'text/html'}, url, url)
            h1 = HistoryItem()
            h1.request = fr
            res.setId(i)
            h1.response = res
            if i == tag_id:
                h1.updateTag(tag_value)
            h1.save()

        h2 = HistoryItem()
        h2.load(tag_id)
        self.assertEqual(h2.tag, tag_value)
開發者ID:1d3df9903ad,項目名稱:w3af,代碼行數:19,代碼來源:test_history.py

示例13: test_tag

    def test_tag(self):
        tag_id = random.randint(501, 999)
        tag_value = rand_alnum(10)
        url = URL("http://w3af.org/a/b/c.php")

        for i in xrange(501, 1000):
            request = HTTPRequest(url, data="a=1")
            hdr = Headers([("Content-Type", "text/html")])
            res = HTTPResponse(200, "<html>", hdr, url, url)
            h1 = HistoryItem()
            h1.request = request
            res.set_id(i)
            h1.response = res
            if i == tag_id:
                h1.update_tag(tag_value)
            h1.save()

        h2 = HistoryItem()
        h2.load(tag_id)
        self.assertEqual(h2.tag, tag_value)
開發者ID:zhuyue1314,項目名稱:w3af,代碼行數:20,代碼來源:test_history.py

示例14: store_in_cache

    def store_in_cache(request, response):
        # Create the http response object
        resp = HTTPResponse.from_httplib_resp(response,
                                              original_url=request.url_object)
        resp.set_id(response.id)
        resp.set_alias(gen_hash(request))

        hi = HistoryItem()
        hi.request = request
        hi.response = resp

        # Now save them
        try:
            hi.save()
        except sqlite3.Error, e:
            msg = 'A sqlite3 error was raised: "%s".' % e
            
            if 'disk' in str(e).lower():
                msg += ' Please check if your disk is full.'
                
            raise w3afMustStopException(msg)
開發者ID:Adastra-thw,項目名稱:w3af,代碼行數:21,代碼來源:db.py

示例15: store_in_cache

    def store_in_cache(request, response):
        # Create the http response object
        resp = HTTPResponse.from_httplib_resp(response, original_url=request.url_object)
        resp.set_id(response.id)
        resp.set_alias(gen_hash(request))

        hi = HistoryItem()
        hi.request = request
        hi.response = resp

        # Now save them
        try:
            hi.save()
        except Exception, ex:
            msg = (
                "Exception while inserting request/response to the"
                " database: %s\nThe request/response that generated"
                " the error is: %s %s %s" % (ex, resp.get_id(), request.get_uri(), resp.get_code())
            )
            om.out.error(msg)
            raise Exception(msg)
開發者ID:kam40oz,項目名稱:w3af,代碼行數:21,代碼來源:cache.py


注:本文中的core.data.db.history.HistoryItem類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。