def scan(self) -> dict: """Start Scan.""" scanner = Scanner(self.options, self.paths) result = scanner.scan() if result: self.format_output(result) return self.result
def scan(rule, extensions, paths, ignore_paths=None): """The libsast scan.""" try: options = { 'match_rules': rule, 'match_extensions': extensions, 'ignore_paths': ignore_paths, 'show_progress': False } scanner = Scanner(options, paths) res = scanner.scan() if res: return format_findings(res['pattern_matcher'], paths[0]) except Exception: logger.exception('libsast scan') return {}
def niap_scan(rule, extensions, paths, apath, ignore_paths=None): """NIAP scan.""" try: if not apath: apath = '' options = { 'choice_rules': rule, 'alternative_path': apath, 'choice_extensions': extensions, 'ignore_paths': ignore_paths, 'show_progress': False } scanner = Scanner(options, paths) res = scanner.scan() if res: return res['choice_matcher'] except Exception: logger.exception('NIAP scan') return {}