Skip to content

Commit 46e10c5

Browse files
authored
PSDecode v4.2 Release
Fixed Issue #9: #9. -dump switch where only a single encoded executable is present resulted in each byte in the executable being written to individual files.
1 parent 6875769 commit 46e10c5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

PSDecode.psm1

+12-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
.NOTES
2626
File Name : PSDecode.psm1
2727
Author : @R3MRUM
28-
Version : 4.1
28+
Version : 4.2
2929
.LINK
3030
https://github.com/R3MRUM/PSDecode
3131
.LINK
@@ -747,11 +747,19 @@ function PSDecode {
747747
if($exe_matches.Count -gt 0){
748748
$extracted_exes = Extract_Executables($exe_matches)
749749
Write-Host "Identified $($exe_matches.Count) potential executable(s). Saving to $([System.IO.Path]::GetTempPath())"
750-
ForEach($exe in $extracted_exes){
751-
$exe_md5 = Get_MD5($exe)
750+
if($exe_matches.Count -eq 1){
751+
$exe_md5 = Get_MD5($extracted_exes)
752752
$out_filename = "$([System.IO.Path]::GetTempPath())$($md5)_executable_$($exe_md5).bin"
753753
Write-Host "Writing $($out_filename).`tMD5: $($exe_md5)"
754-
$exe | Set-Content $out_filename -Encoding Byte
754+
$extracted_exes | Set-Content $out_filename -Encoding Byte
755+
}
756+
Else{
757+
ForEach($exe in $extracted_exes){
758+
$exe_md5 = Get_MD5($exe)
759+
$out_filename = "$([System.IO.Path]::GetTempPath())$($md5)_executable_$($exe_md5).bin"
760+
Write-Host "Writing $($out_filename).`tMD5: $($exe_md5)"
761+
$exe | Set-Content $out_filename -Encoding Byte
762+
}
755763
}
756764
}
757765
}

0 commit comments

Comments
 (0)