MachiavelliII/dockdiver
GitHub: MachiavelliII/dockdiver
一款基于 Go 语言的 Docker Registry 探索工具,支持枚举仓库并离线转储 Manifest、Config 及 Layer 文件。
Stars: 1 | Forks: 0
# dockdiver
**dockdiver** 是一个基于 Go 的工具,用于探索和提取 Docker registry 中的内容。它可以列出仓库、转储特定仓库或转储所有仓库,包括 manifest、config blob 和 layer tarball,并进行 SHA256 完整性校验。本仓库在 `lab/` 目录中包含一个用于测试的 Docker registry 实验环境。
[](https://asciinema.org/a/kLgWzDiTWnoGURFHBs5XXXbLg)
## 功能特性
- 列出 Docker registry 中的所有仓库。
- 转储特定或所有仓库,包含 manifest、config 和 layer。
- 速率限制以确安全操作。
- 对下载的 blob 进行 SHA256 校验。
## 前置条件
- [Go](https://golang.org/dl/)(1.16 或更高版本)用于构建工具。
- [Docker](https://www.docker.com/get-started) 和 [Docker Compose](https://docs.docker.com/compose/install/) 用于运行实验环境(可选)。
## 使用说明
### 设置与构建
**构建工具**
```
git clone https://github.com/MachiavelliII/dockdiver.git
cd dockdiver
go build
./dockdiver
__ __ ___
____/ /___ _____/ /______/ (_) _____ _____
/ __ / __ \/ ___/ //_/ __ / / | / / _ \/ ___/
/ /_/ / /_/ / /__/ ,< / /_/ / /| |/ / __/ / @MachIaVellill
\__,_/\____/\___/_/|_|\__,_/_/ |___/\___/_/
Usage of ./dockdiver:
-bearer string
Bearer token for Authorization
-dir string
Output directory for dumped files (default "docker_dump")
-dump string
Specific repository to dump
-dump-all
Dump all repositories
-headers string
Custom headers as JSON (e.g., '{"X-Custom": "Value"}')
-insecure
Skip TLS certificate verification
-list
List all repositories
-password string
Password for Basic authentication
-port int
Port of the registry (used if not specified in URL) (default 5000)
-proxy string
Proxy URL (e.g., http://127.0.0.1:8080, https://proxy.com:8443, or socks5://127.0.0.1:1080)
-proxy-password string
Password for SOCKS5 proxy authentication
-proxy-username string
Username for SOCKS5 proxy authentication
-rate int
Requests per second (default 3)
-timeout duration
HTTP request timeout (e.g., 10s, 500ms) (default 30s)
-url string
Base URL or hostname of the Docker registry (e.g., http://example.com or example.com)
-username string
Username for Basic authentication
```
### 启动 registry 实验环境进行测试:
运行以下命令来设置实验环境 **(Linux & macOS)**:
```
cd lab/ && chmod +x run_lab.sh && ./run_lab.sh
```
对于 **Windows**:
```
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned # Run once if needed
cd .\lab; .\run_lab_windows.ps1
```
### 测试后清理
对于 **(Linux & macOS)**:
```
# 在 lab/docker/ 目录内。
sudo docker-compose down
rm -rf registry-data
```
对于 **Windows**:
```
docker-compose down # Inside the lab/docker/ directory.
Remove-Item -Path "registry-data" -Recurse -Force
```
#### 灵感来源于 [DockerRegistryGrabber](https://github.com/Syzik/DockerRegistryGrabber)
标签:DevSecOps, Docker 安全, Go 语言, Registry 枚举, SHA256 校验, Web截图, 上游代理, 容器安全, 工具, 开源, 敏感数据发现, 日志审计, 版权保护, 网络安全审计, 请求拦截, 逆向分析, 镜像仓库审计, 镜像提取