Source code for credsweeper.deep_scanner.xml_scanner

import logging
from abc import ABC
from typing import List

from credsweeper.credentials import Candidate
from credsweeper.deep_scanner.abstract_scanner import AbstractScanner
from credsweeper.file_handler.data_content_provider import DataContentProvider
from credsweeper.file_handler.string_content_provider import StringContentProvider

logger = logging.getLogger(__name__)


[docs] class XmlScanner(AbstractScanner, ABC): """Realises xml scanning"""
[docs] def data_scan( self, # data_provider: DataContentProvider, # depth: int, # recursive_limit_size: int) -> List[Candidate]: """Tries to represent data as xml text and scan as text lines""" if data_provider.represent_as_xml(): string_data_provider = StringContentProvider(lines=data_provider.lines, line_numbers=data_provider.line_numbers, file_path=data_provider.file_path, file_type=data_provider.file_type, info=f"{data_provider.info}|XML") return self.scanner.scan(string_data_provider) return []