-
Notifications
You must be signed in to change notification settings - Fork 147
Fix the problem of Master Node reading errors #116
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
base: main
Are you sure you want to change the base?
Conversation
|
Related to #46 |
qkaiser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. Some further improvements can be made. See my comments.
| os.utime(path, (inode['ino'].atime_sec, inode['ino'].mtime_sec), follow_symlinks = False) | ||
| follow_symlinks = False | ||
| if os.name == 'nt': follow_symlinks = True | ||
| os.utime(path, (inode['ino'].atime_sec, inode['ino'].mtime_sec), follow_symlinks=follow_symlinks) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems to be unrelated. Please put it in a dedicated commit with a description explaining why you need to follow symlinks on Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, On Windows, this parameter to False will error with Python 3.12, while True will not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted. Please put that in a dedicated commit.
| if crc != mst_chdr.crc: | ||
| break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would log that the CRC32 does not match:
if crc != mst_chdr.crc:
log(self, 'Master node CRC check failed: expected 0x%x got 0x%x' % (crc, mst_chdr.crc))I'd continue working even in the presence of corrupt master node, this way the tool still extracts something. It may not be the most recent, but at least one that is not corrupt.
if crc != mst_chdr.crc:
log(self, 'Master node CRC check failed: expected 0x%x got 0x%x' % (crc, mst_chdr.crc))
mst_offset += mst_chdr.len
continueWhat do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, masternodes are recorded in sequence. If a CRC failure occurs, there should be no normal ones afterwards. However, you can try continuing the scan. I'm not quite sure if the old data has been completely cleared.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Objective is to be fault-tolerant since ubireader is used by unblob on a variety of weird firmware and image dumps.
|
@scriptkitz do you have some samples you could share ? Ideally a sample that extracts different content between the current |
USRDATA.zip |
LEB1/LEB2 contains multiple MasterNodes. The one with the largest cmt_no needs to be scanned, as that is the currently activated one.