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

Add Windows Jumplist plugin #669

Merged
merged 29 commits into from
Aug 15, 2024

Conversation

Zawadidone
Copy link
Contributor

target-query -t TARGET -f jumplist  --limit 1 | rdump -L
[reading from stdin]
--[ RECORD 1 ]--
          hostname = WINDEV2401EVAL
            domain = None
              type = customDestinations
    application_id = 590aee7bdd69b59b
  application_name = Powershell Windows 10
          lnk_path = C:\Users\User\AppData\Roaming\Microsoft\Windows\Recent\CustomDestinations\590aee7bdd69b59b.customDestinations-ms
          lnk_name = None
         lnk_mtime = 2024-03-21 17:16:41.027615+00:00
         lnk_atime = 2024-03-21 17:16:40.997318+00:00
         lnk_ctime = 2024-03-21 17:16:29.070940+00:00
  lnk_relativepath = None
       lnk_workdir = None
     lnk_arguments = None
  lnk_iconlocation = %windir%\System32\WindowsPowerShell\v1.0\powershell.exe
   local_base_path = C:\Users\User\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk
common_path_suffix = 
      lnk_net_name = None
   lnk_device_name = None
     lnk_full_path = C:\Users\User\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk
        machine_id = windev2401eval
      target_mtime = 2022-05-07 05:22:32.504461+00:00
      target_atime = 2024-03-21 17:16:28.045404+00:00
      target_ctime = 2024-03-21 17:16:20.202059+00:00
          username = User
           user_id = S-1-5-21-147454635-2304731113-4176578439-1000
        user_group = None
         user_home = C:\Users\User
[...]

@Horofic Horofic self-requested a review April 19, 2024 14:29
@Horofic Horofic self-assigned this Apr 19, 2024
dissect/target/helpers/utils.py Outdated Show resolved Hide resolved
)

@export(record=JumpListRecord)
def jumplist(self) -> Iterator[JumpListRecord]:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think additionally exporting the custom_destination and automatic_destination plugins would be nice. So you can choose between them. Something like:

  • target-query -f jumplist.automatic_destination for just automatic_destination jumplists,
  • target-query -f jumplist.custom_destination for just custom_destination jumplists,
  • target-query -f jumplist for both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it a known issue that namespace plugins do not work?

AttributeError: 'JumpListPlugin' object has no attribute 'SUBPLUGINS'

Copy link
Contributor

@Horofic Horofic Aug 7, 2024

Choose a reason for hiding this comment

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

An issue with nested namespaced plugin was reported here #758 and fixed in this PR #763. Could you try and check-out this PR to see if your issue persists?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue persists.

dissect/target/plugins/os/windows/jumplist.py Outdated Show resolved Hide resolved
dissect/target/plugins/os/windows/jumplist.py Outdated Show resolved Hide resolved
dissect/target/plugins/os/windows/jumplist.py Outdated Show resolved Hide resolved
dissect/target/plugins/os/windows/jumplist.py Outdated Show resolved Hide resolved
dissect/target/plugins/os/windows/jumplist.py Show resolved Hide resolved
dissect/target/plugins/os/windows/jumplist.py Outdated Show resolved Hide resolved
dissect/target/plugins/os/windows/jumplist.py Outdated Show resolved Hide resolved
dissect/target/plugins/os/windows/jumplist.py Outdated Show resolved Hide resolved
@Zawadidone Zawadidone requested a review from Horofic August 5, 2024 11:53
@EinatFox EinatFox linked an issue Aug 6, 2024 that may be closed by this pull request
Zawadidone and others added 6 commits August 7, 2024 10:24
@Horofic
Copy link
Contributor

Horofic commented Aug 14, 2024

@Zawadidone I also committed some suggestions directly in your PR, please check if you see anything wrong :).

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 79.16667% with 35 lines in your changes missing coverage. Please review.

Project coverage is 75.40%. Comparing base (cf080f6) to head (3fe7986).
Report is 2 commits behind head on main.

Files Patch % Lines
dissect/target/plugins/os/windows/jumplist.py 76.98% 29 Missing ⚠️
dissect/target/plugins/os/windows/lnk.py 81.25% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #669      +/-   ##
==========================================
+ Coverage   75.39%   75.40%   +0.01%     
==========================================
  Files         300      302       +2     
  Lines       26023    26152     +129     
==========================================
+ Hits        19620    19720     +100     
- Misses       6403     6432      +29     
Flag Coverage Δ
unittests 75.40% <79.16%> (+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.

@Zawadidone Zawadidone requested a review from Horofic August 14, 2024 14:33
@Zawadidone
Copy link
Contributor Author

Zawadidone commented Aug 14, 2024

f9fb309 (#669) is based on 6464029 (#669), if this is not preferred I can remove the commit from the branch.

@Horofic
Copy link
Contributor

Horofic commented Aug 15, 2024

f9fb309 (#669) is based on 6464029 (#669), if this is not preferred I can remove the commit from the branch.

6464029 (#669) is fine! That actually was the first approach I took :)

Comment on lines 1 to 4
import io
import logging
from struct import error as StructError
from typing import BinaryIO, Callable, Iterator
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import io
import logging
from struct import error as StructError
from typing import BinaryIO, Callable, Iterator
from __future__ import annotations
import io
import logging
from struct import error as StructError
from typing import BinaryIO, Iterator

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

"""
yield from self._generate_records(self.automatic_destinations, AutomaticDestinationFile)

def _generate_records(self, destinations: list, destination_file: Callable) -> Iterator[JumpListRecord]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def _generate_records(self, destinations: list, destination_file: Callable) -> Iterator[JumpListRecord]:
def _generate_records(
self, destinations: list, destination_file: AutomaticDestinationFile | CustomDestinationFile
) -> Iterator[JumpListRecord]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@Zawadidone Zawadidone requested a review from Horofic August 15, 2024 09:50
@Horofic Horofic merged commit a9d723b into fox-it:main Aug 15, 2024
18 checks passed
@Zawadidone Zawadidone deleted the feature/add_jumplist_plugin branch August 15, 2024 11:05
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.

Add Windows Jumplist plugin PR #669
2 participants