-
Notifications
You must be signed in to change notification settings - Fork 616
Fix VMware layer tag reading #429
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -48,8 +48,7 @@ def _read_header(self) -> None: | |||||||||||||||||||||||||||
| if magic not in [b"\xD2\xBE\xD2\xBE"]: | ||||||||||||||||||||||||||||
| raise VmwareFormatException(self.name, "Wrong magic bytes for Vmware layer: {}".format(repr(magic))) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # TODO: Change certain structure sizes based on the version | ||||||||||||||||||||||||||||
| # version = magic[1] & 0xf | ||||||||||||||||||||||||||||
| version = magic[0] & 0xf | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| group_size = struct.calcsize(self.group_structure) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
@@ -81,12 +80,20 @@ def _read_header(self) -> None: | |||||||||||||||||||||||||||
| self._context.object("vmware!unsigned int", | ||||||||||||||||||||||||||||
| offset = offset + name_len + 2 + (index * index_len), | ||||||||||||||||||||||||||||
| layer_name = self._meta_layer)) | ||||||||||||||||||||||||||||
| data = self._context.object("vmware!unsigned int", | ||||||||||||||||||||||||||||
| data_len = flags & 0x3f | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # TODO: Read special data sizes (signalling a longer data stream) properly instead of skipping them | ||||||||||||||||||||||||||||
| if data_len in (62, 63): | ||||||||||||||||||||||||||||
| data_len = 4 if version == 0 else 8 | ||||||||||||||||||||||||||||
| offset += 2 + name_len + (indicies_len * index_len) + 2 * data_len | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
| flags | name_len | name | indices | data |
|---|---|---|---|---|
| 1 | 1 | name_len |
4 * indices_len |
data_len |
Some tags however, have a data_len of 62 or 63, which indicate a longer datastream. The layout is than as follows:
| flags | name_len | name | indices | data_size | data_mem_size | padding? | data |
|---|---|---|---|---|---|---|---|
| 1 | 1 | name_len |
4 * indices_len |
4 or 8 | 4 or 8 | 2 | data_size |
The 4 or 8 (which I set as data_len) is version dependent, so this is where the version comes in. Difference between data_size and data_mem_size should occur in cases where the data is compressed (data_size < data_mem_size).
I based this mostly on Volatility 2.x-code and the original parser of the same author.
Uh oh!
There was an error while loading. Please reload this page.