dissect.target 3.20.dev56__py3-none-any.whl → 3.20.dev57__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ from typing import Iterator
4
4
 
5
5
  from defusedxml import ElementTree
6
6
  from dissect.util.ts import wintimestamp
7
+ from flow.record.base import is_valid_field_name
7
8
 
8
9
  from dissect.target.exceptions import UnsupportedPluginError
9
10
  from dissect.target.helpers.fsutil import Path
@@ -11,7 +12,9 @@ from dissect.target.helpers.record import DynamicDescriptor, TargetRecordDescrip
11
12
  from dissect.target.plugin import Plugin, export
12
13
  from dissect.target.target import Target
13
14
 
14
- camel_case_patterns = [re.compile(r"(\S)([A-Z][a-z]+)"), re.compile(r"([a-z0-9])([A-Z])"), re.compile(r"(\w)[.\s](\w)")]
15
+ CAMEL_CASE_PATTERNS = [re.compile(r"(\S)([A-Z][a-z]+)"), re.compile(r"([a-z0-9])([A-Z])"), re.compile(r"(\w)[.\s](\w)")]
16
+ RE_VALID_KEY_START_CHARS = re.compile(r"[a-zA-Z]")
17
+ RE_VALID_KEY_CHARS = re.compile(r"[a-zA-Z0-9_]")
15
18
 
16
19
 
17
20
  def _create_record_descriptor(record_name: str, record_fields: list[tuple[str, str]]) -> TargetRecordDescriptor:
@@ -49,13 +52,25 @@ class WindowsErrorReportingPlugin(Plugin):
49
52
 
50
53
  def _sanitize_key(self, key: str) -> str:
51
54
  # Convert camel case to snake case
52
- for pattern in camel_case_patterns:
55
+ for pattern in CAMEL_CASE_PATTERNS:
53
56
  key = pattern.sub(r"\1_\2", key)
54
57
 
55
- # Keep only basic characters in key
56
- key = re.sub(r"[^a-zA-Z0-9_]", "", key)
57
-
58
- return key.lower()
58
+ clean_key = ""
59
+ separator = "_"
60
+ prev_encoded = False
61
+ for idx, char in enumerate(key):
62
+ if prev_encoded:
63
+ clean_key += separator
64
+ clean_key += char
65
+ if not is_valid_field_name(clean_key):
66
+ clean_key = clean_key[:-1]
67
+ prefix = f"{separator}x" if (idx != 0 and not prev_encoded) else "x"
68
+ clean_key += prefix + char.encode("utf-8").hex()
69
+ prev_encoded = True
70
+ else:
71
+ prev_encoded = False
72
+
73
+ return clean_key.lower()
59
74
 
60
75
  def _collect_wer_data(self, wer_file: Path) -> tuple[list[tuple[str, str]], dict[str, str]]:
61
76
  """Parse data from a .wer file."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.target
3
- Version: 3.20.dev56
3
+ Version: 3.20.dev57
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
@@ -300,7 +300,7 @@ dissect/target/plugins/os/windows/syscache.py,sha256=SXJxwyC34WPUpo0zGqbthdLPSPC
300
300
  dissect/target/plugins/os/windows/tasks.py,sha256=Bpy3tosncnFuGRqomEtB1jwJCVehZq4suhUznjtq4wo,5718
301
301
  dissect/target/plugins/os/windows/thumbcache.py,sha256=jAceapDdP9bNLGZchJ1l1okm7_7xiYHRbI2hVGAzMPk,4249
302
302
  dissect/target/plugins/os/windows/ual.py,sha256=S43ltndKKrs2SqeDLgZv4dzdqtJD8c3Y0Z8FK-Y9IOA,10076
303
- dissect/target/plugins/os/windows/wer.py,sha256=ogecvKYxAvDXLptQj4cn0JLn1FxaXjeSuJWs4JgkoZs,8656
303
+ dissect/target/plugins/os/windows/wer.py,sha256=y4ZU6Yai53UsZ4VLr0V9_uLhZJZ_UEtdPuNzxKbGoEY,9269
304
304
  dissect/target/plugins/os/windows/wua_history.py,sha256=QNtOQNZWKsKyUUrUV8aeoAMDKoH-ERkLx8ahnJzpHCY,54783
305
305
  dissect/target/plugins/os/windows/credential/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
306
306
  dissect/target/plugins/os/windows/credential/credhist.py,sha256=YSjuyd53Augdy_lKKzZHtx5Ozt0HzF6LDYIOb-8P1Pw,7058
@@ -378,10 +378,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
378
378
  dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
379
379
  dissect/target/volumes/md.py,sha256=7ShPtusuLGaIv27SvEETtgsuoQyAa4iAAeOR1NEaajI,1689
380
380
  dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
381
- dissect.target-3.20.dev56.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
382
- dissect.target-3.20.dev56.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
383
- dissect.target-3.20.dev56.dist-info/METADATA,sha256=BlpmEoddfX21zZoE-HnEubfrUSK46Ebc6kZsbYuK24o,13025
384
- dissect.target-3.20.dev56.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
385
- dissect.target-3.20.dev56.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
386
- dissect.target-3.20.dev56.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
387
- dissect.target-3.20.dev56.dist-info/RECORD,,
381
+ dissect.target-3.20.dev57.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
382
+ dissect.target-3.20.dev57.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
383
+ dissect.target-3.20.dev57.dist-info/METADATA,sha256=6Sf6uGhjSx0idsxYz-GPwrPZBOFzZQ4f0oZsPlHjFhE,13025
384
+ dissect.target-3.20.dev57.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
385
+ dissect.target-3.20.dev57.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
386
+ dissect.target-3.20.dev57.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
387
+ dissect.target-3.20.dev57.dist-info/RECORD,,