def main(argv=None): if len(sys.argv) == 1: # pragma: no cover sys.argv.append('-h') args = parse_args(argv) if args.verbose: # pragma: no cover CustomLog.enableDebug(args.verbose) plugins = initialize_plugins(args.plugins) if args.scan: if args.exclude: args.exclude = args.exclude[0] print( json.dumps( baseline.initialize( plugins, args.exclude, args.scan, ).format_for_baseline_output(), indent=2, sort_keys=True, ), ) return 0
def find_secrets_in_files(args): plugins = initialize_plugins(args.plugins) collection = SecretsCollection(plugins) for filename in args.filenames: if filename == args.baseline[0]: # Obviously, don't detect the baseline file continue collection.scan_file(filename) return collection