Last active
September 4, 2025 22:55
-
-
Save cobalthex/86367a2d09f941bb49bc3b81f6bb6e51 to your computer and use it in GitHub Desktop.
[public] powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param([Parameter(Mandatory, Position=0)]$ExePath) | |
| $exeBytes = Get-Content $ExePath -AsByteStream -TotalCount 4096 | |
| $peOffset = [BitConverter]::ToInt32($exeBytes, 0x3c) | |
| $machine = [BitConverter]::ToUInt16($exeBytes, $peOffset + 4) | |
| switch ($machine) | |
| { | |
| 0x014c { "x86" } | |
| 0x8664 { "x64" } | |
| 0xAA64 { "ARM64" } | |
| 0x01c0 { "ARM" } | |
| default { "Unknown (0x$($machine.ToString("X")))" } | |
| } |
Comments are disabled for this gist.