Message
Message
<#
.SYNOPSIS
3-Color DMA Detection Script + Optional Discord Webhook
- RED: Definite DMA cheat detected
- YELLOW: Possible DMA cheat detected
- GREEN: No DMA cheat evidence found
.DESCRIPTION
1. Checks Secure Boot & Kernel DMA Protection.
2. Enumerates:
- Present PCI devices
- Hidden/removed devices
- Registry PCI entries
- SetupAPI logs
- Thunderbolt events
- EDID monitor data
3. Labels device/log evidence as:
- "CONCRETE" if both a suspicious vendor ID & cheat keyword are found
- "SUSPICIOUS" if partial match
- "NONE" otherwise
4. Final color logic:
- RED if we found "CONCRETE" OR if Kernel DMA is ON and we found any
suspicious items.
- YELLOW if suspicious items but Kernel DMA is OFF.
- GREEN if no suspicious items.
.NOTES
- Run as Administrator for full access to device logs.
- Adjust $Global:SuspiciousVendors / $Global:SuspiciousKeywords as needed.
#>
[CmdletBinding()]
param()
# Safe vendors
$Global:KnownSafeVendors = @("Intel", "NVIDIA", "AMD", "Realtek", "Microsoft",
"Logitech", "Corsair", "Kingston", "Samsung", "ASUS", "Broadcom")
#endregion
#region Functions
function Get-SecureBootStatus {
try {
if (Confirm-SecureBootUEFI -ErrorAction SilentlyContinue) { return $true }
else { return $false }
} catch {
return $false
}
}
function Get-KernelDMAProtectionStatus {
$tempReport = "$env:TEMP\msinfo_report.txt"
try {
msinfo32 /report $tempReport | Out-Null
$report = Get-Content $tempReport -ErrorAction SilentlyContinue
Remove-Item $tempReport -Force -ErrorAction SilentlyContinue
foreach ($line in $report) {
if ($line -match "Kernel DMA Protection\s*:\s*(\S+)") {
$status = $matches[1].Trim()
if ($status -eq "Enabled") { return $true }
else { return $false }
}
}
} catch {
return $false
}
return $false
}
function Test-DeviceForSuspicion {
param(
[AllowEmptyString()][AllowNull()][string]$Name,
[AllowEmptyString()][AllowNull()][string]$Description,
[AllowEmptyString()][AllowNull()][string[]]$HardwareIDs
)
# Returns "NONE", "SUSPICIOUS", or "CONCRETE"
if ([string]::IsNullOrWhiteSpace($Name)) { $Name = "[No Name]" }
if ([string]::IsNullOrWhiteSpace($Description)){ $Description = "[No
Description]" }
$foundVendor = $false
$foundKeyword = $false
function Get-SuspiciousPresentPCIDevices {
$devices = Get-CimInstance Win32_PnPEntity -ErrorAction SilentlyContinue
$results = @()
foreach ($dev in $devices) {
$score = Test-DeviceForSuspicion -Name $dev.Name -Description
$dev.Description -HardwareIDs $dev.HardwareID
if ($score -ne "NONE") {
$results += [PSCustomObject]@{
Device = $dev
Evidence = $score
}
}
}
return $results
}
function Get-SuspiciousHiddenDevices {
$all = Get-PnpDevice -PresentOnly:$false -ErrorAction SilentlyContinue
$results = @()
foreach ($dev in $all) {
if ($dev.Status -eq "Unknown" -or $dev.Status -eq "Error") {
$cim = Get-CimInstance Win32_PnPEntity -Filter "DeviceID='$
($dev.InstanceId.Replace('\','\\'))'" -ErrorAction SilentlyContinue
if ($cim) {
$score = Test-DeviceForSuspicion -Name $cim.Name -Description
$cim.Description -HardwareIDs $cim.HardwareID
if ($score -ne "NONE") {
$results += [PSCustomObject]@{
PnpDevice = $dev
CimDevice = $cim
Evidence = $score
}
}
}
}
}
return $results
}
function Get-SuspiciousRegistryPCIDevices {
$key = "HKLM:\SYSTEM\CurrentControlSet\Enum\PCI"
$results = @()
if (Test-Path $key) {
$items = Get-ChildItem $key -ErrorAction SilentlyContinue
foreach ($i in $items) {
foreach ($ven in $Global:SuspiciousVendors) {
if ($i.PSChildName -match "VEN_$ven") {
$results += [PSCustomObject]@{
RegistryKey = $i.PSPath
Identifier = $i.PSChildName
Evidence = "SUSPICIOUS"
}
break
}
}
}
}
return $results
}
function Parse-SetupAPILog {
# Count lines with suspicious versus definite evidence in the SetupAPI log.
$whitelist = @("wdma_usb", "wdmaudio.inf")
$logPath = "C:\Windows\Inf\setupapi.dev.log"
$suspiciousCount = 0
$concreteCount = 0
if (Test-Path $logPath) {
$lines = Get-Content $logPath -ErrorAction SilentlyContinue
foreach ($line in $lines) {
# Skip whitelisted lines.
$skip = $false
foreach ($safe in $whitelist) {
if ($line -match $safe) {
$skip = $true
break
}
}
if ($skip) { continue }
# Check for vendor IDs and keywords.
$hasVendor = $false
foreach ($ven in $Global:SuspiciousVendors) {
if ($line -match "VEN_$ven") {
$hasVendor = $true
break
}
}
$hasKeyword = $false
foreach ($key in $Global:SuspiciousKeywords) {
if ($line -match $key) {
$hasKeyword = $true
break
}
}
if ($hasVendor -and $hasKeyword) {
$concreteCount++
} elseif ($hasVendor -or $hasKeyword) {
$suspiciousCount++
}
}
}
return [PSCustomObject]@{
SuspiciousCount = $suspiciousCount
ConcreteCount = $concreteCount
}
}
function Check-ThunderboltEvents {
$tbEvents = @()
try {
$events = Get-WinEvent -LogName "Microsoft-Windows-Thunderbolt/Operational"
-ErrorAction SilentlyContinue
if ($events) {
foreach ($e in $events) {
if ($e.Message -match "(unauthorized|failed|blocked)") {
$tbEvents += $e
}
}
}
} catch {}
return $tbEvents
}
function Get-EDIDData {
$monitors = @()
$key = "HKLM:\SYSTEM\CurrentControlSet\Enum\DISPLAY"
if (Test-Path $key) {
$items = Get-ChildItem $key -ErrorAction SilentlyContinue
foreach ($i in $items) {
foreach ($sub in Get-ChildItem $i.PSPath -ErrorAction SilentlyContinue)
{
$dp = Get-ItemProperty -Path "$($sub.PSPath)\Device Parameters" -
ErrorAction SilentlyContinue
if ($dp -and $dp.DeviceID) {
$monitors += [PSCustomObject]@{
DevicePath = $sub.PSPath
DeviceID = $dp.DeviceID
}
}
}
}
}
return $monitors
}
#endregion
$secureBoot = Get-SecureBootStatus
$kernelDMA = Get-KernelDMAProtectionStatus
if ($secureBoot) {
Write-Host " - Secure Boot: ENABLED" -ForegroundColor Green
} else {
Write-Host " - Secure Boot: DISABLED" -ForegroundColor Yellow
}
if ($kernelDMA) {
Write-Host " - Kernel DMA Protection: ENABLED" -ForegroundColor Green
} else {
Write-Host " - Kernel DMA Protection: DISABLED/Unsupported" -ForegroundColor
Yellow
}
# Summarize evidence.
$suspiciousItems = 0
$definiteItems = 0
$suspiciousItems += $presentSuspicious.Count
$definiteItems += $presentConcrete.Count
$suspiciousItems += $hiddenSuspicious.Count
$definiteItems += $hiddenConcrete.Count
$suspiciousItems += $regPci.Count
$suspiciousItems += $setupInfo.SuspiciousCount
$definiteItems += $setupInfo.ConcreteCount
if ($tbEvents.Count -gt 0) { $suspiciousItems++ }
if ($edid.Count -gt 1) { $suspiciousItems++ }
if ($definiteItems -gt 0) {
$finalColor = "Red"
} elseif ($suspiciousItems -gt 0) {
if ($kernelDMA) {
$finalColor = "Red" # System is hardened but suspicious evidence found.
} else {
$finalColor = "Yellow" # System vulnerable, possible cheat detected.
}
}
Write-Host "`n$summaryMessage"
#endregion