Commit e1cb02ce authored by Ondřej Borýsek's avatar Ondřej Borýsek
Browse files

Add tests for scan2report

parent 7ccb339e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -16,6 +16,11 @@ from loguru import logger
from helpers.file_root import relative_path  # don't remove this import - other parts of code depend on it


def save_file(text: str, filepath: str) -> None:
    with open(filepath, "w", encoding="utf8") as f:
        f.write(text)


def json_dump(obj: Any, filepath: str) -> None:
    with open(filepath, "w", encoding="utf8") as f:
        json.dump(obj, f, indent=4, ensure_ascii=False, sort_keys=True)
+9 −1
Original line number Diff line number Diff line
from typing import List, Optional
from typing import List, Optional, Any
import pytest


@@ -10,6 +10,14 @@ def skip_and_anotate_problematic_test_files(filepaths: List[str]) -> List[str]:
    return filepaths


def skip_confidential(filepaths: List[Any]) -> List[str]:  # todo: this may be Union[str, ParameterSet]
    for i in range(len(filepaths)):
        filepath = filepaths[i]
        if skip_confidential and isinstance(filepath, str) and "confidential" in filepath.lower():
            filepaths[i] = pytest.param(filepaths[i], marks=pytest.mark.skip(reason="Skipping confidential tests."))
    return filepaths


def _reasons_for_problematic_test_files(filepath: str) -> Optional[str]:
    no_parsing_by_scan2report = "Old nessus formats are not supported by scan2report"

+761 −0

File added.

Preview size limit exceeded, changes collapsed.

+300 −0

File added.

Preview size limit exceeded, changes collapsed.

+122 −0
Original line number Diff line number Diff line
[
    {
        "attack_complexicity": 0,
        "description": "\n\n========================================\n\nhttp://bwa/bodgeit/search.jsp\n\nThe value of the <b>q</b> request parameter is copied into the HTML document as plain text between tags. The payload <b>5d4ff&lt;script&gt;alert(1)&lt;/script&gt;18327</b> was submitted in the q parameter. This input was echoed unmodified in the application's response.<br><br>This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.",
        "fid": "burp_2097920",
        "hosts": [
            "http://bwa/bodgeit/search.jsp"
        ],
        "impact": "",
        "links": [],
        "name": "",
        "plugin_output": {
            "The value of the <b>q</b> request parameter is copied into the HTML document as plain text between tags. The payload <b>5d4ff&lt;script&gt;alert(1)&lt;/script&gt;18327</b> was submitted in the q parameter. This input was echoed unmodified in the application's response.<br><br>This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.": [
                "http://bwa/bodgeit/search.jsp"
            ]
        },
        "recommendations": "",
        "severity": 3,
        "system_impact": 0
    },
    {
        "attack_complexicity": 0,
        "description": "\n\n========================================\n\nhttp://bwa/bodgeit/basket.jsp\n\nThe <b>b_id</b> cookie appears to be vulnerable to SQL injection attacks. The payload <b>'</b> was submitted in the b_id cookie, and a database error message was returned. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.<br><br>The database appears to be Microsoft SQL Server.\nhttp://bwa/bodgeit/login.jsp\n\nThe <b>username</b> parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the username parameter, and a general error message was returned. Two single quotes were then submitted and the error message disappeared. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.\nhttp://bwa/bodgeit/login.jsp\n\nThe <b>password</b> parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the password parameter, and a general error message was returned. Two single quotes were then submitted and the error message disappeared. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.",
        "fid": "WEBAPP_SQLi",
        "hosts": [
            "http://bwa/bodgeit/basket.jsp",
            "http://bwa/bodgeit/login.jsp"
        ],
        "impact": "",
        "links": [],
        "name": "",
        "plugin_output": {
            "The <b>b_id</b> cookie appears to be vulnerable to SQL injection attacks. The payload <b>'</b> was submitted in the b_id cookie, and a database error message was returned. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.<br><br>The database appears to be Microsoft SQL Server.": [
                "http://bwa/bodgeit/basket.jsp"
            ],
            "The <b>password</b> parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the password parameter, and a general error message was returned. Two single quotes were then submitted and the error message disappeared. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.": [
                "http://bwa/bodgeit/login.jsp"
            ],
            "The <b>username</b> parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the username parameter, and a general error message was returned. Two single quotes were then submitted and the error message disappeared. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.": [
                "http://bwa/bodgeit/login.jsp"
            ]
        },
        "recommendations": "",
        "severity": 3,
        "system_impact": 0
    },
    {
        "attack_complexicity": 0,
        "description": "\n\n========================================\n\nhttp://bwa/bodgeit/login.jsp\n\nThe page contains a form with the following action URL, which is submitted over clear-text HTTP:<ul><li>http://bwa/bodgeit/login.jsp</li></ul>The form contains the following password field:<ul><li>password</li></ul>",
        "fid": "burp_3145984",
        "hosts": [
            "http://bwa/bodgeit/login.jsp"
        ],
        "impact": "",
        "links": [],
        "name": "",
        "plugin_output": {
            "The page contains a form with the following action URL, which is submitted over clear-text HTTP:<ul><li>http://bwa/bodgeit/login.jsp</li></ul>The form contains the following password field:<ul><li>password</li></ul>": [
                "http://bwa/bodgeit/login.jsp"
            ]
        },
        "recommendations": "",
        "severity": 3,
        "system_impact": 0
    },
    {
        "attack_complexicity": 0,
        "description": "\n\n========================================\n\nhttp://bwa/bodgeit/\n\nThe following cookie was issued by the application and does not have the HttpOnly flag set:<ul><li><b>JSESSIONID=AD00240A932835EDD60B3F7487A9D15D; Path=/</b></li></ul>The cookie appears to contain a session token, which may increase the risk associated with this issue. You should review the contents of the cookie to determine its function.",
        "fid": "burp_5244416",
        "hosts": [
            "http://bwa/bodgeit/"
        ],
        "impact": "",
        "links": [],
        "name": "",
        "plugin_output": {
            "The following cookie was issued by the application and does not have the HttpOnly flag set:<ul><li><b>JSESSIONID=AD00240A932835EDD60B3F7487A9D15D; Path=/</b></li></ul>The cookie appears to contain a session token, which may increase the risk associated with this issue. You should review the contents of the cookie to determine its function.": [
                "http://bwa/bodgeit/"
            ]
        },
        "recommendations": "",
        "severity": 1,
        "system_impact": 0
    },
    {
        "attack_complexicity": 0,
        "description": "",
        "fid": "WEBAPP_Clickjacking",
        "hosts": [
            "http://bwa/bodgeit/",
            "http://bwa/bodgeit/product.jsp",
            "http://bwa/bodgeit/search.jsp"
        ],
        "impact": "",
        "links": [],
        "name": "",
        "plugin_output": {},
        "recommendations": "",
        "severity": 0,
        "system_impact": 0
    },
    {
        "attack_complexicity": 0,
        "description": "",
        "fid": "burp_8389120",
        "hosts": [
            "http://bwa/bodgeit/",
            "http://bwa/bodgeit/basket.jsp",
            "http://bwa/bodgeit/contact.jsp",
            "http://bwa/bodgeit/login.jsp",
            "http://bwa/bodgeit/product.jsp",
            "http://bwa/bodgeit/search.jsp"
        ],
        "impact": "",
        "links": [],
        "name": "",
        "plugin_output": {},
        "recommendations": "",
        "severity": 0,
        "system_impact": 0
    }
]
 No newline at end of file
Loading