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


Python info_set.InfoSet類代碼示例

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


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

示例1: test_deepcopy

    def test_deepcopy(self):
        i = MockInfo()
        iset1 = InfoSet([i])

        iset1_copy = copy.deepcopy(iset1)

        self.assertEqual(iset1.get_uniq_id(), iset1_copy.get_uniq_id())
開發者ID:andresriancho,項目名稱:w3af,代碼行數:7,代碼來源:test_info_set.py

示例2: test_pickle

    def test_pickle(self):
        i = MockInfo()
        iset1 = InfoSet([i])

        pickled_iset1 = cpickle_dumps(iset1)
        iset1_clone = loads(pickled_iset1)

        self.assertEqual(iset1.get_uniq_id(), iset1_clone.get_uniq_id())
開發者ID:BioSoundSystems,項目名稱:w3af,代碼行數:8,代碼來源:test_info_set.py

示例3: test_add

    def test_add(self):
        i1 = MockInfo(ids=1)
        i2 = MockInfo(ids=2)
        iset = InfoSet([i1])
        added = iset.add(i2)

        self.assertEqual(iset.get_id(), [1, 2])
        self.assertTrue(added)
開發者ID:0x554simon,項目名稱:w3af,代碼行數:8,代碼來源:test_info_set.py

示例4: test_get_desc_template_info_attr_access

    def test_get_desc_template_info_attr_access(self):
        value = 'Yuuup!'

        i = MockInfo()
        i['tag'] = value
        iset = InfoSet([i])
        iset.TEMPLATE = '{{ tag }}'

        self.assertEqual(iset.get_desc(), value)
開發者ID:BioSoundSystems,項目名稱:w3af,代碼行數:9,代碼來源:test_info_set.py

示例5: test_add_more_than_max

    def test_add_more_than_max(self):
        i1 = MockInfo(ids=1)
        i2 = MockInfo(ids=2)

        iset = InfoSet([i1])
        iset.MAX_INFO_INSTANCES = 2

        added = iset.add(i1)
        self.assertTrue(added)

        added = iset.add(i2)
        self.assertFalse(added)
開發者ID:0x554simon,項目名稱:w3af,代碼行數:12,代碼來源:test_info_set.py

示例6: test_match_same_itag

    def test_match_same_itag(self):
        """
        https://github.com/andresriancho/w3af/issues/10286
        """
        itag_1 = 'hello'
        i1 = MockInfo(ids=1)
        i1[itag_1] = 1
        iset_1 = InfoSet([i1])
        iset_1.ITAG = itag_1

        i2 = MockInfo(ids=2)
        i2[itag_1] = 1

        self.assertTrue(iset_1.match(i2))
開發者ID:0x554simon,項目名稱:w3af,代碼行數:14,代碼來源:test_info_set.py

示例7: test_match_different_itag

    def test_match_different_itag(self):
        """
        https://github.com/andresriancho/w3af/issues/10286
        """
        itag_1 = 'hello'
        i1 = MockInfo(ids=1)
        i1[itag_1] = 1
        iset_1 = InfoSet([i1])
        iset_1.ITAG = itag_1

        itag_2 = 'world'
        i2 = MockInfo(ids=2)
        i2[itag_2] = 2

        self.assertFalse(iset_1.match(i2))
開發者ID:0x554simon,項目名稱:w3af,代碼行數:15,代碼來源:test_info_set.py

示例8: test_all_of_info_exclude_ids

    def test_all_of_info_exclude_ids(self):
        i1 = MockInfo()
        i2 = MockInfo()

        v1 = MockVuln()
        v2 = MockVuln()

        iset = InfoSet([i2])
        vset = InfoSet([v2])

        kb.append('a', 'b', i1)
        kb.append('w', 'z', iset)
        kb.append('x', 'y', v1)
        kb.append('4', '2', vset)

        all_findings = kb.get_all_findings()
        all_findings_except_v1 = kb.get_all_findings(exclude_ids=(v1.get_uniq_id(),))
        all_findings_except_v1_v2 = kb.get_all_findings(exclude_ids=(v1.get_uniq_id(), vset.get_uniq_id()))

        self.assertEqual(all_findings, [i1, iset, v1, vset])
        self.assertEqual(all_findings_except_v1, [i1, iset, vset])
        self.assertEqual(all_findings_except_v1_v2, [i1, iset])
開發者ID:andresriancho,項目名稱:w3af,代碼行數:22,代碼來源:test_knowledge_base.py

示例9: test_get_uniq_id

 def test_get_uniq_id(self):
     i = MockInfo()
     iset = InfoSet([i])
     self.assertIsNotNone(iset.get_uniq_id())
開發者ID:BioSoundSystems,項目名稱:w3af,代碼行數:4,代碼來源:test_info_set.py

示例10: test_get_plugin_name

 def test_get_plugin_name(self):
     i = MockInfo()
     iset = InfoSet([i])
     self.assertEqual(iset.get_plugin_name(), 'plugin_name')
開發者ID:BioSoundSystems,項目名稱:w3af,代碼行數:4,代碼來源:test_info_set.py

示例11: test_get_id

 def test_get_id(self):
     i1 = MockInfo(ids=1)
     i2 = MockInfo(ids=2)
     iset = InfoSet([i2, i1])
     self.assertEqual(iset.get_id(), [1, 2])
開發者ID:BioSoundSystems,項目名稱:w3af,代碼行數:5,代碼來源:test_info_set.py

示例12: test_get_desc_no_template

 def test_get_desc_no_template(self):
     i = MockInfo()
     iset = InfoSet([i])
     self.assertEqual(iset.get_desc(), MockInfo.LONG_DESC)
開發者ID:BioSoundSystems,項目名稱:w3af,代碼行數:4,代碼來源:test_info_set.py

示例13: test_get_name

 def test_get_name(self):
     i = MockInfo()
     iset = InfoSet([i])
     self.assertEqual(iset.get_name(), 'TestCase')
開發者ID:BioSoundSystems,項目名稱:w3af,代碼行數:4,代碼來源:test_info_set.py

示例14: test_to_json

    def test_to_json(self):
        i = Info('Blind SQL injection vulnerability', MockInfo.LONG_DESC, 1,
                 'plugin_name')

        i['test'] = 'foo'
        i.add_to_highlight('abc', 'def')

        iset = InfoSet([i])

        jd = iset.to_json()
        json_string = json.dumps(jd)
        jd = json.loads(json_string)

        self.assertEqual(jd['name'], iset.get_name())
        self.assertEqual(jd['url'], str(iset.get_url()))
        self.assertEqual(jd['var'], iset.get_token_name())
        self.assertEqual(jd['response_ids'], iset.get_id())
        self.assertEqual(jd['vulndb_id'], iset.get_vulndb_id())
        self.assertEqual(jd['desc'], iset.get_desc(with_id=False))
        self.assertEqual(jd['long_description'], iset.get_long_description())
        self.assertEqual(jd['fix_guidance'], iset.get_fix_guidance())
        self.assertEqual(jd['fix_effort'], iset.get_fix_effort())
        self.assertEqual(jd['tags'], iset.get_tags())
        self.assertEqual(jd['wasc_ids'], iset.get_wasc_ids())
        self.assertEqual(jd['wasc_urls'], list(iset.get_wasc_urls()))
        self.assertEqual(jd['cwe_urls'], list(iset.get_cwe_urls()))
        self.assertEqual(jd['references'], BLIND_SQLI_REFS)
        self.assertEqual(jd['owasp_top_10_references'], BLIND_SQLI_TOP10_REFS)
        self.assertEqual(jd['plugin_name'], iset.get_plugin_name())
        self.assertEqual(jd['severity'], iset.get_severity())
        self.assertEqual(jd['attributes'], iset.first_info.copy())
        self.assertEqual(jd['highlight'], list(iset.get_to_highlight()))
開發者ID:BioSoundSystems,項目名稱:w3af,代碼行數:32,代碼來源:test_info_set.py


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