Skip to content

Commit

Permalink
Fixed pam persistence removal
Browse files Browse the repository at this point in the history
Locating the pam directory was done differently in install and removal
routines, which caused discrepencies after installation. Should fix #21
  • Loading branch information
calebstewart committed Jul 2, 2020
1 parent dfc8646 commit bdb5b5d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pwncat/persist/pam.py
Expand Up @@ -210,17 +210,17 @@ def remove(self, user: Optional[str] = None):

# Locate the pam_deny.so to know where to place the new module
pam_modules = "/usr/lib/security"
try:
results = (
pwncat.victim.env(["find", "/", "-name", "pam_deny.so"])
.strip()
.decode("utf-8")

results = (
pwncat.victim.run(
"find / -name pam_deny.so 2>/dev/null | grep -v 'snap/'"
)
if results != "":
results = results.split("\n")
pam_modules = os.path.dirname(results[0])
except FileNotFoundError:
pass
.strip()
.decode("utf-8")
)
if results != "":
results = results.split("\n")
pam_modules = os.path.dirname(results[0])

# Ensure the directory exists and is writable
access = pwncat.victim.access(pam_modules)
Expand Down

0 comments on commit bdb5b5d

Please sign in to comment.