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.
- dissect/target/container.py +9 -1
- dissect/target/containers/asdf.py +2 -0
- dissect/target/containers/ewf.py +2 -0
- dissect/target/containers/hdd.py +2 -0
- dissect/target/containers/hds.py +2 -0
- dissect/target/containers/qcow2.py +2 -0
- dissect/target/containers/raw.py +2 -0
- dissect/target/containers/split.py +2 -0
- dissect/target/containers/vdi.py +2 -0
- dissect/target/containers/vhd.py +2 -0
- dissect/target/containers/vhdx.py +2 -0
- dissect/target/containers/vmdk.py +2 -0
- dissect/target/filesystem.py +108 -15
- dissect/target/filesystems/ad1.py +1 -1
- dissect/target/filesystems/btrfs.py +180 -0
- dissect/target/filesystems/cb.py +4 -4
- dissect/target/filesystems/config.py +161 -31
- dissect/target/filesystems/dir.py +1 -1
- dissect/target/filesystems/exfat.py +1 -1
- dissect/target/filesystems/extfs.py +5 -1
- dissect/target/filesystems/fat.py +1 -1
- dissect/target/filesystems/ffs.py +1 -1
- dissect/target/filesystems/itunes.py +1 -1
- dissect/target/filesystems/ntfs.py +1 -1
- dissect/target/filesystems/smb.py +1 -1
- dissect/target/filesystems/squashfs.py +1 -1
- dissect/target/filesystems/tar.py +1 -1
- dissect/target/filesystems/vmfs.py +1 -1
- dissect/target/filesystems/xfs.py +1 -1
- dissect/target/filesystems/zip.py +1 -1
- dissect/target/helpers/cache.py +2 -2
- dissect/target/helpers/configutil.py +283 -83
- dissect/target/helpers/fsutil.py +9 -6
- dissect/target/helpers/hashutil.py +20 -19
- dissect/target/helpers/utils.py +14 -3
- dissect/target/loaders/ad1.py +1 -1
- dissect/target/loaders/asdf.py +1 -1
- dissect/target/loaders/log.py +2 -2
- dissect/target/loaders/smb.py +23 -13
- dissect/target/loaders/targetd.py +12 -2
- dissect/target/loaders/vma.py +1 -1
- dissect/target/loaders/xva.py +1 -1
- dissect/target/plugin.py +14 -2
- dissect/target/plugins/apps/av/sophos.py +1 -2
- dissect/target/plugins/apps/av/symantec.py +3 -4
- dissect/target/plugins/apps/av/trendmicro.py +2 -3
- dissect/target/plugins/{browsers → apps/browser}/chrome.py +6 -3
- dissect/target/plugins/{browsers → apps/browser}/chromium.py +18 -13
- dissect/target/plugins/{browsers → apps/browser}/edge.py +6 -3
- dissect/target/plugins/{browsers → apps/browser}/firefox.py +3 -7
- dissect/target/plugins/{browsers → apps/browser}/iexplore.py +14 -4
- dissect/target/plugins/apps/remoteaccess/teamviewer.py +55 -27
- dissect/target/plugins/apps/ssh/opensshd.py +31 -30
- dissect/target/plugins/apps/{webservers → webserver}/apache.py +1 -1
- dissect/target/plugins/apps/{webservers → webserver}/caddy.py +1 -1
- dissect/target/plugins/apps/{webservers → webserver}/iis.py +1 -1
- dissect/target/plugins/apps/{webservers → webserver}/nginx.py +1 -1
- dissect/target/plugins/child/hyperv.py +1 -2
- dissect/target/plugins/child/vmware_workstation.py +1 -3
- dissect/target/plugins/filesystem/acquire_handles.py +2 -0
- dissect/target/plugins/filesystem/acquire_hash.py +1 -7
- dissect/target/plugins/filesystem/icat.py +5 -5
- dissect/target/plugins/filesystem/ntfs/mft.py +2 -2
- dissect/target/plugins/filesystem/ntfs/mft_timeline.py +2 -2
- dissect/target/plugins/filesystem/ntfs/usnjrnl.py +2 -3
- dissect/target/plugins/filesystem/resolver.py +1 -1
- dissect/target/plugins/filesystem/unix/capability.py +77 -66
- dissect/target/plugins/filesystem/walkfs.py +25 -19
- dissect/target/plugins/filesystem/yara.py +20 -19
- dissect/target/plugins/general/config.py +28 -11
- dissect/target/plugins/os/unix/_os.py +28 -21
- dissect/target/plugins/os/unix/bsd/osx/user.py +1 -3
- dissect/target/plugins/os/unix/cronjobs.py +4 -16
- dissect/target/plugins/os/unix/{linux/esxi → esxi}/_os.py +5 -6
- dissect/target/plugins/os/unix/generic.py +5 -1
- dissect/target/plugins/os/unix/history.py +2 -1
- dissect/target/plugins/os/unix/linux/_os.py +12 -5
- dissect/target/plugins/os/unix/linux/services.py +112 -0
- dissect/target/plugins/os/unix/linux/suse/zypper.py +4 -4
- dissect/target/plugins/os/unix/locale.py +3 -1
- dissect/target/plugins/os/unix/log/journal.py +7 -6
- dissect/target/plugins/os/unix/packagemanager.py +3 -3
- dissect/target/plugins/os/unix/shadow.py +1 -1
- dissect/target/plugins/os/windows/_os.py +2 -1
- dissect/target/plugins/os/windows/amcache.py +9 -10
- dissect/target/plugins/os/windows/catroot.py +2 -2
- dissect/target/plugins/os/windows/cim.py +5 -4
- dissect/target/plugins/os/windows/datetime.py +4 -1
- dissect/target/plugins/os/windows/defender.py +3 -3
- dissect/target/plugins/os/windows/generic.py +10 -11
- dissect/target/plugins/os/windows/lnk.py +6 -6
- dissect/target/plugins/os/windows/log/amcache.py +3 -5
- dissect/target/plugins/os/windows/log/pfro.py +1 -3
- dissect/target/plugins/os/windows/prefetch.py +5 -6
- dissect/target/plugins/os/windows/recyclebin.py +3 -4
- dissect/target/plugins/os/windows/regf/7zip.py +2 -4
- dissect/target/plugins/os/windows/regf/bam.py +1 -2
- dissect/target/plugins/os/windows/regf/cit.py +4 -5
- dissect/target/plugins/os/windows/regf/mru.py +6 -2
- dissect/target/plugins/os/windows/regf/muicache.py +1 -3
- dissect/target/plugins/os/windows/regf/recentfilecache.py +1 -2
- dissect/target/plugins/os/windows/regf/shimcache.py +1 -2
- dissect/target/plugins/os/windows/regf/trusteddocs.py +1 -1
- dissect/target/plugins/os/windows/regf/userassist.py +1 -2
- dissect/target/plugins/os/windows/services.py +2 -4
- dissect/target/plugins/os/windows/sru.py +4 -4
- dissect/target/plugins/os/windows/startupinfo.py +5 -6
- dissect/target/plugins/os/windows/syscache.py +2 -3
- dissect/target/target.py +65 -32
- dissect/target/tools/info.py +2 -1
- dissect/target/tools/mount.py +2 -12
- dissect/target/tools/shell.py +3 -2
- dissect/target/volume.py +10 -9
- dissect/target/volumes/bde.py +1 -1
- dissect/target/volumes/ddf.py +2 -0
- dissect/target/volumes/disk.py +2 -0
- dissect/target/volumes/luks.py +1 -1
- dissect/target/volumes/lvm.py +2 -0
- dissect/target/volumes/md.py +2 -0
- dissect/target/volumes/vmfs.py +2 -0
- {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/METADATA +2 -1
- {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/RECORD +137 -136
- {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/WHEEL +1 -1
- dissect/target/plugins/os/unix/services.py +0 -151
- /dissect/target/plugins/apps/{containers → browser}/__init__.py +0 -0
- /dissect/target/plugins/{browsers → apps/browser}/browser.py +0 -0
- /dissect/target/plugins/apps/{vpns → container}/__init__.py +0 -0
- /dissect/target/plugins/apps/{containers → container}/docker.py +0 -0
- /dissect/target/plugins/apps/{webservers → vpn}/__init__.py +0 -0
- /dissect/target/plugins/apps/{vpns → vpn}/openvpn.py +0 -0
- /dissect/target/plugins/apps/{vpns → vpn}/wireguard.py +0 -0
- /dissect/target/plugins/{browsers → apps/webserver}/__init__.py +0 -0
- /dissect/target/plugins/apps/{webservers/webservers.py → webserver/webserver.py} +0 -0
- /dissect/target/plugins/os/unix/{linux/esxi → esxi}/__init__.py +0 -0
- {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/COPYRIGHT +0 -0
- {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/LICENSE +0 -0
- {dissect.target-3.13.dev26.dist-info → dissect.target-3.14.dist-info}/entry_points.txt +0 -0
- {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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|