dissect.target 3.19.dev57__py3-none-any.whl → 3.20__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. dissect/target/container.py +1 -1
  2. dissect/target/exceptions.py +6 -5
  3. dissect/target/filesystem.py +2 -2
  4. dissect/target/filesystems/btrfs.py +14 -5
  5. dissect/target/filesystems/config.py +5 -1
  6. dissect/target/filesystems/extfs.py +5 -4
  7. dissect/target/filesystems/fat.py +22 -16
  8. dissect/target/filesystems/ffs.py +11 -4
  9. dissect/target/filesystems/jffs.py +12 -7
  10. dissect/target/filesystems/ntfs.py +22 -6
  11. dissect/target/filesystems/overlay.py +14 -4
  12. dissect/target/filesystems/smb.py +3 -3
  13. dissect/target/filesystems/squashfs.py +4 -4
  14. dissect/target/filesystems/vmfs.py +4 -4
  15. dissect/target/filesystems/xfs.py +15 -8
  16. dissect/target/helpers/compat/path_common.py +5 -5
  17. dissect/target/helpers/configutil.py +128 -32
  18. dissect/target/helpers/cyber.py +2 -0
  19. dissect/target/helpers/data/windowsZones.xml +19 -23
  20. dissect/target/helpers/docs.py +1 -1
  21. dissect/target/helpers/keychain.py +2 -0
  22. dissect/target/helpers/mount.py +2 -1
  23. dissect/target/helpers/record.py +29 -2
  24. dissect/target/helpers/record_modifier.py +5 -1
  25. dissect/target/helpers/regutil.py +56 -26
  26. dissect/target/loader.py +1 -1
  27. dissect/target/loaders/mqtt.py +104 -9
  28. dissect/target/loaders/proxmox.py +68 -0
  29. dissect/target/loaders/vma.py +1 -1
  30. dissect/target/loaders/xva.py +1 -1
  31. dissect/target/plugin.py +24 -21
  32. dissect/target/plugins/apps/av/mcafee.py +2 -0
  33. dissect/target/plugins/apps/av/sophos.py +2 -0
  34. dissect/target/plugins/apps/av/trendmicro.py +2 -0
  35. dissect/target/plugins/apps/browser/chromium.py +27 -6
  36. dissect/target/plugins/apps/container/docker.py +48 -32
  37. dissect/target/plugins/apps/editor/__init__.py +0 -0
  38. dissect/target/plugins/apps/editor/editor.py +23 -0
  39. dissect/target/plugins/apps/{texteditor → editor}/windowsnotepad.py +40 -31
  40. dissect/target/plugins/apps/other/__init__.py +0 -0
  41. dissect/target/plugins/apps/other/env.py +56 -0
  42. dissect/target/plugins/apps/shell/powershell.py +6 -2
  43. dissect/target/plugins/apps/shell/wget.py +91 -0
  44. dissect/target/plugins/apps/ssh/openssh.py +2 -0
  45. dissect/target/plugins/apps/ssh/opensshd.py +2 -0
  46. dissect/target/plugins/apps/virtualization/__init__.py +0 -0
  47. dissect/target/plugins/apps/virtualization/vmware_workstation.py +61 -0
  48. dissect/target/plugins/apps/vpn/wireguard.py +9 -9
  49. dissect/target/plugins/apps/webhosting/cpanel.py +2 -0
  50. dissect/target/plugins/apps/webserver/caddy.py +2 -0
  51. dissect/target/plugins/apps/webserver/nginx.py +2 -0
  52. dissect/target/plugins/child/esxi.py +3 -1
  53. dissect/target/plugins/child/parallels.py +68 -0
  54. dissect/target/plugins/child/proxmox.py +23 -0
  55. dissect/target/plugins/child/virtuozzo.py +12 -8
  56. dissect/target/plugins/child/vmware_workstation.py +23 -8
  57. dissect/target/plugins/filesystem/acquire_hash.py +2 -1
  58. dissect/target/plugins/filesystem/icat.py +15 -11
  59. dissect/target/plugins/filesystem/ntfs/mft.py +10 -6
  60. dissect/target/plugins/filesystem/ntfs/mft_timeline.py +3 -1
  61. dissect/target/plugins/filesystem/ntfs/usnjrnl.py +2 -0
  62. dissect/target/plugins/filesystem/ntfs/utils.py +3 -1
  63. dissect/target/plugins/filesystem/unix/suid.py +4 -1
  64. dissect/target/plugins/filesystem/walkfs.py +2 -0
  65. dissect/target/plugins/general/example.py +2 -2
  66. dissect/target/plugins/general/loaders.py +18 -5
  67. dissect/target/plugins/general/network.py +20 -5
  68. dissect/target/plugins/general/osinfo.py +1 -0
  69. dissect/target/plugins/general/plugins.py +53 -10
  70. dissect/target/plugins/os/unix/_os.py +70 -44
  71. dissect/target/plugins/os/unix/applications.py +78 -0
  72. dissect/target/plugins/os/unix/bsd/citrix/history.py +2 -0
  73. dissect/target/plugins/os/unix/bsd/osx/_os.py +4 -21
  74. dissect/target/plugins/os/unix/bsd/osx/network.py +92 -0
  75. dissect/target/plugins/os/unix/bsd/osx/user.py +4 -0
  76. dissect/target/plugins/os/unix/cronjobs.py +8 -4
  77. dissect/target/plugins/os/unix/etc/etc.py +4 -0
  78. dissect/target/plugins/os/unix/generic.py +2 -0
  79. dissect/target/plugins/os/unix/history.py +27 -25
  80. dissect/target/plugins/os/unix/linux/_os.py +8 -10
  81. dissect/target/plugins/os/unix/linux/cmdline.py +2 -0
  82. dissect/target/plugins/os/unix/linux/debian/apt.py +4 -1
  83. dissect/target/plugins/os/unix/linux/debian/dpkg.py +3 -3
  84. dissect/target/plugins/os/unix/linux/debian/proxmox/__init__.py +0 -0
  85. dissect/target/plugins/os/unix/linux/debian/proxmox/_os.py +141 -0
  86. dissect/target/plugins/os/unix/linux/debian/proxmox/vm.py +29 -0
  87. dissect/target/plugins/os/unix/linux/debian/snap.py +79 -0
  88. dissect/target/plugins/os/unix/linux/environ.py +2 -0
  89. dissect/target/plugins/os/unix/linux/fortios/_os.py +74 -63
  90. dissect/target/plugins/os/unix/linux/fortios/generic.py +2 -0
  91. dissect/target/plugins/os/unix/linux/fortios/locale.py +2 -0
  92. dissect/target/plugins/os/unix/linux/modules.py +2 -0
  93. dissect/target/plugins/os/unix/linux/netstat.py +2 -0
  94. dissect/target/{helpers → plugins/os/unix/linux}/network_managers.py +11 -9
  95. dissect/target/plugins/os/unix/linux/processes.py +2 -0
  96. dissect/target/plugins/os/unix/linux/redhat/yum.py +4 -1
  97. dissect/target/plugins/os/unix/linux/services.py +5 -3
  98. dissect/target/plugins/os/unix/linux/sockets.py +2 -0
  99. dissect/target/plugins/os/unix/linux/suse/zypper.py +4 -1
  100. dissect/target/plugins/os/unix/locale.py +2 -0
  101. dissect/target/plugins/os/unix/locate/gnulocate.py +4 -2
  102. dissect/target/plugins/os/unix/locate/mlocate.py +2 -0
  103. dissect/target/plugins/os/unix/locate/plocate.py +3 -1
  104. dissect/target/plugins/os/unix/log/atop.py +2 -0
  105. dissect/target/plugins/os/unix/log/audit.py +3 -1
  106. dissect/target/plugins/os/unix/log/auth.py +351 -38
  107. dissect/target/plugins/os/unix/log/journal.py +123 -101
  108. dissect/target/plugins/os/unix/log/lastlog.py +5 -3
  109. dissect/target/plugins/os/unix/log/messages.py +51 -27
  110. dissect/target/plugins/os/unix/log/utmp.py +52 -71
  111. dissect/target/plugins/os/unix/packagemanager.py +5 -38
  112. dissect/target/plugins/os/unix/shadow.py +3 -1
  113. dissect/target/plugins/os/unix/trash.py +132 -0
  114. dissect/target/plugins/os/windows/_os.py +22 -41
  115. dissect/target/plugins/os/windows/activitiescache.py +9 -4
  116. dissect/target/plugins/os/windows/adpolicy.py +2 -1
  117. dissect/target/plugins/os/windows/amcache.py +16 -13
  118. dissect/target/plugins/os/windows/defender.py +4 -3
  119. dissect/target/plugins/os/windows/dpapi/keyprovider/credhist.py +3 -0
  120. dissect/target/plugins/os/windows/dpapi/keyprovider/empty.py +3 -0
  121. dissect/target/plugins/os/windows/dpapi/keyprovider/keychain.py +3 -0
  122. dissect/target/plugins/os/windows/dpapi/keyprovider/lsa.py +3 -0
  123. dissect/target/plugins/os/windows/env.py +1 -2
  124. dissect/target/plugins/os/windows/exchange/exchange.py +6 -4
  125. dissect/target/plugins/os/windows/generic.py +68 -19
  126. dissect/target/plugins/os/windows/lnk.py +2 -0
  127. dissect/target/plugins/os/windows/locale.py +9 -3
  128. dissect/target/plugins/os/windows/log/etl.py +5 -4
  129. dissect/target/plugins/os/windows/log/evt.py +12 -8
  130. dissect/target/plugins/os/windows/log/evtx.py +9 -7
  131. dissect/target/plugins/os/windows/log/mssql.py +103 -0
  132. dissect/target/plugins/os/windows/log/pfro.py +2 -1
  133. dissect/target/plugins/os/windows/network.py +380 -0
  134. dissect/target/plugins/os/windows/notifications.py +6 -4
  135. dissect/target/plugins/os/windows/prefetch.py +7 -2
  136. dissect/target/plugins/os/windows/regf/7zip.py +9 -1
  137. dissect/target/plugins/os/windows/regf/applications.py +62 -0
  138. dissect/target/plugins/os/windows/regf/auditpol.py +2 -1
  139. dissect/target/plugins/os/windows/regf/bam.py +3 -1
  140. dissect/target/plugins/os/windows/regf/cit.py +14 -12
  141. dissect/target/plugins/os/windows/regf/clsid.py +6 -3
  142. dissect/target/plugins/os/windows/regf/firewall.py +2 -1
  143. dissect/target/plugins/os/windows/regf/mru.py +9 -8
  144. dissect/target/plugins/os/windows/regf/nethist.py +6 -3
  145. dissect/target/plugins/os/windows/regf/recentfilecache.py +3 -1
  146. dissect/target/plugins/os/windows/regf/regf.py +5 -1
  147. dissect/target/plugins/os/windows/regf/shellbags.py +351 -345
  148. dissect/target/plugins/os/windows/regf/shimcache.py +1 -1
  149. dissect/target/plugins/os/windows/regf/usb.py +2 -1
  150. dissect/target/plugins/os/windows/regf/userassist.py +2 -1
  151. dissect/target/plugins/os/windows/registry.py +11 -0
  152. dissect/target/plugins/os/windows/services.py +3 -2
  153. dissect/target/plugins/os/windows/startupinfo.py +7 -2
  154. dissect/target/plugins/os/windows/syscache.py +5 -2
  155. dissect/target/plugins/os/windows/tasks.py +1 -1
  156. dissect/target/plugins/os/windows/thumbcache.py +11 -5
  157. dissect/target/plugins/os/windows/ual.py +12 -9
  158. dissect/target/plugins/os/windows/wer.py +21 -6
  159. dissect/target/plugins/os/windows/wua_history.py +0 -1
  160. dissect/target/target.py +13 -8
  161. dissect/target/tools/dump/utils.py +4 -0
  162. dissect/target/tools/fsutils.py +1 -1
  163. dissect/target/tools/info.py +1 -1
  164. dissect/target/tools/mount.py +15 -5
  165. dissect/target/tools/query.py +15 -9
  166. dissect/target/tools/shell.py +98 -9
  167. dissect/target/tools/utils.py +7 -7
  168. dissect/target/volume.py +4 -4
  169. {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/METADATA +6 -2
  170. {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/RECORD +176 -160
  171. {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/WHEEL +1 -1
  172. dissect/target/helpers/targetd.py +0 -58
  173. dissect/target/loaders/targetd.py +0 -223
  174. dissect/target/plugins/apps/texteditor/texteditor.py +0 -13
  175. dissect/target/plugins/os/unix/etc.py +0 -9
  176. /dissect/target/plugins/apps/{texteditor → database}/__init__.py +0 -0
  177. {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/COPYRIGHT +0 -0
  178. {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/LICENSE +0 -0
  179. {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/entry_points.txt +0 -0
  180. {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/top_level.txt +0 -0
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import io
4
4
  import json
5
+ import logging
5
6
  import re
6
7
  import sys
7
8
  from collections import deque
@@ -47,6 +48,9 @@ except ImportError:
47
48
  HAS_TOML = False
48
49
 
49
50
 
51
+ log = logging.getLogger(__name__)
52
+
53
+
50
54
  def _update_dictionary(current: dict[str, Any], key: str, value: Any) -> None:
51
55
  if prev_value := current.get(key):
52
56
  if isinstance(prev_value, dict):
@@ -65,9 +69,7 @@ def _update_dictionary(current: dict[str, Any], key: str, value: Any) -> None:
65
69
 
66
70
 
67
71
  class PeekableIterator:
68
- """Source gotten from:
69
- https://more-itertools.readthedocs.io/en/stable/_modules/more_itertools/more.html#peekable
70
- """
72
+ # https://more-itertools.readthedocs.io/en/stable/_modules/more_itertools/more.html#peekable
71
73
 
72
74
  def __init__(self, iterable):
73
75
  self._iterator = iter(iterable)
@@ -94,9 +96,6 @@ class PeekableIterator:
94
96
  class ConfigurationParser:
95
97
  """A configuration parser where you can configure certain aspects of the parsing mechanism.
96
98
 
97
- Attributes:
98
- parsed_data: The resulting dictionary after parsing.
99
-
100
99
  Args:
101
100
  collapse: A ``bool`` or an ``Iterator``:
102
101
  If ``True``: it will collapse all the resulting dictionary values.
@@ -161,7 +160,7 @@ class ConfigurationParser:
161
160
  def get(self, item: str, default: Optional[Any] = None) -> Any:
162
161
  return self.parsed_data.get(item, default)
163
162
 
164
- def read_file(self, fh: TextIO) -> None:
163
+ def read_file(self, fh: TextIO | io.BytesIO) -> None:
165
164
  """Parse a configuration file.
166
165
 
167
166
  Raises:
@@ -191,6 +190,8 @@ class Default(ConfigurationParser):
191
190
 
192
191
  This parser splits only on the first ``separator`` it finds:
193
192
 
193
+ .. code-block::
194
+
194
195
  key<separator>value -> {"key": "value"}
195
196
 
196
197
  key<separator>value\n
@@ -303,8 +304,16 @@ class Txt(ConfigurationParser):
303
304
  self.parsed_data = {"content": fh.read(), "size": str(fh.tell())}
304
305
 
305
306
 
307
+ class Bin(ConfigurationParser):
308
+
309
+ """Read the file into ``binary`` and show the number of bytes read"""
310
+
311
+ def parse_file(self, fh: io.BytesIO) -> None:
312
+ self.parsed_data = {"binary": fh.read(), "size": str(fh.tell())}
313
+
314
+
306
315
  class Xml(ConfigurationParser):
307
- """Parses an XML file. Ignores any constructor parameters passed from ``ConfigurationParser`."""
316
+ """Parses an XML file. Ignores any constructor parameters passed from ``ConfigurationParser``."""
308
317
 
309
318
  def _tree(self, tree: ElementTree, root: bool = False) -> dict:
310
319
  """Very simple but robust xml -> dict implementation, see comments."""
@@ -383,8 +392,9 @@ class ListUnwrapper:
383
392
  def unwrap(data: Union[dict, list]) -> Union[dict, list]:
384
393
  """Transforms a list with dictionaries to a dictionary.
385
394
 
386
- The order of the list is preserved. If no dictionary is found,
387
- the list remains untouched:
395
+ The order of the list is preserved. If no dictionary is found, the list remains untouched:
396
+
397
+ .. code-block::
388
398
 
389
399
  ["value1", "value2"] -> ["value1", "value2"]
390
400
 
@@ -457,6 +467,76 @@ class Toml(ConfigurationParser):
457
467
  raise ConfigurationParsingError("Failed to parse file, please install tomli.")
458
468
 
459
469
 
470
+ class Env(ConfigurationParser):
471
+ """Parses ``.env`` file contents according to Docker and bash specification.
472
+
473
+ Does not apply interpolation of substituted values, eg. ``foo=${bar}`` and does not attempt
474
+ to parse list or dict strings. Does not support dynamic env files, eg. `` foo=`bar` ``. Also
475
+ does not support multi-line key/value assignments (yet).
476
+
477
+ Resources:
478
+ - https://docs.docker.com/compose/environment-variables/variable-interpolation/#env-file-syntax
479
+ - https://github.com/theskumar/python-dotenv/blob/main/src/dotenv/parser.py
480
+ """
481
+
482
+ RE_KV = re.compile(r"^(?P<key>.+?)=(?P<value>(\".+?\")|(\'.+?\')|(.*?))?(?P<comment> \#.+?)?$")
483
+
484
+ def __init__(self, comments: bool = True, *args, **kwargs) -> None:
485
+ super().__init__(*args, **kwargs)
486
+ self.comments = comments
487
+ self.parsed_data: dict | tuple[dict, str | None] = {}
488
+
489
+ def parse_file(self, fh: TextIO) -> None:
490
+ for line in fh.readlines():
491
+ # Blank lines are ignored.
492
+ # Lines beginning with ``#`` are processed as comments and ignored.
493
+ if not line or line[0] == "#" or "=" not in line:
494
+ continue
495
+
496
+ # Each line represents a key-value pair. Values can optionally be quoted.
497
+ # Inline comments for unquoted values must be preceded with a space.
498
+ # Value may be empty.
499
+ match = self.RE_KV.match(line)
500
+
501
+ # Line could be invalid
502
+ if not match:
503
+ log.warning("Could not parse line in %s: '%s'", fh, line)
504
+ continue
505
+
506
+ key = match.groupdict()["key"]
507
+ value = match.groupdict().get("value") or ""
508
+ value = value.strip()
509
+ comment = match.groupdict().get("comment")
510
+ comment = comment.replace(" # ", "", 1) if comment else None
511
+
512
+ # Surrounding whitespace characters are removed, unless quoted.
513
+ if value and ((value[0] == '"' and value[-1] == '"') or (value[0] == "'" and value[-1] == "'")):
514
+ is_quoted = True
515
+ value = value.strip("\"'")
516
+ else:
517
+ is_quoted = False
518
+ value = value.strip()
519
+
520
+ # Unquoted values may start with a quote if they are properly escaped.
521
+ if not is_quoted and value[:2] in ["\\'", '\\"']:
522
+ value = value[1:]
523
+
524
+ # Interpret boolean values
525
+ if value.lower() in ["1", "true"]:
526
+ value = True
527
+ elif value.lower() in ["0", "false"]:
528
+ value = False
529
+
530
+ # Interpret integer values
531
+ if isinstance(value, str) and re.match(r"^[0-9]{1,}$", value):
532
+ value = int(value)
533
+
534
+ if key.strip() in self.parsed_data:
535
+ log.warning("Duplicate environment key '%s' in file %s", key.strip(), fh)
536
+
537
+ self.parsed_data[key.strip()] = (value, comment) if self.comments else value
538
+
539
+
460
540
  class ScopeManager:
461
541
  """A (context)manager for dictionary scoping.
462
542
 
@@ -540,6 +620,8 @@ class Indentation(Default):
540
620
 
541
621
  The parser parses this as the following:
542
622
 
623
+ .. code-block::
624
+
543
625
  key value
544
626
  key2 value2
545
627
  -> {"key value": {"key2": "value2"}}
@@ -562,7 +644,7 @@ class Indentation(Default):
562
644
  Args:
563
645
  manager: A :class:`ScopeManager` that contains the logic to ``push`` and ``pop`` scopes. And keeps state.
564
646
  line: The line to be parsed.
565
- key: The key that should be updated during a :method:`ScopeManager.push``.
647
+ key: The key that should be updated during a :method:`ScopeManager.push`.
566
648
  next_line: The next line to be parsed.
567
649
 
568
650
  Returns:
@@ -612,26 +694,28 @@ class SystemD(Indentation):
612
694
  """A :class:`ConfigurationParser` that specifically parses systemd configuration files.
613
695
 
614
696
  Examples:
615
- >>> systemd_data = textwrap.dedent(
616
- '''
617
- [Section1]
618
- Key=Value
619
- [Section2]
620
- Key2=Value 2\\
621
- Value 2 continued
622
- '''
623
- )
624
- >>> parser = SystemD(io.StringIO(systemd_data))
625
- >>> parser.parser_items
626
- {
627
- "Section1": {
628
- "Key": "Value
629
- },
630
- "Section2": {
631
- "Key2": "Value2 Value 2 continued
632
- }
633
- }
634
697
 
698
+ .. code-block::
699
+
700
+ >>> systemd_data = textwrap.dedent(
701
+ '''
702
+ [Section1]
703
+ Key=Value
704
+ [Section2]
705
+ Key2=Value 2\\
706
+ Value 2 continued
707
+ '''
708
+ )
709
+ >>> parser = SystemD(io.StringIO(systemd_data))
710
+ >>> parser.parser_items
711
+ {
712
+ "Section1": {
713
+ "Key": "Value
714
+ },
715
+ "Section2": {
716
+ "Key2": "Value2 Value 2 continued
717
+ }
718
+ }
635
719
  """
636
720
 
637
721
  def _change_scope(
@@ -733,6 +817,8 @@ MATCH_MAP: dict[str, ParserConfig] = {
733
817
  "*/sysconfig/network-scripts/ifcfg-*": ParserConfig(Default),
734
818
  "*/sysctl.d/*.conf": ParserConfig(Default),
735
819
  "*/xml/*": ParserConfig(Xml),
820
+ "*.bashrc": ParserConfig(Txt),
821
+ "*/vim/vimrc*": ParserConfig(Txt),
736
822
  }
737
823
 
738
824
  CONFIG_MAP: dict[tuple[str, ...], ParserConfig] = {
@@ -744,6 +830,13 @@ CONFIG_MAP: dict[tuple[str, ...], ParserConfig] = {
744
830
  "cnf": ParserConfig(Default),
745
831
  "conf": ParserConfig(Default, separator=(r"\s",)),
746
832
  "sample": ParserConfig(Txt),
833
+ "sh": ParserConfig(Txt),
834
+ "key": ParserConfig(Txt),
835
+ "crt": ParserConfig(Txt),
836
+ "pem": ParserConfig(Txt),
837
+ "pl": ParserConfig(Txt), # various admin panels
838
+ "lua": ParserConfig(Txt), # wireshark etc.
839
+ "txt": ParserConfig(Txt),
747
840
  "systemd": ParserConfig(SystemD),
748
841
  "template": ParserConfig(Txt),
749
842
  "toml": ParserConfig(Toml),
@@ -759,6 +852,7 @@ KNOWN_FILES: dict[str, type[ConfigurationParser]] = {
759
852
  "nsswitch.conf": ParserConfig(Default, separator=(":",)),
760
853
  "lsb-release": ParserConfig(Default),
761
854
  "catalog": ParserConfig(Xml),
855
+ "ld.so.cache": ParserConfig(Bin),
762
856
  "fstab": ParserConfig(
763
857
  CSVish,
764
858
  separator=(r"\s",),
@@ -832,9 +926,11 @@ def parse_config(
832
926
  parser_type = _select_parser(entry, hint)
833
927
 
834
928
  parser = parser_type.create_parser(options)
835
-
836
929
  with entry.open() as fh:
837
- open_file = io.TextIOWrapper(fh, encoding="utf-8")
930
+ if not isinstance(parser, Bin):
931
+ open_file = io.TextIOWrapper(fh, encoding="utf-8")
932
+ else:
933
+ open_file = io.BytesIO(fh.read())
838
934
  parser.read_file(open_file)
839
935
 
840
936
  return parser
@@ -52,6 +52,8 @@ MATRIX_REVEAL_SECONDS = 4
52
52
 
53
53
 
54
54
  class Color(Enum):
55
+ """Cyber colors."""
56
+
55
57
  BLACK = 30
56
58
  RED = 31
57
59
  GREEN = 32
@@ -5,8 +5,9 @@ Copyright © 1991-2013 Unicode, Inc.
5
5
  CLDR data files are interpreted according to the LDML specification (http://unicode.org/reports/tr35/)
6
6
  For terms of use, see http://www.unicode.org/copyright.html
7
7
 
8
- NOTE: This file should be updated every ~6 months.
9
- Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/windowsZones.xml
8
+ NOTE: This file should be updated every ~6 months.
9
+ Updated at: 2024-10-28
10
+ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/windowsZones.xml
10
11
  -->
11
12
 
12
13
  <supplementalData>
@@ -33,7 +34,6 @@ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/window
33
34
  <mapZone other="Hawaiian Standard Time" territory="001" type="Pacific/Honolulu"/>
34
35
  <mapZone other="Hawaiian Standard Time" territory="CK" type="Pacific/Rarotonga"/>
35
36
  <mapZone other="Hawaiian Standard Time" territory="PF" type="Pacific/Tahiti"/>
36
- <mapZone other="Hawaiian Standard Time" territory="UM" type="Pacific/Johnston"/>
37
37
  <mapZone other="Hawaiian Standard Time" territory="US" type="Pacific/Honolulu"/>
38
38
  <mapZone other="Hawaiian Standard Time" territory="ZZ" type="Etc/GMT+10"/>
39
39
 
@@ -52,7 +52,7 @@ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/window
52
52
 
53
53
  <!-- (UTC-08:00) Baja California -->
54
54
  <mapZone other="Pacific Standard Time (Mexico)" territory="001" type="America/Tijuana"/>
55
- <mapZone other="Pacific Standard Time (Mexico)" territory="MX" type="America/Tijuana America/Santa_Isabel"/>
55
+ <mapZone other="Pacific Standard Time (Mexico)" territory="MX" type="America/Tijuana"/>
56
56
 
57
57
  <!-- (UTC-08:00) Coordinated Universal Time-08 -->
58
58
  <mapZone other="UTC-08" territory="001" type="Etc/GMT+8"/>
@@ -63,7 +63,6 @@ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/window
63
63
  <mapZone other="Pacific Standard Time" territory="001" type="America/Los_Angeles"/>
64
64
  <mapZone other="Pacific Standard Time" territory="CA" type="America/Vancouver"/>
65
65
  <mapZone other="Pacific Standard Time" territory="US" type="America/Los_Angeles"/>
66
- <mapZone other="Pacific Standard Time" territory="ZZ" type="PST8PDT"/>
67
66
 
68
67
  <!-- (UTC-07:00) Arizona -->
69
68
  <mapZone other="US Mountain Standard Time" territory="001" type="America/Phoenix"/>
@@ -73,15 +72,14 @@ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/window
73
72
  <mapZone other="US Mountain Standard Time" territory="ZZ" type="Etc/GMT+7"/>
74
73
 
75
74
  <!-- (UTC-07:00) Chihuahua, La Paz, Mazatlan -->
76
- <mapZone other="Mountain Standard Time (Mexico)" territory="001" type="America/Chihuahua"/>
77
- <mapZone other="Mountain Standard Time (Mexico)" territory="MX" type="America/Chihuahua America/Mazatlan"/>
75
+ <mapZone other="Mountain Standard Time (Mexico)" territory="001" type="America/Mazatlan"/>
76
+ <mapZone other="Mountain Standard Time (Mexico)" territory="MX" type="America/Mazatlan"/>
78
77
 
79
78
  <!-- (UTC-07:00) Mountain Time (US & Canada) -->
80
79
  <mapZone other="Mountain Standard Time" territory="001" type="America/Denver"/>
81
- <mapZone other="Mountain Standard Time" territory="CA" type="America/Edmonton America/Cambridge_Bay America/Inuvik America/Yellowknife"/>
82
- <mapZone other="Mountain Standard Time" territory="MX" type="America/Ojinaga"/>
80
+ <mapZone other="Mountain Standard Time" territory="CA" type="America/Edmonton America/Cambridge_Bay America/Inuvik"/>
81
+ <mapZone other="Mountain Standard Time" territory="MX" type="America/Ciudad_Juarez"/>
83
82
  <mapZone other="Mountain Standard Time" territory="US" type="America/Denver America/Boise"/>
84
- <mapZone other="Mountain Standard Time" territory="ZZ" type="MST7MDT"/>
85
83
 
86
84
  <!-- (UTC-07:00) Yukon -->
87
85
  <mapZone other="Yukon Standard Time" territory="001" type="America/Whitehorse"/>
@@ -100,10 +98,9 @@ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/window
100
98
 
101
99
  <!-- (UTC-06:00) Central Time (US & Canada) -->
102
100
  <mapZone other="Central Standard Time" territory="001" type="America/Chicago"/>
103
- <mapZone other="Central Standard Time" territory="CA" type="America/Winnipeg America/Rainy_River America/Rankin_Inlet America/Resolute"/>
104
- <mapZone other="Central Standard Time" territory="MX" type="America/Matamoros"/>
101
+ <mapZone other="Central Standard Time" territory="CA" type="America/Winnipeg America/Rankin_Inlet America/Resolute"/>
102
+ <mapZone other="Central Standard Time" territory="MX" type="America/Matamoros America/Ojinaga"/>
105
103
  <mapZone other="Central Standard Time" territory="US" type="America/Chicago America/Indiana/Knox America/Indiana/Tell_City America/Menominee America/North_Dakota/Beulah America/North_Dakota/Center America/North_Dakota/New_Salem"/>
106
- <mapZone other="Central Standard Time" territory="ZZ" type="CST6CDT"/>
107
104
 
108
105
  <!-- (UTC-06:00) Easter Island -->
109
106
  <mapZone other="Easter Island Standard Time" territory="001" type="Pacific/Easter"/>
@@ -111,7 +108,7 @@ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/window
111
108
 
112
109
  <!-- (UTC-06:00) Guadalajara, Mexico City, Monterrey -->
113
110
  <mapZone other="Central Standard Time (Mexico)" territory="001" type="America/Mexico_City"/>
114
- <mapZone other="Central Standard Time (Mexico)" territory="MX" type="America/Mexico_City America/Bahia_Banderas America/Merida America/Monterrey"/>
111
+ <mapZone other="Central Standard Time (Mexico)" territory="MX" type="America/Mexico_City America/Bahia_Banderas America/Merida America/Monterrey America/Chihuahua "/>
115
112
 
116
113
  <!-- (UTC-06:00) Saskatchewan -->
117
114
  <mapZone other="Canada Central Standard Time" territory="001" type="America/Regina"/>
@@ -136,9 +133,8 @@ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/window
136
133
  <!-- (UTC-05:00) Eastern Time (US & Canada) -->
137
134
  <mapZone other="Eastern Standard Time" territory="001" type="America/New_York"/>
138
135
  <mapZone other="Eastern Standard Time" territory="BS" type="America/Nassau"/>
139
- <mapZone other="Eastern Standard Time" territory="CA" type="America/Toronto America/Iqaluit America/Montreal America/Nipigon America/Pangnirtung America/Thunder_Bay"/>
136
+ <mapZone other="Eastern Standard Time" territory="CA" type="America/Toronto America/Iqaluit"/>
140
137
  <mapZone other="Eastern Standard Time" territory="US" type="America/New_York America/Detroit America/Indiana/Petersburg America/Indiana/Vincennes America/Indiana/Winamac America/Kentucky/Monticello America/Louisville"/>
141
- <mapZone other="Eastern Standard Time" territory="ZZ" type="EST5EDT"/>
142
138
 
143
139
  <!-- (UTC-05:00) Haiti -->
144
140
  <mapZone other="Haiti Standard Time" territory="001" type="America/Port-au-Prince"/>
@@ -424,7 +420,7 @@ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/window
424
420
  <mapZone other="FLE Standard Time" territory="FI" type="Europe/Helsinki"/>
425
421
  <mapZone other="FLE Standard Time" territory="LT" type="Europe/Vilnius"/>
426
422
  <mapZone other="FLE Standard Time" territory="LV" type="Europe/Riga"/>
427
- <mapZone other="FLE Standard Time" territory="UA" type="Europe/Kiev Europe/Uzhgorod Europe/Zaporozhye"/>
423
+ <mapZone other="FLE Standard Time" territory="UA" type="Europe/Kiev"/>
428
424
 
429
425
  <!-- (UTC+02:00) Jerusalem -->
430
426
  <mapZone other="Israel Standard Time" territory="001" type="Asia/Jerusalem"/>
@@ -541,7 +537,8 @@ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/window
541
537
  <!-- (UTC+05:00) Ashgabat, Tashkent -->
542
538
  <mapZone other="West Asia Standard Time" territory="001" type="Asia/Tashkent"/>
543
539
  <mapZone other="West Asia Standard Time" territory="AQ" type="Antarctica/Mawson"/>
544
- <mapZone other="West Asia Standard Time" territory="KZ" type="Asia/Oral Asia/Aqtau Asia/Aqtobe Asia/Atyrau"/>
540
+ <!-- Microsoft may create a new zone dedicated for Almaty and Qostanay. -->
541
+ <mapZone other="West Asia Standard Time" territory="KZ" type="Asia/Oral Asia/Almaty Asia/Aqtau Asia/Aqtobe Asia/Atyrau Asia/Qostanay"/>
545
542
  <mapZone other="West Asia Standard Time" territory="MV" type="Indian/Maldives"/>
546
543
  <mapZone other="West Asia Standard Time" territory="TF" type="Indian/Kerguelen"/>
547
544
  <mapZone other="West Asia Standard Time" territory="TJ" type="Asia/Dushanbe"/>
@@ -573,13 +570,12 @@ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/window
573
570
  <mapZone other="Nepal Standard Time" territory="001" type="Asia/Katmandu"/>
574
571
  <mapZone other="Nepal Standard Time" territory="NP" type="Asia/Katmandu"/>
575
572
 
576
- <!-- (UTC+06:00) Astana -->
577
- <mapZone other="Central Asia Standard Time" territory="001" type="Asia/Almaty"/>
573
+ <!-- (UTC+06:00) Astana --> <!-- Microsoft probably keeps Central Asia Standard Time, but change Astana to something else. -->
574
+ <mapZone other="Central Asia Standard Time" territory="001" type="Asia/Bishkek"/>
578
575
  <mapZone other="Central Asia Standard Time" territory="AQ" type="Antarctica/Vostok"/>
579
576
  <mapZone other="Central Asia Standard Time" territory="CN" type="Asia/Urumqi"/>
580
577
  <mapZone other="Central Asia Standard Time" territory="IO" type="Indian/Chagos"/>
581
578
  <mapZone other="Central Asia Standard Time" territory="KG" type="Asia/Bishkek"/>
582
- <mapZone other="Central Asia Standard Time" territory="KZ" type="Asia/Almaty Asia/Qostanay"/>
583
579
  <mapZone other="Central Asia Standard Time" territory="ZZ" type="Etc/GMT-6"/>
584
580
 
585
581
  <!-- (UTC+06:00) Dhaka -->
@@ -656,7 +652,7 @@ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/window
656
652
 
657
653
  <!-- (UTC+08:00) Ulaanbaatar -->
658
654
  <mapZone other="Ulaanbaatar Standard Time" territory="001" type="Asia/Ulaanbaatar"/>
659
- <mapZone other="Ulaanbaatar Standard Time" territory="MN" type="Asia/Ulaanbaatar Asia/Choibalsan"/>
655
+ <mapZone other="Ulaanbaatar Standard Time" territory="MN" type="Asia/Ulaanbaatar"/>
660
656
 
661
657
  <!-- (UTC+08:45) Eucla -->
662
658
  <mapZone other="Aus Central W. Standard Time" territory="001" type="Australia/Eucla"/>
@@ -713,7 +709,7 @@ Source: https://github.com/unicode-org/cldr/blob/main/common/supplemental/window
713
709
 
714
710
  <!-- (UTC+10:00) Hobart -->
715
711
  <mapZone other="Tasmania Standard Time" territory="001" type="Australia/Hobart"/>
716
- <mapZone other="Tasmania Standard Time" territory="AU" type="Australia/Hobart Australia/Currie Antarctica/Macquarie"/>
712
+ <mapZone other="Tasmania Standard Time" territory="AU" type="Australia/Hobart Antarctica/Macquarie"/>
717
713
 
718
714
  <!-- (UTC+10:00) Vladivostok -->
719
715
  <mapZone other="Vladivostok Standard Time" territory="001" type="Asia/Vladivostok"/>
@@ -46,7 +46,7 @@ def get_real_func_obj(func: Callable) -> Tuple[Type, Callable]:
46
46
  return (klass, func)
47
47
 
48
48
 
49
- def get_docstring(obj: Any, placeholder=NO_DOCS) -> str:
49
+ def get_docstring(obj: Any, placeholder: str = NO_DOCS) -> str:
50
50
  """Get object's docstring or a placeholder if no docstring found"""
51
51
  # Use of `inspect.cleandoc()` is preferred to `textwrap.dedent()` here
52
52
  # because many multi-line docstrings in the codebase
@@ -8,6 +8,8 @@ log = logging.getLogger(__name__)
8
8
 
9
9
 
10
10
  class KeyType(Enum):
11
+ """Valid key types."""
12
+
11
13
  RAW = "raw"
12
14
  PASSPHRASE = "passphrase"
13
15
  RECOVERY_KEY = "recovery_key"
@@ -8,7 +8,6 @@ from dissect.util.feature import Feature, feature_enabled
8
8
 
9
9
  from dissect.target.filesystem import Filesystem, FilesystemEntry
10
10
 
11
- HAS_FUSE3 = False
12
11
  if feature_enabled(Feature.BETA):
13
12
  from fuse3 import FuseOSError, Operations
14
13
  from fuse3.c_fuse import fuse_config_p, fuse_conn_info_p
@@ -20,6 +19,8 @@ else:
20
19
  fuse_config_p = c_void_p
21
20
  fuse_conn_info_p = c_void_p
22
21
 
22
+ HAS_FUSE3 = False
23
+
23
24
 
24
25
  log = logging.getLogger(__name__)
25
26
 
@@ -165,8 +165,13 @@ WindowsInterfaceRecord = TargetRecordDescriptor(
165
165
  [
166
166
  *COMMON_INTERFACE_ELEMENTS,
167
167
  ("varint", "vlan"),
168
- ("string", "metric"),
168
+ ("net.ipnetwork[]", "network"),
169
+ ("varint", "metric"),
170
+ ("stringlist", "search_domain"),
171
+ ("datetime", "first_connected"),
169
172
  ("datetime", "last_connected"),
173
+ ("net.ipaddress[]", "subnetmask"),
174
+ ("boolean", "dhcp"),
170
175
  ],
171
176
  )
172
177
 
@@ -175,7 +180,29 @@ MacInterfaceRecord = TargetRecordDescriptor(
175
180
  [
176
181
  *COMMON_INTERFACE_ELEMENTS,
177
182
  ("varint", "vlan"),
178
- ("string", "proxy"),
183
+ ("net.ipnetwork[]", "network"),
179
184
  ("varint", "interface_service_order"),
185
+ ("boolean", "dhcp"),
180
186
  ],
181
187
  )
188
+
189
+
190
+ COMMON_APPLICATION_FIELDS = [
191
+ ("datetime", "ts_modified"),
192
+ ("datetime", "ts_installed"),
193
+ ("string", "name"),
194
+ ("string", "version"),
195
+ ("string", "author"),
196
+ ("string", "type"),
197
+ ("path", "path"),
198
+ ]
199
+
200
+ UnixApplicationRecord = TargetRecordDescriptor(
201
+ "unix/application",
202
+ COMMON_APPLICATION_FIELDS,
203
+ )
204
+
205
+ WindowsApplicationRecord = TargetRecordDescriptor(
206
+ "windows/application",
207
+ COMMON_APPLICATION_FIELDS,
208
+ )
@@ -1,3 +1,4 @@
1
+ import logging
1
2
  from functools import partial
2
3
  from typing import Callable, Iterable, Iterator
3
4
 
@@ -95,13 +96,16 @@ def modify_record(target: Target, record: Record, modifier_function: ModifierFun
95
96
  try:
96
97
  _record = modifier_function(field_name, resolved_path)
97
98
  except FilesystemError as e:
98
- target.log.warning(
99
+ level = logging.INFO if isinstance(e, FileNotFoundError) else logging.WARNING
100
+ target.log.log(
101
+ level,
99
102
  "Unable to modify record '%s' with function '%s': %s",
100
103
  record._desc.name,
101
104
  modifier_function.__name__,
102
105
  e,
103
106
  )
104
107
  target.log.debug("", exc_info=e)
108
+
105
109
  else:
106
110
  additional_records.append(_record)
107
111