dissect.target 3.20.dev22__py3-none-any.whl → 3.20.dev25__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -181,6 +181,9 @@ class BtrfsFilesystemEntry(FilesystemEntry):
181
181
 
182
182
  # Add block information of the filesystem
183
183
  st_info.st_blksize = entry.btrfs.sector_size
184
- st_info.st_blocks = math.ceil(entry.size / st_info.st_blksize)
184
+
185
+ st_info.st_blocks = 0
186
+ if not self.is_dir():
187
+ st_info.st_blocks = (st_info.st_blksize // 512) * math.ceil(st_info.st_size / st_info.st_blksize)
185
188
 
186
189
  return st_info
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import math
3
4
  import stat
4
5
  from typing import BinaryIO, Iterator, Optional
5
6
 
@@ -151,12 +152,14 @@ class NtfsFilesystemEntry(FilesystemEntry):
151
152
  record = self.dereference()
152
153
 
153
154
  size = 0
155
+ real_size = 0
154
156
  if self.is_symlink():
155
157
  mode = stat.S_IFLNK
156
158
  elif self.is_file():
157
159
  mode = stat.S_IFREG
158
160
  try:
159
161
  size = record.size(self.ads)
162
+ real_size = record.size(self.ads, allocated=True)
160
163
  except NtfsFileNotFoundError as e:
161
164
  # Occurs when it cannot find the the specific ads inside its attributes
162
165
  raise FileNotFoundError from e
@@ -176,16 +179,29 @@ class NtfsFilesystemEntry(FilesystemEntry):
176
179
  0,
177
180
  size,
178
181
  stdinfo.last_access_time.timestamp(),
179
- stdinfo.last_change_time.timestamp(),
182
+ stdinfo.last_modification_time.timestamp(),
183
+ # ctime gets set to creation time for python <3.12 purposes
180
184
  stdinfo.creation_time.timestamp(),
181
185
  ]
182
186
  )
183
187
 
184
188
  # Set the nanosecond resolution separately
185
189
  st_info.st_atime_ns = stdinfo.last_access_time_ns
186
- st_info.st_mtime_ns = stdinfo.last_change_time_ns
190
+ st_info.st_mtime_ns = stdinfo.last_modification_time_ns
191
+
187
192
  st_info.st_ctime_ns = stdinfo.creation_time_ns
188
193
 
194
+ st_info.st_birthtime = stdinfo.creation_time.timestamp()
195
+ st_info.st_birthtime_ns = stdinfo.creation_time_ns
196
+
197
+ # real_size is none if the size is resident
198
+ st_info.st_blksize = record.ntfs.cluster_size
199
+ blocks = 0
200
+ if not record.resident:
201
+ blocks = math.ceil(real_size / 512)
202
+
203
+ st_info.st_blocks = blocks
204
+
189
205
  return st_info
190
206
 
191
207
  def attr(self) -> AttributeMap:
@@ -130,8 +130,15 @@ class XfsFilesystemEntry(FilesystemEntry):
130
130
  st_info.st_mtime_ns = self.entry.mtime_ns
131
131
  st_info.st_ctime_ns = self.entry.ctime_ns
132
132
 
133
- # XFS has a birth time, called crtime
133
+ st_info.st_blksize = self.fs.xfs.block_size
134
+ # Convert number of filesystem blocks to basic blocks
135
+ # Reference: https://github.com/torvalds/linux/blob/e32cde8d2bd7d251a8f9b434143977ddf13dcec6/fs/xfs/xfs_iops.c#L602 # noqa: E501
136
+ # Note that block size in XFS is always a multiple of 512, so the division below is safe
137
+ st_info.st_blocks = self.entry.nblocks * (self.fs.xfs.block_size // 512)
138
+
139
+ # XFS has a birth time, since inode version 3 (version 5 of filesystem)
134
140
  st_info.st_birthtime = self.entry.crtime.timestamp()
141
+ st_info.st_birthtime_ns = self.entry.crtime_ns
135
142
 
136
143
  return st_info
137
144
 
@@ -207,7 +207,7 @@ def print_stat(path: fsutil.TargetPath, stdout: TextIO, dereference: bool = Fals
207
207
  filetype=filetype(path),
208
208
  device="?",
209
209
  inode=s.st_ino,
210
- blocks=s.st_blocks or "?",
210
+ blocks=s.st_blocks if s.st_blocks is not None else "?",
211
211
  blksize=s.st_blksize or "?",
212
212
  nlink=s.st_nlink,
213
213
  modeord=oct(stat.S_IMODE(s.st_mode)),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.target
3
- Version: 3.20.dev22
3
+ Version: 3.20.dev25
4
4
  Summary: This module ties all other Dissect modules together, it provides a programming API and command line tools which allow easy access to various data sources inside disk images or file collections (a.k.a. targets)
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -23,7 +23,7 @@ dissect/target/containers/vmdk.py,sha256=5fQGkJy4esXONXrKLbhpkQDt8Fwx19YENK2mOm7
23
23
  dissect/target/data/autocompletion/target_bash_completion.sh,sha256=wrOQ_ED-h8WFcjCmY6n4qKl84tWJv9l8ShFHDfJqJyA,3592
24
24
  dissect/target/filesystems/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  dissect/target/filesystems/ad1.py,sha256=nEPzaaRsb6bL4ItFo0uLdmdLvrmK9BjqHeD3FOp3WQI,2413
26
- dissect/target/filesystems/btrfs.py,sha256=X-eMlKkx88xS2iIWRuq9yaQ82fl0DM435F1sdXkDo8g,6469
26
+ dissect/target/filesystems/btrfs.py,sha256=TotOs0-VOmgSijERZb1pOrIH_E7B1J_DRKqws8ttQTk,6569
27
27
  dissect/target/filesystems/cb.py,sha256=6LcoJiwsYu1Han31IUzVpZVDTifhTLTx_gLfNpB_p6k,5329
28
28
  dissect/target/filesystems/config.py,sha256=GQOtixIIt-Jjtpl3IVqUTujcBFfWaAZeAtvxgNUNetU,11963
29
29
  dissect/target/filesystems/cpio.py,sha256=ssVCjkAtLn2FqmNxeo6U5boyUdSYFxLWfXpytHYGPqs,641
@@ -34,14 +34,14 @@ dissect/target/filesystems/fat.py,sha256=ZSw-wS57vo5eIXJndfI1rZkGu_qh-vyioMzCZFZ
34
34
  dissect/target/filesystems/ffs.py,sha256=Wu8sS1jjmD0QXXcAaD2h_zzfvinjco8qvj0hErufZ-4,4555
35
35
  dissect/target/filesystems/itunes.py,sha256=w2lcWv6jlBPm84tsGZehxKBMXXyuW3KlmwVTF4ssQec,6395
36
36
  dissect/target/filesystems/jffs.py,sha256=Ceqa5Em2pepnXMH_XZFmSNjQyWPo1uWTthBFSMWfKRo,3926
37
- dissect/target/filesystems/ntfs.py,sha256=fGgCKjdO5GrPC21DDr0SwIxmwR7KruNIqGUzysboirA,7068
37
+ dissect/target/filesystems/ntfs.py,sha256=Losf35q9aLm-YdwVllT5so99s-GqTF1ZXMbLX0PUNC0,7624
38
38
  dissect/target/filesystems/overlay.py,sha256=d0BNZcVd3SzBcM1SZO5nX2FrEYcdtVH34BPJQ6Oh4x8,4753
39
39
  dissect/target/filesystems/smb.py,sha256=uxfcOWwEoDCw8Qpsa94T5Pn-SKd4WXs4OOrzVVI55d8,6406
40
40
  dissect/target/filesystems/squashfs.py,sha256=ehzlThXB7n96XUvQnsK5tWLsA9HIxYN-Zxl7aO9D7ts,3921
41
41
  dissect/target/filesystems/tar.py,sha256=EJyvRCU6H7eu0exC0tQggyAZKZ3JFFaihYyx9SIQNqk,5742
42
42
  dissect/target/filesystems/vmfs.py,sha256=sRtYBUAKTKcHrjCXqpFJ8GIVU-ERjqxhB2zXBndtcXU,4955
43
43
  dissect/target/filesystems/vmtar.py,sha256=LlKWkTIuLemQmG9yGqL7980uC_AOL77_GWhbJc_grSk,804
44
- dissect/target/filesystems/xfs.py,sha256=kIyFGKYlyFYC7H3jaEv-lNKtBW4ZkD92H0WpfGcr1ww,4498
44
+ dissect/target/filesystems/xfs.py,sha256=bNYyiAqqTnzKf-Cd-XTbr-3EPWjSlOpjlcyCzO2Toq4,5017
45
45
  dissect/target/filesystems/zip.py,sha256=BeNj23DOYfWuTm5V1V419ViJiMfBrO1VA5gP6rljwXs,5467
46
46
  dissect/target/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  dissect/target/helpers/cache.py,sha256=TXlJBdFRz6V9zKs903am4Yawr0maYw5kZY0RqklDQJM,8568
@@ -347,7 +347,7 @@ dissect/target/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
347
347
  dissect/target/tools/build_pluginlist.py,sha256=5fomcuMwsVzcnYx5Htf5f9lSwsLeUUvomLUXNA4t7m4,849
348
348
  dissect/target/tools/dd.py,sha256=rTM-lgXxrYBpVAtJqFqAatDz45bLoD8-mFt_59Q3Lio,1928
349
349
  dissect/target/tools/fs.py,sha256=3Ny8zoooVeeF7OUkQ0nxZVdEaQeU7vPRjDOYhz6XfRA,5385
350
- dissect/target/tools/fsutils.py,sha256=dyAdp2fzydcozaIZ1mFTpdUeVcibYNJCHN8AFw5FoKU,8285
350
+ dissect/target/tools/fsutils.py,sha256=q0t9gFwKHaPr2Ya-MN2o4LsYledde7kp2DZZTd8roIc,8314
351
351
  dissect/target/tools/info.py,sha256=8nnbqFUYeo4NLPE7ORcTBcDL-TioGB2Nqc1TKcu5qdY,5715
352
352
  dissect/target/tools/logging.py,sha256=5ZnumtMWLyslxfrUGZ4ntRyf3obOOhmn8SBjKfdLcEg,4174
353
353
  dissect/target/tools/mount.py,sha256=8GRYnu4xEmFBHxuIZAYhOMyyTGX8fat1Ou07DNiUnW4,3945
@@ -368,10 +368,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
368
368
  dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
369
369
  dissect/target/volumes/md.py,sha256=7ShPtusuLGaIv27SvEETtgsuoQyAa4iAAeOR1NEaajI,1689
370
370
  dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
371
- dissect.target-3.20.dev22.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
372
- dissect.target-3.20.dev22.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
373
- dissect.target-3.20.dev22.dist-info/METADATA,sha256=OHdFcuSCsZSCOijYk6ndRz3TVY27GvqJY8dzcP30woI,12897
374
- dissect.target-3.20.dev22.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
375
- dissect.target-3.20.dev22.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
376
- dissect.target-3.20.dev22.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
377
- dissect.target-3.20.dev22.dist-info/RECORD,,
371
+ dissect.target-3.20.dev25.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
372
+ dissect.target-3.20.dev25.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
373
+ dissect.target-3.20.dev25.dist-info/METADATA,sha256=jFh9-AJEF-Ngndjz8WcuWXQflbuRTJhlN2u3t1k8sAw,12897
374
+ dissect.target-3.20.dev25.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
375
+ dissect.target-3.20.dev25.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
376
+ dissect.target-3.20.dev25.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
377
+ dissect.target-3.20.dev25.dist-info/RECORD,,