dissect.target 3.13.dev26__py3-none-any.whl → 3.14__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. dissect/target/container.py +9 -1
  2. dissect/target/containers/asdf.py +2 -0
  3. dissect/target/containers/ewf.py +2 -0
  4. dissect/target/containers/hdd.py +2 -0
  5. dissect/target/containers/hds.py +2 -0
  6. dissect/target/containers/qcow2.py +2 -0
  7. dissect/target/containers/raw.py +2 -0
  8. dissect/target/containers/split.py +2 -0
  9. dissect/target/containers/vdi.py +2 -0
  10. dissect/target/containers/vhd.py +2 -0
  11. dissect/target/containers/vhdx.py +2 -0
  12. dissect/target/containers/vmdk.py +2 -0
  13. dissect/target/filesystem.py +108 -15
  14. dissect/target/filesystems/ad1.py +1 -1
  15. dissect/target/filesystems/btrfs.py +180 -0
  16. dissect/target/filesystems/cb.py +4 -4
  17. dissect/target/filesystems/config.py +161 -31
  18. dissect/target/filesystems/dir.py +1 -1
  19. dissect/target/filesystems/exfat.py +1 -1
  20. dissect/target/filesystems/extfs.py +5 -1
  21. dissect/target/filesystems/fat.py +1 -1
  22. dissect/target/filesystems/ffs.py +1 -1
  23. dissect/target/filesystems/itunes.py +1 -1
  24. dissect/target/filesystems/ntfs.py +1 -1
  25. dissect/target/filesystems/smb.py +1 -1
  26. dissect/target/filesystems/squashfs.py +1 -1
  27. dissect/target/filesystems/tar.py +1 -1
  28. dissect/target/filesystems/vmfs.py +1 -1
  29. dissect/target/filesystems/xfs.py +1 -1
  30. dissect/target/filesystems/zip.py +1 -1
  31. dissect/target/helpers/cache.py +2 -2
  32. dissect/target/helpers/configutil.py +283 -83
  33. dissect/target/helpers/fsutil.py +9 -6
  34. dissect/target/helpers/hashutil.py +20 -19
  35. dissect/target/helpers/utils.py +14 -3
  36. dissect/target/loaders/ad1.py +1 -1
  37. dissect/target/loaders/asdf.py +1 -1
  38. dissect/target/loaders/log.py +2 -2
  39. dissect/target/loaders/smb.py +23 -13
  40. dissect/target/loaders/targetd.py +12 -2
  41. dissect/target/loaders/vma.py +1 -1
  42. dissect/target/loaders/xva.py +1 -1
  43. dissect/target/plugin.py +14 -2
  44. dissect/target/plugins/apps/av/sophos.py +1 -2
  45. dissect/target/plugins/apps/av/symantec.py +3 -4
  46. dissect/target/plugins/apps/av/trendmicro.py +2 -3
  47. dissect/target/plugins/{browsers → apps/browser}/chrome.py +6 -3
  48. dissect/target/plugins/{browsers → apps/browser}/chromium.py +18 -13
  49. dissect/target/plugins/{browsers → apps/browser}/edge.py +6 -3
  50. dissect/target/plugins/{browsers → apps/browser}/firefox.py +3 -7
  51. dissect/target/plugins/{browsers → apps/browser}/iexplore.py +14 -4
  52. dissect/target/plugins/apps/remoteaccess/teamviewer.py +55 -27
  53. dissect/target/plugins/apps/ssh/opensshd.py +31 -30
  54. dissect/target/plugins/apps/{webservers → webserver}/apache.py +1 -1
  55. dissect/target/plugins/apps/{webservers → webserver}/caddy.py +1 -1
  56. dissect/target/plugins/apps/{webservers → webserver}/iis.py +1 -1
  57. dissect/target/plugins/apps/{webservers → webserver}/nginx.py +1 -1
  58. dissect/target/plugins/child/hyperv.py +1 -2
  59. dissect/target/plugins/child/vmware_workstation.py +1 -3
  60. dissect/target/plugins/filesystem/acquire_handles.py +2 -0
  61. dissect/target/plugins/filesystem/acquire_hash.py +1 -7
  62. dissect/target/plugins/filesystem/icat.py +5 -5
  63. dissect/target/plugins/filesystem/ntfs/mft.py +2 -2
  64. dissect/target/plugins/filesystem/ntfs/mft_timeline.py +2 -2
  65. dissect/target/plugins/filesystem/ntfs/usnjrnl.py +2 -3
  66. dissect/target/plugins/filesystem/resolver.py +1 -1
  67. dissect/target/plugins/filesystem/unix/capability.py +77 -66
  68. dissect/target/plugins/filesystem/walkfs.py +25 -19
  69. dissect/target/plugins/filesystem/yara.py +20 -19
  70. dissect/target/plugins/general/config.py +28 -11
  71. dissect/target/plugins/os/unix/_os.py +28 -21
  72. dissect/target/plugins/os/unix/bsd/osx/user.py +1 -3
  73. dissect/target/plugins/os/unix/cronjobs.py +4 -16
  74. dissect/target/plugins/os/unix/{linux/esxi → esxi}/_os.py +5 -6
  75. dissect/target/plugins/os/unix/generic.py +5 -1
  76. dissect/target/plugins/os/unix/history.py +2 -1
  77. dissect/target/plugins/os/unix/linux/_os.py +12 -5
  78. dissect/target/plugins/os/unix/linux/services.py +112 -0
  79. dissect/target/plugins/os/unix/linux/suse/zypper.py +4 -4
  80. dissect/target/plugins/os/unix/locale.py +3 -1
  81. dissect/target/plugins/os/unix/log/journal.py +7 -6
  82. dissect/target/plugins/os/unix/packagemanager.py +3 -3
  83. dissect/target/plugins/os/unix/shadow.py +1 -1
  84. dissect/target/plugins/os/windows/_os.py +2 -1
  85. dissect/target/plugins/os/windows/amcache.py +9 -10
  86. dissect/target/plugins/os/windows/catroot.py +2 -2
  87. dissect/target/plugins/os/windows/cim.py +5 -4
  88. dissect/target/plugins/os/windows/datetime.py +4 -1
  89. dissect/target/plugins/os/windows/defender.py +3 -3
  90. dissect/target/plugins/os/windows/generic.py +10 -11
  91. dissect/target/plugins/os/windows/lnk.py +6 -6
  92. dissect/target/plugins/os/windows/log/amcache.py +3 -5
  93. dissect/target/plugins/os/windows/log/pfro.py +1 -3
  94. dissect/target/plugins/os/windows/prefetch.py +5 -6
  95. dissect/target/plugins/os/windows/recyclebin.py +3 -4
  96. dissect/target/plugins/os/windows/regf/7zip.py +2 -4
  97. dissect/target/plugins/os/windows/regf/bam.py +1 -2
  98. dissect/target/plugins/os/windows/regf/cit.py +4 -5
  99. dissect/target/plugins/os/windows/regf/mru.py +6 -2
  100. dissect/target/plugins/os/windows/regf/muicache.py +1 -3
  101. dissect/target/plugins/os/windows/regf/recentfilecache.py +1 -2
  102. dissect/target/plugins/os/windows/regf/shimcache.py +1 -2
  103. dissect/target/plugins/os/windows/regf/trusteddocs.py +1 -1
  104. dissect/target/plugins/os/windows/regf/userassist.py +1 -2
  105. dissect/target/plugins/os/windows/services.py +2 -4
  106. dissect/target/plugins/os/windows/sru.py +4 -4
  107. dissect/target/plugins/os/windows/startupinfo.py +5 -6
  108. dissect/target/plugins/os/windows/syscache.py +2 -3
  109. dissect/target/target.py +65 -32
  110. dissect/target/tools/info.py +2 -1
  111. dissect/target/tools/mount.py +2 -12
  112. dissect/target/tools/shell.py +3 -2
  113. dissect/target/volume.py +10 -9
  114. dissect/target/volumes/bde.py +1 -1
  115. dissect/target/volumes/ddf.py +2 -0
  116. dissect/target/volumes/disk.py +2 -0
  117. dissect/target/volumes/luks.py +1 -1
  118. dissect/target/volumes/lvm.py +2 -0
  119. dissect/target/volumes/md.py +2 -0
  120. dissect/target/volumes/vmfs.py +2 -0
  121. {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/METADATA +2 -1
  122. {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/RECORD +137 -136
  123. {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/WHEEL +1 -1
  124. dissect/target/plugins/os/unix/services.py +0 -151
  125. /dissect/target/plugins/apps/{containers → browser}/__init__.py +0 -0
  126. /dissect/target/plugins/{browsers → apps/browser}/browser.py +0 -0
  127. /dissect/target/plugins/apps/{vpns → container}/__init__.py +0 -0
  128. /dissect/target/plugins/apps/{containers → container}/docker.py +0 -0
  129. /dissect/target/plugins/apps/{webservers → vpn}/__init__.py +0 -0
  130. /dissect/target/plugins/apps/{vpns → vpn}/openvpn.py +0 -0
  131. /dissect/target/plugins/apps/{vpns → vpn}/wireguard.py +0 -0
  132. /dissect/target/plugins/{browsers → apps/webserver}/__init__.py +0 -0
  133. /dissect/target/plugins/apps/{webservers/webservers.py → webserver/webserver.py} +0 -0
  134. /dissect/target/plugins/os/unix/{linux/esxi → esxi}/__init__.py +0 -0
  135. {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/COPYRIGHT +0 -0
  136. {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/LICENSE +0 -0
  137. {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/entry_points.txt +0 -0
  138. {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/top_level.txt +0 -0
@@ -1,151 +0,0 @@
1
- import io
2
- import re
3
- from configparser import ConfigParser
4
- from itertools import chain
5
- from typing import Iterator, TextIO
6
-
7
- from dissect.target.exceptions import FileNotFoundError, UnsupportedPluginError
8
- from dissect.target.helpers.record import TargetRecordDescriptor
9
- from dissect.target.plugin import Plugin, export, internal
10
-
11
- LinuxServiceRecord = TargetRecordDescriptor(
12
- "linux/service",
13
- [
14
- ("datetime", "ts"),
15
- ("string", "name"),
16
- ("string", "config"),
17
- ("path", "source"),
18
- ],
19
- )
20
-
21
-
22
- class ServicesPlugin(Plugin):
23
- SYSTEMD_PATHS = [
24
- "/etc/systemd/system",
25
- "/lib/systemd/system",
26
- "/usr/lib/systemd/system",
27
- ]
28
-
29
- INITD_PATHS = ["/etc/rc.d/init.d", "/etc/init.d"]
30
-
31
- def check_compatible(self) -> None:
32
- if not any([self.target.fs.path(p).exists() for p in self.SYSTEMD_PATHS + self.INITD_PATHS]):
33
- raise UnsupportedPluginError("No supported service directories found")
34
-
35
- @export(record=LinuxServiceRecord)
36
- def services(self) -> Iterator[LinuxServiceRecord]:
37
- """Return information about all installed systemd and init.d services.
38
-
39
- References:
40
- - https://geeksforgeeks.org/what-is-init-d-in-linux-service-management
41
- - http://0pointer.de/blog/projects/systemd-for-admins-3.html
42
- - https://www.freedesktop.org/software/systemd/man/systemd.syntax.html
43
- """
44
-
45
- return chain(self.systemd(), self.initd())
46
-
47
- @internal
48
- def systemd(self) -> Iterator[LinuxServiceRecord]:
49
- ignored_suffixes = [".wants", ".requires", ".d"]
50
-
51
- for systemd_path in self.SYSTEMD_PATHS:
52
- path = self.target.fs.path(systemd_path)
53
- if not path.exists() or not path.is_dir():
54
- continue
55
-
56
- for service_file in path.iterdir():
57
- if should_ignore_file(service_file.name, ignored_suffixes):
58
- continue
59
-
60
- try:
61
- with service_file.open("rt") as fh:
62
- config = parse_systemd_config(fh)
63
- except FileNotFoundError:
64
- # The service is registered but the symlink is broken.
65
- yield LinuxServiceRecord(
66
- ts=service_file.stat(follow_symlinks=False).st_mtime,
67
- name=service_file.name,
68
- config=None,
69
- source=service_file,
70
- _target=self.target,
71
- )
72
- continue
73
-
74
- yield LinuxServiceRecord(
75
- ts=service_file.stat().st_mtime,
76
- name=service_file.name,
77
- config=config,
78
- source=service_file,
79
- _target=self.target,
80
- )
81
-
82
- @internal
83
- def initd(self) -> Iterator[LinuxServiceRecord]:
84
- ignored_suffixes = ["README"]
85
-
86
- for initd_path in self.INITD_PATHS:
87
- path = self.target.fs.path(initd_path)
88
-
89
- if path.exists():
90
- for file_ in path.iterdir():
91
- if should_ignore_file(file_.name, ignored_suffixes):
92
- continue
93
-
94
- yield LinuxServiceRecord(
95
- ts=file_.stat().st_mtime,
96
- name=file_.name,
97
- config=None,
98
- source=file_,
99
- _target=self.target,
100
- )
101
-
102
-
103
- def should_ignore_file(needle: str, haystack: list) -> bool:
104
- for stray in haystack:
105
- if needle.endswith(stray):
106
- return True
107
- return False
108
-
109
-
110
- def parse_systemd_config(fh: TextIO) -> str:
111
- """Returns a string of key/value pairs from a toml/ini-like string.
112
-
113
- This should probably be rewritten to return a proper dict as in
114
- its current form this is only useful when used in Splunk.
115
- """
116
- parser = ConfigParser(strict=False, delimiters=("=",), allow_no_value=True, interpolation=None)
117
- # to preserve casing from configuration.
118
- parser.optionxform = str
119
- parser.read_file(fh)
120
-
121
- output = io.StringIO()
122
- try:
123
- for segment, configuration in parser.items():
124
- original_key = ""
125
- previous_value = ""
126
- concat_value = False
127
- for key, value in configuration.items():
128
- original_key = original_key or key
129
-
130
- if concat_value:
131
- # A backslash was found at the end of the previous line
132
- # If value is None, it might not contain a backslash
133
- # So we turn it into an empty string.
134
- value = f"{previous_value} {key} {value or ''}".strip()
135
-
136
- concat_value = str(value).endswith("\\")
137
- if concat_value:
138
- # Remove any dangling empty space or backslashes
139
- previous_value = value.rstrip("\\ ")
140
- else:
141
- output.write(f'{segment}_{original_key or key}="{value}" ')
142
- original_key = ""
143
- previous_value = ""
144
-
145
- except UnicodeDecodeError:
146
- pass
147
-
148
- output_data = output.getvalue()
149
- # Remove any back slashes or new line characters.
150
- output_data = re.sub(r"(\\|\n)", "", output_data)
151
- return output_data.strip()
File without changes
File without changes