Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reolink RLN36 #1

Closed
AT0myks opened this issue Nov 25, 2022 · 2 comments · Fixed by #4
Closed

Reolink RLN36 #1

AT0myks opened this issue Nov 25, 2022 · 2 comments · Fixed by #4

Comments

@AT0myks
Copy link
Contributor

AT0myks commented Nov 25, 2022

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 Is by Qs 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.

@vmallet
Copy link
Owner

vmallet commented Nov 26, 2022

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.

@AT0myks
Copy link
Contributor Author

AT0myks commented Apr 8, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants