internetwache/GitTools

GitHub: internetwache/GitTools

一套用于发现、下载和还原网站暴露 .git 仓库源代码的三合一安全工具。

Stars: 4136 | Forks: 636

[![GitHub 星标](https://img.shields.io/github/stars/internetwache/GitTools.svg)](https://github.com/internetwache/GitTools/stargazers) [![GitHub 许可证](https://img.shields.io/github/license/internetwache/GitTools.svg)](https://github.com/internetwache/GitTools/blob/master/LICENSE.md) # GitTools 此仓库包含三个用于 Git 研究的小型 python/bash 脚本。[在此处阅读相关内容](https://en.internetwache.org/dont-publicly-expose-git-or-how-we-downloaded-your-websites-sourcecode-an-analysis-of-alexas-1m-28-07-2015/) ## Finder 你可以使用此工具来查找 .git 仓库公开可用的网站。 ### 用法 此 python 脚本用于识别具有公开可访问 ```.git``` 仓库的网站。 它会检查 ```.git/HEAD``` 文件是否包含 ```refs/heads```。 ``` $ ./gitfinder.py -h ########### # Finder 是 https://github.com/internetwache/GitTools 的组成部分 # # 由 @internetwache 的 @gehaxelt 开发并维护 # # 风险自负。在某些情况下使用可能是非法的。 # 仅供教育用途! ########### usage: gitfinder.py [-h] [-i INPUTFILE] [-o OUTPUTFILE] [-t THREADS] optional arguments: -h, --help show this help message and exit -i INPUTFILE, --inputfile INPUTFILE input file -o OUTPUTFILE, --outputfile OUTPUTFILE output file -t THREADS, --threads THREADS threads ``` 输入文件应每行包含一个目标。 该脚本将以 ```[*] Found: DOMAIN``` 的形式将发现的域名输出到 stdout。 #### 扫描 Alexa 前 100 万网站 ``` wget http://s3.amazonaws.com/alexa-static/top-1m.csv.zip unzip top-1m.csv.zip sed -i.bak 's/.*,//' top-1m.csv ./gitfinder.py -i top-1m.csv ``` ## Dumper 此工具可用于从未启用目录列表的 Web 服务器中,尽可能多地下载已发现的 .git 仓库中的内容。 ### 用法 ``` $ ./gitdumper.sh -h [*] USAGE: http://target.tld/.git/ dest-dir [--git-dir=otherdir] --git-dir=otherdir Change the git folder name. Default: .git ``` 注意:此工具无法 100% 保证能完全恢复 .git 仓库。特别是当仓库被压缩成 ```pack``` 文件时,可能会失败。 ## Extractor 一个小型 bash 脚本,用于从损坏的仓库中提取提交及其内容。 此脚本尝试恢复不完整的 git 仓库: - 遍历仓库的所有 commit-object - 尝试还原提交的内容 - 提交*未*按日期排序 ### 用法 ``` $ ./extractor.sh /tmp/mygitrepo /tmp/mygitrepodump ``` 其中 - ```/tmp/mygitrepo``` 包含一个 ```.git``` 目录 - ```/tmp/mygitrepodump``` 是目标目录 如果下载的仓库不完整,可以将其与 ```Git Dumper``` 结合使用。 ## 演示 以下是 **Dumper** 工具的一个小演示: [![asciicast](https://asciinema.org/a/24072.png)](https://asciinema.org/a/24072) ## 代理支持 `urllib` 和 `curl` 应支持通过环境变量进行代理配置: 在 bash 中,设置: ``` export HTTP_PROXY=http://proxy_url:proxy_port export HTTPS_PROXY=http://proxy_url:proxy_port ``` 在 Windows 的 CMD 中,使用: ``` set HTTP_PROXY=http://proxy_url:proxy_port set HTTPS_PROXY=http://proxy_url:proxy_port ``` 基本身份验证应通过以下方式支持: ``` http://username:password@proxy_url:proxy_port ``` ## 环境要求 * git * Python 3+ * curl * bash * sed * binutils (strings) # 许可证 所有工具均使用 MIT 许可证授权。详见 [LICENSE.md](LICENSE.md)
标签:DNS枚举, .git目录泄露, SEO, 应用安全, 数据泄露, 源码泄露, 网站安全, 网站漏洞扫描, 网络安全审计, 网络安全工具, 黑盒测试