-
Notifications
You must be signed in to change notification settings - Fork 4
support mmap as source for package #81
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
Based on suggestion from @qkaiser. This will make it easier to integrate with unblob (see onekey-sec/unblob#1244).
for more information, see https://pre-commit.ci
Should probably think of a better test...
Requires this PR to (almost) work properly: nightlark/pymsi#81
self.path = None | ||
self.file = path_or_bytesio | ||
else: | ||
# TODO: consider typing.BinaryIO |
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.
Did typing.BinaryIO work?
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.
Interesting discussion typing.*IO
: python/typing#829
Leaning towards the current list of type options being fine for now, with the option to change it later if needed for e.g. integration with unblob.
|
||
size = (msi.package.ole.nb_sect * msi.package.ole.sector_size) + 512 | ||
|
||
print(size) |
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 guess it would probably be good to pick a specific version of powertoys.msi eventually so that we know what size to expect here. (Doesn't need to be part of this PR though)
Summary
Based on suggestion from @qkaiser. This will make it easier to integrate with unblob (see onekey-sec/unblob#1244).
Proposed changes
Add mmap as possible input to
Package
and add test cases.I marked it as WIP to see if it makes sense to use
typing.BinaryIO
as the type hint (which sounds like it might work from its description). I also left a TODO for actually testing something about the parsed MSI (I didn't havepowertoys.msi
so I just used7z
).