dissect.target 3.8.dev32__py3-none-any.whl → 3.8.dev34__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,17 +14,21 @@ FILESYSTEMS_ROOT = "uploads"
14
14
 
15
15
  def find_fs_directories(path: Path) -> tuple[Optional[OperatingSystem], Optional[list[Path]]]:
16
16
  # As of Velociraptor version 0.6.7 the structure of the Velociraptor Offline Collector varies by operating system
17
- # Generic.Collectors.File (Unix, OS-X) root filesystem is 'uploads/'
17
+ # Generic.Collectors.File (Linux and OS-X) root filesystem is 'uploads/file/'
18
18
  # Generic.Collectors.File (Windows) and Windows.KapeFiles.Targets (Windows) root filesystem is
19
19
  # 'uploads/<file-accessor>/<drive-name>/'
20
20
  fs_root = path.joinpath(FILESYSTEMS_ROOT)
21
- os_type, dirs = find_dirs(fs_root)
22
- if os_type in [OperatingSystem.LINUX, OperatingSystem.OSX]:
23
- return os_type, [dirs[0]]
21
+
22
+ # Linux and OS-X
23
+ file_root = fs_root.joinpath("file")
24
+ if file_root.exists():
25
+ os_type, dirs = find_dirs(file_root)
26
+ if os_type in [OperatingSystem.LINUX, OperatingSystem.OSX]:
27
+ return os_type, [dirs[0]]
24
28
 
25
29
  # This suppports usage of the ntfs accessor 'uploads/mft/%5C%5C.%5CC%3A' not the accessors lazy_ntfs or auto
26
30
  mft_root = fs_root.joinpath("mft")
27
- if not os_type and mft_root.exists():
31
+ if mft_root.exists():
28
32
  # If the `mft` directory exists, assume all the subdirectories are volumes
29
33
  return OperatingSystem.WINDOWS, list(mft_root.iterdir())
30
34
 
@@ -143,6 +143,15 @@ class TargetCmd(cmd.Cmd):
143
143
 
144
144
  return cmd.Cmd.default(self, line)
145
145
 
146
+ def emptyline(self):
147
+ """This function forces Python's cmd.Cmd module to behave like a regular shell.
148
+
149
+ When entering an empty command, the cmd module will by default repeat the previous command.
150
+ By defining an empty ``emptyline`` function we make sure no command is executed instead.
151
+ See https://stackoverflow.com/a/16479030
152
+ """
153
+ pass
154
+
146
155
  def _exec(self, func, command_args_str):
147
156
  """
148
157
  Command execution helper that chains initial command and piped
@@ -720,6 +729,20 @@ class TargetCli(TargetCmd):
720
729
  shutil.copyfileobj(fh, stdout)
721
730
  stdout.flush()
722
731
 
732
+ @arg("path")
733
+ def cmd_zcat(self, args, stdout):
734
+ """print file content from compressed files"""
735
+ paths = self.resolveglobpath(args.path)
736
+ stdout = stdout.buffer
737
+ for path in paths:
738
+ path = self.checkfile(path)
739
+ if not path:
740
+ continue
741
+
742
+ fh = fsutil.open_decompress(path)
743
+ shutil.copyfileobj(fh, stdout)
744
+ stdout.flush()
745
+
723
746
  @arg("path")
724
747
  def cmd_hexdump(self, args, stdout):
725
748
  """print a hexdump of the first X bytes"""
@@ -748,6 +771,15 @@ class TargetCli(TargetCmd):
748
771
 
749
772
  pydoc.pager(path.open("rt", errors="ignore").read(10 * 1024 * 1024))
750
773
 
774
+ @arg("path")
775
+ def cmd_zless(self, args, stdout):
776
+ """open the first 10 MB of a compressed file with zless"""
777
+ path = self.checkfile(args.path)
778
+ if not path:
779
+ return
780
+
781
+ pydoc.pager(fsutil.open_decompress(path, "rt").read(10 * 1024 * 1024))
782
+
751
783
  @arg("path", nargs="+")
752
784
  def cmd_readlink(self, args, stdout):
753
785
  """print resolved symbolic links or canonical file names"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.target
3
- Version: 3.8.dev32
3
+ Version: 3.8.dev34
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
@@ -72,7 +72,7 @@ dissect/target/loaders/tar.py,sha256=55chcbh9CDTczSmSPJ3O1FrfpXaZTTPL28Oqih8rPOA
72
72
  dissect/target/loaders/target.py,sha256=mfkNz586eHb1PuzbwrvRPf9CcoPDLm5wPGFT1_rMH5s,662
73
73
  dissect/target/loaders/vb.py,sha256=CnQcn7bAkMzIB1y-lWLtPPXdIVsyeDaT6hTZEurjkV4,2072
74
74
  dissect/target/loaders/vbox.py,sha256=bOxsUiJ0IKx2GETs12FJkYChXBVatSkvWdLmhR5XPZc,691
75
- dissect/target/loaders/velociraptor.py,sha256=B6DrGhsHBgJBu1Wcd8eRTNTU5OsLvo9qNMEUM0p2caY,2143
75
+ dissect/target/loaders/velociraptor.py,sha256=rfZXTDm3eSgz29n1GOOswArdRsOf2ctJmSHb8RvCRQ0,2240
76
76
  dissect/target/loaders/vma.py,sha256=sWjkQrdq3zAJyckInhvJVsVfihoU4wLM25RMT8L2KWo,519
77
77
  dissect/target/loaders/vmx.py,sha256=By8AmbBmVd3U13oIZs9_0mVV3tpWNPoJBLmHZXqs1GE,740
78
78
  dissect/target/loaders/xva.py,sha256=66rsZGPwrLOaHtzou5oicYuOdIWQOeKtvvXsGm89dqg,544
@@ -240,7 +240,7 @@ dissect/target/tools/logging.py,sha256=5ZnumtMWLyslxfrUGZ4ntRyf3obOOhmn8SBjKfdLc
240
240
  dissect/target/tools/mount.py,sha256=oPjE954wRPnuhiXavoTSoZkMGKa5GpH9cMWZ3-piQd8,2320
241
241
  dissect/target/tools/query.py,sha256=Btt_PMVAWIYHhPLg0b8u5e_TDdG8CG5xapxLu82dbSE,11466
242
242
  dissect/target/tools/reg.py,sha256=37g_Xdb5ZbYAkMgQFmZNdKM_wWP9Bcw2Kk6quo1gwZ4,2147
243
- dissect/target/tools/shell.py,sha256=-zr5QaekJi7vXEnS_u8ua4KBSJm5TSJTIy6KlzFTvso,34908
243
+ dissect/target/tools/shell.py,sha256=HICeIN5kCZYyGmAm_riWO9xrGnQmOzSp-Oici4QeO6Y,36003
244
244
  dissect/target/tools/utils.py,sha256=i9gHb-_IK73NEiA9sKVCPkeY80lRj_RYpGXnsy_4Ak8,6727
245
245
  dissect/target/tools/dump/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
246
246
  dissect/target/tools/dump/run.py,sha256=yHn9xl_VjasgiuLpjtZdnLW32QCbkwHfnnTPY6Ck_aw,9689
@@ -251,10 +251,10 @@ dissect/target/volumes/bde.py,sha256=gYGg5yF9MNARwNzEkrEfZmKkxyZW4rhLkpdnPJCbhGk
251
251
  dissect/target/volumes/disk.py,sha256=95grSsPt1BLVpKwTclwQYzPFGKTkFFqapIk0RoGWf38,968
252
252
  dissect/target/volumes/lvm.py,sha256=zXAfszxNR6tOGrKAtAa_E-JhjI-sXQyR4VYLXD-kqCw,1616
253
253
  dissect/target/volumes/vmfs.py,sha256=mlAJ8278tYaoRjk1u6tFFlCaDQUrVu5ZZE4ikiFvxi8,1707
254
- dissect.target-3.8.dev32.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
255
- dissect.target-3.8.dev32.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
256
- dissect.target-3.8.dev32.dist-info/METADATA,sha256=Xxk_a-9Tb-0_dvcelF-C5KTFviYGegIYrD76c9l0JVA,9752
257
- dissect.target-3.8.dev32.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
258
- dissect.target-3.8.dev32.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
259
- dissect.target-3.8.dev32.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
260
- dissect.target-3.8.dev32.dist-info/RECORD,,
254
+ dissect.target-3.8.dev34.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
255
+ dissect.target-3.8.dev34.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
256
+ dissect.target-3.8.dev34.dist-info/METADATA,sha256=w87iqHAzoUqr5rasT7zTj2DHOnBqHTJK0SFJctHj9l8,9752
257
+ dissect.target-3.8.dev34.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
258
+ dissect.target-3.8.dev34.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
259
+ dissect.target-3.8.dev34.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
260
+ dissect.target-3.8.dev34.dist-info/RECORD,,