fix: add fallback to lastlog2 for SSH login retrieval and remove unnecessary libptytty dependency
Some checks failed
Nix Format Check / check-format (push) Failing after 38s
Some checks failed
Nix Format Check / check-format (push) Failing after 38s
This commit is contained in:
parent
612a8bf7b1
commit
1cb4a9acc4
@ -14,6 +14,12 @@ def get_last_ssh_login():
|
|||||||
try:
|
try:
|
||||||
result = subprocess.run(['lastlog', '-u', os.environ.get("USER", "")],
|
result = subprocess.run(['lastlog', '-u', os.environ.get("USER", "")],
|
||||||
capture_output=True, text=True)
|
capture_output=True, text=True)
|
||||||
|
|
||||||
|
# If lastlog didn't work try lastlog2
|
||||||
|
if result.returncode != 0:
|
||||||
|
result = subprocess.run(['lastlog2', os.environ.get("USER", "")],
|
||||||
|
capture_output=True, text=True)
|
||||||
|
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
lines = result.stdout.strip().split('\n')
|
lines = result.stdout.strip().split('\n')
|
||||||
if len(lines) >= 2: # Header line + data line
|
if len(lines) >= 2: # Header line + data line
|
||||||
|
@ -32,9 +32,6 @@
|
|||||||
pipx
|
pipx
|
||||||
devbox
|
devbox
|
||||||
|
|
||||||
# OS independent and secure pty/tty and utmp/wtmp/lastlog
|
|
||||||
libptytty
|
|
||||||
|
|
||||||
# Development SDKs/Toolkits
|
# Development SDKs/Toolkits
|
||||||
gcc
|
gcc
|
||||||
pkg-config
|
pkg-config
|
||||||
|
Loading…
x
Reference in New Issue
Block a user