fox-it / dissect.target

The Dissect module tying 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).
GNU Affero General Public License v3.0
44 stars 47 forks source link

TarLoader issues #135

Closed JSCU-CNI closed 1 year ago

JSCU-CNI commented 1 year ago

We've come across two issues regarding the use of tar-files:

  1. With the merge of #112, the class TarFile is removed. This however breaks the AsdfLoader.
  2. In the TarLoader, directories are skipped. It seems that as result of this, empty folders are not included in for example target.walkfs(), although they might be of value from a forensic point of view. The current test does not include the occurrence of empty folders within a tar-file.
Schamper commented 1 year ago

I believe both of these issues are currently resolved. Can you confirm and close the issue if this is the case?

JSCU-CNI commented 1 year ago

The latter issue has indeed been fixed with #144 and #195. The first issue however still seems to be present. The AsdfLoader still tries to import TarFile from dissect.target.loaders.tar in loaders/asdf.py.

This is output from the latest main branch of dissect.target:

$ target-shell example.E01 -vvvvv
2023-04-06T12:01:25.405640Z [warning  ] Failed to import <lazyattr dissect.target.loaders.asdf.AsdfLoader loaded=False> [dissect.target.loader] 
2023-04-06T12:01:25.405721Z [debug    ]            [dissect.target.loader] 
Traceback (most recent call last):
  File "/tmp/dissect.target/dissect/target/loader.py", line 147, in find_loader
    if loader.detect(item):
  File "/tmp/dissect.target/dissect/target/helpers/lazy.py", line 57, in __getattr__
    self._realattr = getattr(self.module._module, self.attr)  # noqa
  File "/tmp/dissect.target/dissect/target/helpers/lazy.py", line 38, in __getattr__
    self._error()
  File "/tmp/dissect.target/dissect/target/helpers/lazy.py", line 32, in _error
    raise ImportError(f"Failed to lazily import {self.module._module_name}: {self.exc}")  # noqa
ImportError: Failed to lazily import dissect.target.loaders.asdf: cannot import name 'TarFile' from 'dissect.target.loaders.tar' (/tmp/dissect.target/dissect/target/loaders/tar.py)
Schamper commented 1 year ago

Ah correct, made a quick PR for that!