Source code for mass_driver.models.scan

"""Scanners for repos"""
from pathlib import Path
from typing import Any, Callable, NamedTuple

from pydantic import BaseModel

ScannerFunc = Callable[[Path], dict[str, Any]]
"""The scanner function itself, taking cloned repo, returning a dict of findings"""


[docs] class Scanner(NamedTuple): """A single scanner""" name: str """The scanner's name (plugin name)""" func: ScannerFunc """The scanner function itself"""
[docs] class ScanFile(BaseModel): """Config file for Scan Activity""" scanner_names: list[str] """The list of scanner plugins to use"""
[docs] class ScanLoaded(ScanFile): """The post-loaded version of ScanFile""" scanners: list[Scanner] """Loaded Scanner objects"""