以下是使用 PowerShell 脚本在 Windows Server 上尝试禁用 SWEET32 密码组的方法:
# 设置编码为 UTF-8
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
# 获取当前的 Schannel 密码设置
$currentSettings = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers'
# 查找可能与 SWEET32 相关的密码组项并禁用
foreach ($keyName in $currentSettings.PSChildName) {
if ($keyName -like '*可能与 SWEET32 相关的关键字*') {
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\$keyName" -Name Enabled -Value 0
}
}
$serviceNameKeyword = "w3svc"
$services = Get-Service | Where-Object { $_.Name -like "*$serviceNameKeyword*" }
if ($services) {
# 对找到的服务进行操作
foreach ($service in $services) {
Restart-Service -Name $service.Name
}
} else {
# Write-Host "没有找到包含关键词 '$serviceNameKeyword' 的服务。"
}
# Write-Host "可能与 SWEET32 相关的密码组已尝试禁用并根据情况处理了相关服务。"
2076

被折叠的 条评论
为什么被折叠?



