MatrixEditor / hiktools

Python & C++ library for working with hikvision firmware/ SADP packets/ SADP Tool functionalities
MIT License
11 stars 0 forks source link

trying to extract a dav file failed #5

Open JacekKac opened 1 month ago

JacekKac commented 1 month ago

python3 -m hiktools.fmod digicap.dav firmware Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/pi/.local/lib/python3.9/site-packages/hiktools/fmod/main.py", line 37, in with DigiCap(sys.argv[1]) as dcap: File "/home/pi/.local/lib/python3.9/site-packages/hiktools/fmod/digicap.py", line 429, in enter self.fparse() File "/home/pi/.local/lib/python3.9/site-packages/hiktools/fmod/digicap.py", line 407, in fparse raw_data = decode_xor16( File "/home/pi/.local/lib/python3.9/site-packages/hiktools/fmod/digicap.py", line 263, in decode_xor16 result.append(key_byte ^ buf[index]) IndexError: index out of range

MatrixEditor commented 1 month ago

Hello @JacekKac,

the problem is either

  1. The firmware file is of a recent version and is therefore not supported by this library,
  2. or there's a flaw in the parsing logic (which I would have to verify)

If you are sure the latter one is causing the problem, it would be nice to share the file for investigation.