Skip to main content

Extract information from Reolink firmware files.

Project description

reolinkfw

Python versions PyPI License

What is it

This is a small tool to get information on Reolink firmwares. It's able to read ZIP and PAK files, either local or at the end of a URL. The info is read from the files contained in the firmware (mainly dvr.xml) and if we trust them to be 100% correct, it allows to know precisely which model/hardware version a given firmware is targeting.

It was first developed as part of another Reolink-related project but became its own thing.

Currently it doesn't do anything more and is probably not that useful outside of this other project.

Requirements

  • Python 3.9+
  • python-lzo (see below for installation)

Installation

Windows

To ease the pain of building/installing python-lzo on Windows I built wheels for it (only for CPython on Windows 64-bit). Download the one for your Python version and install it:

pip install python_lzo-X.Y-cp3Z-cp3Z-win_amd64.whl
pip install reolinkfw

A PR is open to have python-lzo wheels be officially provided on PyPI.

If you are having problems installing lxml on Python 3.11, see here.

Non-Windows

Install python-lzo then

pip install reolinkfw

Usage

Command line

reolinkfw info file_or_url

As a library

import reolinkfw
url = "https://reolink-storage.s3.amazonaws.com/website/firmware/20200523firmware/RLC-410-5MP_20_20052300.zip"
print(reolinkfw.get_info(url))
file = "/home/ben/RLC-410-5MP_20_20052300.zip"
print(reolinkfw.get_info(file))

In most cases where a URL is used, it will be a direct link to the file (meaning if you were to open it in a browser, the download would start).

But in some cases (for example beta firmwares) Reolink gives a Google Drive or a bit.ly link (that redirects to a Google Drive link).

These URLs are automatically handled so that you don't have to figure out the "real" download link, and in this case the url value(s) in the result JSON will not be the link that you gave but the direct download one.

However the Google Drive folder links (drive.google.com/drive/folders) are not handled and in these cases you must find the real URL, or you can also download the file.

Example

The command

reolinkfw info RLC-410-5MP_20_20052300.zip -i 2

will give something like this:

[
  {
    "firmware_version_prefix": "v3.0.0",
    "board_type": "IPC_51516M5M",
    "board_name": "IPC_51516M5M",
    "build_date": "200523",
    "display_type_info": "RLC-410-5MP",
    "detail_machine_type": "IPC_51516M5M",
    "type": "IPC",
    "version_file": "20_20052300",
    "sha256": "6ef371a51b61d7b21d8f7016d90b5fc1ed3eaa8a3f30f1e202a3474bfb4807e5",
    "file": "RLC-410-5MP_20_20052300.zip"
  }
]

Notes

There are at least 3 types of file systems used for Reolink firmwares:

Some ZIP files provided by Reolink contain multiple PAKs. This is why get_info always returns a list.

Issues

The RLN36 PAKs have a very small difference in their structure that pakler does not yet handle. This means that without modifying the pakler source you won't be able to do anything with these files and you will get the Could not guess section count error.

An issue is open to fix this and you can check it out if you really need a (dirty) solution.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reolinkfw-1.0.0.tar.gz (24.0 kB view hashes)

Uploaded Source

Built Distribution

reolinkfw-1.0.0-py3-none-any.whl (22.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page