ubi_reader
ubi_reader copied to clipboard
Accept file objects
This gives more flexibility when using ubireader as a library and fixes the behavior mentioned in https://github.com/onekey-sec/ubi_reader/pull/89#issuecomment-1573199832.
For example this is now possible:
with ZipFile("ubi.zip") as myzip:
with myzip.open("ubi.bin") as ubi:
block_size = guess_peb_size(ubi)
ufile_obj = ubi_file(ubi, block_size)
...
Admittedly this is not the best use case right now if you need walk.index() because it takes an extremely long time when the file is zipped, but that's a separate issue.
This looks decent but I'll wait for my more Python experienced colleagues to have a look :)