Reolink RLN36
AT0myks opened this issue · comments
The firmwares for this device have, for some reason, a slightly different structure.
Right now pakler -l NT98333_NVR_36IP_REOLINK_L300_211_22102136.pak
will give
Attempting to guess number of sections... failed to guess, using default of 10
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Scripts\pakler.exe\__main__.py", line 7, in <module>
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\pakler.py", line 484, in main
header = read_header(filename, section_count)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\pakler.py", line 212, in read_header
return Header(buf, section_count, mtd_part_count)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\pakler.py", line 151, in __init__
self.sections.append(Section(buf[:SECTION_SIZE], num))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\pakler.py", line 87, in __init__
decode_strings(self, SECTION_STRINGS)
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\pakler.py", line 64, in decode_strings
fixed = cstr.rstrip(b'\0').decode('utf-8')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 4: invalid start byte
After looking at the file in a hex editor, if you replace the I
s by Q
s in SECTION_FORMAT
and HEADER_FORMAT
you get the expected result.
However there is still something else that I'm missing because the CRC is not correct:
CRC MISMATCH, file: NT98333_NVR_36IP_REOLINK_L300_211_22102136.pak, header.crc=3157ab80, got=e3cd54ab
At least this "fix" allowed me to work with the file.
This seems really annoying as I don't know how to spot this different layout and don't see an obvious way of handling it in pakler.
Interesting, I see things have evolved quite a bit! I just briefly looked and it seems the RLN36 is an ARM64 cpu running a 64-bit Linux. I'll try to take a look to see what happened to the PAK format but time has been hard to find lately.
That seems to be exactly it. It looks like this is their only device with 64-bit hardware. I have a PR ready to add support for this layout but there's another one I want to submit first.