I am a complete layman so I can’t do it alone. I don’t know anything about PS However, the task seems to be simple.
I have a script - but you can only process single files with it at a time. I would like to be able to use it for several files at once - just e.g. for * .xxx in the directory. The output files may have the same name.
Can someone modify this script or give me a different one that will apply the first to all files in a given location at once?
Thank you in advance for any help. Here is the script:
# Usage: ps\xorcrypt.ps1 bin\input.bin bin\output.bin param ( [Parameter(Mandatory=$true)] [string] $file1, #First File [Parameter(Mandatory=$true)] [string] $out #Output File ) #end param [Environment]::CurrentDirectory = (Get-Location -PSProvider FileSystem).ProviderPath $file1_b = [System.IO.File]::ReadAllBytes($file1) $xord_byte_array = New-Object Byte[] $file1_b.Count # Put your key here [Byte[]] $key =0x55,0x66,0x77,0x88 $key_position = 0 # XOR for($i=0; $i -lt $file1_b.Count; $i++) { $xord_byte_array[$i] = $file1_b[$i] -bxor $key[$key_position] $key_position += 1 if ($key_position -eq $key.Length) {$key_position = 0} } # Write the XORd bytes to the output file [System.IO.File]::WriteAllBytes("$out", $xord_byte_array) Write-host "$out" -foregroundcolor yellow -nonewline; Write-host ".";