Module: reporter.py — badsnakes - v0.2.0 Documentation

# 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:

  > - `ReporterModule`

  > - `ReporterPickle`

  > - `ReporterWheel`

  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:

  > - `badsnakes.libs.containers.Assign.report()`

  > - `badsnakes.libs.containers.Attribute.report()`

  > - `badsnakes.libs.containers.Call.report()`

  > - etc.

class badsnakes.libs.reporter._ReporterBase

  Bases: `object`

  Currently not implemented.

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

  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()

    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()

    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()

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

  _report_classification()

    Report the current module’s overall classification.

  _report_classification_only()

    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()

    For each node class, report the dangerous findings.

  _report_suspect()

    For each node class, report the suspect findings.

class badsnakes.libs.reporter.ReporterPickle

  Bases: `_ReporterBase`

  Report findings for a given pickle file.

  Raises:

    NotImplementedError – Currently not implemented. Available for future development.

class badsnakes.libs.reporter.ReporterWheel

  Bases: `_ReporterBase`

  Report findings for all plaintext files in a given wheel.

  Raises:

    NotImplementedError – Currently not implemented. Available for future development.