continuity/scripts/dexor_binary_file.ps1

15 lines
397 B
PowerShell
Raw Permalink Normal View History

2023-11-16 16:56:13 +00:00
$SourceFilePath = $args[0]
$DestinationFilePath = $args[1]
$XorKey = [byte]$args[2]
# Load the binary data from the file
$data = [System.IO.File]::ReadAllBytes($SourceFilePath)
# Apply the XOR operation
for ($i = 0; $i -lt $data.Length; $i++) {
$data[$i] = $data[$i] -bxor $XorKey
}
# Write the output to the destination file
[System.IO.File]::WriteAllBytes($DestinationFilePath, $data)