Sort-of-a-noob looking to get back into hacking my Dahua NVR and IP Cams with Linux

Aug 21, 2020
4
4
Linares
Hello,

I'm new to this forum, but not new to IP cams. I wanted to say 'hello world' and tell a little about myself.

I consider myself relatively computer-savvy and I like to hack into my devices to get the most out of them. I exclusively use Linux and strongly support OSS, and I'm probably more security and privacy focused than most people (hopefully not read as paranoid jaja). I'm a seasoned Python user, with less experience in embedded systems, networking, front-end development, and statically typed languages.

So enough about boring old me. Several years ago a built a Dahua IP Cam network for my parents, taking the time to read the many helpful resources and comments on this forum to walk myself through the process. The project was successful, my mom said so - the selection, wiring, and installation of the cameras wasn't so difficult, and the performance of the Dahua NVR and retrieval of footage has been satisfactory, with some caveats. In addition, I overwrote their router's firmware with Tomato in order to set up a VPN, allowing us to view the cameras remotely in a secure manner, both from my personal desktop via RTSP and from our smartphones using Dahua's proprietary app.

At the same time when I was building my parent's system, I purchased a separate Dahua camera and NVR to see what I could do. Unfortunately, I was disappointed with the possibilities:
  • The NVR itself is a flashed with a Busybox binary blob, so it isn't obvious how I could configure the NVR via telnet, or modify the firmware directly. I was a bit hesitant to flash new firmware on it at the time.
  • Due to using Busybox, computer vision tools cannot be implemented within the NVR to parse the DAV files. The native 'motion detection' tools in the firmware give way too many false positives.
  • Attempts to access the data via Linux were limited - using Wine to run SmartPSS was not reliable, and using RSTP does not let me access historical footage.
  • The NVR would 'phone home' for some services, such as push notifications. I would want to at least have the option to self-host these types of things, if possible.
Essentially, I was being forced to rely on proprietary tools to access historical data. I had hoped I could extract the video footage to apply some computer vision / machine learning frameworks in a seamless and extendable way, but I couldn't figure out a pipeline at the time. The best I was able to do was connect to the RTSP stream from my desktop, save portions of the film, then process these files using YOLO v3, but the whole process was inefficient and inflexible (large files saved from RTSP, poor streaming quality, effort needed to extend darknet to describe the results in a useful way). Given that I was busy with other things at the time, I put this project to the side, and moved on to other things.

I still have this NVR and some cameras lying around, so I wanted to get back to this now that I'm stuck at home all the time. Something tells me that I may need to build my own box with a GPU and perhaps install something like iSpy/ZoneMinder/BlueCherry to handle some of the things the Dahua NVR was doing, such as video storage, timestamps, and data overwriting. These projects all seem unpolished, from what I read, but I guess I will have to fiddle around to see what is possible. I still think the NVR could be used as a storage device, but maybe others have suggestions what could be done with it. Ideally, I would like to overwrite the NVR with some decent firmware that maintains the existing features of the Dahua NVR and tunnel into it from another GPU-possessing device to extract images that can then be parsed with Tensorflow or the like. Given my zeal for Linux, Blue Iris isn't an option for me (sorry everyone).

If anyone has similar experiences or interests, please let me know. I look forward to helping others by sharing what little I know.

Many thanks!
 
  • Like
Reactions: mat200