Skip to content

Commit

Permalink
Add additional log paths to AnyDesk plugin (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
DevJoost committed Aug 17, 2023
1 parent 4381ca9 commit 1f58694
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions dissect/target/plugins/apps/remoteaccess/anydesk.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,37 @@ class AnydeskPlugin(RemoteAccessPlugin):

__namespace__ = "anydesk"

# Anydesk log when service (Windows)
GLOBS = [
"/sysvol/ProgramData/AnyDesk/*.trace",
# Anydesk logs when installed as a service
SERVICE_GLOBS = [
"/sysvol/ProgramData/AnyDesk/*.trace", # Standard client >= Windows 7
"/sysvol/ProgramData/AnyDesk/ad_*/*.trace", # Custom client >= Windows 7
"/var/log/anydesk*.trace", # Standard/Custom client Linux/MacOS
]

# User specific Anydesk logs
USER_GLOBS = [
"appdata/roaming/AnyDesk/*.trace", # Standard client Windows
"appdata/roaming/AnyDesk/ad_*/*.trace", # Custom client Windows
".anydesk/*.trace", # Standard client Linux/MacOS
".anydesk_ad_*/*.trace", # Custom client Linux/MacOS
]

def __init__(self, target):
super().__init__(target)

self.logfiles = []

# Check service globs (Windows)
# Check service globs
user = None
for log_glob in self.GLOBS:
for log_glob in self.SERVICE_GLOBS:
for logfile in self.target.fs.glob(log_glob):
self.logfiles.append([logfile, user])

# Anydesk logs when as user
for user_details in self.target.user_details.all_with_home():
for logfile in user_details.home_path.glob("appdata/roaming/AnyDesk/*.trace"):
self.logfiles.append([logfile, user_details.user])
for log_glob in self.USER_GLOBS:
for logfile in user_details.home_path.glob(log_glob):
self.logfiles.append([logfile, user_details.user])

def check_compatible(self):
if not (len(self.logfiles)):
Expand All @@ -45,10 +56,11 @@ def logs(self):
"""Return the content of the AnyDesk logs.
AnyDesk is a remote desktop application and can be used by adversaries to get (persistent) access to a machine.
Log files (.trace files) are retrieved from /ProgramData/AnyDesk/ and AppData/roaming/AnyDesk/
Log files (.trace files) are retrieved from various location based on OS and client type.
References:
- https://www.inversecos.com/2021/02/forensic-analysis-of-anydesk-logs.html
- https://support.anydesk.com/knowledge/trace-files#trace-file-locations
"""
for logfile, user in self.logfiles:
logfile = self.target.fs.path(logfile)
Expand Down

0 comments on commit 1f58694

Please sign in to comment.