Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed KeyError when loading Windows targets over SMB #726

Merged
merged 6 commits into from
Jun 26, 2024
Merged

Fixed KeyError when loading Windows targets over SMB #726

merged 6 commits into from
Jun 26, 2024

Conversation

Paradoxis
Copy link
Contributor

Change various ["sysvol"] statements to .get methods as to avoid breaking SMB targets with low-privileged credentials

│                                                                                                  │
│ /home/user/.local/lib/python3.11/site-packages/dissect/target/plugins/os/windows/_os.py:82 in    │
│ add_mounts                                                                                       │
│                                                                                                  │
│    79 │   │   │   self.target.log.debug("", exc_info=e)                                          │
│    80 │   │                                                                                      │
│    81 │   │   # Fallback mount the sysvol to C: if we didn't manage to mount it to any other d   │
│ ❱  82 │   │   if operator.countOf(self.target.fs.mounts.values(), self.target.fs.mounts["sysvo   │
│    83 │   │   │   if "c:" not in self.target.fs.mounts:                                          │
│    84 │   │   │   │   self.target.log.debug("Unable to determine drive letter of sysvol, falli   │
│    85 │   │   │   │   self.target.fs.mount("c:", self.target.fs.mounts["sysvol"])                │
│                                                                                                  │
│ ╭─────────────────────────────────────── locals ────────────────────────────────────────╮        │
│ │ self = <dissect.target.plugins.os.windows._os.WindowsPlugin object at 0x7f87c488a3d0> │        │
│ ╰───────────────────────────────────────────────────────────────────────────────────────╯        │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: 'sysvol'

Copy link

codecov bot commented Jun 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.01%. Comparing base (b89b12d) to head (51defd2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #726   +/-   ##
=======================================
  Coverage   75.01%   75.01%           
=======================================
  Files         294      294           
  Lines       25016    25018    +2     
=======================================
+ Hits        18766    18768    +2     
  Misses       6250     6250           
Flag Coverage Δ
unittests 75.01% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

dissect/target/plugins/os/windows/_os.py Show resolved Hide resolved
dissect/target/plugins/os/windows/_os.py Outdated Show resolved Hide resolved
dissect/target/plugins/os/windows/_os.py Outdated Show resolved Hide resolved
Paradoxis and others added 3 commits June 17, 2024 14:49
Remove default value

Co-authored-by: Miauwkeru <Miauwkeru@users.noreply.github.com>
Co-authored-by: Miauwkeru <Miauwkeru@users.noreply.github.com>
Co-authored-by: Miauwkeru <Miauwkeru@users.noreply.github.com>
Copy link
Contributor

@Miauwkeru Miauwkeru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was asked to make it a bit more explicit with the changes

dissect/target/plugins/os/windows/_os.py Outdated Show resolved Hide resolved
dissect/target/plugins/os/windows/_os.py Outdated Show resolved Hide resolved
dissect/target/plugins/os/windows/_os.py Outdated Show resolved Hide resolved
dissect/target/plugins/os/windows/_os.py Outdated Show resolved Hide resolved
Paradoxis and others added 2 commits June 26, 2024 08:19
Co-authored-by: Miauwkeru <Miauwkeru@users.noreply.github.com>
@Miauwkeru Miauwkeru merged commit 19c973f into fox-it:main Jun 26, 2024
17 of 18 checks passed
otnxSl pushed a commit to otnxSl/dissect.target that referenced this pull request Jul 9, 2024
this is in regards with low-privileged user credentials
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants