dissect.hypervisor 3.22.dev4__py3-none-any.whl → 3.22.dev6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,183 @@
1
+ # Generated by cstruct-stubgen
2
+ from typing import BinaryIO, Literal, TypeAlias, overload
3
+
4
+ import dissect.cstruct as __cs__
5
+
6
+ class _c_hyperv(__cs__.cstruct):
7
+ SIGNATURE_STORAGE_HEADER: Literal[19406868] = ...
8
+ FIRST_HEADER_OFFSET: Literal[0] = ...
9
+ SECOND_HEADER_OFFSET: Literal[4096] = ...
10
+ SIGNATURE_REPLAY_LOG_HEADER: Literal[17891331] = ...
11
+ SIGNATURE_OBJECT_TABLE_HEADER: Literal[17891329] = ...
12
+ OBJECT_TABLE_OFFSET: Literal[8192] = ...
13
+ SIGNATURE_KEY_TABLE_HEADER: Literal[2] = ...
14
+ class HyperVStorageHeader(__cs__.Structure):
15
+ signature: _c_hyperv.uint32
16
+ checksum: _c_hyperv.uint32
17
+ sequence_number: _c_hyperv.uint16
18
+ version: _c_hyperv.uint32
19
+ unknown2: _c_hyperv.uint64
20
+ alignment: _c_hyperv.uint32
21
+ replay_log_offset: _c_hyperv.uint64
22
+ replay_log_size: _c_hyperv.uint64
23
+ header_size: _c_hyperv.uint32
24
+ @overload
25
+ def __init__(
26
+ self,
27
+ /,
28
+ signature: _c_hyperv.uint32 | None = ...,
29
+ checksum: _c_hyperv.uint32 | None = ...,
30
+ sequence_number: _c_hyperv.uint16 | None = ...,
31
+ version: _c_hyperv.uint32 | None = ...,
32
+ unknown2: _c_hyperv.uint64 | None = ...,
33
+ alignment: _c_hyperv.uint32 | None = ...,
34
+ replay_log_offset: _c_hyperv.uint64 | None = ...,
35
+ replay_log_size: _c_hyperv.uint64 | None = ...,
36
+ header_size: _c_hyperv.uint32 | None = ...,
37
+ ): ...
38
+ @overload
39
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
40
+
41
+ class HyperVStorageReplayLog(__cs__.Structure):
42
+ signature: _c_hyperv.uint32
43
+ checksum: _c_hyperv.uint32
44
+ num_entries: _c_hyperv.uint32
45
+ unknown1: _c_hyperv.uint8
46
+ max_entries: _c_hyperv.uint32
47
+ unknown2: _c_hyperv.uint32
48
+ unknown3: _c_hyperv.uint32
49
+ unknown4: _c_hyperv.uint32
50
+ unknown5: _c_hyperv.uint32
51
+ unknown6: _c_hyperv.uint8
52
+ @overload
53
+ def __init__(
54
+ self,
55
+ /,
56
+ signature: _c_hyperv.uint32 | None = ...,
57
+ checksum: _c_hyperv.uint32 | None = ...,
58
+ num_entries: _c_hyperv.uint32 | None = ...,
59
+ unknown1: _c_hyperv.uint8 | None = ...,
60
+ max_entries: _c_hyperv.uint32 | None = ...,
61
+ unknown2: _c_hyperv.uint32 | None = ...,
62
+ unknown3: _c_hyperv.uint32 | None = ...,
63
+ unknown4: _c_hyperv.uint32 | None = ...,
64
+ unknown5: _c_hyperv.uint32 | None = ...,
65
+ unknown6: _c_hyperv.uint8 | None = ...,
66
+ ): ...
67
+ @overload
68
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
69
+
70
+ class HyperVStorageReplayLogEntry(__cs__.Structure):
71
+ offset: _c_hyperv.uint64
72
+ size: _c_hyperv.uint32
73
+ unknown2: _c_hyperv.uint32
74
+ unknown3: _c_hyperv.uint32
75
+ checksum: _c_hyperv.uint32
76
+ data_checksum: _c_hyperv.uint32
77
+ @overload
78
+ def __init__(
79
+ self,
80
+ /,
81
+ offset: _c_hyperv.uint64 | None = ...,
82
+ size: _c_hyperv.uint32 | None = ...,
83
+ unknown2: _c_hyperv.uint32 | None = ...,
84
+ unknown3: _c_hyperv.uint32 | None = ...,
85
+ checksum: _c_hyperv.uint32 | None = ...,
86
+ data_checksum: _c_hyperv.uint32 | None = ...,
87
+ ): ...
88
+ @overload
89
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
90
+
91
+ class ObjectEntryType(__cs__.Enum):
92
+ Unknown0 = ...
93
+ ObjectTable = ...
94
+ KeyTable = ...
95
+ File = ...
96
+ Free = ...
97
+ Unknown5Header = ...
98
+ ReplayLog = ...
99
+ ChangeTrackingBuffer = ...
100
+
101
+ class HyperVStorageObjectTable(__cs__.Structure):
102
+ signature: _c_hyperv.uint32
103
+ num_entries: _c_hyperv.uint32
104
+ @overload
105
+ def __init__(self, /, signature: _c_hyperv.uint32 | None = ..., num_entries: _c_hyperv.uint32 | None = ...): ...
106
+ @overload
107
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
108
+
109
+ class HyperVStorageObjectTableEntry(__cs__.Structure):
110
+ type: _c_hyperv.ObjectEntryType
111
+ checksum: _c_hyperv.uint32
112
+ offset: _c_hyperv.uint64
113
+ size: _c_hyperv.uint32
114
+ allocated: _c_hyperv.uint8
115
+ @overload
116
+ def __init__(
117
+ self,
118
+ /,
119
+ type: _c_hyperv.ObjectEntryType | None = ...,
120
+ checksum: _c_hyperv.uint32 | None = ...,
121
+ offset: _c_hyperv.uint64 | None = ...,
122
+ size: _c_hyperv.uint32 | None = ...,
123
+ allocated: _c_hyperv.uint8 | None = ...,
124
+ ): ...
125
+ @overload
126
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
127
+
128
+ class KeyDataType(__cs__.Enum):
129
+ Free = ...
130
+ Unknown = ...
131
+ Int = ...
132
+ UInt = ...
133
+ Double = ...
134
+ String = ...
135
+ Array = ...
136
+ Bool = ...
137
+ Node = ...
138
+
139
+ class KeyDataFlag(__cs__.Flag):
140
+ FileObjectPointer = ...
141
+
142
+ class HyperVStorageKeyTable(__cs__.Structure):
143
+ signature: _c_hyperv.uint16
144
+ index: _c_hyperv.uint16
145
+ sequence_number: _c_hyperv.uint16
146
+ checksum: _c_hyperv.uint32
147
+ @overload
148
+ def __init__(
149
+ self,
150
+ /,
151
+ signature: _c_hyperv.uint16 | None = ...,
152
+ index: _c_hyperv.uint16 | None = ...,
153
+ sequence_number: _c_hyperv.uint16 | None = ...,
154
+ checksum: _c_hyperv.uint32 | None = ...,
155
+ ): ...
156
+ @overload
157
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
158
+
159
+ class HyperVStorageKeyTableEntryHeader(__cs__.Structure):
160
+ type: _c_hyperv.uint16
161
+ size: _c_hyperv.uint32
162
+ parent_table_idx: _c_hyperv.uint16
163
+ parent_offset: _c_hyperv.uint32
164
+ checksum: _c_hyperv.uint32
165
+ insertion_sequence: _c_hyperv.uint32
166
+ data_offset: _c_hyperv.uint8
167
+ @overload
168
+ def __init__(
169
+ self,
170
+ /,
171
+ type: _c_hyperv.uint16 | None = ...,
172
+ size: _c_hyperv.uint32 | None = ...,
173
+ parent_table_idx: _c_hyperv.uint16 | None = ...,
174
+ parent_offset: _c_hyperv.uint32 | None = ...,
175
+ checksum: _c_hyperv.uint32 | None = ...,
176
+ insertion_sequence: _c_hyperv.uint32 | None = ...,
177
+ data_offset: _c_hyperv.uint8 | None = ...,
178
+ ): ...
179
+ @overload
180
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
181
+
182
+ # Technically `c_hyperv` is an instance of `_c_hyperv`, but then we can't use it in type hints
183
+ c_hyperv: TypeAlias = _c_hyperv
@@ -26,6 +26,7 @@ class _c_asif(__cs__.cstruct):
26
26
  @overload
27
27
  def __init__(
28
28
  self,
29
+ /,
29
30
  header_signature: _c_asif.uint32 | None = ...,
30
31
  header_version: _c_asif.uint32 | None = ...,
31
32
  header_size: _c_asif.uint32 | None = ...,
@@ -55,6 +56,7 @@ class _c_asif(__cs__.cstruct):
55
56
  @overload
56
57
  def __init__(
57
58
  self,
59
+ /,
58
60
  header_signature: _c_asif.uint32 | None = ...,
59
61
  header_version: _c_asif.uint32 | None = ...,
60
62
  header_size: _c_asif.uint32 | None = ...,
@@ -0,0 +1,92 @@
1
+ # Generated by cstruct-stubgen
2
+ from typing import BinaryIO, Literal, TypeAlias, overload
3
+
4
+ import dissect.cstruct as __cs__
5
+
6
+ class _c_hdd(__cs__.cstruct):
7
+ SIGNATURE_STRUCTURED_DISK_V1: Literal[b"WithoutFreeSpace"] = ...
8
+ SIGNATURE_STRUCTURED_DISK_V2: Literal[b"WithouFreSpacExt"] = ...
9
+ SIGNATURE_DISK_IN_USE: Literal[1953459801] = ...
10
+ SECTOR_LOG: Literal[9] = ...
11
+ SECTOR_SIZE: Literal[512] = ...
12
+ class pvd_header(__cs__.Structure):
13
+ m_Sig: __cs__.CharArray
14
+ m_Type: _c_hdd.uint32
15
+ m_Heads: _c_hdd.uint32
16
+ m_Cylinders: _c_hdd.uint32
17
+ m_Sectors: _c_hdd.uint32
18
+ m_Size: _c_hdd.uint32
19
+ m_SizeInSectors_v1: _c_hdd.uint32
20
+ Unused: _c_hdd.uint32
21
+ m_SizeInSectors_v2: _c_hdd.uint64
22
+ m_DiskInUse: _c_hdd.uint32
23
+ m_FirstBlockOffset: _c_hdd.uint32
24
+ m_Flags: _c_hdd.uint32
25
+ m_FormatExtensionOffset: _c_hdd.uint64
26
+ @overload
27
+ def __init__(
28
+ self,
29
+ /,
30
+ m_Sig: __cs__.CharArray | None = ...,
31
+ m_Type: _c_hdd.uint32 | None = ...,
32
+ m_Heads: _c_hdd.uint32 | None = ...,
33
+ m_Cylinders: _c_hdd.uint32 | None = ...,
34
+ m_Sectors: _c_hdd.uint32 | None = ...,
35
+ m_Size: _c_hdd.uint32 | None = ...,
36
+ m_SizeInSectors_v1: _c_hdd.uint32 | None = ...,
37
+ Unused: _c_hdd.uint32 | None = ...,
38
+ m_SizeInSectors_v2: _c_hdd.uint64 | None = ...,
39
+ m_DiskInUse: _c_hdd.uint32 | None = ...,
40
+ m_FirstBlockOffset: _c_hdd.uint32 | None = ...,
41
+ m_Flags: _c_hdd.uint32 | None = ...,
42
+ m_FormatExtensionOffset: _c_hdd.uint64 | None = ...,
43
+ ): ...
44
+ @overload
45
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
46
+
47
+ class pvd_ext_block_check(__cs__.Structure):
48
+ m_Magic: _c_hdd.uint64
49
+ m_Md5: __cs__.Array[_c_hdd.uint8]
50
+ @overload
51
+ def __init__(self, /, m_Magic: _c_hdd.uint64 | None = ..., m_Md5: __cs__.Array[_c_hdd.uint8] | None = ...): ...
52
+ @overload
53
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
54
+
55
+ class pvd_ext_block_element_header(__cs__.Structure):
56
+ magic: _c_hdd.uint64
57
+ flags: _c_hdd.uint64
58
+ size: _c_hdd.uint32
59
+ unused32: _c_hdd.uint32
60
+ @overload
61
+ def __init__(
62
+ self,
63
+ /,
64
+ magic: _c_hdd.uint64 | None = ...,
65
+ flags: _c_hdd.uint64 | None = ...,
66
+ size: _c_hdd.uint32 | None = ...,
67
+ unused32: _c_hdd.uint32 | None = ...,
68
+ ): ...
69
+ @overload
70
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
71
+
72
+ class pvd_dirty_bitmap_raw(__cs__.Structure):
73
+ m_Size: _c_hdd.uint64
74
+ m_Id: __cs__.Array[_c_hdd.uint8]
75
+ m_Granularity: _c_hdd.uint32
76
+ m_L1Size: _c_hdd.uint32
77
+ m_L1: __cs__.Array[_c_hdd.uint64]
78
+ @overload
79
+ def __init__(
80
+ self,
81
+ /,
82
+ m_Size: _c_hdd.uint64 | None = ...,
83
+ m_Id: __cs__.Array[_c_hdd.uint8] | None = ...,
84
+ m_Granularity: _c_hdd.uint32 | None = ...,
85
+ m_L1Size: _c_hdd.uint32 | None = ...,
86
+ m_L1: __cs__.Array[_c_hdd.uint64] | None = ...,
87
+ ): ...
88
+ @overload
89
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
90
+
91
+ # Technically `c_hdd` is an instance of `_c_hdd`, but then we can't use it in type hints
92
+ c_hdd: TypeAlias = _c_hdd
@@ -59,6 +59,7 @@ class _c_qcow2(__cs__.cstruct):
59
59
  @overload
60
60
  def __init__(
61
61
  self,
62
+ /,
62
63
  magic: _c_qcow2.uint32 | None = ...,
63
64
  version: _c_qcow2.uint32 | None = ...,
64
65
  backing_file_offset: _c_qcow2.uint64 | None = ...,
@@ -87,7 +88,7 @@ class _c_qcow2(__cs__.cstruct):
87
88
  magic: _c_qcow2.uint32
88
89
  len: _c_qcow2.uint32
89
90
  @overload
90
- def __init__(self, magic: _c_qcow2.uint32 | None = ..., len: _c_qcow2.uint32 | None = ...): ...
91
+ def __init__(self, /, magic: _c_qcow2.uint32 | None = ..., len: _c_qcow2.uint32 | None = ...): ...
91
92
  @overload
92
93
  def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
93
94
 
@@ -95,7 +96,7 @@ class _c_qcow2(__cs__.cstruct):
95
96
  offset: _c_qcow2.uint64
96
97
  length: _c_qcow2.uint64
97
98
  @overload
98
- def __init__(self, offset: _c_qcow2.uint64 | None = ..., length: _c_qcow2.uint64 | None = ...): ...
99
+ def __init__(self, /, offset: _c_qcow2.uint64 | None = ..., length: _c_qcow2.uint64 | None = ...): ...
99
100
  @overload
100
101
  def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
101
102
 
@@ -107,6 +108,7 @@ class _c_qcow2(__cs__.cstruct):
107
108
  @overload
108
109
  def __init__(
109
110
  self,
111
+ /,
110
112
  nb_bitmaps: _c_qcow2.uint32 | None = ...,
111
113
  reserved32: _c_qcow2.uint32 | None = ...,
112
114
  bitmap_directory_size: _c_qcow2.uint64 | None = ...,
@@ -128,6 +130,7 @@ class _c_qcow2(__cs__.cstruct):
128
130
  @overload
129
131
  def __init__(
130
132
  self,
133
+ /,
131
134
  l1_table_offset: _c_qcow2.uint64 | None = ...,
132
135
  l1_size: _c_qcow2.uint32 | None = ...,
133
136
  id_str_size: _c_qcow2.uint16 | None = ...,
@@ -148,6 +151,7 @@ class _c_qcow2(__cs__.cstruct):
148
151
  @overload
149
152
  def __init__(
150
153
  self,
154
+ /,
151
155
  vm_state_size_large: _c_qcow2.uint64 | None = ...,
152
156
  disk_size: _c_qcow2.uint64 | None = ...,
153
157
  icount: _c_qcow2.uint64 | None = ...,
@@ -22,6 +22,7 @@ class _c_vdi(__cs__.cstruct):
22
22
  @overload
23
23
  def __init__(
24
24
  self,
25
+ /,
25
26
  Cylinders: _c_vdi.uint32 | None = ...,
26
27
  Heads: _c_vdi.uint32 | None = ...,
27
28
  Sectors: _c_vdi.uint32 | None = ...,
@@ -38,6 +39,7 @@ class _c_vdi(__cs__.cstruct):
38
39
  @overload
39
40
  def __init__(
40
41
  self,
42
+ /,
41
43
  szFileInfo: __cs__.CharArray | None = ...,
42
44
  u32Signature: _c_vdi.uint32 | None = ...,
43
45
  u32Version: _c_vdi.uint32 | None = ...,
@@ -68,6 +70,7 @@ class _c_vdi(__cs__.cstruct):
68
70
  @overload
69
71
  def __init__(
70
72
  self,
73
+ /,
71
74
  cbHeader: _c_vdi.uint32 | None = ...,
72
75
  u32Type: _c_vdi.VDI_IMAGE_TYPE | None = ...,
73
76
  fFlags: _c_vdi.VDI_IMAGE_FLAGS | None = ...,
@@ -0,0 +1,103 @@
1
+ # Generated by cstruct-stubgen
2
+ from typing import BinaryIO, TypeAlias, overload
3
+
4
+ import dissect.cstruct as __cs__
5
+
6
+ class _c_vhd(__cs__.cstruct):
7
+ class footer(__cs__.Structure):
8
+ cookie: __cs__.CharArray
9
+ features: _c_vhd.uint32
10
+ version: _c_vhd.uint32
11
+ data_offset: _c_vhd.uint64
12
+ timestamp: _c_vhd.uint32
13
+ creator_application: _c_vhd.uint32
14
+ creator_version: _c_vhd.uint32
15
+ creator_host_os: _c_vhd.uint32
16
+ original_size: _c_vhd.uint64
17
+ current_size: _c_vhd.uint64
18
+ disk_geometry: _c_vhd.uint32
19
+ disk_type: _c_vhd.uint32
20
+ checksum: _c_vhd.uint32
21
+ unique_id: __cs__.CharArray
22
+ saved_state: _c_vhd.char
23
+ reserved: __cs__.CharArray
24
+ @overload
25
+ def __init__(
26
+ self,
27
+ /,
28
+ cookie: __cs__.CharArray | None = ...,
29
+ features: _c_vhd.uint32 | None = ...,
30
+ version: _c_vhd.uint32 | None = ...,
31
+ data_offset: _c_vhd.uint64 | None = ...,
32
+ timestamp: _c_vhd.uint32 | None = ...,
33
+ creator_application: _c_vhd.uint32 | None = ...,
34
+ creator_version: _c_vhd.uint32 | None = ...,
35
+ creator_host_os: _c_vhd.uint32 | None = ...,
36
+ original_size: _c_vhd.uint64 | None = ...,
37
+ current_size: _c_vhd.uint64 | None = ...,
38
+ disk_geometry: _c_vhd.uint32 | None = ...,
39
+ disk_type: _c_vhd.uint32 | None = ...,
40
+ checksum: _c_vhd.uint32 | None = ...,
41
+ unique_id: __cs__.CharArray | None = ...,
42
+ saved_state: _c_vhd.char | None = ...,
43
+ reserved: __cs__.CharArray | None = ...,
44
+ ): ...
45
+ @overload
46
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
47
+
48
+ class parent_locator(__cs__.Structure):
49
+ platform_code: _c_vhd.uint32
50
+ platform_data_space: _c_vhd.uint32
51
+ platform_data_length: _c_vhd.uint32
52
+ reserved: _c_vhd.uint32
53
+ platform_data_offset: _c_vhd.uint64
54
+ @overload
55
+ def __init__(
56
+ self,
57
+ /,
58
+ platform_code: _c_vhd.uint32 | None = ...,
59
+ platform_data_space: _c_vhd.uint32 | None = ...,
60
+ platform_data_length: _c_vhd.uint32 | None = ...,
61
+ reserved: _c_vhd.uint32 | None = ...,
62
+ platform_data_offset: _c_vhd.uint64 | None = ...,
63
+ ): ...
64
+ @overload
65
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
66
+
67
+ class dynamic_header(__cs__.Structure):
68
+ cookie: __cs__.CharArray
69
+ data_offset: _c_vhd.uint64
70
+ table_offset: _c_vhd.uint64
71
+ header_version: _c_vhd.uint32
72
+ max_table_entries: _c_vhd.uint32
73
+ block_size: _c_vhd.uint32
74
+ checksum: _c_vhd.uint32
75
+ parent_unique_id: __cs__.CharArray
76
+ parent_timestamp: _c_vhd.uint32
77
+ reserved1: _c_vhd.uint32
78
+ parent_unicode_name: __cs__.CharArray
79
+ parent_locators: __cs__.Array[_c_vhd.parent_locator]
80
+ reserved2: __cs__.CharArray
81
+ @overload
82
+ def __init__(
83
+ self,
84
+ /,
85
+ cookie: __cs__.CharArray | None = ...,
86
+ data_offset: _c_vhd.uint64 | None = ...,
87
+ table_offset: _c_vhd.uint64 | None = ...,
88
+ header_version: _c_vhd.uint32 | None = ...,
89
+ max_table_entries: _c_vhd.uint32 | None = ...,
90
+ block_size: _c_vhd.uint32 | None = ...,
91
+ checksum: _c_vhd.uint32 | None = ...,
92
+ parent_unique_id: __cs__.CharArray | None = ...,
93
+ parent_timestamp: _c_vhd.uint32 | None = ...,
94
+ reserved1: _c_vhd.uint32 | None = ...,
95
+ parent_unicode_name: __cs__.CharArray | None = ...,
96
+ parent_locators: __cs__.Array[_c_vhd.parent_locator] | None = ...,
97
+ reserved2: __cs__.CharArray | None = ...,
98
+ ): ...
99
+ @overload
100
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
101
+
102
+ # Technically `c_vhd` is an instance of `_c_vhd`, but then we can't use it in type hints
103
+ c_vhd: TypeAlias = _c_vhd
@@ -0,0 +1,205 @@
1
+ # Generated by cstruct-stubgen
2
+ from typing import BinaryIO, Literal, TypeAlias, overload
3
+
4
+ import dissect.cstruct as __cs__
5
+
6
+ class _c_vhdx(__cs__.cstruct):
7
+ PAYLOAD_BLOCK_NOT_PRESENT: Literal[0] = ...
8
+ PAYLOAD_BLOCK_UNDEFINED: Literal[1] = ...
9
+ PAYLOAD_BLOCK_ZERO: Literal[2] = ...
10
+ PAYLOAD_BLOCK_UNMAPPED: Literal[3] = ...
11
+ PAYLOAD_BLOCK_FULLY_PRESENT: Literal[6] = ...
12
+ PAYLOAD_BLOCK_PARTIALLY_PRESENT: Literal[7] = ...
13
+ SB_BLOCK_NOT_PRESENT: Literal[0] = ...
14
+ SB_BLOCK_PRESENT: Literal[6] = ...
15
+ class file_identifier(__cs__.Structure):
16
+ signature: __cs__.CharArray
17
+ creator: __cs__.CharArray
18
+ @overload
19
+ def __init__(self, /, signature: __cs__.CharArray | None = ..., creator: __cs__.CharArray | None = ...): ...
20
+ @overload
21
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
22
+
23
+ class header(__cs__.Structure):
24
+ signature: __cs__.CharArray
25
+ checksum: _c_vhdx.uint32
26
+ sequence_number: _c_vhdx.uint64
27
+ file_write_guid: __cs__.CharArray
28
+ data_write_guid: __cs__.CharArray
29
+ log_guid: __cs__.CharArray
30
+ log_version: _c_vhdx.uint16
31
+ version: _c_vhdx.uint16
32
+ log_length: _c_vhdx.uint32
33
+ log_offset: _c_vhdx.uint64
34
+ reserved: __cs__.CharArray
35
+ @overload
36
+ def __init__(
37
+ self,
38
+ /,
39
+ signature: __cs__.CharArray | None = ...,
40
+ checksum: _c_vhdx.uint32 | None = ...,
41
+ sequence_number: _c_vhdx.uint64 | None = ...,
42
+ file_write_guid: __cs__.CharArray | None = ...,
43
+ data_write_guid: __cs__.CharArray | None = ...,
44
+ log_guid: __cs__.CharArray | None = ...,
45
+ log_version: _c_vhdx.uint16 | None = ...,
46
+ version: _c_vhdx.uint16 | None = ...,
47
+ log_length: _c_vhdx.uint32 | None = ...,
48
+ log_offset: _c_vhdx.uint64 | None = ...,
49
+ reserved: __cs__.CharArray | None = ...,
50
+ ): ...
51
+ @overload
52
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
53
+
54
+ class region_table_header(__cs__.Structure):
55
+ signature: __cs__.CharArray
56
+ checksum: _c_vhdx.uint32
57
+ entry_count: _c_vhdx.uint32
58
+ reserved: __cs__.CharArray
59
+ @overload
60
+ def __init__(
61
+ self,
62
+ /,
63
+ signature: __cs__.CharArray | None = ...,
64
+ checksum: _c_vhdx.uint32 | None = ...,
65
+ entry_count: _c_vhdx.uint32 | None = ...,
66
+ reserved: __cs__.CharArray | None = ...,
67
+ ): ...
68
+ @overload
69
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
70
+
71
+ class region_table_entry(__cs__.Structure):
72
+ guid: __cs__.CharArray
73
+ file_offset: _c_vhdx.uint64
74
+ length: _c_vhdx.uint32
75
+ required: _c_vhdx.uint32
76
+ @overload
77
+ def __init__(
78
+ self,
79
+ /,
80
+ guid: __cs__.CharArray | None = ...,
81
+ file_offset: _c_vhdx.uint64 | None = ...,
82
+ length: _c_vhdx.uint32 | None = ...,
83
+ required: _c_vhdx.uint32 | None = ...,
84
+ ): ...
85
+ @overload
86
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
87
+
88
+ class bat_entry(__cs__.Structure):
89
+ state: _c_vhdx.uint64
90
+ reserved: _c_vhdx.uint64
91
+ file_offset_mb: _c_vhdx.uint64
92
+ @overload
93
+ def __init__(
94
+ self,
95
+ /,
96
+ state: _c_vhdx.uint64 | None = ...,
97
+ reserved: _c_vhdx.uint64 | None = ...,
98
+ file_offset_mb: _c_vhdx.uint64 | None = ...,
99
+ ): ...
100
+ @overload
101
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
102
+
103
+ class metadata_table_header(__cs__.Structure):
104
+ signature: __cs__.CharArray
105
+ reserved: __cs__.CharArray
106
+ entry_count: _c_vhdx.uint16
107
+ reserved2: __cs__.CharArray
108
+ @overload
109
+ def __init__(
110
+ self,
111
+ /,
112
+ signature: __cs__.CharArray | None = ...,
113
+ reserved: __cs__.CharArray | None = ...,
114
+ entry_count: _c_vhdx.uint16 | None = ...,
115
+ reserved2: __cs__.CharArray | None = ...,
116
+ ): ...
117
+ @overload
118
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
119
+
120
+ class metadata_table_entry(__cs__.Structure):
121
+ item_id: __cs__.CharArray
122
+ offset: _c_vhdx.uint32
123
+ length: _c_vhdx.uint32
124
+ is_user: _c_vhdx.uint32
125
+ is_virtual_disk: _c_vhdx.uint32
126
+ is_required: _c_vhdx.uint32
127
+ reserved: _c_vhdx.uint32
128
+ reserved2: _c_vhdx.uint32
129
+ @overload
130
+ def __init__(
131
+ self,
132
+ /,
133
+ item_id: __cs__.CharArray | None = ...,
134
+ offset: _c_vhdx.uint32 | None = ...,
135
+ length: _c_vhdx.uint32 | None = ...,
136
+ is_user: _c_vhdx.uint32 | None = ...,
137
+ is_virtual_disk: _c_vhdx.uint32 | None = ...,
138
+ is_required: _c_vhdx.uint32 | None = ...,
139
+ reserved: _c_vhdx.uint32 | None = ...,
140
+ reserved2: _c_vhdx.uint32 | None = ...,
141
+ ): ...
142
+ @overload
143
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
144
+
145
+ class file_parameters(__cs__.Structure):
146
+ block_size: _c_vhdx.uint32
147
+ leave_block_allocated: _c_vhdx.uint32
148
+ has_parent: _c_vhdx.uint32
149
+ reserved: _c_vhdx.uint32
150
+ @overload
151
+ def __init__(
152
+ self,
153
+ /,
154
+ block_size: _c_vhdx.uint32 | None = ...,
155
+ leave_block_allocated: _c_vhdx.uint32 | None = ...,
156
+ has_parent: _c_vhdx.uint32 | None = ...,
157
+ reserved: _c_vhdx.uint32 | None = ...,
158
+ ): ...
159
+ @overload
160
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
161
+
162
+ class virtual_disk_id(__cs__.Structure):
163
+ virtual_disk_id: __cs__.CharArray
164
+ @overload
165
+ def __init__(self, /, virtual_disk_id: __cs__.CharArray | None = ...): ...
166
+ @overload
167
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
168
+
169
+ virtual_disk_size: TypeAlias = _c_vhdx.uint64
170
+ logical_sector_size: TypeAlias = _c_vhdx.uint32
171
+ physical_sector_size: TypeAlias = _c_vhdx.uint32
172
+ class parent_locator_header(__cs__.Structure):
173
+ locator_type: __cs__.CharArray
174
+ reserved: _c_vhdx.uint16
175
+ key_value_count: _c_vhdx.uint16
176
+ @overload
177
+ def __init__(
178
+ self,
179
+ /,
180
+ locator_type: __cs__.CharArray | None = ...,
181
+ reserved: _c_vhdx.uint16 | None = ...,
182
+ key_value_count: _c_vhdx.uint16 | None = ...,
183
+ ): ...
184
+ @overload
185
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
186
+
187
+ class parent_locator_entry(__cs__.Structure):
188
+ key_offset: _c_vhdx.uint32
189
+ value_offset: _c_vhdx.uint32
190
+ key_length: _c_vhdx.uint16
191
+ value_length: _c_vhdx.uint16
192
+ @overload
193
+ def __init__(
194
+ self,
195
+ /,
196
+ key_offset: _c_vhdx.uint32 | None = ...,
197
+ value_offset: _c_vhdx.uint32 | None = ...,
198
+ key_length: _c_vhdx.uint16 | None = ...,
199
+ value_length: _c_vhdx.uint16 | None = ...,
200
+ ): ...
201
+ @overload
202
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
203
+
204
+ # Technically `c_vhdx` is an instance of `_c_vhdx`, but then we can't use it in type hints
205
+ c_vhdx: TypeAlias = _c_vhdx
@@ -93,10 +93,10 @@ typedef struct {
93
93
  #define SPARSE_VERSION_INCOMPAT_FLAGS 3
94
94
  #define SPARSE_GTE_EMPTY 0x00000000
95
95
  #define SPARSE_GD_AT_END 0xFFFFFFFFFFFFFFFF
96
- #define SPARSE_SINGLE_END_LINE_CHAR '\n'
96
+ #define SPARSE_SINGLE_END_LINE_CHAR '\\n'
97
97
  #define SPARSE_NON_END_LINE_CHAR ' '
98
- #define SPARSE_DOUBLE_END_LINE_CHAR1 '\r'
99
- #define SPARSE_DOUBLE_END_LINE_CHAR2 '\n'
98
+ #define SPARSE_DOUBLE_END_LINE_CHAR1 '\\r'
99
+ #define SPARSE_DOUBLE_END_LINE_CHAR2 '\\n'
100
100
  #define SPARSEFLAG_COMPAT_FLAGS 0x0000FFFF
101
101
  #define SPARSEFLAG_VALID_NEWLINE_DETECTOR 1
102
102
  #define SPARSEFLAG_USE_REDUNDANT 2
@@ -0,0 +1,210 @@
1
+ # Generated by cstruct-stubgen
2
+ from typing import BinaryIO, Literal, TypeAlias, overload
3
+
4
+ import dissect.cstruct as __cs__
5
+
6
+ class _c_vmdk(__cs__.cstruct):
7
+ SPARSE_MAGICNUMBER: Literal[1447904331] = ...
8
+ SPARSE_VERSION_INCOMPAT_FLAGS: Literal[3] = ...
9
+ SPARSE_GTE_EMPTY: Literal[0] = ...
10
+ SPARSE_GD_AT_END: Literal[18446744073709551615] = ...
11
+ SPARSE_SINGLE_END_LINE_CHAR: Literal["\n"] = ...
12
+ SPARSE_NON_END_LINE_CHAR: Literal[" "] = ...
13
+ SPARSE_DOUBLE_END_LINE_CHAR1: Literal["\r"] = ...
14
+ SPARSE_DOUBLE_END_LINE_CHAR2: Literal["\n"] = ...
15
+ SPARSEFLAG_COMPAT_FLAGS: Literal[65535] = ...
16
+ SPARSEFLAG_VALID_NEWLINE_DETECTOR: Literal[1] = ...
17
+ SPARSEFLAG_USE_REDUNDANT: Literal[2] = ...
18
+ SPARSEFLAG_MAGIC_GTE: Literal[4] = ...
19
+ SPARSEFLAG_INCOMPAT_FLAGS: Literal[4294901760] = ...
20
+ SPARSEFLAG_COMPRESSED: Literal[65536] = ...
21
+ SPARSEFLAG_EMBEDDED_LBA: Literal[131072] = ...
22
+ SPARSE_COMPRESSALGORITHM_NONE: Literal[0] = ...
23
+ SPARSE_COMPRESSALGORITHM_DEFLATE: Literal[1] = ...
24
+ SESPARSE_CONST_HEADER_MAGIC: Literal[3405691582] = ...
25
+ SESPARSE_VOLATILE_HEADER_MAGIC: Literal[3405691582] = ...
26
+ SESPARSE_GRAIN_TYPE_MASK: Literal[17293822569102704640] = ...
27
+ SESPARSE_GRAIN_TYPE_UNALLOCATED: Literal[0] = ...
28
+ SESPARSE_GRAIN_TYPE_FALLTHROUGH: Literal[1152921504606846976] = ...
29
+ SESPARSE_GRAIN_TYPE_ZERO: Literal[2305843009213693952] = ...
30
+ SESPARSE_GRAIN_TYPE_ALLOCATED: Literal[3458764513820540928] = ...
31
+ GRAIN_MARKER_EOS: Literal[0] = ...
32
+ GRAIN_MARKER_GRAIN_TABLE: Literal[1] = ...
33
+ GRAIN_MARKER_GRAIN_DIRECTORY: Literal[2] = ...
34
+ GRAIN_MARKER_FOOTER: Literal[3] = ...
35
+ GRAIN_MARKER_PROGRESS: Literal[4] = ...
36
+ class VMDKSparseExtentHeader(__cs__.Structure):
37
+ magic: __cs__.CharArray
38
+ version: _c_vmdk.uint32
39
+ flags: _c_vmdk.uint32
40
+ capacity: _c_vmdk.uint64
41
+ grain_size: _c_vmdk.uint64
42
+ descriptor_offset: _c_vmdk.uint64
43
+ descriptor_size: _c_vmdk.uint64
44
+ num_grain_table_entries: _c_vmdk.uint32
45
+ secondary_grain_directory_offset: _c_vmdk.uint64
46
+ primary_grain_directory_offset: _c_vmdk.uint64
47
+ overhead: _c_vmdk.uint64
48
+ is_dirty: _c_vmdk.uint8
49
+ single_end_line_char: _c_vmdk.char
50
+ non_end_line_char: _c_vmdk.char
51
+ double_end_line_chars: __cs__.CharArray
52
+ compress_algorithm: _c_vmdk.uint16
53
+ pad: __cs__.CharArray
54
+ @overload
55
+ def __init__(
56
+ self,
57
+ /,
58
+ magic: __cs__.CharArray | None = ...,
59
+ version: _c_vmdk.uint32 | None = ...,
60
+ flags: _c_vmdk.uint32 | None = ...,
61
+ capacity: _c_vmdk.uint64 | None = ...,
62
+ grain_size: _c_vmdk.uint64 | None = ...,
63
+ descriptor_offset: _c_vmdk.uint64 | None = ...,
64
+ descriptor_size: _c_vmdk.uint64 | None = ...,
65
+ num_grain_table_entries: _c_vmdk.uint32 | None = ...,
66
+ secondary_grain_directory_offset: _c_vmdk.uint64 | None = ...,
67
+ primary_grain_directory_offset: _c_vmdk.uint64 | None = ...,
68
+ overhead: _c_vmdk.uint64 | None = ...,
69
+ is_dirty: _c_vmdk.uint8 | None = ...,
70
+ single_end_line_char: _c_vmdk.char | None = ...,
71
+ non_end_line_char: _c_vmdk.char | None = ...,
72
+ double_end_line_chars: __cs__.CharArray | None = ...,
73
+ compress_algorithm: _c_vmdk.uint16 | None = ...,
74
+ pad: __cs__.CharArray | None = ...,
75
+ ): ...
76
+ @overload
77
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
78
+
79
+ class COWDSparseExtentHeader(__cs__.Structure):
80
+ magic: __cs__.CharArray
81
+ version: _c_vmdk.uint32
82
+ flags: _c_vmdk.uint32
83
+ capacity: _c_vmdk.uint32
84
+ grain_size: _c_vmdk.uint32
85
+ primary_grain_directory_offset: _c_vmdk.uint32
86
+ num_grain_directory_entries: _c_vmdk.uint32
87
+ next_free_grain: _c_vmdk.uint32
88
+ @overload
89
+ def __init__(
90
+ self,
91
+ /,
92
+ magic: __cs__.CharArray | None = ...,
93
+ version: _c_vmdk.uint32 | None = ...,
94
+ flags: _c_vmdk.uint32 | None = ...,
95
+ capacity: _c_vmdk.uint32 | None = ...,
96
+ grain_size: _c_vmdk.uint32 | None = ...,
97
+ primary_grain_directory_offset: _c_vmdk.uint32 | None = ...,
98
+ num_grain_directory_entries: _c_vmdk.uint32 | None = ...,
99
+ next_free_grain: _c_vmdk.uint32 | None = ...,
100
+ ): ...
101
+ @overload
102
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
103
+
104
+ class VMDKSESparseConstHeader(__cs__.Structure):
105
+ magic: _c_vmdk.uint64
106
+ version: _c_vmdk.uint64
107
+ capacity: _c_vmdk.uint64
108
+ grain_size: _c_vmdk.uint64
109
+ grain_table_size: _c_vmdk.uint64
110
+ flags: _c_vmdk.uint64
111
+ reserved1: _c_vmdk.uint64
112
+ reserved2: _c_vmdk.uint64
113
+ reserved3: _c_vmdk.uint64
114
+ reserved4: _c_vmdk.uint64
115
+ volatile_header_offset: _c_vmdk.uint64
116
+ volatile_header_size: _c_vmdk.uint64
117
+ journal_header_offset: _c_vmdk.uint64
118
+ journal_header_size: _c_vmdk.uint64
119
+ journal_offset: _c_vmdk.uint64
120
+ journal_size: _c_vmdk.uint64
121
+ grain_directory_offset: _c_vmdk.uint64
122
+ grain_directory_size: _c_vmdk.uint64
123
+ grain_tables_offset: _c_vmdk.uint64
124
+ grain_tables_size: _c_vmdk.uint64
125
+ free_bitmap_offset: _c_vmdk.uint64
126
+ free_bitmap_size: _c_vmdk.uint64
127
+ backmap_offset: _c_vmdk.uint64
128
+ backmap_size: _c_vmdk.uint64
129
+ grains_offset: _c_vmdk.uint64
130
+ grains_size: _c_vmdk.uint64
131
+ pad: __cs__.Array[_c_vmdk.uint8]
132
+ @overload
133
+ def __init__(
134
+ self,
135
+ /,
136
+ magic: _c_vmdk.uint64 | None = ...,
137
+ version: _c_vmdk.uint64 | None = ...,
138
+ capacity: _c_vmdk.uint64 | None = ...,
139
+ grain_size: _c_vmdk.uint64 | None = ...,
140
+ grain_table_size: _c_vmdk.uint64 | None = ...,
141
+ flags: _c_vmdk.uint64 | None = ...,
142
+ reserved1: _c_vmdk.uint64 | None = ...,
143
+ reserved2: _c_vmdk.uint64 | None = ...,
144
+ reserved3: _c_vmdk.uint64 | None = ...,
145
+ reserved4: _c_vmdk.uint64 | None = ...,
146
+ volatile_header_offset: _c_vmdk.uint64 | None = ...,
147
+ volatile_header_size: _c_vmdk.uint64 | None = ...,
148
+ journal_header_offset: _c_vmdk.uint64 | None = ...,
149
+ journal_header_size: _c_vmdk.uint64 | None = ...,
150
+ journal_offset: _c_vmdk.uint64 | None = ...,
151
+ journal_size: _c_vmdk.uint64 | None = ...,
152
+ grain_directory_offset: _c_vmdk.uint64 | None = ...,
153
+ grain_directory_size: _c_vmdk.uint64 | None = ...,
154
+ grain_tables_offset: _c_vmdk.uint64 | None = ...,
155
+ grain_tables_size: _c_vmdk.uint64 | None = ...,
156
+ free_bitmap_offset: _c_vmdk.uint64 | None = ...,
157
+ free_bitmap_size: _c_vmdk.uint64 | None = ...,
158
+ backmap_offset: _c_vmdk.uint64 | None = ...,
159
+ backmap_size: _c_vmdk.uint64 | None = ...,
160
+ grains_offset: _c_vmdk.uint64 | None = ...,
161
+ grains_size: _c_vmdk.uint64 | None = ...,
162
+ pad: __cs__.Array[_c_vmdk.uint8] | None = ...,
163
+ ): ...
164
+ @overload
165
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
166
+
167
+ class VMDKSESparseVolatileHeader(__cs__.Structure):
168
+ magic: _c_vmdk.uint64
169
+ free_gt_number: _c_vmdk.uint64
170
+ next_txn_seq_number: _c_vmdk.uint64
171
+ replay_journal: _c_vmdk.uint64
172
+ pad: __cs__.Array[_c_vmdk.uint8]
173
+ @overload
174
+ def __init__(
175
+ self,
176
+ /,
177
+ magic: _c_vmdk.uint64 | None = ...,
178
+ free_gt_number: _c_vmdk.uint64 | None = ...,
179
+ next_txn_seq_number: _c_vmdk.uint64 | None = ...,
180
+ replay_journal: _c_vmdk.uint64 | None = ...,
181
+ pad: __cs__.Array[_c_vmdk.uint8] | None = ...,
182
+ ): ...
183
+ @overload
184
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
185
+
186
+ class SparseGrainLBAHeaderOnDisk(__cs__.Structure):
187
+ lba: _c_vmdk.uint64
188
+ cmp_size: _c_vmdk.uint32
189
+ @overload
190
+ def __init__(self, /, lba: _c_vmdk.uint64 | None = ..., cmp_size: _c_vmdk.uint32 | None = ...): ...
191
+ @overload
192
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
193
+
194
+ class SparseSpecialLBAHeaderOnDisk(__cs__.Structure):
195
+ lba: _c_vmdk.uint64
196
+ cmp_size: _c_vmdk.uint32
197
+ type: _c_vmdk.uint32
198
+ @overload
199
+ def __init__(
200
+ self,
201
+ /,
202
+ lba: _c_vmdk.uint64 | None = ...,
203
+ cmp_size: _c_vmdk.uint32 | None = ...,
204
+ type: _c_vmdk.uint32 | None = ...,
205
+ ): ...
206
+ @overload
207
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
208
+
209
+ # Technically `c_vmdk` is an instance of `_c_vmdk`, but then we can't use it in type hints
210
+ c_vmdk: TypeAlias = _c_vmdk
@@ -18,7 +18,7 @@ if TYPE_CHECKING:
18
18
  class VDI:
19
19
  """VirtualBox Virtual Disk Image (VDI) implementation.
20
20
 
21
- Use :method:`open` to get a stream for reading from the VDI file. The stream will handle reading
21
+ Use :meth:`open` to get a stream for reading from the VDI file. The stream will handle reading
22
22
  from the parent disk if necessary (and provided).
23
23
 
24
24
  If provided with a file-like object, the caller is responsible for closing it.
@@ -0,0 +1,46 @@
1
+ from __future__ import annotations
2
+
3
+ from dissect.cstruct import cstruct
4
+
5
+ c_def = """
6
+ struct EnvelopeFileHeader {
7
+ char magic[21];
8
+ char _pad[483];
9
+ uint32 size;
10
+ uint32 version;
11
+ };
12
+
13
+ struct DataTransformAeadFooter {
14
+ char magic[23];
15
+ char _pad[9];
16
+ char data[4056];
17
+ uint32 size;
18
+ uint32 version;
19
+ };
20
+
21
+ struct DataTransformCryptoFooter {
22
+ char magic[25];
23
+ char _pad[479];
24
+ uint32 padding;
25
+ uint32 version;
26
+ };
27
+
28
+ enum AttributeType : uint8 {
29
+ Invalid = 0x0,
30
+ // These are guesses based on size and used attributes
31
+ UInt8 = 0x1,
32
+ UInt16 = 0x2,
33
+ UInt32 = 0x3,
34
+ UInt64 = 0x4,
35
+ Int8 = 0x5,
36
+ Int16 = 0x6,
37
+ Int32 = 0x7,
38
+ Int64 = 0x8,
39
+ Float = 0x9,
40
+ Double = 0xA,
41
+ // These are certain
42
+ String = 0xB,
43
+ Bytes = 0xC
44
+ };
45
+ """
46
+ c_envelope = cstruct().load(c_def)
@@ -0,0 +1,76 @@
1
+ # Generated by cstruct-stubgen
2
+ from typing import BinaryIO, TypeAlias, overload
3
+
4
+ import dissect.cstruct as __cs__
5
+
6
+ class _c_envelope(__cs__.cstruct):
7
+ class EnvelopeFileHeader(__cs__.Structure):
8
+ magic: __cs__.CharArray
9
+ _pad: __cs__.CharArray
10
+ size: _c_envelope.uint32
11
+ version: _c_envelope.uint32
12
+ @overload
13
+ def __init__(
14
+ self,
15
+ /,
16
+ magic: __cs__.CharArray | None = ...,
17
+ _pad: __cs__.CharArray | None = ...,
18
+ size: _c_envelope.uint32 | None = ...,
19
+ version: _c_envelope.uint32 | None = ...,
20
+ ): ...
21
+ @overload
22
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
23
+
24
+ class DataTransformAeadFooter(__cs__.Structure):
25
+ magic: __cs__.CharArray
26
+ _pad: __cs__.CharArray
27
+ data: __cs__.CharArray
28
+ size: _c_envelope.uint32
29
+ version: _c_envelope.uint32
30
+ @overload
31
+ def __init__(
32
+ self,
33
+ /,
34
+ magic: __cs__.CharArray | None = ...,
35
+ _pad: __cs__.CharArray | None = ...,
36
+ data: __cs__.CharArray | None = ...,
37
+ size: _c_envelope.uint32 | None = ...,
38
+ version: _c_envelope.uint32 | None = ...,
39
+ ): ...
40
+ @overload
41
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
42
+
43
+ class DataTransformCryptoFooter(__cs__.Structure):
44
+ magic: __cs__.CharArray
45
+ _pad: __cs__.CharArray
46
+ padding: _c_envelope.uint32
47
+ version: _c_envelope.uint32
48
+ @overload
49
+ def __init__(
50
+ self,
51
+ /,
52
+ magic: __cs__.CharArray | None = ...,
53
+ _pad: __cs__.CharArray | None = ...,
54
+ padding: _c_envelope.uint32 | None = ...,
55
+ version: _c_envelope.uint32 | None = ...,
56
+ ): ...
57
+ @overload
58
+ def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...
59
+
60
+ class AttributeType(__cs__.Enum):
61
+ Invalid = ...
62
+ UInt8 = ...
63
+ UInt16 = ...
64
+ UInt32 = ...
65
+ UInt64 = ...
66
+ Int8 = ...
67
+ Int16 = ...
68
+ Int32 = ...
69
+ Int64 = ...
70
+ Float = ...
71
+ Double = ...
72
+ String = ...
73
+ Bytes = ...
74
+
75
+ # Technically `c_envelope` is an instance of `_c_envelope`, but then we can't use it in type hints
76
+ c_envelope: TypeAlias = _c_envelope
@@ -26,51 +26,9 @@ try:
26
26
  except ImportError:
27
27
  HAS_PYCRYPTODOME = False
28
28
 
29
- from dissect.cstruct import cstruct
30
29
  from dissect.util.stream import RangeStream
31
30
 
32
- c_def = """
33
- struct EnvelopeFileHeader {
34
- char magic[21];
35
- char _pad[483];
36
- uint32 size;
37
- uint32 version;
38
- };
39
-
40
- struct DataTransformAeadFooter {
41
- char magic[23];
42
- char _pad[9];
43
- char data[4056];
44
- uint32 size;
45
- uint32 version;
46
- };
47
-
48
- struct DataTransformCryptoFooter {
49
- char magic[25];
50
- char _pad[479];
51
- uint32 padding;
52
- uint32 version;
53
- };
54
-
55
- enum AttributeType : uint8 {
56
- Invalid = 0x0,
57
- // These are guesses based on size and used attributes
58
- UInt8 = 0x1,
59
- UInt16 = 0x2,
60
- UInt32 = 0x3,
61
- UInt64 = 0x4,
62
- Int8 = 0x5,
63
- Int16 = 0x6,
64
- Int32 = 0x7,
65
- Int64 = 0x8,
66
- Float = 0x9,
67
- Double = 0xA,
68
- // These are certain
69
- String = 0xB,
70
- Bytes = 0xC
71
- };
72
- """
73
- c_envelope = cstruct().load(c_def)
31
+ from dissect.hypervisor.util.c_envelope import c_envelope
74
32
 
75
33
  FILE_HEADER_MAGIC = b"DataTransformEnvelope"
76
34
  FOOTER_AEAD_MAGIC = b"DataTransformAeadFooter"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissect.hypervisor
3
- Version: 3.22.dev4
3
+ Version: 3.22.dev6
4
4
  Summary: A Dissect module implementing parsers for various hypervisor disk, backup and configuration files
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -22,14 +22,14 @@ Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
23
  License-File: COPYRIGHT
24
24
  Requires-Dist: defusedxml
25
- Requires-Dist: dissect.cstruct<5,>=4
25
+ Requires-Dist: dissect.cstruct<6,>=5.0.dev
26
26
  Requires-Dist: dissect.util<4,>=3
27
27
  Provides-Extra: full
28
28
  Requires-Dist: pycryptodome; extra == "full"
29
29
  Requires-Dist: backports.zstd; python_version < "3.14" and extra == "full"
30
30
  Provides-Extra: dev
31
31
  Requires-Dist: dissect.hypervisor[full]; extra == "dev"
32
- Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
32
+ Requires-Dist: dissect.cstruct<6.0.dev,>=5.0.dev; extra == "dev"
33
33
  Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
34
34
  Dynamic: license-file
35
35
 
@@ -2,6 +2,7 @@ dissect/hypervisor/__init__.py,sha256=Ws-X8SrKohjhD9mFgySKuGEYsf6D3V4ktVWb4vlEN3
2
2
  dissect/hypervisor/exceptions.py,sha256=MexvnJmZbCnYoAoFbTc67iILlvMkpUpaPla_x9otGYQ,200
3
3
  dissect/hypervisor/descriptor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  dissect/hypervisor/descriptor/c_hyperv.py,sha256=l_iW7CjK4DGJkg8NzNINFltA-txEPh-t17KYaSSNiDs,4405
5
+ dissect/hypervisor/descriptor/c_hyperv.pyi,sha256=8lvLx_b3grwT20rQY7Qjhj7rjURI0l_13c2nhg-Uq2E,6703
5
6
  dissect/hypervisor/descriptor/hyperv.py,sha256=B71-TKGpndRfKHSRSaSDA1ak6rQiNlDLs97burrJwkw,17643
6
7
  dissect/hypervisor/descriptor/ovf.py,sha256=9TbUgY1F11EnSgUQYrkaJawGJeD-Swr1xHcH39Hpttc,1922
7
8
  dissect/hypervisor/descriptor/pvs.py,sha256=Ek8_m5PsyAWSFMD-q_E2j1fRqq5bb8g8ZiahlQSBcvI,701
@@ -10,18 +11,22 @@ dissect/hypervisor/descriptor/vmx.py,sha256=HHmQI92QMnufeFyphCWUI8hWeJci5XsYAB4G
10
11
  dissect/hypervisor/disk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
12
  dissect/hypervisor/disk/asif.py,sha256=-HIXnoG8uFGTFj58kTRayVUqWtIPPKF04xMpiOYBL18,10840
12
13
  dissect/hypervisor/disk/c_asif.py,sha256=bVjbXy6icCLY6-v2zZ22xnOsHdupnO4oOAmyuZx13lU,878
13
- dissect/hypervisor/disk/c_asif.pyi,sha256=XlFattLWlcRLQTCCzKThgANsW9JwUOi_utWjPr7pXyI,2814
14
+ dissect/hypervisor/disk/c_asif.pyi,sha256=mKtJqrlVWmDsPdKm9zrQ0vTpviURottT5_Nt5eUIMHM,2844
14
15
  dissect/hypervisor/disk/c_hdd.py,sha256=wrJ5qwyf7QCZ3Pl-I8eYDR4CUUo4pAFhjzs8huRGqs8,2235
16
+ dissect/hypervisor/disk/c_hdd.pyi,sha256=XOVyX35OYKUsxlTXxr_AH5qRQaF0evB54gBzR16p7Kw,3521
15
17
  dissect/hypervisor/disk/c_qcow2.py,sha256=jOr2fQmDQuegbE1qDX2x2xaA4RS0LKMsOCI5UwKJxhg,5071
16
- dissect/hypervisor/disk/c_qcow2.pyi,sha256=OAEQzYoexjUpyApO0I-JQe22qBPzej_KC4r_77jAo3U,7867
18
+ dissect/hypervisor/disk/c_qcow2.pyi,sha256=Xgc1cw0L02JOk2r7n53uTU71hpwwmvVMmdCkPPz_uHA,7933
17
19
  dissect/hypervisor/disk/c_vdi.py,sha256=I900-qEvbS7dvtVIqbRcyF47OhTiyoA1Y6TtT-tlUv8,3514
18
- dissect/hypervisor/disk/c_vdi.pyi,sha256=7c3eU3MeZlvbZbOJixe_JEVpuQsIZs2mxP1iH2fV4pQ,3661
20
+ dissect/hypervisor/disk/c_vdi.pyi,sha256=N_N35FMtPmMSmtS7jjQpmbkXd7dep0ccUReK_n7jBU4,3706
19
21
  dissect/hypervisor/disk/c_vhd.py,sha256=gYOwOdvhMKNLflugkpjmdn__ZUJBlxeByx6P0ePNQ00,1493
22
+ dissect/hypervisor/disk/c_vhd.pyi,sha256=37pOQaoHZoWZ0WdOXfFOFtRRiUxZPHvqTybcFcZOLZg,4107
20
23
  dissect/hypervisor/disk/c_vhdx.py,sha256=4yNU51jfYPEBFXEZAvaF8cFdHBRlmCe_OU5ZU83-kco,2920
21
- dissect/hypervisor/disk/c_vmdk.py,sha256=lfObMyD9r-20DCDwVDm9xT98cq3aE4MCJF5TpDBNdd4,5988
24
+ dissect/hypervisor/disk/c_vhdx.pyi,sha256=prInSVOxkouNzXkpgHrXVVUWQIHKgjgWTjs4iHm7hNs,7551
25
+ dissect/hypervisor/disk/c_vmdk.py,sha256=thKdnhhJVtDkzXakZAKp55l9KbbLWjYT0qWONbYOrrw,5991
26
+ dissect/hypervisor/disk/c_vmdk.pyi,sha256=eXzUGUx9Pt3M3MVw5VJfn97Yw7cLbMkvxcb3ifjxGkg,9079
22
27
  dissect/hypervisor/disk/hdd.py,sha256=ChKtQIQrssIgZyUv86JE9-n4XdjDT14pc6EO6mZllQg,12981
23
28
  dissect/hypervisor/disk/qcow2.py,sha256=Em628ixzU6Wey8yIhTlKbp4O8LSksR7Ive3knbX0dnc,24330
24
- dissect/hypervisor/disk/vdi.py,sha256=URS0JNvBZVEWnZQYV6nrgsMBXmumDIIem5Eqmv-VVG0,4479
29
+ dissect/hypervisor/disk/vdi.py,sha256=HPYmMOHv85nD0bXLO0zYjz7DhWOyN22WViLLxS1gN4A,4477
25
30
  dissect/hypervisor/disk/vhd.py,sha256=GfEfFp5g8OlV0MrTXqSfBRzMMvIZO_T1A8d05SeGiBk,3948
26
31
  dissect/hypervisor/disk/vhdx.py,sha256=kgxS81oG4J3RPsDput-t3QhbF1vDCdjfPqY__sWbX6g,13215
27
32
  dissect/hypervisor/disk/vmdk.py,sha256=7HawKrwlq2_7n1NguCftXBNX_NXglkm2d_D5lJ0LGvE,19653
@@ -29,12 +34,14 @@ dissect/hypervisor/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
29
34
  dissect/hypervisor/tools/envelope.py,sha256=BvaBSoXq3VrZ2GJVrfnL8NB6OLbdp8qD05jedxSAKwQ,1024
30
35
  dissect/hypervisor/tools/vmtar.py,sha256=ArqAAUjSqktDmGCP6m-Bp1ujqWkDtCGC3xKz-WBa4m4,512
31
36
  dissect/hypervisor/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
- dissect/hypervisor/util/envelope.py,sha256=EhZjZh3EezqxkJ84OgqpptHIhpVWPcUkFMjdYU-iAnU,10442
37
+ dissect/hypervisor/util/c_envelope.py,sha256=y-fxMw9dLhEw6swbskWATQNb8Gs5Vxddu9BxYbizBy4,854
38
+ dissect/hypervisor/util/c_envelope.pyi,sha256=oQpluy6mGmlOcK1LIlKIYJ4b2nmDKyHgUZvt3wvBp3k,2407
39
+ dissect/hypervisor/util/envelope.py,sha256=XOSQnvLtJAA0tI8Mi7D-JUkliOX-889BUfc-d4Oo7f4,9683
33
40
  dissect/hypervisor/util/vmtar.py,sha256=D728bup7WW5ZYFILQ6_jLQ2-fS7Qdr__Z6TJAABTUw0,4791
34
- dissect_hypervisor-3.22.dev4.dist-info/licenses/COPYRIGHT,sha256=EOOoIwk_inOMUD4c1ylpzMtYLjGzmc-MLEVAEdLLr20,305
35
- dissect_hypervisor-3.22.dev4.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
36
- dissect_hypervisor-3.22.dev4.dist-info/METADATA,sha256=EiALPqcP_7F6zD3tqNAfg6ky2JSJkqrG6Qr-v-T_jks,3470
37
- dissect_hypervisor-3.22.dev4.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
38
- dissect_hypervisor-3.22.dev4.dist-info/entry_points.txt,sha256=kW36GnJ3G1dSRYFL4r8Bj32Al_CkGqST3bdHvo3pyiY,120
39
- dissect_hypervisor-3.22.dev4.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
40
- dissect_hypervisor-3.22.dev4.dist-info/RECORD,,
41
+ dissect_hypervisor-3.22.dev6.dist-info/licenses/COPYRIGHT,sha256=EOOoIwk_inOMUD4c1ylpzMtYLjGzmc-MLEVAEdLLr20,305
42
+ dissect_hypervisor-3.22.dev6.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
43
+ dissect_hypervisor-3.22.dev6.dist-info/METADATA,sha256=7UJ61V3VxtHBKiLuaBLJE0hoq7KnWlsau-hHNy2qbag,3476
44
+ dissect_hypervisor-3.22.dev6.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
45
+ dissect_hypervisor-3.22.dev6.dist-info/entry_points.txt,sha256=kW36GnJ3G1dSRYFL4r8Bj32Al_CkGqST3bdHvo3pyiY,120
46
+ dissect_hypervisor-3.22.dev6.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
47
+ dissect_hypervisor-3.22.dev6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (82.0.1)
2
+ Generator: setuptools (84.2.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5