Skip to content

WIP: add support for MSI #1244

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

WIP: add support for MSI #1244

wants to merge 1 commit into from

Conversation

jcrussell
Copy link

I took a look at adding support for MSI (#1211) and ran into a couple of issues.

Pymsi requires a path or BytesIO -- is there a way to convert from an unblob file? I was looking at file_utils.OffsetFile which seems closer (might need pymsi to support file-like objects, @nightlark). I made the following changes:

--- a/python/unblob/file_utils.py
+++ b/python/unblob/file_utils.py
@@ -125,6 +125,16 @@ class OffsetFile:
    def tell(self):
        return self._file.tell() - self._offset

+    @property
+    def closed(self):
+        return self._file == None
+
+    def close(self):
+        if self._file:
+            self._file.close()
+            self._file = None

And in pymsi changed the __init__ for Package to:

class Package:
    def __init__(self, path_or_bytesio: Union[Path, io.BytesIO]):
        if hasattr(path_or_bytesio, "read"):
            self.path = None
            self.file = path_or_bytesio
        else:
            self.path = path_or_bytesio.resolve(True)
            self.file = self.path.open("rb")

This seems to work but I'm not sure if there's an easier way.

I'm getting an error related to sandboxing which I suspect is unrelated:

Activated FS access restrictions; rules=[Read("/"), ReadWrite("/dev/shm"), ReadWrite("/tmp/foo"), RemoveDir("/tmp/foo"), RemoveFile("/tmp/foo"), MakeDir("/tmp"), ReadWrite("unblob.log")], status=FullyEnforced pid=3928538
Processing file                path=/home/jon/Downloads/7z2501.msi pid=3928542 size=0x17dc00
...
  File "/usr/lib/python3.11/pathlib.py", line 1045, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/tmp/foo/7z2501.msi_extract/0-1513984.msi'

I've been testing with a 7zip MSI downloaded from here:

https://www.7-zip.org/a/7z2501.msi

Finally, I commented out an entry in DEFAULT_SKIP_MAGIC to get the new handler called. I don't know what other side effects this will have.

Any suggestions?

Basic scaffolding, running into a few issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant