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

fix(report): do not remove duplicate in reports by default #392

Merged
merged 1 commit into from
May 6, 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
1 change: 1 addition & 0 deletions secator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class Runners(StrictModel):
progress_update_frequency: int = 60
skip_cve_search: bool = False
skip_cve_low_confidence: bool = True
remove_duplicates: bool = False


class HTTP(StrictModel):
Expand Down
5 changes: 4 additions & 1 deletion secator/report.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import operator

from secator.config import CONFIG
from secator.output_types import OUTPUT_TYPES, OutputType
from secator.utils import merge_opts, get_file_timestamp
from secator.rich import console
Expand Down Expand Up @@ -64,8 +65,10 @@ def build(self):
sort_by, _ = get_table_fields(output_type)
items = [
item for item in self.runner.results
if isinstance(item, OutputType) and item._type == output_name and not item._duplicate
if isinstance(item, OutputType) and item._type == output_name
]
if CONFIG.runners.remove_duplicates:
items = [item for item in items if not item._duplicate]
if items:
if sort_by and all(sort_by):
items = sorted(items, key=operator.attrgetter(*sort_by))
Expand Down
4 changes: 3 additions & 1 deletion secator/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,10 @@ def print_results_table(results, title=None, exclude_fields=[], log=False):
if output_type.__name__ == 'Progress':
continue
items = [
item for item in results if item._type == output_type.get_name() and not item._duplicate
item for item in results if item._type == output_type.get_name()
]
if CONFIG.runners.remove_duplicates:
items = [item for item in items if not item._duplicate]
if items:
_table = build_table(
items,
Expand Down
Loading