v2.2.1: Critical multi-run session bugfix, .Count property fix, ASR prompt improvement, code quality review

This commit is contained in:
NexusOne23 2025-12-20 23:08:01 +01:00
parent c6f8291d50
commit b3efcf35fd
68 changed files with 307 additions and 159 deletions

View file

@ -1,6 +1,6 @@
@{
RootModule = 'ASR.psm1'
ModuleVersion = '2.2.0'
ModuleVersion = '2.2.1'
GUID = 'b2c3d4e5-f6a7-8901-bcde-f23456789012'
Author = 'NexusOne23'
CompanyName = 'Open Source Project'
@ -25,7 +25,7 @@
LicenseUri = ''
ProjectUri = ''
ReleaseNotes = @"
v2.2.0 - Production Release
v2.2.1 - Production Release
- All 19 ASR rules implementation
- Hybrid approach: Registry backup + Set-MpPreference application
- SCCM/Configuration Manager detection

View file

@ -11,7 +11,7 @@
.NOTES
Author: NexusOne23
Version: 2.2.0
Version: 2.2.1
Requires: PowerShell 5.1+, Administrator privileges, Windows Defender
#>

View file

@ -307,7 +307,7 @@ function Invoke-ASRRules {
Write-Host "This rule blocks very new or unknown executables that" -ForegroundColor Yellow
Write-Host "are not yet trusted by Microsoft's reputation systems." -ForegroundColor Yellow
Write-Host ""
Write-Host "Do you install NEW or UNTRUSTED software frequently?" -ForegroundColor White
Write-Host "Do you install NEW software frequently?" -ForegroundColor White
Write-Host ""
Write-Host " - Games from independent developers" -ForegroundColor Gray
Write-Host " - Beta software / Early access programs" -ForegroundColor Gray
@ -315,12 +315,12 @@ function Invoke-ASRRules {
Write-Host " - Open-source tools without Microsoft reputation" -ForegroundColor Gray
Write-Host ""
Write-Host "Options:" -ForegroundColor Cyan
Write-Host " [Y] Yes - I need to install untrusted software" -ForegroundColor Yellow
Write-Host " [Y] Yes - I regularly install new software" -ForegroundColor Yellow
Write-Host " > AUDIT mode: Events logged, installs allowed" -ForegroundColor Gray
Write-Host " > Developer/test mode (less secure)" -ForegroundColor Gray
Write-Host " > Recommended if you install software from various sources" -ForegroundColor Gray
Write-Host ""
Write-Host " [N] No - I only install trusted software" -ForegroundColor Green
Write-Host " > BLOCK mode: Maximum security (recommended)" -ForegroundColor Gray
Write-Host " [N] No - I rarely install new software" -ForegroundColor Green
Write-Host " > BLOCK mode: Maximum security" -ForegroundColor Gray
Write-Host " > New/unknown installers may be blocked" -ForegroundColor Gray
Write-Host ""
@ -483,14 +483,14 @@ function Invoke-ASRRules {
$mpPref = Get-MpPreference
$currentActions = $mpPref.AttackSurfaceReductionRules_Actions
if ($currentActions) {
$result.Details.BlockMode = ($currentActions | Where-Object { $_ -eq 1 }).Count
$result.Details.AuditMode = ($currentActions | Where-Object { $_ -eq 2 }).Count
$result.Details.DisabledMode = ($currentActions | Where-Object { $_ -eq 0 }).Count
$result.Details.BlockMode = @($currentActions | Where-Object { $_ -eq 1 }).Count
$result.Details.AuditMode = @($currentActions | Where-Object { $_ -eq 2 }).Count
$result.Details.DisabledMode = @($currentActions | Where-Object { $_ -eq 0 }).Count
} else {
# Fallback to array count
$result.Details.BlockMode = ($asrRules | Where-Object { $_.Action -eq 1 }).Count
$result.Details.AuditMode = ($asrRules | Where-Object { $_.Action -eq 2 }).Count
$result.Details.DisabledMode = ($asrRules | Where-Object { $_.Action -eq 0 }).Count
$result.Details.BlockMode = @($asrRules | Where-Object { $_.Action -eq 1 }).Count
$result.Details.AuditMode = @($asrRules | Where-Object { $_.Action -eq 2 }).Count
$result.Details.DisabledMode = @($asrRules | Where-Object { $_.Action -eq 0 }).Count
}
# Step 6: Verification

View file

@ -2,7 +2,7 @@
# Module manifest for AdvancedSecurity
# Version
ModuleVersion = '2.2.0'
ModuleVersion = '2.2.1'
# Unique ID
GUID = 'e7f5a3d2-8c9b-4f1e-a6d3-9b2c8f4e5a1d'
@ -48,7 +48,7 @@
LicenseUri = ''
ProjectUri = ''
ReleaseNotes = @'
v2.2.0 (2025-12-08)
v2.2.1 (2025-12-08)
- Production release of AdvancedSecurity module
- 49 advanced hardening settings implemented (was 36)
- NEW: Wireless Display (Miracast) security hardening

View file

@ -1,5 +1,5 @@
# AdvancedSecurity Module Loader
# Version: 2.2.0
# Version: 2.2.1
# Description: Advanced Security Hardening - Beyond Microsoft Security Baseline
# Get module path

View file

@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Administrative Shares Configuration",
"description": "Configuration for disabling administrative shares (C$, ADMIN$, etc.) to prevent lateral movement",
"version": "2.2.0",
"version": "2.2.1",
"Administrative_Shares": {
"description": "Disable automatic creation and remove existing administrative shares",

View file

@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Credential Protection Configuration",
"description": "Configuration for credential hardening including WDigest protection",
"version": "2.2.0",
"version": "2.2.1",
"WDigest_Protection": {
"description": "Prevent WDigest from storing plaintext passwords in LSASS memory",

View file

@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "RDP Hardening Configuration",
"description": "Configuration for RDP (Remote Desktop Protocol) hardening including NLA enforcement and optional complete disable",
"version": "2.2.0",
"version": "2.2.1",
"NLA_Enforcement": {
"description": "Network Level Authentication (NLA) enforcement settings",

View file

@ -21,7 +21,7 @@ function Block-FingerProtocol {
.NOTES
Author: NexusOne23
Version: 2.2.0
Version: 2.2.1
Requires: Administrator privileges
REFERENCES:

View file

@ -27,7 +27,7 @@ function Set-SRPRules {
.NOTES
Author: NexusOne23
Version: 2.2.0
Version: 2.2.1
Requires: Administrator privileges
REFERENCES:

View file

@ -22,7 +22,7 @@ function Set-WindowsUpdate {
.NOTES
Author: NexusOne23
Version: 2.2.0
Version: 2.2.1
Requires: Administrator privileges
Based on: Windows Settings > Windows Update > Advanced options
#>

View file

@ -28,6 +28,7 @@ function Test-DiscoveryProtocolsSecurity {
Tcp5357ListenersClosed = $null
Tcp5358ListenersClosed = $null
Compliant = $false
Pass = $true # Optional feature (Maximum only) - always pass
}
try {
@ -69,7 +70,7 @@ function Test-DiscoveryProtocolsSecurity {
if ($rules.Count -gt 0) {
$result.FirewallRulesPresent = ($rules.Count -eq $ruleNames.Count)
$result.FirewallRulesEnabled = ($rules | Where-Object { $_.Enabled -eq 'True' -and $_.Action -eq 'Block' }).Count -eq $ruleNames.Count
$result.FirewallRulesEnabled = @($rules | Where-Object { $_.Enabled -eq 'True' -and $_.Action -eq 'Block' }).Count -eq $ruleNames.Count
}
# 4) Optional: check that ports are not listening

View file

@ -16,10 +16,12 @@ function Test-FirewallShieldsUp {
$value = Get-ItemProperty -Path $regPath -Name $valueName -ErrorAction SilentlyContinue
if ($null -eq $value -or $value.$valueName -ne 1) {
# Shields Up is OPTIONAL (Maximum profile only) - not a failure if not enabled
return @{
Pass = $false
Message = "Shields Up NOT enabled (Public network allows configured exceptions)"
Pass = $true # Optional feature - always pass
Message = "Shields Up not enabled (Optional - Maximum profile only)"
CurrentValue = if ($null -eq $value) { "Not Set" } else { $value.$valueName }
IsEnabled = $false
}
}
@ -27,13 +29,15 @@ function Test-FirewallShieldsUp {
Pass = $true
Message = "Shields Up ENABLED (Public network blocks ALL incoming)"
CurrentValue = 1
IsEnabled = $true
}
}
catch {
return @{
Pass = $false
Pass = $true # Don't fail on error for optional feature
Message = "Error checking Shields Up: $_"
CurrentValue = "Error"
IsEnabled = $false
}
}
}

View file

@ -11,7 +11,7 @@ function Invoke-AdvancedSecurity {
- Enterprise: Conservative approach with domain-safety checks
- Maximum: Maximum hardening for air-gapped/high-security environments
Features implemented (v2.2.0):
Features implemented (v2.2.1):
- RDP NLA enforcement + optional complete disable
- WDigest credential protection
- Administrative shares disable (domain-aware)

View file

@ -110,13 +110,15 @@ function Test-AdvancedSecurity {
Write-Host "Testing Discovery Protocols (WS-Discovery + mDNS)..." -ForegroundColor Gray
$discoveryTest = Test-DiscoveryProtocolsSecurity
if ($discoveryTest) {
# Optional feature (Maximum profile only) - use Pass field which is always true
$statusText = if ($discoveryTest.Compliant) { "Disabled (Maximum)" } else { "Enabled (Optional - Maximum profile only)" }
$results += [PSCustomObject]@{
Feature = "Discovery Protocols (WS-Discovery + mDNS)"
Status = if ($discoveryTest.Compliant) { "Secure" } else { "Insecure" }
Status = $statusText
Details = "mDNS=" + $(if ($discoveryTest.EnableMDNS -eq 0) { "Disabled" } else { "Enabled/Not Set" }) +
"; Services: FDResPub=" + $discoveryTest.FDResPubDisabled + ", fdPHost=" + $discoveryTest.FdPHostDisabled +
"; FirewallRulesEnabled=" + $discoveryTest.FirewallRulesEnabled
Compliant = $discoveryTest.Compliant
Compliant = $discoveryTest.Pass # Always true - optional feature
}
}
@ -124,9 +126,11 @@ function Test-AdvancedSecurity {
Write-Host "Testing Firewall Shields Up (Public)..." -ForegroundColor Gray
$shieldsUpTest = Test-FirewallShieldsUp
# Always pass - this is an optional hardening only for the Maximum (air-gapped) profile
$statusText = if ($shieldsUpTest.IsEnabled) { "Enabled (Maximum)" } else { "Not enabled (Optional - Maximum profile only)" }
$results += [PSCustomObject]@{
Feature = "Firewall Shields Up (Public)"
Compliant = $shieldsUpTest.Pass
Status = $statusText
Compliant = $shieldsUpTest.Pass # Always true - optional feature
Details = $shieldsUpTest.Message
}
@ -147,8 +151,8 @@ function Test-AdvancedSecurity {
Write-Host "============================================" -ForegroundColor Cyan
Write-Host ""
$compliantCount = ($results | Where-Object { $_.Compliant -eq $true }).Count
$totalTests = $results.Count
$compliantCount = @($results | Where-Object { $_.Compliant -eq $true }).Count
$totalTests = @($results).Count
$compliancePercent = [math]::Round(($compliantCount / $totalTests) * 100, 1)
Write-Host "Total Tests: $totalTests" -ForegroundColor White

View file

@ -1,6 +1,6 @@
@{
RootModule = 'AntiAI.psm1'
ModuleVersion = '2.2.0'
ModuleVersion = '2.2.1'
GUID = 'f8e9d7c6-5b4a-3c2d-1e0f-9a8b7c6d5e4f'
Author = 'NexusOne23'
CompanyName = 'Open Source Project'

View file

@ -11,7 +11,7 @@
.NOTES
Module: AntiAI
Version: 2.2.0
Version: 2.2.1
Author: NoID Privacy
#>
@ -29,7 +29,7 @@ $privateFunctions = @(
'Disable-Recall'
'Set-RecallProtection'
'Disable-Copilot'
'Disable-CopilotAdvanced' # NEW v2.2.0: URI handlers, Edge sidebar, Recall export
'Disable-CopilotAdvanced' # NEW v2.2.1: URI handlers, Edge sidebar, Recall export
'Disable-ClickToDo'
'Disable-SettingsAgent'
'Disable-ExplorerAI' # NEW: File Explorer AI Actions menu

View file

@ -40,7 +40,7 @@
.NOTES
Requires Administrator privileges.
Part of NoID Privacy AntiAI Module v2.2.0
Part of NoID Privacy AntiAI Module v2.2.1
#>
function Disable-CopilotAdvanced {
[CmdletBinding()]

View file

@ -42,7 +42,7 @@
.NOTES
Author: NoID Privacy
Version: 2.2.0 (Extended validation)
Version: 2.2.1 (Extended validation)
Requires: Windows 11 24H2+, Administrator privileges
#>

View file

@ -52,7 +52,7 @@
.NOTES
Author: NoID Privacy
Version: 2.2.0
Version: 2.2.1
Requires: Windows 11 24H2 or later, Administrator privileges
Impact: All AI features completely disabled, reboot required
#>
@ -70,7 +70,7 @@ function Invoke-AntiAI {
Write-Host "" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " ANTI-AI MODULE v2.2.0" -ForegroundColor Cyan
Write-Host " ANTI-AI MODULE v2.2.1" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Disables 15 AI features (32 policies):" -ForegroundColor White
@ -171,7 +171,7 @@ function Invoke-AntiAI {
@{ Path = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Paint"; Name = "DisableImageCreator"; Type = "DWord" },
@{ Path = "HKLM:\SOFTWARE\Policies\WindowsNotepad"; Name = "DisableAIFeatures"; Type = "DWord" },
@{ Path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsAI"; Name = "DisableSettingsAgent"; Type = "DWord" },
# NEW v2.2.0: Advanced Copilot Blocking
# NEW v2.2.1: Advanced Copilot Blocking
@{ Path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsAI"; Name = "AllowRecallExport"; Type = "DWord" },
@{ Path = "HKLM:\SOFTWARE\Policies\Microsoft\Edge"; Name = "EdgeSidebarEnabled"; Type = "DWord" },
@{ Path = "HKLM:\SOFTWARE\Policies\Microsoft\Edge"; Name = "ShowHubsSidebar"; Type = "DWord" },
@ -355,7 +355,7 @@ function Invoke-AntiAI {
}
# ============================================================================
# ADVANCED COPILOT BLOCKING (NEW v2.2.0)
# ADVANCED COPILOT BLOCKING (NEW v2.2.1)
# ============================================================================
Write-Host ""
Write-Host " [Advanced Copilot Blocks]" -ForegroundColor Cyan

View file

@ -2,7 +2,7 @@
# Module manifest for DNS module
RootModule = 'DNS.psm1'
ModuleVersion = '2.2.0'
ModuleVersion = '2.2.1'
GUID = 'a8f7b3c9-4e5d-4a2b-9c1d-8f3e5a7b9c2d'
Author = 'NexusOne23'
CompanyName = 'Open Source Project'

View file

@ -12,7 +12,7 @@
.NOTES
Author: NoID Privacy
Version: 2.2.0
Version: 2.2.1
Requires: PowerShell 5.1+, Administrator privileges
#>

View file

@ -128,7 +128,7 @@ function Restore-DNSSettings {
$keyContent = Get-ChildItem $dnsClientPath -ErrorAction SilentlyContinue
$keyProps = Get-ItemProperty $dnsClientPath -ErrorAction SilentlyContinue
# Count properties (exclude PS metadata like PSPath, etc.)
$propCount = ($keyProps.PSObject.Properties | Where-Object { $_.Name -notin @('PSPath','PSParentPath','PSChildName','PSDrive','PSProvider') }).Count
$propCount = @($keyProps.PSObject.Properties | Where-Object { $_.Name -notin @('PSPath','PSParentPath','PSChildName','PSDrive','PSProvider') }).Count
if (($null -eq $keyContent -or $keyContent.Count -eq 0) -and $propCount -eq 0) {
Remove-Item $dnsClientPath -Force -ErrorAction SilentlyContinue
@ -158,7 +158,7 @@ function Restore-DNSSettings {
if (Test-Path $dnsParamsPath) {
$keyContent = Get-ChildItem $dnsParamsPath -ErrorAction SilentlyContinue
$keyProps = Get-ItemProperty $dnsParamsPath -ErrorAction SilentlyContinue
$propCount = ($keyProps.PSObject.Properties | Where-Object { $_.Name -notin @('PSPath','PSParentPath','PSChildName','PSDrive','PSProvider') }).Count
$propCount = @($keyProps.PSObject.Properties | Where-Object { $_.Name -notin @('PSPath','PSParentPath','PSChildName','PSDrive','PSProvider') }).Count
if (($null -eq $keyContent -or $keyContent.Count -eq 0) -and $propCount -eq 0) {
Remove-Item $dnsParamsPath -Force -ErrorAction SilentlyContinue

View file

@ -3,7 +3,7 @@
RootModule = 'EdgeHardening.psm1'
# Version number of this module
ModuleVersion = '2.2.0'
ModuleVersion = '2.2.1'
# ID used to uniquely identify this module
GUID = '8e3f4c2a-9b1d-4e7a-a2c5-6f8b3d9e1a4c'
@ -48,7 +48,7 @@
LicenseUri = ''
ProjectUri = ''
ReleaseNotes = @"
v2.2.0 - Production Release
v2.2.1 - Production Release
- Microsoft Edge v139 Security Baseline implementation
- 20 security policies (native PowerShell, no LGPO.exe)
- SmartScreen enforcement with override prevention

View file

@ -16,7 +16,7 @@
.NOTES
Author: NexusOne23
Version: 2.2.0
Version: 2.2.1
Requires: PowerShell 5.1+, Administrator privileges
#>

View file

@ -48,7 +48,7 @@
.NOTES
Author: NexusOne23
Version: 2.2.0
Version: 2.2.1
Requires: PowerShell 5.1+, Administrator privileges
IMPORTANT: This applies Microsoft's recommended security baseline.

View file

@ -23,7 +23,7 @@
.NOTES
Author: NexusOne23
Version: 2.2.0
Version: 2.2.1
Can be run without Administrator privileges
#>

View file

@ -1,6 +1,6 @@
@{
RootModule = 'Privacy.psm1'
ModuleVersion = '2.2.0'
ModuleVersion = '2.2.1'
GUID = 'a9f7c8d3-2e5b-4a1f-9c3d-7e8f5a6b2c4d'
Author = 'NexusOne23'
CompanyName = 'Open Source Project'

View file

@ -16,7 +16,7 @@
.NOTES
Module: Privacy
Version: 2.2.0
Version: 2.2.1
Author: NoID Privacy
#>

View file

@ -38,12 +38,12 @@ function Backup-PrivacySettings {
"HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore",
"HKLM:\SOFTWARE\Policies\Microsoft\Dsh",
"HKLM:\SOFTWARE\Policies\Microsoft\FindMyDevice",
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\TextInput", # AllowLinguisticDataCollection (v2.2.0)
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\TextInput", # AllowLinguisticDataCollection (v2.2.1)
"HKLM:\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\appDiagnostics",
# HKCU User Keys
"HKCU:\Software\Policies\Microsoft\Windows\Explorer",
"HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo",
# NEW: Anti-Advertising & Search Settings (v2.2.0)
# NEW: Anti-Advertising & Search Settings (v2.2.1)
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Search",
"HKCU:\Software\Microsoft\Windows\CurrentVersion\SearchSettings",
@ -52,7 +52,7 @@ function Backup-PrivacySettings {
"HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications",
"HKCU:\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement",
"HKCU:\SOFTWARE\Microsoft\Personalization\Settings",
# NEW: Input Personalization Settings (v2.2.0 - FIX missing HKCU backup)
# NEW: Input Personalization Settings (v2.2.1 - FIX missing HKCU backup)
"HKCU:\SOFTWARE\Microsoft\InputPersonalization",
"HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore",
"HKCU:\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\appDiagnostics"

View file

@ -354,7 +354,7 @@ function Invoke-PrivacyHardening {
$bloatwareListPath = Join-Path $moduleBackupPath "REMOVED_APPS_LIST.txt"
$listContent = @()
$listContent += "================================================================"
$listContent += " REMOVED APPS - NoID Privacy v2.2.0"
$listContent += " REMOVED APPS - NoID Privacy v2.2.1"
$listContent += " Session: $(Split-Path $moduleBackupPath -Leaf)"
$listContent += " Date: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')"
$listContent += "================================================================"

View file

@ -44,7 +44,7 @@
.NOTES
Author: NexusOne23
Version: 2.2.0 - Self-Contained Edition
Version: 2.2.1 - Self-Contained Edition
Requires: PowerShell 5.1+, Administrator privileges
BREAKING CHANGE from v1.0:

View file

@ -1,6 +1,6 @@
@{
RootModule = 'SecurityBaseline.psm1'
ModuleVersion = '2.2.0'
ModuleVersion = '2.2.1'
GUID = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'
Author = 'NexusOne23'
CompanyName = 'Open Source Project'
@ -26,7 +26,7 @@
LicenseUri = ''
ProjectUri = ''
ReleaseNotes = @"
v2.2.0 - Self-Contained Edition
v2.2.1 - Self-Contained Edition
- NO LGPO.exe REQUIRED! Fully self-contained implementation
- 425 Microsoft Security Baseline settings for Windows 11 25H2
- 335 Registry policies (Computer + User)

View file

@ -13,7 +13,7 @@
.NOTES
Author: NexusOne23
Version: 2.2.0
Version: 2.2.1
Requires: PowerShell 5.1+, Administrator privileges
#>