Skip to content

Commit

Permalink
Changes volume scanner to pass options (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz authored Dec 2, 2020
1 parent 2d5268d commit a8661b7
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 50 deletions.
4 changes: 2 additions & 2 deletions config/dpkg/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dfvfs (20201118-1) unstable; urgency=low
dfvfs (20201202-1) unstable; urgency=low

* Auto-generated

-- Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com> Wed, 18 Nov 2020 06:32:26 +0100
-- Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com> Wed, 02 Dec 2020 08:10:45 +0100
2 changes: 1 addition & 1 deletion dfvfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
storage media types and file formats.
"""

__version__ = '20201118'
__version__ = '20201202'
8 changes: 4 additions & 4 deletions dfvfs/credentials/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
The credentials manager uses credential (instances of Credentials) to specify
which credentials a specific path specification type supports. E.g. in case
of BitLocker Drive Encryption (BDE):
* password;
* recovery password;
* startup key;
* key data.
* password;
* recovery password;
* startup key;
* key data.
"""

from __future__ import unicode_literals
Expand Down
36 changes: 8 additions & 28 deletions dfvfs/helpers/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,14 +656,9 @@ def GetAPFSVolumeIdentifiers(self, volume_system, volume_identifiers):
Returns:
list[str]: selected volume identifiers including prefix or None.
"""
print_header = True
while True:
if print_header:
self._PrintAPFSVolumeIdentifiersOverview(
volume_system, volume_identifiers)

print_header = False
self._PrintAPFSVolumeIdentifiersOverview(volume_system, volume_identifiers)

while True:
self._output_writer.Write('\n')

lines = self._textwrapper.wrap(self._USER_PROMPT_APFS)
Expand Down Expand Up @@ -702,14 +697,9 @@ def GetLVMVolumeIdentifiers(self, volume_system, volume_identifiers):
Returns:
list[str]: selected volume identifiers including prefix or None.
"""
print_header = True
while True:
if print_header:
self._PrintLVMVolumeIdentifiersOverview(
volume_system, volume_identifiers)

print_header = False
self._PrintLVMVolumeIdentifiersOverview(volume_system, volume_identifiers)

while True:
self._output_writer.Write('\n')

lines = self._textwrapper.wrap(self._USER_PROMPT_LVM)
Expand Down Expand Up @@ -747,14 +737,9 @@ def GetPartitionIdentifiers(self, volume_system, volume_identifiers):
Returns:
list[str]: selected volume identifiers including prefix or None.
"""
print_header = True
while True:
if print_header:
self._PrintPartitionIdentifiersOverview(
volume_system, volume_identifiers)

print_header = False
self._PrintPartitionIdentifiersOverview(volume_system, volume_identifiers)

while True:
self._output_writer.Write('\n')

lines = self._textwrapper.wrap(self._USER_PROMPT_TSK)
Expand Down Expand Up @@ -791,14 +776,9 @@ def GetVSSStoreIdentifiers(self, volume_system, volume_identifiers):
Returns:
list[str]: selected volume identifiers including prefix or None.
"""
print_header = True
while True:
if print_header:
self._PrintVSSStoreIdentifiersOverview(
volume_system, volume_identifiers)

print_header = False
self._PrintVSSStoreIdentifiersOverview(volume_system, volume_identifiers)

while True:
self._output_writer.Write('\n')

lines = self._textwrapper.wrap(self._USER_PROMPT_VSS)
Expand Down
26 changes: 14 additions & 12 deletions dfvfs/helpers/volume_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class VolumeScannerOptions(object):
"""Volume scanner options.
Attribute:
Attributes:
partitions (list[str]): partition identifiers.
scan_mode (str): mode that defines how the VolumeScanner should scan
for volumes and snapshots.
Expand Down Expand Up @@ -161,8 +161,8 @@ def _GetAPFSVolumeIdentifiers(self, scan_node, options):
list[str]: APFS volume identifiers.
Raises:
ScannerError: if the format of or within the source is not supported
or the the scan node is invalid.
ScannerError: if the scan node is invalid or the scanner does not know
how to proceed.
UserAbort: if the user requested to abort.
"""
if not scan_node or not scan_node.path_spec:
Expand Down Expand Up @@ -218,8 +218,8 @@ def _GetLVMVolumeIdentifiers(self, scan_node, options):
list[str]: LVM volume identifiers.
Raises:
ScannerError: if the format of or within the source is not supported
or the the scan node is invalid.
ScannerError: if the scan node is invalid or the scanner does not know
how to proceed.
UserAbort: if the user requested to abort.
"""
if not scan_node or not scan_node.path_spec:
Expand Down Expand Up @@ -279,9 +279,8 @@ def _GetPartitionIdentifiers(self, scan_node, options):
list[str]: partition identifiers.
Raises:
ScannerError: if the format of or within the source is not supported or
the scan node is invalid or if the volume for a specific identifier
cannot be retrieved.
ScannerError: if the scan node is invalid or the scanner does not know
how to proceed.
UserAbort: if the user requested to abort.
"""
if not scan_node or not scan_node.path_spec:
Expand Down Expand Up @@ -338,8 +337,8 @@ def _GetVSSStoreIdentifiers(self, scan_node, options):
list[str]: VSS store identifiers.
Raises:
ScannerError: if the format the scan node is invalid or no mediator
is provided and VSS store identifiers are found.
ScannerError: if the scan node is invalid or the scanner does not know
how to proceed.
UserAbort: if the user requested to abort.
"""
if not scan_node or not scan_node.path_spec:
Expand Down Expand Up @@ -716,11 +715,14 @@ def OpenFile(self, windows_path):

return self._file_system.GetFileObjectByPathSpec(path_spec)

def ScanForWindowsVolume(self, source_path):
def ScanForWindowsVolume(self, source_path, options=None):
"""Scans for a Windows volume.
Args:
source_path (str): source path.
options (Optional[VolumeScannerOptions]): volume scanner options. If None
the default volume scanner options are used, which are defined in the
VolumeScannerOptions class.
Returns:
bool: True if a Windows volume was found.
Expand All @@ -730,7 +732,7 @@ def ScanForWindowsVolume(self, source_path):
is not a file or directory, or if the format of or within the source
file is not supported.
"""
windows_path_specs = self.GetBasePathSpecs(source_path)
windows_path_specs = self.GetBasePathSpecs(source_path, options=options)
if (not windows_path_specs or
self._source_type == definitions.SOURCE_TYPE_FILE):
return False
Expand Down
2 changes: 1 addition & 1 deletion dfvfs/vfs/ntfs_file_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def _GetLink(self):
str: path of the linked file.
"""
if self._link is None:
self._link = self._fsntfs_file_entry.reparse_point_print_name
self._link = self._fsntfs_file_entry.symbolic_link_target
if self._link:
# Strip off the drive letter, we assume the link is within
# the same volume.
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/user/Installation-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The l2tdevtools project provides [an update script](https://github.com/log2timel
to ease the process of keeping the dependencies up to date.

The script requires [pywin32](https://github.com/mhammond/pywin32/releases) and
[Python WMI](https://pypi.python.org/pypi/WMI/).
[Python WMI](https://pypi.org/project/WMI).

To install the release versions of the dependencies run:

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def _make_spec_file(self):
'Programming Language :: Python',
],
packages=find_packages('.', exclude=[
'docs', 'tests', 'tests.*', 'utils']),
'examples', 'docs', 'tests', 'tests.*', 'utils']),
package_dir={
'dfvfs': 'dfvfs'
},
Expand Down

0 comments on commit a8661b7

Please sign in to comment.