Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 3
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)
Exemplo n.º 4
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)
Exemplo n.º 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)
Exemplo n.º 6
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)