Exemple #1
0
    def test_number_of_new_false_positives(self):
        # Add a couple of false positives to database as new issues,
        # and check that the they're counted properly
        issue = {'scenario_id': '1',
                 'timestamp': datetime.datetime.utcnow(),
                 'test_runner_host': 'localhost',
                 'url': 'url',
                 'severity': 'severity',
                 'issuetype': 'issuetype',
                 'issuename': 'issuename',
                 'issuedetail': 'issuedetail',
                 'confidence': 'confidence',
                 'host': 'host',
                 'port': 'port',
                 'protocol': 'protocol',
                 'messages': 'messagejson'}

        # Add one, expect count to be 1
        dbtools.add_false_positive(self.context, issue)
        self.assertEqual(dbtools.number_of_new_in_database(self.context),
                         1, "After adding one, expect one finding in database")

        # Add a second one, expect count to be 2
        dbtools.add_false_positive(self.context, issue)
        self.assertEqual(dbtools.number_of_new_in_database(self.context),
                         2, "After adding two, expect two findings in db")
Exemple #2
0
    def test_number_of_new_false_positives(self):
        # Add a couple of false positives to database as new issues,
        # and check that the they're counted properly
        issue = {
            'scenario_id': '1',
            'timestamp': datetime.datetime.utcnow(),
            'test_runner_host': 'localhost',
            'url': 'url',
            'severity': 'severity',
            'issuetype': 'issuetype',
            'issuename': 'issuename',
            'issuedetail': 'issuedetail',
            'confidence': 'confidence',
            'host': 'host',
            'port': 'port',
            'protocol': 'protocol',
            'messages': 'messagejson'
        }

        # Add one, expect count to be 1
        dbtools.add_false_positive(self.context, issue)
        self.assertEqual(dbtools.number_of_new_in_database(self.context), 1,
                         "After adding one, expect one finding in database")

        # Add a second one, expect count to be 2
        dbtools.add_false_positive(self.context, issue)
        self.assertEqual(dbtools.number_of_new_in_database(self.context), 2,
                         "After adding two, expect two findings in db")
Exemple #3
0
def step_impl(context):
    """Check whether the findings reported by Burp have already been found earlier"""
    scanissues = context.results

    # Go through each issue, and add issues that aren't in the database
    # into the database. If we've found new issues, assert False.

    new_items = 0
    for issue in scanissues:
        issue['scenario_id'] = context.scenario_id
        if scandb.known_false_positive(context, issue) is False:
            new_items += 1
            scandb.add_false_positive(context, issue)

    unprocessed_items = scandb.number_of_new_in_database(context)

    if unprocessed_items > 0:
        assert False, "Unprocessed findings in database. %s new issue(s), total %s issue(s)." % (new_items, unprocessed_items)
    assert True
Exemple #4
0
def step_impl(context):
    """Check whether the findings reported by Burp have already been found earlier"""
    scanissues = context.results

    # Go through each issue, and add issues that aren't in the database
    # into the database. If we've found new issues, assert False.

    new_items = 0
    for issue in scanissues:
        issue['scenario_id'] = context.scenario_id
        if scandb.known_false_positive(context, issue) is False:
            new_items += 1
            scandb.add_false_positive(context, issue)

    unprocessed_items = scandb.number_of_new_in_database(context)

    if unprocessed_items > 0:
        assert False, "Unprocessed findings in database. %s new issue(s), total %s issue(s)." % (
            new_items, unprocessed_items)
    assert True