Extract information from Reolink firmware files.
Project description
reolinkfw
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:
- cramfs (handled by Kaitai Struct)
- squashfs (handled by PySquashfsImage)
- UBIFS (handled by ubi_reader)
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
Built Distribution
Hashes for reolinkfw-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f3d4370f7dcfbbeaec71e617bdaef69f6551209754479473af8ff843db324d2 |
|
MD5 | dfa2493a3f002e7b9a6fd0bea649ee97 |
|
BLAKE2b-256 | 1dd32dc1bf32ad1f7a733c9d3656123824da3d0172a96a84182c4617313601da |