Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
10 changes: 6 additions & 4 deletions unblob/handlers/filesystem/ubi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from unblob.extractors import Command

from ...file_utils import InvalidInputFormat, get_endian, iterate_patterns
from ...file_utils import InvalidInputFormat, SeekError, get_endian, iterate_patterns
from ...iter_utils import get_intervals
from ...models import File, Handler, HexString, StructHandler, ValidChunk

Expand Down Expand Up @@ -81,7 +81,7 @@ class UBIFSHandler(StructHandler):
"""
HEADER_STRUCT = "ubifs_sb_node_t"

EXTRACTOR = Command("ubireader_extract_files", "{inpath}", "-o", "{outdir}")
EXTRACTOR = Command("ubireader_extract_files", "{inpath}", "-w", "-o", "{outdir}")

def calculate_chunk(self, file: File, start_offset: int) -> Optional[ValidChunk]:
endian = get_endian(file, self._BIG_ENDIAN_MAGIC)
Expand Down Expand Up @@ -137,8 +137,10 @@ def _walk_ubi(self, file: File, peb_size: int) -> int:
first_bytes = file.read(len(self._UBI_EC_HEADER))
if first_bytes == b"" or first_bytes != self._UBI_EC_HEADER:
break
file.seek(offset + peb_size)

try:
file.seek(offset + peb_size)
except SeekError:
break
return offset

def calculate_chunk(self, file: File, start_offset: int) -> Optional[ValidChunk]:
Expand Down