Ejemplo n.º 1
0
 def scan(self, filename: str) -> Optional[Secret]:
     plugin = WhisperPlugins(filename)
     for ret in plugin.pairs():
         if len(ret) == 2:  # key, value
             yield self.detect_secrets(ret[0], ret[1], plugin.filepath)
         elif len(ret) == 3:  # key, value, breadcrumbs
             yield self.detect_secrets(ret[0],
                                       ret[1],
                                       plugin.filepath,
                                       breadcrumbs=ret[2])
Ejemplo n.º 2
0
 def scan(self, filename: str) -> Optional[Secret]:
     plugin = WhisperPlugins(filename)
     if not plugin:
         return None
     self.foundlines[plugin.filepath.as_posix()] = []
     yield self.detect_secrets("file", plugin.filepath.as_posix(), plugin.filepath)
     for ret in plugin.pairs():
         if len(ret) == 2:  # key, value
             yield self.detect_secrets(ret[0], ret[1], plugin.filepath)
         elif len(ret) == 3:  # key, value, breadcrumbs
             yield self.detect_secrets(ret[0], ret[1], plugin.filepath, breadcrumbs=ret[2])
Ejemplo n.º 3
0
def test_init(filename, expected_plugin):
    filename = fixture_path(filename)
    plugin = WhisperPlugins(filename).plugin
    assert isinstance(plugin, expected_plugin)