Skip to content

Commit

Permalink
Fix retrieving the root registry key (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
Schamper authored Aug 14, 2023
1 parent ca70def commit 58c0db0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dissect/target/plugins/os/windows/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def key(self, key: Optional[str] = None) -> KeyCollection:
Returns a KeyCollection which contains all keys that match
the query.
"""
key = key.strip("\\")
key = (key or "").strip("\\")

if not key:
return KeyCollection([self._root.root()])
Expand Down
7 changes: 7 additions & 0 deletions tests/test_plugins_os_windows_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,10 @@ def test_registry_plugin_glob_ext(target_win_users, pattern, key_names) -> None:
collection_names.append(key_collection.name)

assert sorted(collection_names) == sorted(key_names)


def test_registry_plugin_root_none(target_win_users) -> None:
plugin: RegistryPlugin = target_win_users.registry

assert plugin.key()
assert plugin.key("")

0 comments on commit 58c0db0

Please sign in to comment.