Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions dissect/target/filesystems/exfat.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from __future__ import annotations

import stat
from datetime import timedelta, timezone
from typing import TYPE_CHECKING, BinaryIO, Optional

from dissect.fat import exfat
from dissect.util.stream import RunlistStream
from dissect.util.ts import UTC, dostimestamp
from dissect.util.ts import dostimestamp

from dissect.target.exceptions import FileNotFoundError, NotADirectoryError
from dissect.target.filesystem import Filesystem, FilesystemEntry
Expand Down Expand Up @@ -127,13 +128,16 @@

# all timestamps are recorded in local time. the utc offset (of the system generating the timestamp in question)
# is recorded in the associated tz byte
c_tz = UTC(self.fs.exfat._utc_timezone(fe.create_timezone))
m_tz = UTC(self.fs.exfat._utc_timezone(fe.modified_timezone))
a_tz = UTC(self.fs.exfat._utc_timezone(fe.access_timezone))
c_tz = self.fs.exfat._utc_timezone(fe.create_timezone)
c_tzinfo = timezone(timedelta(minutes=c_tz["offset"]), c_tz["name"])
m_tz = self.fs.exfat._utc_timezone(fe.modified_timezone)
m_tzinfo = timezone(timedelta(minutes=m_tz["offset"]), m_tz["name"])
a_tz = self.fs.exfat._utc_timezone(fe.access_timezone)
a_tzinfo = timezone(timedelta(minutes=a_tz["offset"]), a_tz["name"])

Check warning on line 136 in dissect/target/filesystems/exfat.py

View check run for this annotation

Codecov / codecov/patch

dissect/target/filesystems/exfat.py#L131-L136

Added lines #L131 - L136 were not covered by tests

ctime = dostimestamp(fe.create_time, fe.create_offset).replace(tzinfo=c_tz)
mtime = dostimestamp(fe.modified_time, fe.modified_offset).replace(tzinfo=m_tz)
atime = dostimestamp(fe.access_time).replace(tzinfo=a_tz)
ctime = dostimestamp(fe.create_time, fe.create_offset).replace(tzinfo=c_tzinfo)
mtime = dostimestamp(fe.modified_time, fe.modified_offset).replace(tzinfo=m_tzinfo)
atime = dostimestamp(fe.access_time).replace(tzinfo=a_tzinfo)

Check warning on line 140 in dissect/target/filesystems/exfat.py

View check run for this annotation

Codecov / codecov/patch

dissect/target/filesystems/exfat.py#L138-L140

Added lines #L138 - L140 were not covered by tests

# mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime
st_info = [
Expand All @@ -144,8 +148,8 @@
0,
0,
size,
atime.timetuple().timestamp(),
mtime.timetuple().timestamp(),
ctime.timetuple().timestamp(),
atime.timestamp(),
mtime.timestamp(),
ctime.timestamp(),
]
return fsutil.stat_result(st_info)
Loading