Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear files from cached scanners in distribute() #293

Merged
merged 1 commit into from
Jan 23, 2023

Conversation

ryanohoro
Copy link
Collaborator

Describe the change

When pulling a scanner object from cache, distribute() clears the files property before use.

      name = scanner['name']
      und_name = inflection.underscore(name)
      scanner_import = f'strelka.scanners.{und_name}'
      module = importlib.import_module(scanner_import)
      if und_name not in self.scanner_cache:
          attr = getattr(module, name)(self.backend_cfg, self.coordinator)
          self.scanner_cache[und_name] = attr
      options = scanner.get('options', {})
      plugin = self.scanner_cache[und_name]

      # Clear cached scanner of files
      plugin.files = []

Fixes #292

Describe testing procedures

./strelka-oneshot -l - -f src/python/strelka/tests/fixtures/test.html | wc -l
2
./strelka-oneshot -l - -f src/python/strelka/tests/fixtures/test.html | wc -l
2
./strelka-oneshot -l - -f src/python/strelka/tests/fixtures/test.html | wc -l
2

Sample output

No changes

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of and tested my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@phutelmyer phutelmyer merged commit e46cb8c into target:master Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Strelka Emitting Empty Files
2 participants