dissect.target 3.16.dev37__py3-none-any.whl → 3.16.dev39__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,12 +19,6 @@ WINDOWS_ACCESSORS = ["mft", "ntfs", "lazy_ntfs", "ntfs_vss", "auto"]
19
19
 
20
20
 
21
21
  def find_fs_directories(path: Path) -> tuple[Optional[OperatingSystem], Optional[list[Path]]]:
22
- # As of Velociraptor version 0.7.0 the structure of the Velociraptor Offline Collector varies by operating system.
23
- # Generic.Collectors.File (Unix) uses the accessors file and auto.
24
- # Generic.Collectors.File (Windows) and Windows.KapeFiles.Targets (Windows) uses the accessors
25
- # mft, ntfs, lazy_ntfs, ntfs_vss and auto. The loader only supports a collection where a single accessor is used.
26
- # For Windows usage of the ntfs_vss accessor can be forced by configuring VSSAnalysisAge to be greater than 0.
27
-
28
22
  fs_root = path.joinpath(FILESYSTEMS_ROOT)
29
23
 
30
24
  # Unix
@@ -43,6 +37,9 @@ def find_fs_directories(path: Path) -> tuple[Optional[OperatingSystem], Optional
43
37
  if accessor_root.exists():
44
38
  # If the accessor directory exists, assume all the subdirectories are volumes
45
39
  for volume in accessor_root.iterdir():
40
+ if not volume.is_dir():
41
+ continue
42
+
46
43
  # https://github.com/Velocidex/velociraptor/blob/87368e7cc678144592a1614bb3bbd0a0f900ded9/accessors/ntfs/vss.go#L82
47
44
  if "HarddiskVolumeShadowCopy" in volume.name:
48
45
  vss_volumes.add(volume)
@@ -60,6 +57,17 @@ def find_fs_directories(path: Path) -> tuple[Optional[OperatingSystem], Optional
60
57
  class VelociraptorLoader(DirLoader):
61
58
  """Load Rapid7 Velociraptor forensic image files.
62
59
 
60
+ As of Velociraptor version 0.7.0 the structure of the Velociraptor Offline Collector varies by operating system.
61
+ Generic.Collectors.File (Unix) uses the accessors file and auto. The loader supports the following configuration::
62
+
63
+ {"Generic.Collectors.File":{"Root":"/","collectionSpec":"Glob\\netc/**\\nvar/log/**"}}
64
+
65
+ Generic.Collectors.File (Windows) and Windows.KapeFiles.Targets (Windows) uses the accessors mft, ntfs, lazy_ntfs,
66
+ ntfs_vss and auto. The loader only supports a collection where a single accessor is used, which can be forced by
67
+ using the following configuration::
68
+
69
+ {"Windows.KapeFiles.Targets":{"VSSAnalysisAge":"1000","_SANS_Triage":"Y"}}
70
+
63
71
  References:
64
72
  - https://www.rapid7.com/products/velociraptor/
65
73
  - https://docs.velociraptor.app/
@@ -1,7 +1,7 @@
1
1
  import re
2
2
  from collections import OrderedDict
3
3
  from configparser import ConfigParser
4
- from os.path import basename
4
+ from functools import partial
5
5
  from pathlib import Path
6
6
  from typing import Iterator, Union
7
7
 
@@ -34,7 +34,7 @@ WireGuardPeerRecord = TargetRecordDescriptor(
34
34
  ("string", "name"),
35
35
  ("string", "public_key"),
36
36
  ("string", "pre_shared_key"),
37
- ("net.ipnetwork", "allowed_ips"),
37
+ ("net.ipnetwork[]", "allowed_ips"),
38
38
  ("string", "endpoint"),
39
39
  ("varint", "persistent_keep_alive"),
40
40
  ("string", "source"),
@@ -102,37 +102,42 @@ class WireGuardPlugin(Plugin):
102
102
 
103
103
  config = _parse_config(config_buf)
104
104
 
105
- for section in config.sections():
105
+ # Set up an iterator to go through all the sections and pre-set the fallback
106
+ config_iterator = ((section, partial(config.get, section, fallback=None)) for section in config.sections())
107
+
108
+ for section, config_dict in config_iterator:
106
109
  if "Interface" in section:
107
- if address := config.get(section, "Address", fallback=None):
110
+ if address := config_dict("Address"):
108
111
  address = address.split("/")[0]
109
- name = basename(config_path)
110
- name = self.TUNNEL_NAME_RE.sub("", name)
112
+
111
113
  yield WireGuardInterfaceRecord(
112
- name=name,
114
+ name=config_path.stem,
113
115
  address=address,
114
- listen_port=config.get(section, "ListenPort", fallback=None),
115
- private_key=config.get(section, "PrivateKey", fallback=None),
116
- fw_mark=config.get(section, "FwMark", fallback=None),
117
- dns=config.get(section, "DNS", fallback=None),
118
- table=config.get(section, "Table", fallback=None),
119
- mtu=config.get(section, "MTU", fallback=None),
120
- preup=config.get(section, "PreUp", fallback=None),
121
- postup=config.get(section, "PostUp", fallback=None),
122
- predown=config.get(section, "PreDown", fallback=None),
123
- postdown=config.get(section, "PostDown", fallback=None),
116
+ listen_port=config_dict("ListenPort"),
117
+ private_key=config_dict("PrivateKey"),
118
+ fw_mark=config_dict("FwMark"),
119
+ dns=config_dict("DNS"),
120
+ table=config_dict("Table"),
121
+ mtu=config_dict("MTU"),
122
+ preup=config_dict("PreUp"),
123
+ postup=config_dict("PostUp"),
124
+ predown=config_dict("PreDown"),
125
+ postdown=config_dict("PostDown"),
124
126
  source=config_path,
125
127
  _target=self.target,
126
128
  )
127
129
 
128
130
  if "Peer" in section:
131
+ if allowed_ips := config_dict("AllowedIPs"):
132
+ allowed_ips = [value.strip() for value in allowed_ips.split(",")]
133
+
129
134
  yield WireGuardPeerRecord(
130
- name=config.get(section, "Name", fallback=None),
131
- public_key=config.get(section, "PublicKey", fallback=None),
132
- pre_shared_key=config.get(section, "PreSharedKey", fallback=None),
133
- allowed_ips=config.get(section, "AllowedIPs", fallback=None),
134
- endpoint=config.get(section, "Endpoint", fallback=None),
135
- persistent_keep_alive=config.get(section, "PersistentKeepAlive", fallback=None),
135
+ name=config_dict("Name"),
136
+ public_key=config_dict("PublicKey"),
137
+ pre_shared_key=config_dict("PreSharedKey"),
138
+ allowed_ips=allowed_ips,
139
+ endpoint=config_dict("Endpoint"),
140
+ persistent_keep_alive=config_dict("PersistentKeepAlive"),
136
141
  source=config_path,
137
142
  _target=self.target,
138
143
  )
@@ -148,6 +153,8 @@ def _parse_config(content: str) -> ConfigParser:
148
153
  """
149
154
 
150
155
  cp = ConfigParser(defaults=None, dict_type=MultiDict, strict=False)
156
+ # Set to use str so it doesn't do any lower operation on the keys.
157
+ cp.optionxform = str
151
158
  cp.read_string(content)
152
159
  return cp
153
160
 
@@ -158,7 +165,7 @@ class MultiDict(OrderedDict):
158
165
  super().__init__(*args, **kwargs)
159
166
 
160
167
  def __setitem__(self, key, val):
161
- if isinstance(val, dict) and (key == "Peer" or key == "Interface"):
168
+ if isinstance(val, dict) and (key in ["Peer", "Interface"]):
162
169
  self._unique += 1
163
170
  key += str(self._unique)
164
171
  super().__setitem__(key, val)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.target
3
- Version: 3.16.dev37
3
+ Version: 3.16.dev39
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
@@ -102,7 +102,7 @@ dissect/target/loaders/targetd.py,sha256=sfbn2_j3il2G-rPywAoNT5YPtD5KmKkmBv1zrPD
102
102
  dissect/target/loaders/utm.py,sha256=e5x5ZI3HeL0STh4S-CaQb68Rnug4SVZR9zlmHaGFj0M,978
103
103
  dissect/target/loaders/vb.py,sha256=CnQcn7bAkMzIB1y-lWLtPPXdIVsyeDaT6hTZEurjkV4,2072
104
104
  dissect/target/loaders/vbox.py,sha256=8JD7D8iAY9JRvTHsrosp5ZMsZezuLhZ10Zt8sEL7KBI,732
105
- dissect/target/loaders/velociraptor.py,sha256=tikJEVCUDloWJNd5J3jJjNcVkOp-OnEe1O79DY2WLWw,4372
105
+ dissect/target/loaders/velociraptor.py,sha256=WPnDIWANIIUPgc-kfXSjXptCQ2pkcy1jdkEydiOvs58,4613
106
106
  dissect/target/loaders/vma.py,sha256=AAY5-s-nz6wgvmcFkptJD7nNXhpkdf6SqEKVOrJaIKs,644
107
107
  dissect/target/loaders/vmwarevm.py,sha256=1MlKoIuWSwpYmpuLxDuVacvaYHUhAGO1KgZxzrc4fyg,428
108
108
  dissect/target/loaders/vmx.py,sha256=o1rYYKu6ReleqqHf2aeRcNrmoRcngWZNhz1h7GlmggQ,962
@@ -137,7 +137,7 @@ dissect/target/plugins/apps/ssh/putty.py,sha256=N8ssjutUVN50JNA5fEIVISbP5sJ7bGTF
137
137
  dissect/target/plugins/apps/ssh/ssh.py,sha256=uCaoWlT2bgKLUHA1aL6XymJDWJ8JmLsN8PB1C66eidY,1409
138
138
  dissect/target/plugins/apps/vpn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
139
139
  dissect/target/plugins/apps/vpn/openvpn.py,sha256=NZeFSFgGAifevGIQBusdbBRFOPxu0584Th8rKE-XSus,6875
140
- dissect/target/plugins/apps/vpn/wireguard.py,sha256=45WvCqQQGrG3DVDH5ghcsGpM_BomF4RcTLzcIvnyuNs,6554
140
+ dissect/target/plugins/apps/vpn/wireguard.py,sha256=SoAMED_bwWJQ3nci5qEY-qV4wJKSSDZQ8K7DoJRYq0k,6521
141
141
  dissect/target/plugins/apps/webhosting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
142
142
  dissect/target/plugins/apps/webhosting/cpanel.py,sha256=OeFQnu9GmpffIlFyK-AR2Qf8tjyMhazWEAUyccDU5y0,2979
143
143
  dissect/target/plugins/apps/webserver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -332,10 +332,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
332
332
  dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
333
333
  dissect/target/volumes/md.py,sha256=j1K1iKmspl0C_OJFc7-Q1BMWN2OCC5EVANIgVlJ_fIE,1673
334
334
  dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
335
- dissect.target-3.16.dev37.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
336
- dissect.target-3.16.dev37.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
337
- dissect.target-3.16.dev37.dist-info/METADATA,sha256=Zksa2i_x7GaCd7AE8DnKxPk_uAeWgFPL7FrzDkvp4qE,11107
338
- dissect.target-3.16.dev37.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
339
- dissect.target-3.16.dev37.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
340
- dissect.target-3.16.dev37.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
341
- dissect.target-3.16.dev37.dist-info/RECORD,,
335
+ dissect.target-3.16.dev39.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
336
+ dissect.target-3.16.dev39.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
337
+ dissect.target-3.16.dev39.dist-info/METADATA,sha256=ngLz4XeexsGKv4urTocePElt3tx1Jpc0yxVHs1FcGWU,11107
338
+ dissect.target-3.16.dev39.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
339
+ dissect.target-3.16.dev39.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
340
+ dissect.target-3.16.dev39.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
341
+ dissect.target-3.16.dev39.dist-info/RECORD,,