本帖最后由 WHY 于 2023-2-22 20:04 编辑
PowerShell 脚本
2023/02/22 简化脚本。我测试没有发现问题 | $file1 = '01.txt'; | | $file2 = 'basetik.tik'; | | $file3 = 'basetik_001.tik'; | | | | $text = [IO.File]::ReadAllText($file1, [Text.Encoding]::Default); | | $bytes = [IO.File]::ReadAllBytes($file2); | | | | Function Set-ByteValue($key, [int]$offSet){ | | $reg = '(?i)(?<=' + $key + ' *)[a-f0-9]+'; | | $s = ([regex]::Match($text, $reg)).Value; | | for ($i = 0; $i -lt $s.Length; $i+=2) { | | $x = $i / 2 + $offSet; | | $bytes[$x] = [byte][int]('0x' + $s.SubString($i, 2)); | | } | | } | | | | Set-ByteValue -key 'Using title id:' -offSet 0x01DC; | | Set-ByteValue -key 'generated encrypted:' -offSet 0x01BF; | | | | [IO.File]::WriteAllBytes($file3, $bytes); | | | | echo 'Done'; | | [Console]::ReadLine();COPY |
|