Skip to content

Commit 12333be

Browse files
author
Jake Hildreth
committed
Fresh Build for 2025.04.20 release
1 parent f9b30f2 commit 12333be

2 files changed

Lines changed: 34 additions & 23 deletions

File tree

Invoke-Locksmith.ps1

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
param (
2-
[int]$Mode,
1+
[CmdletBinding(HelpUri = 'https://jakehildreth.github.io/Locksmith/Invoke-Locksmith')]
2+
param (
3+
# The mode to run Locksmith in. Defaults to 0.
4+
[Parameter(Mandatory = $false)]
5+
[ValidateSet(0, 1, 2, 3, 4)]
6+
[int]$Mode = 0,
7+
8+
# The scans to run. Defaults to 'All'.
39
[Parameter()]
410
[ValidateSet('Auditing', 'ESC1', 'ESC2', 'ESC3', 'ESC4', 'ESC5', 'ESC6', 'ESC8', 'ESC11', 'ESC13', 'ESC15', 'EKUwu', 'All', 'PromptMe')]
511
[array]$Scans = 'All'
@@ -2900,7 +2906,12 @@ function Set-AdditionalCAProperty {
29002906
$CAHostDistinguishedName = (Get-ADObject -Filter { (Name -eq $CAHostName) -and (objectclass -eq 'computer') } -Server $ForestGC ).DistinguishedName
29012907
$CAHostFQDN = (Get-ADObject -Filter { (Name -eq $CAHostName) -and (objectclass -eq 'computer') } -Properties DnsHostname -Server $ForestGC).DnsHostname
29022908
}
2903-
$ping = if ($CAHostFQDN) { Test-Connection -ComputerName $CAHostFQDN -Count 1 -Quiet } else { Write-Warning "Unable to resolve $($_.Name) Fully Qualified Domain Name (FQDN)" }
2909+
$ping = if ($CAHostFQDN) {
2910+
Test-Connection -ComputerName $CAHostFQDN -Count 1 -Quiet
2911+
}
2912+
else {
2913+
Write-Warning "Unable to resolve $($_.Name) Fully Qualified Domain Name (FQDN)"
2914+
}
29042915
if ($ping) {
29052916
try {
29062917
if ($Credential) {
@@ -3395,23 +3406,23 @@ function Set-RiskRating {
33953406
switch ($Issue.objectClass) {
33963407
# Being able to modify Root CA Objects is very bad.
33973408
'certificationAuthority' {
3398-
$RiskValue += 2; $RiskScoring += 'Root Certification Authority bject: +2'
3409+
$RiskValue += 2; $RiskScoring += 'Root Certification Authority bject: +2'
33993410
}
34003411
# Being able to modify Issuing CA Objects is also very bad.
34013412
'pKIEnrollmentService' {
3402-
$RiskValue += 2; $RiskScoring += 'Issuing Certification Authority Object: +2'
3413+
$RiskValue += 2; $RiskScoring += 'Issuing Certification Authority Object: +2'
34033414
}
34043415
# Being able to modify CA Hosts? Yeah... very bad.
34053416
'computer' {
3406-
$RiskValue += 2; $RiskScoring += 'Certification Authority Host Computer: +2'
3417+
$RiskValue += 2; $RiskScoring += 'Certification Authority Host Computer: +2'
34073418
}
34083419
# Being able to modify OIDs could result in ESC13 vulns.
34093420
'msPKI-Enterprise-Oid' {
3410-
$RiskValue += 1; $RiskScoring += 'OID: +1'
3421+
$RiskValue += 1; $RiskScoring += 'OID: +1'
34113422
}
34123423
# Being able to modify PKS containers is bad.
34133424
'container' {
3414-
$RiskValue += 1; $RiskScoring += 'Container: +1'
3425+
$RiskValue += 1; $RiskScoring += 'Container: +1'
34153426
}
34163427
}
34173428
}
@@ -3420,19 +3431,19 @@ function Set-RiskRating {
34203431
# Convert Value to Name
34213432
$RiskName = switch ($RiskValue) {
34223433
{ $_ -le 1 } {
3423-
'Informational'
3434+
'Informational'
34243435
}
34253436
2 {
3426-
'Low'
3437+
'Low'
34273438
}
34283439
3 {
3429-
'Medium'
3440+
'Medium'
34303441
}
34313442
4 {
3432-
'High'
3443+
'High'
34333444
}
34343445
{ $_ -ge 5 } {
3435-
'Critical'
3446+
'Critical'
34363447
}
34373448
}
34383449

@@ -3981,7 +3992,7 @@ Set-Acl -Path `$Path -AclObject `$ACL
39813992
"@
39823993
}
39833994
4 {
3984-
break
3995+
break
39853996
}
39863997
5 {
39873998
$Issue.Fix = @"
@@ -4144,10 +4155,10 @@ Function Write-HostColorized {
41444155
# We precompile them for better performance with many input objects.
41454156
[System.Text.RegularExpressions.RegexOptions] $reOpts =
41464157
if ($CaseSensitive) {
4147-
'Compiled, ExplicitCapture'
4158+
'Compiled, ExplicitCapture'
41484159
}
41494160
else {
4150-
'Compiled, ExplicitCapture, IgnoreCase'
4161+
'Compiled, ExplicitCapture, IgnoreCase'
41514162
}
41524163

41534164
# Transform the dictionary:
@@ -4169,10 +4180,10 @@ Function Write-HostColorized {
41694180
}
41704181
$colorArgs = @{ }
41714182
if ($fg) {
4172-
$colorArgs['ForegroundColor'] = [ConsoleColor] $fg
4183+
$colorArgs['ForegroundColor'] = [ConsoleColor] $fg
41734184
}
41744185
if ($bg) {
4175-
$colorArgs['BackgroundColor'] = [ConsoleColor] $bg
4186+
$colorArgs['BackgroundColor'] = [ConsoleColor] $bg
41764187
}
41774188

41784189
# Consolidate the patterns into a single pattern with alternation ('|'),
@@ -4191,7 +4202,7 @@ Function Write-HostColorized {
41914202
}
41924203
}
41934204
catch {
4194-
throw
4205+
throw
41954206
}
41964207

41974208
# Construct the arguments to pass to Out-String.
@@ -4214,7 +4225,7 @@ Function Write-HostColorized {
42144225
foreach ($m in $entry.Key.Matches($_)) {
42154226
@{ Index = $m.Index; Text = $m.Value; ColorArgs = $entry.Value }
42164227
if ($WholeLine) {
4217-
break patternLoop
4228+
break patternLoop
42184229
}
42194230
}
42204231
}
@@ -4390,7 +4401,7 @@ function Invoke-Locksmith {
43904401
[System.Management.Automation.PSCredential]$Credential
43914402
)
43924403

4393-
$Version = '2025.3.28'
4404+
$Version = '2025.4.20'
43944405
$LogoPart1 = @'
43954406
_ _____ _______ _ _ _______ _______ _____ _______ _ _
43964407
| | | | |____/ |______ | | | | | |_____|

Locksmith.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
FunctionsToExport = 'Invoke-Locksmith'
99
GUID = 'b1325b42-8dc4-4f17-aa1f-dcb5984ca14a'
1010
HelpInfoURI = 'https://raw.githubusercontent.com/jakehildreth/Locksmith/main/en-US/'
11-
ModuleVersion = '2025.3.28'
11+
ModuleVersion = '2025.4.20'
1212
PowerShellVersion = '5.1'
1313
PrivateData = @{
1414
PSData = @{
1515
ExternalModuleDependencies = @('ActiveDirectory', 'ServerManager', 'Microsoft.PowerShell.Utility', 'Microsoft.PowerShell.LocalAccounts', 'Microsoft.PowerShell.Management', 'Microsoft.PowerShell.Security', 'CimCmdlets', 'Dism')
1616
IconUri = 'https://raw.githubusercontent.com/jakehildreth/Locksmith/main/Images/locksmith.ico'
1717
ProjectUri = 'https://github.com/jakehildreth/Locksmith'
18-
Tags = @('Windows', 'Locksmith', 'CA', 'PKI', 'ActiveDirectory', 'CertificateServices', 'ADCS')
18+
Tags = @('Locksmith', 'ActiveDirectory', 'ADCS', 'CA', 'Certificate', 'CertificateAuthority', 'CertificateServices', 'PKI', 'X509', 'Windows')
1919
}
2020
}
2121
RequiredModules = @('ActiveDirectory', 'ServerManager', 'Microsoft.PowerShell.Utility', 'Microsoft.PowerShell.LocalAccounts', 'Microsoft.PowerShell.Management', 'Microsoft.PowerShell.Security', 'CimCmdlets', 'Dism')

0 commit comments

Comments
 (0)