2023-11-16 16:56:13 +00:00
|
|
|
|
$SourceFilePath = $args[0]
|
|
|
|
|
$DestinationFilePath = $args[1]
|
|
|
|
|
$XorKey = [byte]$args[2]
|
2024-09-18 14:40:23 +00:00
|
|
|
|
[System.Environment]::CurrentDirectory = (Get-Location)
|
2023-11-16 16:56:13 +00:00
|
|
|
|
# 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)
|