Module: reporter.py

Purpose:

This module provides the terminal-based reporting functionality for the project. File-based reporting is handled by the badsnakes.libs.logger module.

There is a specific reporting class, based on the analysis provided:

All of these classes inherit their base functionality from the private _ReporterBase class.

Platform:

Linux/Windows | Python 3.10+

Developer:

J Berendt

Email:

development@s3dev.uk

Comments:

This module’s implementation is very simple in that it only iterates a module’s node classes and calls the .report() method on each container, which provides the formatting for each message. The formatting is not controlled by this module.

For example:

class badsnakes.libs.reporter._ReporterBase[source]

Bases: object

Currently not implemented.

class badsnakes.libs.reporter.ReporterModule(modules: list[module.Module] | tuple[module.Module])[source]

Bases: _ReporterBase

Iterate all modules and report the findings for each node type.

Parameters:

modules (list[module.Module] | tuple[module.Module]) – A list (or tuple) of badsnakes.libs.module.Module objects containing the findings to be reported.

report()[source]

Primary reporting callable.

This method iterates the modules provided on instantiation of the ReporterModule class, and reports the node-class-specific findings for each.

report_classification_only()[source]

Reporting callable for displaying the classification only.

This method iterates the modules provided on instantiation of the ReporterModule class, and reports each module’s classification.

_display_title()[source]

Display a formatted version of the current module’s name.

_report_classification()[source]

Report the current module’s overall classification.

_report_classification_only()[source]

Report the current module’s overall classification.

This method differs from the _report_classification() in that this method also displays the module name, as the report_classification_only() method does not print the module name in a title banner.

_report_dangerous()[source]

For each node class, report the dangerous findings.

_report_suspect()[source]

For each node class, report the suspect findings.

class badsnakes.libs.reporter.ReporterPickle[source]

Bases: _ReporterBase

Report findings for a given pickle file.

Raises:

NotImplementedError – Currently not implemented. Available for future development.

class badsnakes.libs.reporter.ReporterWheel[source]

Bases: _ReporterBase

Report findings for all plaintext files in a given wheel.

Raises:

NotImplementedError – Currently not implemented. Available for future development.