onekey-sec / ubi_reader

Collection of Python scripts for reading information about and extracting data from UBI and UBIFS images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Porting to Python 3

0xd3xt3r opened this issue · comments

any plans on porting the library to python3 ?

It should work with Python 3, but it has not been tested on some of the newer versions of 3.
-Jason

Tired to testing it with python 3.5.7 didn't work.
Syntax issues with print method and Exception syntax

The latest version has worked okay for me on 3.5.3, not sure what they would have changed. I'll look into it.
-Jason

I dought it will work on any python3 version due to following syntax errors :

  1. print 'Hello' which in python3 is print("Hello")
  2. except Exception, e: which in python3 is exception Exception as e
  3. other list and generator issues

What lines are those on? Those things should have all been fixed when it was ported to 3. Where did you get your copy from pip? or github?

Sorry about not posting the whole problem, current version working just fine with the python3.

I checkout to the old version commit : 0955e6b, as there were some issue with the current version.

I am able to extract the filesystem from the firmware image with the earlier version(commit mentioned above) and I am have trouble extracting the filesystem from the same image with the latest version. The error which am getting is as follows:

read Error: Block ends at 39608400 which is greater than file size 39499289
extract_blocks Fatal: PEB: 242.0: Bad Read Offset Request

Try using the -w command line flag with the new version, it should just warn about the problem instead of stopping.

doing little digging... I traced the error to line 112 of ubi_io.py file and commenting the exception image was able to extract the filesystem from the image. ( on the latest version of the code)

Oh sweet it works

Good to hear.

Thanks, for the quick response