コード例 #1
0
 def test_save_vulner_fail(self):
     test_xml = open('/var/tmp/test.xml', 'w')
     # wrong xml
     test_xml.write('wrong string')
     test_xml.close()
     result = save_vulnerabilities(self.scan, test_xml.name)
     self.assertFalse(result)
コード例 #2
0
 def test_save_vulner(self):
     Vulnerability.objects.all().delete
     test_xml = open('/var/tmp/test.xml', 'w')
     test_xml.write('<?xml version="1.0" encoding="UTF-8"?>'
                    '<w3afrun start="1334319384">'
                    '<vulnerability id="[106]" method="GET" name="test"'
                    ' plugin="xss" severity="Medium" >'
                    '<description>'
                    'test desc'
                    '</description>'
                    '<httprequest id="106">'
                    '<status>'
                    'tttttt'
                    '</status>'
                    '<headers>'
                    '<header content="test.test-domain.ru" field="Host"/>'
                    '</headers>'
                    '</httprequest>'
                    '</vulnerability>'
                    '</w3afrun>')
     test_xml.close()
     result = save_vulnerabilities(self.scan, test_xml.name)
     self.assertEqual(
         Vulnerability.objects.filter(scan=self.scan).count(), 1)
     self.assertTrue(result)
コード例 #3
0
ファイル: w3af_run.py プロジェクト: andresriancho/w3af-webui
 def test_save_vulner_fail(self):
     test_xml = open('/var/tmp/test.xml', 'w')
     # wrong xml
     test_xml.write('wrong string')
     test_xml.close()
     result = save_vulnerabilities(self.scan, test_xml.name)
     self.assertFalse(result)
コード例 #4
0
ファイル: w3af_run.py プロジェクト: andresriancho/w3af-webui
 def test_save_vulner(self):
     Vulnerability.objects.all().delete
     test_xml = open('/var/tmp/test.xml', 'w')
     test_xml.write(
         '<?xml version="1.0" encoding="UTF-8"?>'
         '<w3afrun start="1334319384">'
         '<vulnerability id="[106]" method="GET" name="test"'
         ' plugin="xss" severity="Medium" >'
         '<description>'
         'test desc'
         '</description>'
         '<httprequest id="106">'
         '<status>'
         'tttttt'
         '</status>'
         '<headers>'
         '<header content="test.test-domain.ru" field="Host"/>'
         '</headers>'
         '</httprequest>'
         '</vulnerability>'
         '</w3afrun>'
         )
     test_xml.close()
     result = save_vulnerabilities(self.scan, test_xml.name)
     self.assertEqual(
         Vulnerability.objects.filter(scan=self.scan).count(), 1)
     self.assertTrue(result)
コード例 #5
0
 def test_save_vulner_not_found(self):
     Vulnerability.objects.all().delete
     test_xml = open('/var/tmp/test.xml', 'w')
     test_xml.write('<?xml version="1.0" encoding="UTF-8"?>'
                    '<w3afrun start="1334319384">'
                    '</w3afrun>')
     test_xml.close()
     result = save_vulnerabilities(self.scan, test_xml.name)
     self.assertEqual(
         Vulnerability.objects.filter(scan=self.scan).count(), 0)
     self.assertTrue(result)
コード例 #6
0
ファイル: w3af_run.py プロジェクト: andresriancho/w3af-webui
 def test_save_vulner_not_found(self):
     Vulnerability.objects.all().delete
     test_xml = open('/var/tmp/test.xml', 'w')
     test_xml.write(
         '<?xml version="1.0" encoding="UTF-8"?>'
         '<w3afrun start="1334319384">'
         '</w3afrun>'
         )
     test_xml.close()
     result = save_vulnerabilities(self.scan, test_xml.name)
     self.assertEqual(
         Vulnerability.objects.filter(scan=self.scan).count(), 0)
     self.assertTrue(result)