dissect.volume 3.14.dev2__tar.gz → 3.14.dev4__tar.gz

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.
Files changed (142) hide show
  1. dissect_volume-3.14.dev4/.gitattributes +1 -0
  2. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/PKG-INFO +1 -1
  3. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/lvm/c_lvm2.py +2 -0
  4. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/md/c_md.py +2 -0
  5. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/md/md.py +19 -8
  6. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/vinum/config.py +3 -1
  7. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/vinum/vinum.py +2 -0
  8. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect.volume.egg-info/PKG-INFO +1 -1
  9. dissect_volume-3.14.dev4/dissect.volume.egg-info/SOURCES.txt +137 -0
  10. {dissect_volume-3.14.dev2/tests/docs → dissect_volume-3.14.dev4/tests/_docs}/Makefile +1 -1
  11. dissect_volume-3.14.dev4/tests/_docs/__init__.py +0 -0
  12. {dissect_volume-3.14.dev2/tests/docs → dissect_volume-3.14.dev4/tests/_docs}/conf.py +5 -0
  13. dissect_volume-3.14.dev4/tests/conftest.py +254 -0
  14. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/tests/test_md.py +9 -1
  15. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/tox.ini +4 -4
  16. dissect_volume-3.14.dev2/.gitattributes +0 -5
  17. dissect_volume-3.14.dev2/dissect.volume.egg-info/SOURCES.txt +0 -136
  18. dissect_volume-3.14.dev2/tests/conftest.py +0 -254
  19. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/.git-blame-ignore-revs +0 -0
  20. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/COPYRIGHT +0 -0
  21. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/LICENSE +0 -0
  22. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/MANIFEST.in +0 -0
  23. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/README.md +0 -0
  24. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/__init__.py +0 -0
  25. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/ddf/__init__.py +0 -0
  26. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/ddf/c_ddf.py +0 -0
  27. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/ddf/ddf.py +0 -0
  28. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/disk/__init__.py +0 -0
  29. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/disk/disk.py +0 -0
  30. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/disk/partition.py +0 -0
  31. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/disk/schemes/__init__.py +0 -0
  32. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/disk/schemes/apm.py +0 -0
  33. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/disk/schemes/bsd.py +0 -0
  34. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/disk/schemes/gpt.py +0 -0
  35. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/disk/schemes/mbr.py +0 -0
  36. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/dm/__init__.py +0 -0
  37. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/dm/btree.py +0 -0
  38. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/dm/c_dm.py +0 -0
  39. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/dm/thin.py +0 -0
  40. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/exceptions.py +0 -0
  41. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/ldm.py +0 -0
  42. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/lvm/__init__.py +0 -0
  43. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/lvm/lvm2.py +0 -0
  44. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/lvm/metadata.py +0 -0
  45. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/lvm/physical.py +0 -0
  46. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/md/__init__.py +0 -0
  47. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/raid/__init__.py +0 -0
  48. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/raid/raid.py +0 -0
  49. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/raid/stream.py +0 -0
  50. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/vinum/__init__.py +0 -0
  51. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/vinum/c_vinum.py +0 -0
  52. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect/volume/vss.py +0 -0
  53. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect.volume.egg-info/dependency_links.txt +0 -0
  54. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect.volume.egg-info/requires.txt +0 -0
  55. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/dissect.volume.egg-info/top_level.txt +0 -0
  56. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/pyproject.toml +0 -0
  57. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/setup.cfg +0 -0
  58. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/tests/__init__.py +0 -0
  59. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid0-1.bin.gz +0 -0
  60. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid0-2.bin.gz +0 -0
  61. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid0-3.bin.gz +0 -0
  62. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid0-raid1-1.bin.gz +0 -0
  63. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid0-raid1-2.bin.gz +0 -0
  64. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid1-1.bin.gz +0 -0
  65. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid1-2.bin.gz +0 -0
  66. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid10-1.bin.gz +0 -0
  67. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid10-2.bin.gz +0 -0
  68. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid10-3.bin.gz +0 -0
  69. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid10-4.bin.gz +0 -0
  70. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid4-1.bin.gz +0 -0
  71. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid4-2.bin.gz +0 -0
  72. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid5-1.bin.gz +0 -0
  73. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid5-2.bin.gz +0 -0
  74. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid5-3.bin.gz +0 -0
  75. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid6-1.bin.gz +0 -0
  76. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid6-2.bin.gz +0 -0
  77. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid6-3.bin.gz +0 -0
  78. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/ddf/ddf-raid6-4.bin.gz +0 -0
  79. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data/disk}/apm.bin +0 -0
  80. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data/disk}/bsd.bin +0 -0
  81. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data/disk}/bsd64.bin.gz +0 -0
  82. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data/disk}/gpt.bin +0 -0
  83. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data/disk}/gpt_4k.bin +0 -0
  84. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data/disk}/gpt_esxi.bin +0 -0
  85. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data/disk}/gpt_hybrid.bin +0 -0
  86. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data/disk}/gpt_no_name_xff.bin +0 -0
  87. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data/disk}/mbr.bin +0 -0
  88. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/dm/dm-thin-data.bin.gz +0 -0
  89. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/dm/dm-thin-empty-data.bin.gz +0 -0
  90. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/dm/dm-thin-empty-metadata.bin.gz +0 -0
  91. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/dm/dm-thin-metadata.bin.gz +0 -0
  92. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/lvm/lvm-mirror-1.bin.gz +0 -0
  93. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/lvm/lvm-mirror-2.bin.gz +0 -0
  94. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/lvm/lvm-thin.bin.gz +0 -0
  95. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/lvm/lvm.bin.gz +0 -0
  96. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-90-1.bin.gz +0 -0
  97. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-90-2.bin.gz +0 -0
  98. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-90-raid1-1.bin.gz +0 -0
  99. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-90-raid1-2.bin.gz +0 -0
  100. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-linear-1.bin.gz +0 -0
  101. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-linear-2.bin.gz +0 -0
  102. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid0-1.bin.gz +0 -0
  103. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid0-2.bin.gz +0 -0
  104. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid0-3.bin.gz +0 -0
  105. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid1-1.bin.gz +0 -0
  106. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid1-2.bin.gz +0 -0
  107. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid10-1.bin.gz +0 -0
  108. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid10-2.bin.gz +0 -0
  109. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid4-1.bin.gz +0 -0
  110. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid4-2.bin.gz +0 -0
  111. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid4-3.bin.gz +0 -0
  112. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid5-1.bin.gz +0 -0
  113. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid5-2.bin.gz +0 -0
  114. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid5-3.bin.gz +0 -0
  115. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid6-1.bin.gz +0 -0
  116. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid6-2.bin.gz +0 -0
  117. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid6-3.bin.gz +0 -0
  118. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/md/md-raid6-4.bin.gz +0 -0
  119. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-concat_diska.bin.gz +0 -0
  120. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-concat_diskb.bin.gz +0 -0
  121. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-mirror_diska.bin.gz +0 -0
  122. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-mirror_diskb.bin.gz +0 -0
  123. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-raid5_diska.bin.gz +0 -0
  124. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-raid5_diskb.bin.gz +0 -0
  125. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-raid5_diskc.bin.gz +0 -0
  126. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-raid5_diskd.bin.gz +0 -0
  127. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-striped_diska.bin.gz +0 -0
  128. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-striped_diskb.bin.gz +0 -0
  129. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-stripedmirror_diska.bin.gz +0 -0
  130. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-stripedmirror_diskb.bin.gz +0 -0
  131. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-stripedmirror_diskc.bin.gz +0 -0
  132. {dissect_volume-3.14.dev2/tests/data → dissect_volume-3.14.dev4/tests/_data}/vinum/vinum-stripedmirror_diskd.bin.gz +0 -0
  133. {dissect_volume-3.14.dev2/tests/docs → dissect_volume-3.14.dev4/tests/_docs}/index.rst +0 -0
  134. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/tests/test_apm.py +0 -0
  135. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/tests/test_bsd.py +0 -0
  136. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/tests/test_ddf.py +0 -0
  137. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/tests/test_dm.py +0 -0
  138. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/tests/test_gpt.py +0 -0
  139. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/tests/test_lvm.py +0 -0
  140. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/tests/test_mbr.py +0 -0
  141. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/tests/test_vinum.py +0 -0
  142. {dissect_volume-3.14.dev2 → dissect_volume-3.14.dev4}/tests/test_vinum_config.py +0 -0
@@ -0,0 +1 @@
1
+ tests/_data/** filter=lfs diff=lfs merge=lfs -text
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: dissect.volume
3
- Version: 3.14.dev2
3
+ Version: 3.14.dev4
4
4
  Summary: A Dissect module implementing a parser for different disk volume and partition systems, for example LVM2, GPT and MBR
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from dissect.cstruct import cstruct
2
4
 
3
5
  lvm_def = """
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from dissect.cstruct import cstruct
2
4
 
3
5
  md_def = """
@@ -143,14 +143,23 @@ class MDPhysicalDisk(PhysicalDisk):
143
143
  super().__init__(fh, self.data_offset * SECTOR_SIZE, self.data_size * SECTOR_SIZE)
144
144
 
145
145
 
146
- def find_super_block(fh: BinaryIO) -> tuple[int, int, int]:
147
- # Super block can start at a couple of places, depending on version
148
- # Just try them all until we find one
146
+ def find_super_block(fh: BinaryIO) -> tuple[int | None, int | None, int | None]:
147
+ """Find the super block of an MD device.
149
148
 
150
- size = fh.size if hasattr(fh, "size") else fh.seek(0, io.SEEK_END)
149
+ Args:
150
+ fh: The file-like object to search for the super block.
151
+
152
+ Returns:
153
+ A tuple containing the sector, major version, and minor version of the super block, or a
154
+ tuple of ``None`` if no super block was found.
155
+ """
156
+
157
+ size = fh.size if (hasattr(fh, "size") and fh.size is not None) else fh.seek(0, io.SEEK_END)
151
158
  size //= SECTOR_SIZE
152
159
 
153
- possible_offsets = [
160
+ # Super block can start at a couple of places, depending on version
161
+ # Just try them all until we find one
162
+ possible_sectors = [
154
163
  # 0.90.0
155
164
  (size & ~(c_md.MD_RESERVED_SECTORS - 1)) - c_md.MD_RESERVED_SECTORS,
156
165
  # Major version 1
@@ -162,16 +171,18 @@ def find_super_block(fh: BinaryIO) -> tuple[int, int, int]:
162
171
  8,
163
172
  ]
164
173
 
165
- for offset in possible_offsets:
166
- fh.seek(offset * SECTOR_SIZE)
174
+ for sector in possible_sectors:
175
+ if sector < 0:
176
+ continue
167
177
 
178
+ fh.seek(sector * SECTOR_SIZE)
168
179
  peek = fh.read(12)
169
180
  if len(peek) != 12:
170
181
  continue
171
182
 
172
183
  magic, major, minor = struct.unpack("<3I", peek)
173
184
  if magic == c_md.MD_SB_MAGIC:
174
- return offset, major, minor
185
+ return sector, major, minor
175
186
 
176
187
  return None, None, None
177
188
 
@@ -356,6 +356,8 @@ def tokenize(line: bytes) -> iter[bytes]:
356
356
 
357
357
 
358
358
  class VinumConfigs(TypedDict):
359
+ """Vinum configurations."""
360
+
359
361
  volumes: list[Volume]
360
362
  plexes: list[Plex]
361
363
  sds: list[SD]
@@ -376,7 +378,7 @@ def parse_vinum_config(config_time: datetime, config: bytes) -> VinumConfigs:
376
378
 
377
379
  Parsing forgiveness and strictness is implemented in the same way as in the vinum kernel code:
378
380
 
379
- Lines with an unknown configuration "type" (not b"volume", b"plex" or b"sd"), are ignored.
381
+ Lines with an unknown configuration ``type`` (not ``volume``, ``plex`` or ``sd``), are ignored.
380
382
 
381
383
  Lines that fail to parse due to:
382
384
  - no name present
@@ -73,6 +73,8 @@ DefaultByName = defaultdict[bytes, T]
73
73
 
74
74
 
75
75
  class Config(TypedDict):
76
+ """Configuration."""
77
+
76
78
  volumes: ByName[Volume]
77
79
  plexes: ByName[Plex]
78
80
  sds: ByName[SD]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: dissect.volume
3
- Version: 3.14.dev2
3
+ Version: 3.14.dev4
4
4
  Summary: A Dissect module implementing a parser for different disk volume and partition systems, for example LVM2, GPT and MBR
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -0,0 +1,137 @@
1
+ .git-blame-ignore-revs
2
+ .gitattributes
3
+ COPYRIGHT
4
+ LICENSE
5
+ MANIFEST.in
6
+ README.md
7
+ pyproject.toml
8
+ tox.ini
9
+ dissect.volume.egg-info/PKG-INFO
10
+ dissect.volume.egg-info/SOURCES.txt
11
+ dissect.volume.egg-info/dependency_links.txt
12
+ dissect.volume.egg-info/requires.txt
13
+ dissect.volume.egg-info/top_level.txt
14
+ dissect/volume/__init__.py
15
+ dissect/volume/exceptions.py
16
+ dissect/volume/ldm.py
17
+ dissect/volume/vss.py
18
+ dissect/volume/ddf/__init__.py
19
+ dissect/volume/ddf/c_ddf.py
20
+ dissect/volume/ddf/ddf.py
21
+ dissect/volume/disk/__init__.py
22
+ dissect/volume/disk/disk.py
23
+ dissect/volume/disk/partition.py
24
+ dissect/volume/disk/schemes/__init__.py
25
+ dissect/volume/disk/schemes/apm.py
26
+ dissect/volume/disk/schemes/bsd.py
27
+ dissect/volume/disk/schemes/gpt.py
28
+ dissect/volume/disk/schemes/mbr.py
29
+ dissect/volume/dm/__init__.py
30
+ dissect/volume/dm/btree.py
31
+ dissect/volume/dm/c_dm.py
32
+ dissect/volume/dm/thin.py
33
+ dissect/volume/lvm/__init__.py
34
+ dissect/volume/lvm/c_lvm2.py
35
+ dissect/volume/lvm/lvm2.py
36
+ dissect/volume/lvm/metadata.py
37
+ dissect/volume/lvm/physical.py
38
+ dissect/volume/md/__init__.py
39
+ dissect/volume/md/c_md.py
40
+ dissect/volume/md/md.py
41
+ dissect/volume/raid/__init__.py
42
+ dissect/volume/raid/raid.py
43
+ dissect/volume/raid/stream.py
44
+ dissect/volume/vinum/__init__.py
45
+ dissect/volume/vinum/c_vinum.py
46
+ dissect/volume/vinum/config.py
47
+ dissect/volume/vinum/vinum.py
48
+ tests/__init__.py
49
+ tests/conftest.py
50
+ tests/test_apm.py
51
+ tests/test_bsd.py
52
+ tests/test_ddf.py
53
+ tests/test_dm.py
54
+ tests/test_gpt.py
55
+ tests/test_lvm.py
56
+ tests/test_mbr.py
57
+ tests/test_md.py
58
+ tests/test_vinum.py
59
+ tests/test_vinum_config.py
60
+ tests/_data/ddf/ddf-raid0-1.bin.gz
61
+ tests/_data/ddf/ddf-raid0-2.bin.gz
62
+ tests/_data/ddf/ddf-raid0-3.bin.gz
63
+ tests/_data/ddf/ddf-raid0-raid1-1.bin.gz
64
+ tests/_data/ddf/ddf-raid0-raid1-2.bin.gz
65
+ tests/_data/ddf/ddf-raid1-1.bin.gz
66
+ tests/_data/ddf/ddf-raid1-2.bin.gz
67
+ tests/_data/ddf/ddf-raid10-1.bin.gz
68
+ tests/_data/ddf/ddf-raid10-2.bin.gz
69
+ tests/_data/ddf/ddf-raid10-3.bin.gz
70
+ tests/_data/ddf/ddf-raid10-4.bin.gz
71
+ tests/_data/ddf/ddf-raid4-1.bin.gz
72
+ tests/_data/ddf/ddf-raid4-2.bin.gz
73
+ tests/_data/ddf/ddf-raid5-1.bin.gz
74
+ tests/_data/ddf/ddf-raid5-2.bin.gz
75
+ tests/_data/ddf/ddf-raid5-3.bin.gz
76
+ tests/_data/ddf/ddf-raid6-1.bin.gz
77
+ tests/_data/ddf/ddf-raid6-2.bin.gz
78
+ tests/_data/ddf/ddf-raid6-3.bin.gz
79
+ tests/_data/ddf/ddf-raid6-4.bin.gz
80
+ tests/_data/disk/apm.bin
81
+ tests/_data/disk/bsd.bin
82
+ tests/_data/disk/bsd64.bin.gz
83
+ tests/_data/disk/gpt.bin
84
+ tests/_data/disk/gpt_4k.bin
85
+ tests/_data/disk/gpt_esxi.bin
86
+ tests/_data/disk/gpt_hybrid.bin
87
+ tests/_data/disk/gpt_no_name_xff.bin
88
+ tests/_data/disk/mbr.bin
89
+ tests/_data/dm/dm-thin-data.bin.gz
90
+ tests/_data/dm/dm-thin-empty-data.bin.gz
91
+ tests/_data/dm/dm-thin-empty-metadata.bin.gz
92
+ tests/_data/dm/dm-thin-metadata.bin.gz
93
+ tests/_data/lvm/lvm-mirror-1.bin.gz
94
+ tests/_data/lvm/lvm-mirror-2.bin.gz
95
+ tests/_data/lvm/lvm-thin.bin.gz
96
+ tests/_data/lvm/lvm.bin.gz
97
+ tests/_data/md/md-90-1.bin.gz
98
+ tests/_data/md/md-90-2.bin.gz
99
+ tests/_data/md/md-90-raid1-1.bin.gz
100
+ tests/_data/md/md-90-raid1-2.bin.gz
101
+ tests/_data/md/md-linear-1.bin.gz
102
+ tests/_data/md/md-linear-2.bin.gz
103
+ tests/_data/md/md-raid0-1.bin.gz
104
+ tests/_data/md/md-raid0-2.bin.gz
105
+ tests/_data/md/md-raid0-3.bin.gz
106
+ tests/_data/md/md-raid1-1.bin.gz
107
+ tests/_data/md/md-raid1-2.bin.gz
108
+ tests/_data/md/md-raid10-1.bin.gz
109
+ tests/_data/md/md-raid10-2.bin.gz
110
+ tests/_data/md/md-raid4-1.bin.gz
111
+ tests/_data/md/md-raid4-2.bin.gz
112
+ tests/_data/md/md-raid4-3.bin.gz
113
+ tests/_data/md/md-raid5-1.bin.gz
114
+ tests/_data/md/md-raid5-2.bin.gz
115
+ tests/_data/md/md-raid5-3.bin.gz
116
+ tests/_data/md/md-raid6-1.bin.gz
117
+ tests/_data/md/md-raid6-2.bin.gz
118
+ tests/_data/md/md-raid6-3.bin.gz
119
+ tests/_data/md/md-raid6-4.bin.gz
120
+ tests/_data/vinum/vinum-concat_diska.bin.gz
121
+ tests/_data/vinum/vinum-concat_diskb.bin.gz
122
+ tests/_data/vinum/vinum-mirror_diska.bin.gz
123
+ tests/_data/vinum/vinum-mirror_diskb.bin.gz
124
+ tests/_data/vinum/vinum-raid5_diska.bin.gz
125
+ tests/_data/vinum/vinum-raid5_diskb.bin.gz
126
+ tests/_data/vinum/vinum-raid5_diskc.bin.gz
127
+ tests/_data/vinum/vinum-raid5_diskd.bin.gz
128
+ tests/_data/vinum/vinum-striped_diska.bin.gz
129
+ tests/_data/vinum/vinum-striped_diskb.bin.gz
130
+ tests/_data/vinum/vinum-stripedmirror_diska.bin.gz
131
+ tests/_data/vinum/vinum-stripedmirror_diskb.bin.gz
132
+ tests/_data/vinum/vinum-stripedmirror_diskc.bin.gz
133
+ tests/_data/vinum/vinum-stripedmirror_diskd.bin.gz
134
+ tests/_docs/Makefile
135
+ tests/_docs/__init__.py
136
+ tests/_docs/conf.py
137
+ tests/_docs/index.rst
@@ -3,7 +3,7 @@
3
3
 
4
4
  # You can set these variables from the command line, and also
5
5
  # from the environment for the first two.
6
- SPHINXOPTS ?= -jauto
6
+ SPHINXOPTS ?= -jauto -w $(BUILDDIR)/warnings.log --fail-on-warning
7
7
  SPHINXBUILD ?= sphinx-build
8
8
  SOURCEDIR = .
9
9
  BUILDDIR = build
File without changes
@@ -32,3 +32,8 @@ autodoc_typehints = "signature"
32
32
  autodoc_member_order = "groupwise"
33
33
 
34
34
  autosectionlabel_prefix_document = True
35
+
36
+ suppress_warnings = [
37
+ # https://github.com/readthedocs/sphinx-autoapi/issues/285
38
+ "autoapi.python_import_resolution",
39
+ ]
@@ -0,0 +1,254 @@
1
+ from __future__ import annotations
2
+
3
+ import contextlib
4
+ import gzip
5
+ from pathlib import Path
6
+ from typing import IO, TYPE_CHECKING, BinaryIO
7
+
8
+ import pytest
9
+
10
+ if TYPE_CHECKING:
11
+ from collections.abc import Iterator
12
+
13
+
14
+ def absolute_path(filename: str) -> Path:
15
+ return Path(__file__).parent / filename
16
+
17
+
18
+ def open_file(name: str, mode: str = "rb") -> Iterator[IO]:
19
+ with absolute_path(name).open(mode) as fh:
20
+ yield fh
21
+
22
+
23
+ def open_file_gz(name: str, mode: str = "rb") -> Iterator[IO]:
24
+ with gzip.GzipFile(absolute_path(name), mode) as fh:
25
+ yield fh
26
+
27
+
28
+ def open_files_gz(names: list[str], mode: str = "rb") -> Iterator[list[gzip.GzipFile]]:
29
+ with contextlib.ExitStack() as stack:
30
+ yield [stack.enter_context(gzip.GzipFile(absolute_path(name), mode)) for name in names]
31
+
32
+
33
+ @pytest.fixture
34
+ def lvm() -> Iterator[BinaryIO]:
35
+ yield from open_file_gz("_data/lvm/lvm.bin.gz")
36
+
37
+
38
+ @pytest.fixture
39
+ def lvm_thin() -> Iterator[BinaryIO]:
40
+ yield from open_file_gz("_data/lvm/lvm-thin.bin.gz")
41
+
42
+
43
+ @pytest.fixture
44
+ def lvm_mirror() -> Iterator[list[BinaryIO]]:
45
+ yield from open_files_gz(["_data/lvm/lvm-mirror-1.bin.gz", "_data/lvm/lvm-mirror-2.bin.gz"])
46
+
47
+
48
+ @pytest.fixture
49
+ def mbr() -> Iterator[BinaryIO]:
50
+ yield from open_file("_data/disk/mbr.bin")
51
+
52
+
53
+ @pytest.fixture
54
+ def gpt() -> Iterator[BinaryIO]:
55
+ yield from open_file("_data/disk/gpt.bin")
56
+
57
+
58
+ @pytest.fixture
59
+ def gpt_hybrid() -> Iterator[BinaryIO]:
60
+ yield from open_file("_data/disk/gpt_hybrid.bin")
61
+
62
+
63
+ @pytest.fixture
64
+ def gpt_4k() -> Iterator[BinaryIO]:
65
+ yield from open_file("_data/disk/gpt_4k.bin")
66
+
67
+
68
+ @pytest.fixture
69
+ def gpt_esxi() -> Iterator[BinaryIO]:
70
+ yield from open_file("_data/disk/gpt_esxi.bin")
71
+
72
+
73
+ @pytest.fixture
74
+ def gpt_no_name_xff() -> Iterator[BinaryIO]:
75
+ yield from open_file("_data/disk/gpt_no_name_xff.bin")
76
+
77
+
78
+ @pytest.fixture
79
+ def apm() -> Iterator[BinaryIO]:
80
+ yield from open_file("_data/disk/apm.bin")
81
+
82
+
83
+ @pytest.fixture
84
+ def bsd() -> Iterator[BinaryIO]:
85
+ yield from open_file("_data/disk/bsd.bin")
86
+
87
+
88
+ @pytest.fixture
89
+ def bsd64() -> Iterator[BinaryIO]:
90
+ yield from open_file_gz("_data/disk/bsd64.bin.gz")
91
+
92
+
93
+ @pytest.fixture
94
+ def dm_thin() -> Iterator[list[BinaryIO]]:
95
+ yield from open_files_gz(["_data/dm/dm-thin-metadata.bin.gz", "_data/dm/dm-thin-data.bin.gz"])
96
+
97
+
98
+ @pytest.fixture
99
+ def dm_thin_empty() -> Iterator[list[BinaryIO]]:
100
+ yield from open_files_gz(["_data/dm/dm-thin-empty-metadata.bin.gz", "_data/dm/dm-thin-empty-data.bin.gz"])
101
+
102
+
103
+ @pytest.fixture
104
+ def md_linear() -> Iterator[list[BinaryIO]]:
105
+ yield from open_files_gz(["_data/md/md-linear-1.bin.gz", "_data/md/md-linear-2.bin.gz"])
106
+
107
+
108
+ @pytest.fixture
109
+ def md_raid0() -> Iterator[list[BinaryIO]]:
110
+ yield from open_files_gz(["_data/md/md-raid0-1.bin.gz", "_data/md/md-raid0-2.bin.gz", "_data/md/md-raid0-3.bin.gz"])
111
+
112
+
113
+ @pytest.fixture
114
+ def md_raid1() -> Iterator[list[BinaryIO]]:
115
+ yield from open_files_gz(["_data/md/md-raid1-1.bin.gz", "_data/md/md-raid1-2.bin.gz"])
116
+
117
+
118
+ @pytest.fixture
119
+ def md_raid4() -> Iterator[list[BinaryIO]]:
120
+ yield from open_files_gz(["_data/md/md-raid4-1.bin.gz", "_data/md/md-raid4-2.bin.gz", "_data/md/md-raid4-3.bin.gz"])
121
+
122
+
123
+ @pytest.fixture
124
+ def md_raid5() -> Iterator[list[BinaryIO]]:
125
+ yield from open_files_gz(["_data/md/md-raid5-1.bin.gz", "_data/md/md-raid5-2.bin.gz", "_data/md/md-raid5-3.bin.gz"])
126
+
127
+
128
+ @pytest.fixture
129
+ def md_raid6() -> Iterator[list[BinaryIO]]:
130
+ yield from open_files_gz(
131
+ [
132
+ "_data/md/md-raid6-1.bin.gz",
133
+ "_data/md/md-raid6-2.bin.gz",
134
+ "_data/md/md-raid6-3.bin.gz",
135
+ "_data/md/md-raid6-4.bin.gz",
136
+ ]
137
+ )
138
+
139
+
140
+ @pytest.fixture
141
+ def md_raid10() -> Iterator[list[BinaryIO]]:
142
+ yield from open_files_gz(["_data/md/md-raid10-1.bin.gz", "_data/md/md-raid10-2.bin.gz"])
143
+
144
+
145
+ @pytest.fixture
146
+ def md_90_raid1() -> Iterator[list[BinaryIO]]:
147
+ yield from open_files_gz(["_data/md/md-90-raid1-1.bin.gz", "_data/md/md-90-raid1-2.bin.gz"])
148
+
149
+
150
+ @pytest.fixture
151
+ def ddf_raid0() -> Iterator[list[BinaryIO]]:
152
+ yield from open_files_gz(
153
+ ["_data/ddf/ddf-raid0-1.bin.gz", "_data/ddf/ddf-raid0-2.bin.gz", "_data/ddf/ddf-raid0-3.bin.gz"]
154
+ )
155
+
156
+
157
+ @pytest.fixture
158
+ def ddf_raid1() -> Iterator[list[BinaryIO]]:
159
+ yield from open_files_gz(["_data/ddf/ddf-raid1-1.bin.gz", "_data/ddf/ddf-raid1-2.bin.gz"])
160
+
161
+
162
+ @pytest.fixture
163
+ def ddf_raid0_raid1() -> Iterator[list[BinaryIO]]:
164
+ yield from open_files_gz(["_data/ddf/ddf-raid0-raid1-1.bin.gz", "_data/ddf/ddf-raid0-raid1-2.bin.gz"])
165
+
166
+
167
+ @pytest.fixture
168
+ def ddf_raid4() -> Iterator[list[BinaryIO]]:
169
+ yield from open_files_gz(["_data/ddf/ddf-raid4-1.bin.gz", "_data/ddf/ddf-raid4-2.bin.gz"])
170
+
171
+
172
+ @pytest.fixture
173
+ def ddf_raid5() -> Iterator[list[BinaryIO]]:
174
+ yield from open_files_gz(
175
+ ["_data/ddf/ddf-raid5-1.bin.gz", "_data/ddf/ddf-raid5-2.bin.gz", "_data/ddf/ddf-raid5-3.bin.gz"]
176
+ )
177
+
178
+
179
+ @pytest.fixture
180
+ def ddf_raid6() -> Iterator[list[BinaryIO]]:
181
+ yield from open_files_gz(
182
+ [
183
+ "_data/ddf/ddf-raid6-1.bin.gz",
184
+ "_data/ddf/ddf-raid6-2.bin.gz",
185
+ "_data/ddf/ddf-raid6-3.bin.gz",
186
+ "_data/ddf/ddf-raid6-4.bin.gz",
187
+ ]
188
+ )
189
+
190
+
191
+ @pytest.fixture
192
+ def ddf_raid10() -> Iterator[list[BinaryIO]]:
193
+ yield from open_files_gz(
194
+ [
195
+ "_data/ddf/ddf-raid10-1.bin.gz",
196
+ "_data/ddf/ddf-raid10-2.bin.gz",
197
+ "_data/ddf/ddf-raid10-3.bin.gz",
198
+ "_data/ddf/ddf-raid10-4.bin.gz",
199
+ ]
200
+ )
201
+
202
+
203
+ @pytest.fixture
204
+ def vinum_concat() -> Iterator[list[BinaryIO]]:
205
+ yield from open_files_gz(
206
+ [
207
+ "_data/vinum/vinum-concat_diska.bin.gz",
208
+ "_data/vinum/vinum-concat_diskb.bin.gz",
209
+ ]
210
+ )
211
+
212
+
213
+ @pytest.fixture
214
+ def vinum_mirror() -> Iterator[list[BinaryIO]]:
215
+ yield from open_files_gz(
216
+ [
217
+ "_data/vinum/vinum-mirror_diska.bin.gz",
218
+ "_data/vinum/vinum-mirror_diskb.bin.gz",
219
+ ]
220
+ )
221
+
222
+
223
+ @pytest.fixture
224
+ def vinum_raid5() -> Iterator[list[BinaryIO]]:
225
+ yield from open_files_gz(
226
+ [
227
+ "_data/vinum/vinum-raid5_diska.bin.gz",
228
+ "_data/vinum/vinum-raid5_diskb.bin.gz",
229
+ "_data/vinum/vinum-raid5_diskc.bin.gz",
230
+ "_data/vinum/vinum-raid5_diskd.bin.gz",
231
+ ]
232
+ )
233
+
234
+
235
+ @pytest.fixture
236
+ def vinum_striped() -> Iterator[list[BinaryIO]]:
237
+ yield from open_files_gz(
238
+ [
239
+ "_data/vinum/vinum-striped_diska.bin.gz",
240
+ "_data/vinum/vinum-striped_diskb.bin.gz",
241
+ ]
242
+ )
243
+
244
+
245
+ @pytest.fixture
246
+ def vinum_stripedmirror() -> Iterator[list[BinaryIO]]:
247
+ yield from open_files_gz(
248
+ [
249
+ "_data/vinum/vinum-stripedmirror_diska.bin.gz",
250
+ "_data/vinum/vinum-stripedmirror_diskb.bin.gz",
251
+ "_data/vinum/vinum-stripedmirror_diskc.bin.gz",
252
+ "_data/vinum/vinum-stripedmirror_diskd.bin.gz",
253
+ ]
254
+ )
@@ -1,10 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from io import BytesIO
3
4
  from typing import BinaryIO
4
5
 
5
6
  import pytest
6
7
 
7
- from dissect.volume.md.md import MD
8
+ from dissect.volume.md.md import MD, find_super_block
8
9
  from dissect.volume.raid.stream import RAID0Stream
9
10
 
10
11
 
@@ -61,3 +62,10 @@ def test_md_raid0_zones(md_raid0: list[BinaryIO]) -> None:
61
62
  assert fh.zones[1].zone_end == 5242880
62
63
  assert fh.zones[1].dev_start == 1048576
63
64
  assert len(fh.zones[1].devices) == 2
65
+
66
+
67
+ def test_md_search_sb_none_size() -> None:
68
+ fh = BytesIO()
69
+ fh.size = None
70
+
71
+ assert find_super_block(fh) == (None, None, None)
@@ -55,12 +55,12 @@ deps =
55
55
  sphinx-design
56
56
  furo
57
57
  commands =
58
- make -C tests/docs clean
59
- make -C tests/docs html
58
+ make -C tests/_docs clean
59
+ make -C tests/_docs html
60
60
 
61
61
  [testenv:docs-linkcheck]
62
62
  allowlist_externals = make
63
63
  deps = {[testenv:docs-build]deps}
64
64
  commands =
65
- make -C tests/docs clean
66
- make -C tests/docs linkcheck
65
+ make -C tests/_docs clean
66
+ make -C tests/_docs linkcheck
@@ -1,5 +0,0 @@
1
- tests/data/dm/* filter=lfs diff=lfs merge=lfs -text
2
- tests/data/md/* filter=lfs diff=lfs merge=lfs -text
3
- tests/data/ddf/* filter=lfs diff=lfs merge=lfs -text
4
- tests/data/lvm/* filter=lfs diff=lfs merge=lfs -text
5
- tests/data/vinum/* filter=lfs diff=lfs merge=lfs -text