trufflehog.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:dupin 作者: guardian 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号