get_login_accounts reads the host's own accounts (Get-LocalUser), their last login and failed attempts from the account database, expiry and lock, and whether each is an administrator (S-1-5-32-544, by SID) or may log in over Remote Desktop (the logon right and its denial from secedit, the host's fDenyTSConnections). groups lists the groups that grant either, with every member, a domain's included. uid is the RID, sid the SID. A domain controller's accounts are not read. get_login_sessions reads logon events 4624 of type 2, 10 and 11 of the last seven days from the Security log, ended by 4634/4647, an administrator's two linked logons as one session. own_address is the reading's own WinRM logon's address; records_since the log's oldest event. A log without any logon raises LoginSessionsUnavailable. Both scripts are in tools/harvest.py.
15 lines
598 B
Python
15 lines
598 B
Python
"""Who can log in to a Windows host and who did, for the access review (NetOrk/netork#2895).
|
|
|
|
:class:`WindowsLoginsMixin` is both readings, :mod:`napalm_windows.login_accounts` and
|
|
:mod:`napalm_windows.login_sessions`, as one base of the driver.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from napalm_windows.login_accounts import WindowsLoginAccountsMixin
|
|
from napalm_windows.login_sessions import WindowsLoginSessionsMixin
|
|
|
|
|
|
class WindowsLoginsMixin(WindowsLoginAccountsMixin, WindowsLoginSessionsMixin):
|
|
"""``get_login_accounts`` and ``get_login_sessions``; the driver carries the scripts."""
|