Open Davider-code opened 2 years ago
You can pushd / set-location to the directory you want before running it, and it will unpack there
As for using it purely via powershell, it needs more adjustments since it's made to support multiple file attachments. I plan to restructure the output to make that easier.
But if you can't wait, here's your example with BAT85 and randomized password:
# first, mimic $f as it is in the batch file output - the first attachment would be $f[2]
$f = @(0,0)
$f+= @'
::!e^f7}}}}}zpN]c}}}}}-{0Xr}}}}}}=9K9}OOh0V8SfqpTx3.}||hw}66|U}}}}}}}UECg^Oq/^JPQCbZiR,^l8a4^C,JJ}}}_U}}}}}fnUWb2!oz~^_Sa-$mr67-~db4
::}0+l;WG=TE}}VZu}}|hU}}_@V}}_@V}9o.GWj5Q
'@
# second, add the decode part
$b='Microsoft.VisualBasic';Add-Type -As $b;$k=iex "[$b.Interaction]::InputBox('Key',85)";if($k.Length-ne85){exit};Add-Type -Ty @'
using System.IO; public class BAT85 {public static void Dec (ref string[] f, int x, string fo, string key) { unchecked {
byte[] b85=new byte[256];long n=0;int p=0,q=0,c=255,z=f[x].Length; while (c>0) b85[c--]=85; while (c<85) b85[key[c]]=(byte)c++;
int[] p85={52200625,614125,7225,85,1}; using (FileStream o=new FileStream(fo,FileMode.Create)) { for (int i=0;i != z;i++) {
c=b85[f[x][i]]; if (c==85) continue; n += c * p85[p++]; if (p==5) {p=0; q=4; while (q > 0) {q--; o.WriteByte((byte)(n>>8*q));}
n=0;}} if (p>0) {for (int i=0;i<5-p;i++) {n += 84 * p85[p+i];} q=4; while (q>(5-p)) {o.WriteByte((byte)(n>>8*(--q)));} } } }}}
'@; cd -Lit($env:__CD__); function X([int]$x=1){[BAT85]::Dec([ref]$f,$x+1,$x,$k); expand -R $x -F:* .; del $x -force}
# third, call decode function - with arg = 1 because it's the 1st attachment
X(1)
use this randomized key when asked:
}V0UN9@Sd_23{A-WBqh(.oHC!w]|lb)D$pJfK^/n+x7zrQR&1?cmvIOMXa4uZL#TiGkFjPy;esYt[Eg~86=5,
You can pushd / set-location to the directory you want before running it, and it will unpack there
As for using it purely via powershell, it needs more adjustments since it's made to support multiple file attachments. I plan to restructure the output to make that easier.
But if you can't wait, here's your example with BAT85 and randomized password:
# first, mimic $f as it is in the batch file output - the first attachment would be $f[2] $f = @(0,0) $f+= @' ::!e^f7}}}}}zpN]c}}}}}-{0Xr}}}}}}=9K9}OOh0V8SfqpTx3.}||hw}66|U}}}}}}}UECg^Oq/^JPQCbZiR,^l8a4^C,JJ}}}_U}}}}}fnUWb2!oz~^_Sa-$mr67-~db4 ::}0+l;WG=TE}}VZu}}|hU}}_@V}}_@V}9o.GWj5Q '@ # second, add the decode part $b='Microsoft.VisualBasic';Add-Type -As $b;$k=iex "[$b.Interaction]::InputBox('Key',85)";if($k.Length-ne85){exit};Add-Type -Ty @' using System.IO; public class BAT85 {public static void Dec (ref string[] f, int x, string fo, string key) { unchecked { byte[] b85=new byte[256];long n=0;int p=0,q=0,c=255,z=f[x].Length; while (c>0) b85[c--]=85; while (c<85) b85[key[c]]=(byte)c++; int[] p85={52200625,614125,7225,85,1}; using (FileStream o=new FileStream(fo,FileMode.Create)) { for (int i=0;i != z;i++) { c=b85[f[x][i]]; if (c==85) continue; n += c * p85[p++]; if (p==5) {p=0; q=4; while (q > 0) {q--; o.WriteByte((byte)(n>>8*q));} n=0;}} if (p>0) {for (int i=0;i<5-p;i++) {n += 84 * p85[p+i];} q=4; while (q>(5-p)) {o.WriteByte((byte)(n>>8*(--q)));} } } }}} '@; cd -Lit($env:__CD__); function X([int]$x=1){[BAT85]::Dec([ref]$f,$x+1,$x,$k); expand -R $x -F:* .; del $x -force} # third, call decode function - with arg = 1 because it's the 1st attachment X(1)
use this randomized key when asked:
}V0UN9@Sd_23{A-WBqh(.oHC!w]|lb)D$pJfK^/n+x7zrQR&1?cmvIOMXa4uZL#TiGkFjPy;esYt[Eg~86=5,
Thank you very much for your reply I'm looking forward to code enhancement. Pure PowerShell code can support custom expand paths,
Thank you very much for the hard work of the developers of this project
I want to change the bat code into PowerShell code
My programming level is not good. I tried several times without success, so I want to ask the developer for help. Thank you in advance
In addition, I want to know how to customize the output path, for example: $path ='c:\ABC '
code1---bat
code2---powershell--no't succeed