PowerShellのバイト配列をファイルに書き込むには

PowerShellのバイト配列をファイルに書き込むには、以下のようなPowerShellスクリプトを作成して実行する。

[byte[]]$Bytes=@(84,104,105,115,32,112,114,111,103,114,97,109,32,99,97,110,110,111,116,32,98,101,32,114,117,110,32,105,110,32,68,79,83,32,109,111,100,101);

[System.IO.File]::WriteAllBytes("C:\path\to\out.bin", $Bytes);

GitHubにスクリプトをアップロード済。

後日、もっと手っ取り早い方法を知った。

CyberChefの From Decimalはpythonのchr()と同様の働きをする。To Decimalord()と同様の働きをする。

結論:CyberChefは万能

参考
https://eddiejackson.net/wp/?p=23393

Leave a Reply

Your email address will not be published. Required fields are marked *