From c151556e865bed6d812cdb8b58741441e231d5f3 Mon Sep 17 00:00:00 2001 From: Arnaud Rebillout Date: Tue, 17 Sep 2024 14:01:04 +0700 Subject: [PATCH] Fix various Python 3.12 SyntaxWarning --- CHANGELOG.md | 2 ++ empire/server/data/agent/ironpython_agent.py | 2 +- .../module_source/python/privesc/linuxprivchecker.py | 10 +++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0096643c7..658f46a7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Fixed various Python 3.12 SyntaxWarning + ## [5.11.4] - 2024-09-04 ### Added diff --git a/empire/server/data/agent/ironpython_agent.py b/empire/server/data/agent/ironpython_agent.py index 13fdcb04c..15636ea82 100644 --- a/empire/server/data/agent/ironpython_agent.py +++ b/empire/server/data/agent/ironpython_agent.py @@ -1393,7 +1393,7 @@ def run_command(self, command, cmdargs=None): if (-not $($o.User)) { $o = 'N/A' } else { - $o = "$($o.Domain)\$($o.User)" + $o = "$($o.Domain)\\$($o.User)" } } catch { $o = 'N/A' diff --git a/empire/server/data/module_source/python/privesc/linuxprivchecker.py b/empire/server/data/module_source/python/privesc/linuxprivchecker.py index 3b2721966..cf4b8648b 100644 --- a/empire/server/data/module_source/python/privesc/linuxprivchecker.py +++ b/empire/server/data/module_source/python/privesc/linuxprivchecker.py @@ -333,22 +333,22 @@ def search_file_perms(): fdperms = { "WWDIRSROOT": { - "cmd": "find / \( -wholename '/home/homedir*' -prune \) -o \( -type d -perm -0002 \) -exec ls -ld '{}' ';' 2>/dev/null | grep root", + "cmd": r"find / \( -wholename '/home/homedir*' -prune \) -o \( -type d -perm -0002 \) -exec ls -ld '{}' ';' 2>/dev/null | grep root", "msg": "World Writeable Directories for User/Group 'Root'", "results": [], }, "WWDIRS": { - "cmd": "find / \( -wholename '/home/homedir*' -prune \) -o \( -type d -perm -0002 \) -exec ls -ld '{}' ';' 2>/dev/null | grep -v root", + "cmd": r"find / \( -wholename '/home/homedir*' -prune \) -o \( -type d -perm -0002 \) -exec ls -ld '{}' ';' 2>/dev/null | grep -v root", "msg": "World Writeable Directories for Users other than Root", "results": [], }, "WWFILES": { - "cmd": "find / \( -wholename '/home/homedir/*' -prune -o -wholename '/proc/*' -prune \) -o \( -type f -perm -0002 \) -exec ls -l '{}' ';' 2>/dev/null", + "cmd": r"find / \( -wholename '/home/homedir/*' -prune -o -wholename '/proc/*' -prune \) -o \( -type f -perm -0002 \) -exec ls -l '{}' ';' 2>/dev/null", "msg": "World Writable Files", "results": [], }, "SUID": { - "cmd": "find / \( -perm -2000 -o -perm -4000 \) -exec ls -ld {} \; 2>/dev/null", + "cmd": r"find / \( -perm -2000 -o -perm -4000 \) -exec ls -ld {} \; 2>/dev/null", "msg": "SUID/SGID Files and Directories", "results": [], }, @@ -1171,7 +1171,7 @@ def write(self, message): bigline = "=======================================================================================" print(bigline) print( - """ + r""" __ _ ____ _ ________ __ / / (_)___ __ ___ __/ __ \_____(_) __/ ____/ /_ ___ _____/ /_____ _____ / / / / __ \/ / / / |/_/ /_/ / ___/ / | / / / / __ \/ _ \/ ___/ //_/ _ \/ ___/