Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ add burp dastardly #9514

Merged
merged 4 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/content/en/integrations/parsers/file/burp_dastardly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: "Burp Dastardly"
toc_hide: true
---
### File Types
DefectDojo parser accepts Burp Dastardly Scans as an XML output.

Dastardly is a free, lightweight web application security scanner for your CI/CD pipeline. It is designed specifically for web developers, and checks your application for seven security issues that are likely to interest you during software development. Dastardly is based on the same scanner as Burp Suite (Burp Scanner).

### Sample Scan Data
Sample Burp Dastardly scans can be found [here](https://github.com/DefectDojo/django-DefectDojo/tree/master/unittests/scans/burp_dastardly).
1 change: 1 addition & 0 deletions dojo/tools/burp_dastardly/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__author__ = "manuel-sommer"
49 changes: 49 additions & 0 deletions dojo/tools/burp_dastardly/parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import logging
from defusedxml import ElementTree as etree
from dojo.models import Finding

logger = logging.getLogger(__name__)


class BurpDastardlyParser(object):

def get_scan_types(self):
return ["Burp Dastardly Scan"]

def get_label_for_scan_types(self, scan_type):
return "Burp Dastardly Scan"

def get_description_for_scan_types(self, scan_type):
return (
"Import Burp Dastardly XML files."
)

def get_findings(self, xml_output, test):
tree = etree.parse(xml_output, etree.XMLParser())
return self.get_items(tree, test)

def get_items(self, tree, test):
items = list()
for node in tree.findall("testsuite"):
if int(node.attrib["failures"]) != 0:
name = node.attrib["name"]
testcase = node.findall("testcase")
for case in testcase:
for fail in case.findall("failure"):
title = fail.attrib["message"]
severity = fail.attrib["type"]
description = fail.text
finding = Finding(
title=title,
url=name,
test=test,
severity=severity,
description=description,
false_p=False,
duplicate=False,
out_of_scope=False,
mitigated=None,
dynamic_finding=True,
)
items.append(finding)
return items
2 changes: 1 addition & 1 deletion dojo/tools/chefinspect/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__author__ = "manuel_sommer"
__author__ = "manuel-sommer"
2 changes: 1 addition & 1 deletion dojo/tools/gcloud_artifact_scan/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__author__ = "manuel_sommer"
__author__ = "manuel-sommer"
2 changes: 1 addition & 1 deletion dojo/tools/hcl_appscan/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__author__ = "manuel_sommer"
__author__ = "manuel-sommer"
2 changes: 1 addition & 1 deletion dojo/tools/humble/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__author__ = "manuel_sommer"
__author__ = "manuel-sommer"
2 changes: 1 addition & 1 deletion dojo/tools/kubeaudit/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__author__ = "manuel_sommer"
__author__ = "manuel-sommer"
2 changes: 1 addition & 1 deletion dojo/tools/ms_defender/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__author__ = "manuel_sommer"
__author__ = "manuel-sommer"
2 changes: 1 addition & 1 deletion dojo/tools/openvas/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__author__ = "manuel_sommer"
__author__ = "manuel-sommer"
2 changes: 1 addition & 1 deletion dojo/tools/redhatsatellite/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__author__ = "manuel_sommer"
__author__ = "manuel-sommer"
2 changes: 1 addition & 1 deletion dojo/tools/ssh_audit/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__author__ = "manuel_sommer"
__author__ = "manuel-sommer"
686 changes: 686 additions & 0 deletions unittests/scans/burp_dastardly/many_findings.xml

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions unittests/tools/test_burp_dastardly_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from os import path

from ..dojo_test_case import DojoTestCase
from dojo.models import Test
from dojo.tools.burp_dastardly.parser import BurpDastardlyParser


class TestBurpParser(DojoTestCase):

def test_burp_dastardly_multiple_findings(self):
with open(path.join(path.dirname(__file__), "../scans/burp_dastardly/many_findings.xml")) as test_file:
parser = BurpDastardlyParser()
findings = parser.get_findings(test_file, Test())
for finding in findings:
for endpoint in finding.unsaved_endpoints:
endpoint.clean()
self.assertEqual(4, len(findings))
Loading