PyanSofyan/V380Decoder

GitHub: PyanSofyan/V380Decoder

通过对 V380 Pro 安卓应用的逆向工程,解密该品牌摄像头的音视频流并提供 RTSP、ONVIF 等标准协议输出。

Stars: 1 | Forks: 0

# V380 解码器 从加密的 V380 摄像头提取视频和音频。较新的 V380 摄像头对视频和音频流使用了加密。本项目是对 V380 Pro APK 进行逆向工程以发现解密方法的结果。 这是 [prsyahmi/v380](https://github.com/prsyahmi/v380) 的移植版本,并包含重大增强功能: - ✅ 音频和视频解密 - ✅ RTSP 服务器输出 - ✅ ONVIF 支持(实验性 - 已使用 Onvif Device Manager 测试) - ✅ 用于摄像头控制的 Web UI 和 REST API - ✅ 快照 API - ✅ 云中继流支持 ## 已测试摄像头 **注意:** 我仅测试了 2 台运行设备版本 31 的 V380 摄像头。 **摄像头 1:** - 软件:`AppEV2W_VA3_V2.5.9.5_20231211` - 固件:`Hw_AWT3710D_XHR_V1.0_WF_20230519` **摄像头 2:** - 软件:`AppEV2W_VA3_V1.3.7.0_20231211` - 固件:`Hw_AWT3610E_XHR_E_V1.0_WF_20230607` ## 系统要求 - .NET 10 SDK(用于从源码构建) - FFmpeg(可选,用于通过管道输出视频/音频) ## 命令行参数 | 参数 | 默认值 | 必填 | 描述 | |----------|---------|----------|-------------| | `--id` | - | ✅ 是 | 摄像头设备 ID | | `--username` | `admin` | ✅ 是 | 摄像头用户名 | | `--password` | - | ✅ 是 | 摄像头密码 | | `--ip` | - | ⚠️ 若 LAN | 摄像头 IP 地址(LAN 源必填) | | `--port` | `8800` | 否 | 摄像头端口 | | `--source` | `lan` | 否 | 连接源:`lan` 或 `cloud` | | `--output` | `rtsp` | 否 | 输出模式:`video`、`audio` 或 `rtsp` | | `--enable-onvif` | `false` | 否 | 启用 ONVIF 服务器(需要 `output=rtsp`) | | `--enable-api` | `false` | 否 | 启用 Web UI 和 REST API | | `--rtsp-port` | `8554` | 否 | RTSP 服务器端口 | | `--http-port` | `8080` | 否 | Web 服务器端口(用于 ONVIF/API) | | `--debug` | `false` | 否 | 启用调试日志 | | `--discover` | `false` | 否 | 发现摄像头 | | `--help` | `false` | 否 | 打印帮助 | ## 使用示例 下载最新 [发布版](https://github.com/PyanSofyan/V380decoder/releases/latest) ### 查找摄像头设备 ``` ./V380Decoder --discover ``` ### 视频输出(通过管道传输至 FFplay) ``` ./V380Decoder --id 12345678 --username admin --password password --ip 192.168.1.2 --output video | ffplay -f h264 -i pipe:0 ``` ### 音频输出(通过管道传输至 FFplay) ``` ./V380Decoder --id 12345678 --username admin --password password --ip 192.168.1.2 --output audio | ffplay -f alaw -ar 8000 -ac 1 -i pipe:0 ``` ### RTSP 服务器 ``` # 默认 (RTSP 模式) ./V380Decoder --id 12345678 --username admin --password password --ip 192.168.1.2 # 或者明确指定 ./V380Decoder --id 12345678 --username admin --password password --ip 192.168.1.2 --output rtsp ``` **访问流:** ``` rtsp://192.168.1.3:8554/live ``` **访问快照:** ``` http://192.168.1.3:8080/snapshot ``` ### 云流媒体 通过中继服务器流式传输(自动检测中继 IP): ``` ./V380Decoder --id 12345678 --username admin --password password --source cloud ``` ## ONVIF 支持(实验性) **状态:** 实验性 - 仅使用 [Onvif Device Manager](https://sourceforge.net/projects/onvifdm/) (ODM) 测试过 **启用 ONVIF:** ``` ./V380Decoder --id 12345678 --username admin --password password --ip 192.168.1.2 --enable-onvif ``` **访问 ONVIF 端点:** ``` http://192.168.1.3:8080/onvif/device_service ``` **功能:** - ✅ 实时视频 - ✅ PTZ 控制(平移/俯仰) - ✅ 图像设置(灯光控制) - ✅ 媒体配置文件 - ⚠️ 设备发现未实现,需手动添加 ## Web UI 与 REST API 通过 Web 界面或 REST API 控制您的摄像头。 **启用 API:** ``` ./V380Decoder --id 12345678 --username admin --password password --ip 192.168.1.2 --enable-api ``` ### Web UI ``` http://192.168.1.3:8080 ``` ### REST API 端点 **PTZ 控制:** ``` curl -X POST http://192.168.1.3:8080/api/ptz/right curl -X POST http://192.168.1.3:8080/api/ptz/left curl -X POST http://192.168.1.3:8080/api/ptz/up curl -X POST http://192.168.1.3:8080/api/ptz/down ``` **灯光控制:** ``` curl -X POST http://192.168.1.3:8080/api/light/on curl -X POST http://192.168.1.3:8080/api/light/off curl -X POST http://192.168.1.3:8080/api/light/auto ``` **图像模式:** ``` curl -X POST http://192.168.1.3:8080/api/image/color # Day mode (color) curl -X POST http://192.168.1.3:8080/api/image/bw # Night mode (B&W with IR) curl -X POST http://192.168.1.3:8080/api/image/auto # Auto switch curl -X POST http://192.168.1.3:8080/api/image/flip # Flip image 180° ``` **状态:** ``` curl http://192.168.1.3:8080/api/status ``` ## 从源码构建 1. **安装 .NET 10 SDK** - 下载地址:https://dotnet.microsoft.com/download/dotnet/10.0 2. **克隆仓库** git clone https://github.com/PyanSofyan/V380Decoder.git cd V380Decoder 3. **构建** dotnet build 4. **带参数运行** dotnet run -- --id 12345678 --username admin --password password --ip 192.168.1.2 5. **发布(可选 - 用于部署)** # Linux x64 dotnet publish -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -p:PublishTrimmed=true -o ./publish/linux-x64 # Linux ARM64 (Raspberry Pi 3+) dotnet publish -c Release -r linux-arm64 --self-contained true -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -p:PublishTrimmed=true -o ./publish/linux-arm64 # Linux ARM (Raspberry Pi 等) dotnet publish -c Release -r linux-arm --self-contained true -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -p:PublishTrimmed=true -o ./publish/linux-arm # Windows x64 dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -p:PublishTrimmed=true -o ./publish/win-x64 # Windows x86 (由于 IL Trimmer 兼容性问题,构建时不进行裁剪) dotnet publish -c Release -r win-x86 --self-contained true -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -o ./publish/win-x86 ## 作为系统服务运行 ### Linux (systemd) 创建 `/etc/systemd/system/v380decoder.service`: ``` [Unit] Description=V380 Camera Decoder After=network.target [Service] Type=simple User=YOUR_USERNAME WorkingDirectory=/home/YOUR_USERNAME/v380decoder ExecStart=/home/YOUR_USERNAME/v380decoder/V380Decoder --id 12345678 --username admin --password password --ip 192.168.1.2 --enable-onvif --enable-api Restart=always RestartSec=5 [Install] WantedBy=multi-user.target ``` 启用并启动: ``` sudo systemctl daemon-reload sudo systemctl enable v380decoder sudo systemctl start v380decoder sudo systemctl status v380decoder ``` ### Docker 构建并运行: ``` docker build -t v380decoder . docker run -d --restart unless-stopped --network host v380decoder --id 12345678 --username admin --password password --ip 192.168.1.2 --enable-onvif --enable-api ``` ## 致谢 - [prsyahmi/v380](https://github.com/prsyahmi/v380) - 原始 V380 逆向工程工作 - [Cyberlink Security](https://cyberlinksecurity.ie/vulnerabilities-to-exploit-a-chinese-ip-camera/) - V380 漏洞研究 - 使用的工具:[Wireshark](https://www.wireshark.org/)、[PacketSender](https://packetsender.com/)、[JADX](https://github.com/skylot/jadx)、[Ghidra](https://github.com/NationalSecurityAgency/ghidra)、[Frida](https://github.com/frida/frida)
标签:FFmpeg, IoT安全, ONVIF, PE 加载器, REST API, RTSP服务器, V380, XXE攻击, 云台控制, 云资产清单, 协议分析, 固件分析, 实时流传输, 摄像头解密, 智能家居, 权限提升, 监控摄像头, 网络摄像机, 网络测绘, 视频流解密, 请求拦截, 逆向工程, 音视频提取