def main():
parser = argparse.ArgumentParser(description='Find secrets hidden in the depths of git.')
parser.add_argument('-o', '--output-file', dest="output_file", help="Filename to write output to (defaults to stdout)")
parser.add_argument('git_url', type=str, help='URL for secret searching')
args = parser.parse_args()
project_path = tempfile.mkdtemp()
Repo.clone_from(args.git_url, project_path)
repo = Repo(project_path)
if args.output_file is not None:
with open(args.output_file, "w") as f:
utf8_output = codecs.getwriter('utf8')
utf8_file = utf8_output(f)
find_strings(repo, output_file=utf8_file)
else:
find_strings(repo)
shutil.rmtree(project_path, onerror=del_rw)
评论列表
文章目录