feat: Windows host depth — identity, packages, updates, posture, firewall, logins, storage, events, repairs (NetOrk/netork#2888–#2899) #12

Merged
christianmanivong merged 32 commits from chore/merge-train-windows-depth into main 2026-12-02 21:31:41 +00:00
32 Commits
Author SHA1 Message Date
Christian Manivong 635607bfa4 chore(deps): require napalm-device-types 4.56.0, CI without the train pre-install
driver / lint (pull_request) Successful in 12s
driver / standard (pull_request) Successful in 14s
driver / lowest (pull_request) Successful in 25s
driver / test (3.12) (pull_request) Successful in 54s
driver / types (pull_request) Successful in 1m0s
driver / test (3.13) (pull_request) Successful in 54s
driver / build (pull_request) Successful in 25s
driver / security (pull_request) Successful in 55s
CI / driver (pull_request) Successful in 1m34s
driver / publish (pull_request) Skipped
2026-12-02 22:21:46 +01:00
Christian Manivong 52286e4009 Merge remote-tracking branch 'origin/feature/windows-logins-2895' into chore/merge-train-windows-depth
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 22s
driver / lowest (pull_request) Successful in 42s
driver / types (pull_request) Successful in 1m24s
driver / test (3.12) (pull_request) Successful in 1m23s
driver / test (3.13) (pull_request) Successful in 1m16s
driver / build (pull_request) Successful in 35s
driver / security (pull_request) Successful in 1m23s
CI / driver (pull_request) Successful in 2m58s
driver / publish (pull_request) Skipped
2026-12-01 23:21:04 +01:00
Christian Manivong 2b0bfac4f7 refactor(logins): keep the member and session parses within complexity 10 (NetOrk/netork#2895)
_member hands its name and kind to _member_name and _is_group;
parse_login_sessions hands the audit check to _audited_logons and the
sessions to _sessions. No change in behaviour.
2026-12-01 23:20:36 +01:00
Christian Manivong 63a04c068b ci: test against the napalm-device-types train until it is released
driver / lint (pull_request) Failing after 4m17s
driver / standard (pull_request) Failing after 4m19s
driver / types (pull_request) Failing after 4m18s
driver / test (3.12) (pull_request) Failing after 4m21s
driver / test (3.13) (pull_request) Failing after 4m20s
driver / lowest (pull_request) Failing after 4m19s
driver / security (pull_request) Failing after 8m27s
driver / build (pull_request) Failing after 4m19s
CI / driver (pull_request) Failing after 12m50s
driver / publish (pull_request) Skipped
2026-12-01 23:20:25 +01:00
Christian Manivong a75be93c05 fix(harvest): the posture script belongs to SCRIPTS; imports sorted
driver / standard (pull_request) Failing after 14s
driver / lint (pull_request) Successful in 15s
driver / lowest (pull_request) Failing after 27s
driver / types (pull_request) Failing after 58s
driver / test (3.12) (pull_request) Failing after 53s
driver / test (3.13) (pull_request) Failing after 53s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 51s
CI / driver (pull_request) Failing after 1m47s
driver / publish (pull_request) Skipped
2026-12-01 13:23:31 +01:00
Christian Manivong c35b832db3 Merge remote-tracking branch 'origin/feature/windows-posture-2893' into chore/merge-train-windows-depth
# Conflicts:
#	CHANGELOG.md
#	README.md
#	napalm_windows/windows.py
#	tools/harvest.py
2026-12-01 13:22:57 +01:00
Christian Manivong a15e24a38c fix(harvest): the Windows Update scripts belong to SCRIPTS, not RUNS 2026-12-01 13:19:42 +01:00
Christian Manivong 6fbf2f7ef6 Merge remote-tracking branch 'origin/feature/windows-update-2892' into chore/merge-train-windows-depth
# Conflicts:
#	CHANGELOG.md
#	README.md
#	napalm_windows/windows.py
#	tools/harvest.py
2026-12-01 13:18:29 +01:00
Christian Manivong 08c97339bb style: sort the mixin imports of the merged streams 2026-12-01 13:18:29 +01:00
Christian Manivong e9e14cf316 Merge remote-tracking branch 'origin/feature/windows-repairs-2899' into chore/merge-train-windows-depth
# Conflicts:
#	CHANGELOG.md
#	README.md
#	napalm_windows/windows.py
#	tests/fixtures/synthetic/README.md
#	tools/harvest.py
2026-12-01 13:18:04 +01:00
Christian Manivong 48a1a5c14f Merge remote-tracking branch 'origin/feature/windows-events-2897' into chore/merge-train-windows-depth
# Conflicts:
#	CHANGELOG.md
#	README.md
#	napalm_windows/windows.py
#	tools/harvest.py
2026-12-01 13:18:04 +01:00
Christian Manivong 998dcbb05f Merge remote-tracking branch 'origin/feature/windows-exposure' into chore/merge-train-windows-depth
# Conflicts:
#	CHANGELOG.md
#	README.md
#	napalm_windows/windows.py
#	tools/harvest.py
2026-12-01 13:18:04 +01:00
Christian Manivong aa744d0309 Merge remote-tracking branch 'origin/feature/windows-logins-2895' into chore/merge-train-windows-depth
# Conflicts:
#	CHANGELOG.md
#	README.md
#	napalm_windows/windows.py
#	tools/harvest.py
2026-12-01 13:18:03 +01:00
Christian Manivong c02cf1a0bb Merge remote-tracking branch 'origin/feature/windows-basics' into chore/merge-train-windows-depth
# Conflicts:
#	CHANGELOG.md
#	README.md
#	napalm_windows/windows.py
#	tools/harvest.py
2026-12-01 13:18:03 +01:00
Christian Manivong 9ff597a0da Merge remote-tracking branch 'origin/feature/windows-storage-2896' into chore/merge-train-windows-depth 2026-12-01 13:17:42 +01:00
Christian Manivong 4108581580 feat(updates): Windows Update -- search, pending updates, install in a SYSTEM task, history (NetOrk/netork#2892)
refresh_available_updates runs the Windows Update Agent's search against the
configured source and keeps its reading under HKLM\SOFTWARE\napalm-windows;
get_available_updates reads it back without a search, leaving out what the
history shows installed since, and raises PackageIndexMissing before the
first search. Each update carries its title, KB articles, CveIDs and
MsrcSeverity, and is named by its title without month, KB and version, so
next month's cumulative update keeps the name. Previews, feature upgrades and
drivers are left out.

apply_updates installs in a one-shot task running as SYSTEM, since Windows
refuses downloads and installs to a network logon. The task's script and the
exact UpdateID:revision chosen travel in the run's registry key; it searches
again, refuses what no longer matches exactly, what asks for input or has
unaccepted licence terms, installs nothing while a restart is pending and
never restarts. Its log is followed line by line; the next run sweeps what a
dead run left. get_scheduled_jobs shows these tasks as an application's.

get_update_history reads QueryHistory, one transaction per entry, with the
ClientApplicationID as requested_by.
2026-12-01 12:57:20 +01:00
Christian Manivong de6ab3c801 feat(logins): login accounts and console and Remote Desktop sessions (NetOrk/netork#2895)
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.
2026-12-01 12:55:49 +01:00
Christian Manivong 89a52db1a5 feat(log-sources): the event channels as the host's log sources (NetOrk/netork#2897)
WindowsLogSourcesMixin.get_log_sources lists every event channel that is
switched on and holds records (Get-WinEvent -ListLog *) as a source of kind
eventlog, named by its channel, with its .evtx file, size and last write.
Analytic and debug channels are left out. README and CHANGELOG describe the
services, host events and log sources readings.
2026-12-01 12:54:25 +01:00
Christian Manivong f8f46c133d refactor(host-status): the restart reasons as a table, within the complexity limit 2026-12-01 12:54:14 +01:00
Christian Manivong 891a31fe45 docs: the host basics in the README and CHANGELOG; harvest records their scripts 2026-12-01 12:53:46 +01:00
Christian Manivong 0df672fb7c feat(repairs): a caller's limit tightens a run's bound (NetOrk/netork#2899) 2026-12-01 12:53:17 +01:00
Christian Manivong 54b3c9b362 feat(host-status): restart required and automatic updates from Windows Update and the registry (NetOrk/netork#2891) 2026-12-01 12:53:17 +01:00
Christian Manivong 21a21383ff feat(host-events): the event log's shutdowns, crashes, hardware and disk errors (NetOrk/netork#2897)
WindowsHostEventsMixin.get_host_events(since=None) reads, in one script, three
bounded queries over the window: the System log's rare events (Kernel-Power 41,
EventLog 6008, WER-SystemErrorReporting 1001, WHEA-Logger 18, disk 7, Ntfs 55)
with their messages, its frequent ones (WHEA-Logger 19/47, disk 153, Service
Control Manager 7031/7034) and the Application log's crashes (Application Error
1000). Each query catches NoMatchingEventsFound; one that fails names its kinds
unread, one read up to its bound names them capped.
2026-12-01 12:53:13 +01:00
Christian Manivong 975eecf0cc Host firewall and Windows features (NetOrk/netork#2894, #2898)
get_host_firewall reads the Windows Firewall: the profiles' settings in
force, every enabled rule of the active policy with its filters read in
bulk and joined on InstanceID, and the profile of each connected
interface. get_windows_features lists the image's optional features
with their state from Win32_OptionalFeature. Both scripts are in the
harvest.
2026-12-01 12:51:41 +01:00
Christian Manivong 81c4df3159 feat(packages): installed programs from the machine-wide Uninstall keys (NetOrk/netork#2890) 2026-12-01 12:51:31 +01:00
Christian Manivong 7a5c607ae4 feat(storage): disks, pools, volumes and drive health without smartctl (NetOrk/netork#2896)
WindowsStorageMixin implements napalm-device-types' HostStorageMixin, so
the host reports its storage and stays a host:

- get_disks: Get-PhysicalDisk with medium, bus, Windows' health and the
  Storage Spaces pool a disk is in; a Storage Spaces virtual disk is no
  physical disk.
- get_disk_smart: Get-StorageReliabilityCounter per disk (temperature,
  wear, power-on hours, uncorrected read and write errors). A counter
  that cannot be read is no counter, not an error; disks that report
  nothing are left out.
- get_disk_pools: Storage Spaces' pools.
- get_volumes: fixed volumes mounted at a drive letter or in a folder,
  with file system and health.

A disk whose medium Windows cannot tell and whose counters are empty (a
virtual disk, a RAID controller's logical disk) reads temperature -1 and
health "unknown". Every script probes its cmdlets first. The fixtures
are synthetic; the scripts are in harvest.py for the first real host.
2026-12-01 12:50:56 +01:00
Christian Manivong 84f6a3c3e3 feat(services): how a service's last run ended, trigger start and account (NetOrk/netork#2897)
get_services moves into WindowsServicesMixin and reads, beside state and start
mode, Win32_Service's ExitCode (1066 hands over to ServiceSpecificExitCode, 1077
is not started since boot), StartName and whether a TriggerInfo key starts the
service, as napalm-device-types' ServiceDict result, exit_code, trigger_start
and account.
2026-12-01 12:50:24 +01:00
Christian Manivong 169d88f7e5 feat(users): local accounts as UserDict, the RID as uid and the SID beside it (NetOrk/netork#2889) 2026-12-01 12:50:13 +01:00
Christian Manivong 0bbeebb7a7 feat(repairs): SFC, DISM and Defender runs through HostRepairMixin (NetOrk/netork#2899)
verify_system_files (sfc /verifyonly), check_component_store (DISM
/ScanHealth /English), update_antimalware_signatures (Update-MpSignature)
and scan_antimalware (Start-MpScan, quick or full), each one bounded PSRP
call streamed line by line through PsrpTransport.run_streaming. Native
tools run as a process read in their own encoding (sfc: UTF-16), and NULs
of UTF-16 read byte by byte are dropped. The exit code decides; a missing
tool or Defender says it is not available. sfc /scannow and DISM
/RestoreHealth stay undefined until a real host was tested.

tools/harvest.py --runs records the runs' output.
2026-12-01 12:49:37 +01:00
Christian Manivong a97e59c1e2 feat(processes): running processes from Win32_Process and Get-Process (NetOrk/netork#2889) 2026-12-01 12:49:17 +01:00
Christian Manivong 8ed5e0ed87 feat(identity): the SMBIOS identity from the CIM classes (NetOrk/netork#2888) 2026-12-01 12:47:57 +01:00
Christian Manivong 62bbc7df49 feat(posture): the security posture as the hardening reading (NetOrk/netork#2893)
get_hardening() reads Secure Boot, the TPM, BitLocker per volume, Defender,
the firewall profiles' state and virtualization-based security in one script,
each part caught on its own and each cmdlet probed with Get-Command first.
BitLocker through Win32_EncryptableVolume, never Get-BitLockerVolume: no
recovery password or key protector is read.
2026-12-01 12:47:25 +01:00