dissect.extfs 3.13.dev2__py3-none-any.whl → 3.14.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/extfs.py CHANGED
@@ -39,7 +39,6 @@ log.setLevel(os.getenv("DISSECT_LOG_EXTFS", "CRITICAL"))
39
39
  class ExtFS:
40
40
  def __init__(self, fh: BinaryIO):
41
41
  self.fh = fh
42
- # self._path_cache = {}
43
42
  self._journal = None
44
43
 
45
44
  fh.seek(c_ext.EXT2_SBOFF)
@@ -117,25 +116,22 @@ class ExtFS:
117
116
 
118
117
  return self._journal
119
118
 
120
- def get(self, path: str | int, node: INode | None = None) -> INode:
121
- if isinstance(path, int):
122
- return self.get_inode(path)
119
+ def get(self, path_or_inum: str | int, node: INode | None = None) -> INode:
120
+ if isinstance(path_or_inum, int):
121
+ return self.get_inode(path_or_inum)
123
122
 
124
123
  node = node if node else self.root
125
- parts = path.split("/")
126
- for part_num, part in enumerate(parts):
124
+ parts = path_or_inum.split("/")
125
+ for part in parts:
127
126
  if not part:
128
127
  continue
129
128
 
130
- while node.filetype == stat.S_IFLNK and part_num < len(parts):
131
- node = node.link_inode
132
-
133
129
  for entry in node.iterdir():
134
130
  if entry.filename == part:
135
131
  node = entry
136
132
  break
137
133
  else:
138
- raise FileNotFoundError(f"File not found: {path}")
134
+ raise FileNotFoundError(f"File not found: {path_or_inum}")
139
135
 
140
136
  return node
141
137
 
@@ -144,13 +140,12 @@ class ExtFS:
144
140
  inum: int,
145
141
  filename: str | None = None,
146
142
  filetype: int | None = None,
147
- parent: INode | None = None,
148
143
  lazy: bool = False,
149
144
  ) -> INode:
150
145
  if inum < c_ext.EXT2_BAD_INO or inum > self.sb.s_inodes_count:
151
146
  raise Error(f"inum out of range {c_ext.EXT2_BAD_INO}-{self.sb.s_inodes_count}: {inum}")
152
147
 
153
- inode = INode(self, inum, filename, filetype, parent=parent)
148
+ inode = INode(self, inum, filename, filetype)
154
149
  if not lazy:
155
150
  inode._inode = inode._read_inode()
156
151
 
@@ -186,21 +181,17 @@ class INode:
186
181
  inum: int,
187
182
  filename: str | None = None,
188
183
  filetype: int | None = None,
189
- parent: INode | None = None,
190
184
  ):
191
185
  self.extfs = extfs
192
186
  self.inum = inum
193
- self.parent = parent
194
187
  self._inode = None
195
188
 
196
189
  self.filename = filename
197
190
  self._filetype = filetype
198
191
  self._size = None
199
192
  self._link = None
200
- self._link_inode = None
201
193
  self._xattr = None
202
194
 
203
- self._dirlist = None
204
195
  self._runlist = None
205
196
 
206
197
  def __repr__(self) -> str:
@@ -246,15 +237,6 @@ class INode:
246
237
  self._link = self.open().read().decode(errors="surrogateescape")
247
238
  return self._link
248
239
 
249
- @property
250
- def link_inode(self) -> INode:
251
- if not self._link_inode:
252
- # Relative lookups work because . and .. are actual directory entries
253
- link = self.link
254
- relnode = None if link.startswith("/") else self.parent
255
- self._link_inode = self.extfs.get(self.link, relnode)
256
- return self._link_inode
257
-
258
240
  @property
259
241
  def xattr(self) -> list[XAttr]:
260
242
  if not self._xattr:
@@ -337,9 +319,7 @@ class INode:
337
319
  return _parse_ns_ts(time, time_extra)
338
320
 
339
321
  def listdir(self) -> dict[str, INode]:
340
- if not self._dirlist:
341
- self._dirlist = {node.filename: node for node in self.iterdir()}
342
- return self._dirlist
322
+ return {node.filename: node for node in self.iterdir()}
343
323
 
344
324
  dirlist = listdir
345
325
 
@@ -365,7 +345,7 @@ class INode:
365
345
  if ftype:
366
346
  ftype = FILETYPES[ftype]
367
347
 
368
- yield self.extfs.get_inode(direntry.inode, fname, ftype, parent=self, lazy=True)
348
+ yield self.extfs.get_inode(direntry.inode, fname, ftype, lazy=True)
369
349
 
370
350
  offset += direntry.rec_len
371
351
  buf.seek(offset)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: dissect.extfs
3
- Version: 3.13.dev2
3
+ Version: 3.14.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
@@ -27,6 +27,7 @@ Requires-Dist: dissect.util<4,>=3
27
27
  Provides-Extra: dev
28
28
  Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
29
29
  Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
30
+ Dynamic: license-file
30
31
 
31
32
  # dissect.extfs
32
33
 
@@ -0,0 +1,12 @@
1
+ dissect/extfs/__init__.py,sha256=1_K5exKlh5eEUQF-vFkj0JzdDoxIZxPp4EC6B_8rQtI,346
2
+ dissect/extfs/c_ext.py,sha256=4429SV3LXJIeD1YIot-vzS-pVdNguwlcvi37cFfh1pY,23423
3
+ dissect/extfs/c_jdb2.py,sha256=4KZ_eq6MQ_gCh1VGtw11G_mN4PEV6PvJBDNUGhfLbMM,3664
4
+ dissect/extfs/exceptions.py,sha256=rVL-M01CBpk74d8VeeeqQuwD5P1WHluvNbAnj5D8BBw,263
5
+ dissect/extfs/extfs.py,sha256=KI_V_FcOVN0nr9DeqtXpF4v5bS5EiJABoztkPXYknmw,18450
6
+ dissect/extfs/journal.py,sha256=3od5IdtKAeF6zFi2iCcQ-YynrQx4e8_SAJ7zpv6Qv3k,5043
7
+ dissect_extfs-3.14.dev1.dist-info/licenses/COPYRIGHT,sha256=vz2IXoFr4ZWY2Q8QmDgdqzZmyqHhRZiAQC490UHWWdQ,300
8
+ dissect_extfs-3.14.dev1.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
9
+ dissect_extfs-3.14.dev1.dist-info/METADATA,sha256=pVuHB86RNu0H9A-8fBB738LPYzFPkOxrBxQWVcrSTm4,3282
10
+ dissect_extfs-3.14.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ dissect_extfs-3.14.dev1.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
12
+ dissect_extfs-3.14.dev1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,12 +0,0 @@
1
- dissect/extfs/__init__.py,sha256=1_K5exKlh5eEUQF-vFkj0JzdDoxIZxPp4EC6B_8rQtI,346
2
- dissect/extfs/c_ext.py,sha256=4429SV3LXJIeD1YIot-vzS-pVdNguwlcvi37cFfh1pY,23423
3
- dissect/extfs/c_jdb2.py,sha256=4KZ_eq6MQ_gCh1VGtw11G_mN4PEV6PvJBDNUGhfLbMM,3664
4
- dissect/extfs/exceptions.py,sha256=rVL-M01CBpk74d8VeeeqQuwD5P1WHluvNbAnj5D8BBw,263
5
- dissect/extfs/extfs.py,sha256=rjAi6qCipWYhi14iJ8c2yD5HaxQ_1gsJMGXyAqVglKs,19202
6
- dissect/extfs/journal.py,sha256=3od5IdtKAeF6zFi2iCcQ-YynrQx4e8_SAJ7zpv6Qv3k,5043
7
- dissect.extfs-3.13.dev2.dist-info/COPYRIGHT,sha256=vz2IXoFr4ZWY2Q8QmDgdqzZmyqHhRZiAQC490UHWWdQ,300
8
- dissect.extfs-3.13.dev2.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
9
- dissect.extfs-3.13.dev2.dist-info/METADATA,sha256=9KNW0ROdkiSl5c0gn4L6yXGndXhCT6io79nudhsAWdA,3260
10
- dissect.extfs-3.13.dev2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
11
- dissect.extfs-3.13.dev2.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
12
- dissect.extfs-3.13.dev2.dist-info/RECORD,,