Files
elysium/Update-LithnetStore.ps1
T
tomas.kracmar 50dcf8c1b7 refactor(Update-LithnetStore): move the importer into the module as Update-ElysiumLithnetStore
Second root script converted to a module cmdlet, same pattern as
Update-ElysiumKhdb:

- The script body -> src/Elysium/Public/Update-ElysiumLithnetStore.ps1,
  exported, same parameters.
- Get-ListFromSetting and Resolve-ExistingPath -> Private/Settings.ps1.
  The script's own Get-BooleanSetting copy is dropped for the shared
  one (TryParse instead of Convert.ToBoolean; both accept exactly
  true/false and fall back to the default for anything else).
- The inline default-KHDB resolution becomes Get-KhdbPath in
  Private/Khdb.ps1 (InstallationPath + WeakPasswordsDatabase via
  Get-InstallationPath), for the other scripts to reuse.
- Transcript via the shared Start/Stop-ElysiumTranscript; $PSScriptRoot
  becomes $InstallRoot.

Update-LithnetStore.ps1 is now a thin wrapper (relaunch under pwsh,
import module, call the cmdlet with the bound parameters).

Tests, with global stub functions standing in for the Lithnet cmdlets
so they can be mocked on any OS: default KHDB under
InstallationPath/WeakPasswordsDatabase plus settings and parameter
sources each go to the right import cmdlet; HIBP sync on/off;
Close-Store runs when an import fails; a missing KHDB names the path.
18/18 Pester tests pass. The wrapper also ran end-to-end against a stub
LithnetPasswordProtection module on PSModulePath: all three lists
imported, store closed, transcript written under Reports/logs.
2026-11-04 12:54:45 +01:00

44 lines
1.7 KiB
PowerShell

##################################################
## ____ ___ ____ _____ _ _ _____ _____ ##
## / ___/ _ \| _ \| ____| | \ | | ____|_ _| ##
## | | | | | | |_) | _| | \| | _| | | ##
## | |__| |_| | _ <| |___ _| |\ | |___ | | ##
## \____\__\_\_| \_\_____(_)_| \_|_____| |_| ##
##################################################
## Project: Elysium ##
## File: Update-LithnetStore.ps1 ##
## Support: support@cqre.net ##
##################################################
<#
.SYNOPSIS
Populates a Lithnet Password Protection store with compromised passwords and banned words.
.DESCRIPTION
Reads configuration from ElysiumSettings.txt (or a provided settings file), opens the Lithnet
Password Protection store, optionally synchronizes with Have I Been Pwned, imports local NTLM
hash lists, plaintext password lists, and banned-word files.
Thin wrapper around the Update-ElysiumLithnetStore cmdlet in src/Elysium, kept so existing
invocations and the menu keep working.
#>
[CmdletBinding()]
param(
[string]$SettingsPath,
[string[]]$HashFiles,
[string[]]$PlaintextFiles,
[string[]]$BannedWordFiles,
[switch]$SkipHibpSync
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
[string]$commonHelper = Join-Path -Path $PSScriptRoot -ChildPath 'Elysium.Common.ps1'
if (-not (Test-Path -LiteralPath $commonHelper)) { throw "Common helper not found at $commonHelper" }
. $commonHelper
Restart-WithPwshIfAvailable -BoundParameters $PSBoundParameters -UnboundArguments $MyInvocation.UnboundArguments
Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath 'src/Elysium/Elysium.psd1') -Force
Update-ElysiumLithnetStore @PSBoundParameters