dissect.extfs 3.10.dev4__py3-none-any.whl → 3.11.dev1__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.
dissect/extfs/c_ext.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import stat
2
2
 
3
- from dissect import cstruct
3
+ from dissect.cstruct import cstruct
4
4
 
5
5
  ext_def = """
6
6
  #define EXT2_SBOFF 1024 // offset to superblock
@@ -397,8 +397,7 @@ struct ext4_xattr_entry {
397
397
  };
398
398
  """
399
399
 
400
- c_ext = cstruct.cstruct()
401
- c_ext.load(ext_def)
400
+ c_ext = cstruct().load(ext_def)
402
401
 
403
402
  EXT2 = 2
404
403
  EXT3 = 3
dissect/extfs/c_jdb2.py CHANGED
@@ -1,4 +1,4 @@
1
- from dissect import cstruct
1
+ from dissect.cstruct import cstruct
2
2
 
3
3
  jdb2_def = """
4
4
  #define JBD2_MAGIC_NUMBER 0xC03B3998
@@ -87,5 +87,4 @@ struct journal_block_tag3 {
87
87
  };
88
88
  """
89
89
 
90
- c_jdb2 = cstruct.cstruct(endian=">")
91
- c_jdb2.load(jdb2_def)
90
+ c_jdb2 = cstruct(endian=">").load(jdb2_def)
dissect/extfs/extfs.py CHANGED
@@ -9,7 +9,6 @@ from functools import lru_cache
9
9
  from typing import BinaryIO, Iterator, Optional, Union
10
10
  from uuid import UUID
11
11
 
12
- from dissect.cstruct import Instance
13
12
  from dissect.util import ts
14
13
  from dissect.util.stream import RangeStream, RunlistStream
15
14
 
@@ -154,7 +153,7 @@ class ExtFS:
154
153
 
155
154
  return inode
156
155
 
157
- def _read_group_desc(self, group_num: int) -> Instance:
156
+ def _read_group_desc(self, group_num: int) -> c_ext.ext2_group_desc | c_ext.ext4_group_desc:
158
157
  if group_num >= self.groups_count:
159
158
  raise Error("Group number exceeds amount of groups")
160
159
 
@@ -204,7 +203,7 @@ class INode:
204
203
  def __repr__(self) -> str:
205
204
  return f"<inode {self.inum}>"
206
205
 
207
- def _read_inode(self) -> Instance:
206
+ def _read_inode(self) -> c_ext.ext4_inode:
208
207
  block_group_num, index = divmod(self.inum - 1, self.extfs.sb.s_inodes_per_group)
209
208
  block_group = self.extfs._read_group_desc(block_group_num)
210
209
 
@@ -218,7 +217,7 @@ class INode:
218
217
  return c_ext.ext4_inode(self.extfs.fh)
219
218
 
220
219
  @property
221
- def inode(self) -> Instance:
220
+ def inode(self) -> c_ext.ext4_inode:
222
221
  if not self._inode:
223
222
  self._inode = self._read_inode()
224
223
  return self._inode
@@ -456,7 +455,7 @@ class INode:
456
455
 
457
456
 
458
457
  class XAttr:
459
- def __init__(self, extfs: ExtFS, inode: INode, entry: Instance, value: bytes):
458
+ def __init__(self, extfs: ExtFS, inode: INode, entry: c_ext.ext4_xattr_entry, value: bytes):
460
459
  self.extfs = extfs
461
460
  self.inode = inode
462
461
  self.entry = entry
@@ -496,7 +495,7 @@ def _parse_indirect(inode: INode, offset: int, num_blocks: int, level: int) -> l
496
495
  return blocks
497
496
 
498
497
 
499
- def _parse_extents(inode: INode, buf: bytes) -> Iterator[Instance]:
498
+ def _parse_extents(inode: INode, buf: bytes) -> Iterator[c_ext.ext4_extent]:
500
499
  extent_header = c_ext.ext4_extent_header(buf)
501
500
 
502
501
  if extent_header.eh_magic != 0xF30A:
dissect/extfs/journal.py CHANGED
@@ -4,7 +4,6 @@ import datetime
4
4
  import io
5
5
  from typing import BinaryIO, Iterator, Optional
6
6
 
7
- from dissect.cstruct import Instance
8
7
  from dissect.util.stream import RangeStream
9
8
 
10
9
  from dissect.extfs.c_jdb2 import c_jdb2
@@ -83,7 +82,7 @@ class JDB2:
83
82
 
84
83
 
85
84
  class DescriptorBlock:
86
- def __init__(self, jdb2: JDB2, header: Instance, block: int):
85
+ def __init__(self, jdb2: JDB2, header: c_jdb2.journal_header, block: int):
87
86
  self.jdb2 = jdb2
88
87
  self.header = header
89
88
  self.journal_block = block
@@ -110,7 +109,9 @@ class DescriptorBlock:
110
109
 
111
110
 
112
111
  class DescriptorBlockTag:
113
- def __init__(self, descriptor: DescriptorBlock, tag: Instance, journal_block: int):
112
+ def __init__(
113
+ self, descriptor: DescriptorBlock, tag: c_jdb2.journal_block_tag | c_jdb2.journal_block_tag3, journal_block: int
114
+ ):
114
115
  self.descriptor = descriptor
115
116
  self.tag = tag
116
117
  self.journal_block = journal_block
@@ -127,7 +128,11 @@ class DescriptorBlockTag:
127
128
 
128
129
  class CommitBlock:
129
130
  def __init__(
130
- self, jdb2: JDB2, header: Instance, journal_block: int, descriptors: Optional[list[DescriptorBlock]] = None
131
+ self,
132
+ jdb2: JDB2,
133
+ header: c_jdb2.commit_header,
134
+ journal_block: int,
135
+ descriptors: Optional[list[DescriptorBlock]] = None,
131
136
  ):
132
137
  self.jdb2 = jdb2
133
138
  self.header = header
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.extfs
3
- Version: 3.10.dev4
3
+ Version: 3.11.dev1
4
4
  Summary: A Dissect module implementing a parser for the ExtFS file system, the native filesystem for Linux operating systems
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -22,8 +22,11 @@ Requires-Python: ~=3.9
22
22
  Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
24
  License-File: COPYRIGHT
25
- Requires-Dist: dissect.cstruct <4.0.dev,>=3.0.dev
26
- Requires-Dist: dissect.util <4.0.dev,>=3.0.dev
25
+ Requires-Dist: dissect.cstruct <5,>=4.dev
26
+ Requires-Dist: dissect.util <4,>=3
27
+ Provides-Extra: dev
28
+ Requires-Dist: dissect.cstruct <5.0.dev,>=4.0.dev ; extra == 'dev'
29
+ Requires-Dist: dissect.util <4.0.dev,>=3.0.dev ; extra == 'dev'
27
30
 
28
31
  # dissect.extfs
29
32
 
@@ -0,0 +1,12 @@
1
+ dissect/extfs/__init__.py,sha256=7LER03IJw1H_l1QY43uEJIbXfYSwUuV5qOjfAP26m8o,346
2
+ dissect/extfs/c_ext.py,sha256=fB5V39vG94BfWgWiJW0i-ahRKNrAVY7zDHEIi2tfyBs,23387
3
+ dissect/extfs/c_jdb2.py,sha256=I3VpjTl6u8b8dV9_3HGEzC64sjcrcO_f6APjlMndnvA,3628
4
+ dissect/extfs/exceptions.py,sha256=K2M5r2M3HvOcwkX_vD079GtqVKCiU1u-Y9MVEvxrEuo,162
5
+ dissect/extfs/extfs.py,sha256=y9j-1gDx7OrFd4_tQfioevHoQxg-1P_JppvgiccwpvA,19293
6
+ dissect/extfs/journal.py,sha256=X5DSg_hYfKgIZnzwG617JspGdFDGyWV-rQfb75MapoQ,4968
7
+ dissect.extfs-3.11.dev1.dist-info/COPYRIGHT,sha256=vz2IXoFr4ZWY2Q8QmDgdqzZmyqHhRZiAQC490UHWWdQ,300
8
+ dissect.extfs-3.11.dev1.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
9
+ dissect.extfs-3.11.dev1.dist-info/METADATA,sha256=byZjSFPGfjjJKp3ab6I2J6n3Ux-zBEdvC8kJBG6S064,3270
10
+ dissect.extfs-3.11.dev1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
11
+ dissect.extfs-3.11.dev1.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
12
+ dissect.extfs-3.11.dev1.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- dissect/extfs/__init__.py,sha256=7LER03IJw1H_l1QY43uEJIbXfYSwUuV5qOjfAP26m8o,346
2
- dissect/extfs/c_ext.py,sha256=pPFQyyiyuRTVK_XDmeEGZphv04vpsub4FqJb6Dm3pjg,23393
3
- dissect/extfs/c_jdb2.py,sha256=cp_MVRuU_TZ0JwGF4BAAo3np68dH-oFeAK32IvtXpkc,3635
4
- dissect/extfs/exceptions.py,sha256=K2M5r2M3HvOcwkX_vD079GtqVKCiU1u-Y9MVEvxrEuo,162
5
- dissect/extfs/extfs.py,sha256=Q_7VfV-uHsiaH0E2-GBp9CW4fAczuK9xtmOULGMskh4,19254
6
- dissect/extfs/journal.py,sha256=xqf_QfL_GIWbLMpfkQA4S-7ttAQk9NlLr0JdLoc0kH4,4889
7
- dissect.extfs-3.10.dev4.dist-info/COPYRIGHT,sha256=vz2IXoFr4ZWY2Q8QmDgdqzZmyqHhRZiAQC490UHWWdQ,300
8
- dissect.extfs-3.10.dev4.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
9
- dissect.extfs-3.10.dev4.dist-info/METADATA,sha256=TZ2-2qCDR-eic8uYKQntiprcnb1OBFcrn8Y-3-LZs-E,3139
10
- dissect.extfs-3.10.dev4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
11
- dissect.extfs-3.10.dev4.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
12
- dissect.extfs-3.10.dev4.dist-info/RECORD,,