Skip to content

Commit

Permalink
Fix requested changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed May 28, 2024
1 parent b826fed commit f9bedda
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions core/scanners.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""

from __future__ import annotations

import base64
import binascii
import enum
import logging
import re
from typing import ClassVar
from typing import TYPE_CHECKING, ClassVar


from types_.scanner import ScannerSecret
if TYPE_CHECKING:
from types_.scanner import ScannerSecret


logger: logging.Logger = logging.getLogger(__name__)
Expand All @@ -37,7 +41,7 @@ class Services(enum.Enum):

class BaseScanner:
REGEX: ClassVar[re.Pattern[str]]
SERVICE: Services
SERVICE: ClassVar[Services]

@classmethod
def match(cls, content: str) -> ScannerSecret:
Expand Down Expand Up @@ -103,15 +107,17 @@ def scan_file(
file: str,
/,
*,
allowed: list[Services] = [],
disallowed: list[Services] = [],
allowed: list[Services] | None = None,
disallowed: list[Services] | None = None,
) -> list[ScannerSecret]:
"""Scan for tokens in a given files content.
You may pass a list of allowed or disallowed Services.
If both lists are empty (Default) all available services will be scanned.
"""
allowed = allowed if allowed else list(Services)
disallowed = disallowed or []
allowed = allowed or list(Services)

services: list[Services] = [s for s in allowed if s not in disallowed]
secrets: list[ScannerSecret] = []

Expand Down

0 comments on commit f9bedda

Please sign in to comment.