Skip to content

Commit

Permalink
Deprecated GetStat file entry method #52
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Nov 14, 2021
1 parent 76c6602 commit ac50606
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion config/dpkg/control
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Homepage: https://github.com/log2timeline/dfvfs

Package: python3-dfvfs
Architecture: all
Depends: libbde-python3 (>= 20140531), libewf-python3 (>= 20131210), libfsapfs-python3 (>= 20201107), libfsext-python3 (>= 20210721), libfshfs-python3 (>= 20210722), libfsntfs-python3 (>= 20200921), libfsxfs-python3 (>= 20210726), libfvde-python3 (>= 20160719), libfwnt-python3 (>= 20210717), libluksde-python3 (>= 20200101), libmodi-python3 (>= 20210405), libqcow-python3 (>= 20201213), libsigscan-python3 (>= 20191221), libsmdev-python3 (>= 20140529), libsmraw-python3 (>= 20140612), libvhdi-python3 (>= 20201014), libvmdk-python3 (>= 20140421), libvsgpt-python3 (>= 20210207), libvshadow-python3 (>= 20160109), libvslvm-python3 (>= 20160109), python3-cffi-backend (>= 1.9.1), python3-cryptography (>= 2.0.2), python3-dfdatetime (>= 20210509), python3-dtfabric (>= 20170524), python3-idna (>= 2.5), python3-pytsk3 (>= 20210419), python3-pyxattr (>= 0.7.2), python3-yaml (>= 3.10), ${python3:Depends}, ${misc:Depends}
Depends: libbde-python3 (>= 20140531), libewf-python3 (>= 20131210), libfsapfs-python3 (>= 20201107), libfsext-python3 (>= 20210721), libfshfs-python3 (>= 20210722), libfsntfs-python3 (>= 20200921), libfsxfs-python3 (>= 20210726), libfvde-python3 (>= 20160719), libfwnt-python3 (>= 20210717), libluksde-python3 (>= 20200101), libmodi-python3 (>= 20210405), libqcow-python3 (>= 20201213), libsigscan-python3 (>= 20191221), libsmdev-python3 (>= 20140529), libsmraw-python3 (>= 20140612), libvhdi-python3 (>= 20201014), libvmdk-python3 (>= 20140421), libvsgpt-python3 (>= 20210207), libvshadow-python3 (>= 20160109), libvslvm-python3 (>= 20160109), python3-cffi-backend (>= 1.9.1), python3-cryptography (>= 2.0.2), python3-dfdatetime (>= 20211113), python3-dtfabric (>= 20170524), python3-idna (>= 2.5), python3-pytsk3 (>= 20210419), python3-pyxattr (>= 0.7.2), python3-yaml (>= 3.10), ${python3:Depends}, ${misc:Depends}
Description: Python 3 module of dfVFS
dfVFS, or Digital Forensics Virtual File System, provides read-only access to
file-system objects from various storage media types and file formats. The goal
Expand Down
2 changes: 1 addition & 1 deletion dependencies.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ version_property: __version__

[dfdatetime]
dpkg_name: python3-dfdatetime
minimum_version: 20210509
minimum_version: 20211113
rpm_name: python3-dfdatetime
version_property: __version__

Expand Down
4 changes: 4 additions & 0 deletions dfvfs/vfs/file_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import abc

from dfvfs.lib import decorators
from dfvfs.lib import definitions
from dfvfs.resolver import resolver
from dfvfs.vfs import vfs_stat
Expand Down Expand Up @@ -417,9 +418,12 @@ def GetSubFileEntryByName(self, name, case_sensitive=True):

return matching_sub_file_entry

@decorators.deprecated
def GetStat(self):
"""Retrieves information about the file entry.
This method is deprecated use StatAttribute instead.
Returns:
VFSStat: a stat object or None if not available.
"""
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
docutils
recommonmark
sphinx >= 4.1.0
sphinx >= 2.0.1,< 4.1.0
sphinx-markdown-tables
sphinx-rtd-theme >= 0.5.1
9 changes: 5 additions & 4 deletions docs/sources/Code-snippets.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ for sub_file_entry in file_entry.sub_file_entries:
print(sub_file_entry.name)
```
### Retrieving an inode value
### Retrieving an inode number
```python
from dfvfs.lib import definitions
from dfvfs.path import factory
from dfvfs.resolver import resolver
from dfvfs.vfs import attribute

image_location = 'image.E01'
file_location = '/Users/MyUser/AppData/Local/Microsoft/Office/15.0/OfficeFileCache/MyFile.txt'
Expand All @@ -87,7 +88,7 @@ tsk_path_spec = factory.Factory.NewPathSpec(definitions.TYPE_INDICATOR_TSK, loca

file_entry = resolver.Resolver.OpenFileEntry(tsk_path_spec)

stat_object = file_entry.GetStat()

print('Inode: {0:d}'.format(stat_object.ino))
for file_entry_attribute in file_entry.attributes:
if isinstance(file_entry_attribute, attribute.StatAttribute):
print('Inode number: {0:d}'.format(file_entry_attribute.inode_number))
```
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pip >= 7.0.0
PyYAML >= 3.10
cffi >= 1.9.1
cryptography >= 2.0.2
dfdatetime >= 20210509
dfdatetime >= 20211113
dtfabric >= 20170524
libbde-python >= 20140531
libewf-python >= 20131210
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ requires = libbde-python3 >= 20140531
libvslvm-python3 >= 20160109
python3-cffi >= 1.9.1
python3-cryptography >= 2.0.2
python3-dfdatetime >= 20210509
python3-dfdatetime >= 20211113
python3-dtfabric >= 20170524
python3-idna >= 2.5
python3-pytsk3 >= 20210419
Expand Down
13 changes: 6 additions & 7 deletions tests/vfs/ntfs_file_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,9 @@ def testAttributes(self):
self.assertIsNotNone(attribute.modification_time)
self.assertIsNotNone(attribute.entry_modification_time)

stat_time, stat_time_nano = (
attribute.modification_time.CopyToStatTimeTuple())
self.assertEqual(stat_time, 1567246979)
self.assertEqual(stat_time_nano, 9581788)
date_time_string = (
attribute.modification_time.CopyToDateTimeStringISO8601())
self.assertEqual(date_time_string, '2019-08-31T10:22:59.9581788+00:00')

attribute = attributes[1]

Expand All @@ -584,9 +583,9 @@ def testAttributes(self):
self.assertIsNotNone(attribute.modification_time)
self.assertIsNotNone(attribute.entry_modification_time)

stat_time, stat_time_nano = attribute.access_time.CopyToStatTimeTuple()
self.assertEqual(stat_time, 1567246979)
self.assertEqual(stat_time_nano, 9567496)
date_time_string = (
attribute.access_time.CopyToDateTimeStringISO8601())
self.assertEqual(date_time_string, '2019-08-31T10:22:59.9567496+00:00')

attribute = attributes[2]

Expand Down

0 comments on commit ac50606

Please sign in to comment.