enet-validator/scripts/session/check_desc.ps1

26 lines
997 B
PowerShell
Raw Permalink Normal View History

[Console]::OutputEncoding = [Text.Encoding]::UTF8
$lines = [IO.File]::ReadAllLines("$env:TEMP\opencode\ss123.tsv")
$checked = 0; $allDesc = 0
foreach ($ln in $lines) {
$p = $ln -split "`t"
if ($p.Count -lt 5 -or $p[4].Length -lt 100) { continue }
$hex = $p[4] -replace '[^0-9a-fA-F]',''
if ($hex.Length -ne 2168) { continue }
$b = New-Object byte[] 1084
for ($i = 0; $i -lt 1084; $i++) { $b[$i] = [Convert]::ToByte($hex.Substring($i*2,2),16) }
if ($b[0x20] -ne 1 -or $b[0x21] -ne 1) { continue }
$checked++
if ($checked -gt 200) { break }
$ok = $true
foreach ($base in @(0x3C, 0x23C)) {
for ($i = 0; $i -lt 511; $i++) {
$d = ($b[$base+$i] - $b[$base+$i+1]) -band 0xFF
if ($d -ne 1) { $ok = $false; break }
}
if (-not $ok) { break }
}
if ($ok) { $allDesc++ }
}
echo "检查帧: $checked, 全 512B 严格递减(mod256): $allDesc"
# 若成立 → 数据=加密后的全零, rot 可从首字节推出