Windows 7 support ( PowerShell 2.0 / C# 2.0 )
Very fast encoding and decoding BAT85 class
Multiple file(s) and folder(s) "Send to" selection
Optional line split and prefix
- using $ instead of * so that the encoded text cannot contain /* or */ and break host script
Used mostly for sharing configs / scripts / dumps / captures as plain-text on message boards that lack proper file attachments, or to safekeep, run multiple tests and sharing binaries in malware analysis tasks
To prevent copy/paste line-endings issues with the script, use github's clone or download - download ZIP button
Compressed 2 TXT.bat
adds itself to the Send To right-click menu for convenience in usage. To remove, just run:
cmd.exe /c del /f/q "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\SendTo\Compressed 2 TXT.bat"
Tweaked version of Ascii85 that works well with batch syntax highlighter used by pastebin and others
Dictionary:
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$&()+,-./;=?@[]^_{|}~
Encoded example of this release (with batch parameters set/a USE_LINES=1
and set/a USE_PREFIX=1
):
@echo off & pushd %~dp0
powershell -noprofile -c "$f=[io.file]::ReadAllText('%~f0') -split ':bat2file\:.*';iex ($f[1]);X 1;X 2;X 3;X 4;"
exit/b
:bat2file: Compressed2TXT v5.1
Add-Type -Language CSharp -TypeDefinition @"
using System.IO; public class BAT85{ public static void Decode(string tmp, string s) { MemoryStream ms=new MemoryStream(); n=0;
byte[] b85=new byte[255]; string a85="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$&()+,-./;=?@[]^_{|}~";
int[] p85={52200625,614125,7225,85,1}; for(byte i=0;i<85;i++){b85[(byte)a85[i]]=i;} bool k=false;int p=0; foreach(char c in s){
switch(c){ case'\0':case'\n':case'\r':case'\b':case'\t':case'\xA0':case' ':case':': k=false;break; default: k=true;break; }
if(k){ n+= b85[(byte)c] * p85[p++]; if(p == 5){ ms.Write(n4b(), 0, 4); n=0; p=0; } } } if(p>0){ for(int i=0;i<5-p;i++){
n += 84 * p85[p+i]; } ms.Write(n4b(), 0, p-1); } File.WriteAllBytes(tmp, ms.ToArray()); ms.SetLength(0); }
private static byte[] n4b(){ return new byte[4]{(byte)(n>>24),(byte)(n>>16),(byte)(n>>8),(byte)n}; } private static long n=0; }
"@; function X([int]$r=1){ $tmp="$r._"; echo "`n$r.."; [BAT85]::Decode($tmp, $f[$r+1]); expand -R $tmp -F:* .; del $tmp -force }
:bat2file: ~
::O/bZg00000fdBvi00000EC2ui000000|5a50RR9100000O8[_?0RRIP82|tP00000005XyWmEtFE[x@UVRUqIX;~JBWpe/UuvCsN02u(VfPjqvFpvQZ0000D00001
::0000gAarGTbUk5pbZ.p_Dj/QVY(~OgY.SA#00
:bat2file: LICENSE~
::O/bZg000002m=5B00000EC2ui000000|5a50RR9100000L/wH+0RRIPM-5+?00000005XyWmEtFOi4pUPE$nylS^4ayaGoATY!L#01$FS00093H8KDI4n-h~JnaNL
::mY[PjP5[jJ-~(DV&{K9}(l(WU[+c&p|E2&_5Uc;IGXOwE1OQG[/Uv/Yg|nJ@44f]zf&PkjM@}=JeUmGal.ZU(ZjuaUlr4rV|0n;d|NjvB00000002NV]B~ul.|sxX
::faQXM0q#73WE,)Dy|[o=fP@O-zHjy^H6U1fZyuK@1;r#vKDtOv-AjzZ-aXW]Fj!3uSMb|@25__;F/;5{4^I|r/rf6w!C-SoBoAZ41F5(7uE2C|WXAeHv2};V3tlME
::g?VsGUJS7l70lgB6tw@)b(^O.l^WA~G4.my+=Wj|yHF8j-Y$1UUf^rkr0)gPeIQ~qKs;VP-Ra4027QvqNv|P+?Cp&gbn^pH)yoV=RujSa;;Pauk|HlyVt^?T9wui_
::eDdbp#)1dt;!mx/FN@LZqWix2J78rIxf3_]?E,Rs9H,+,x?mCN2iVm-#Naj]h4sTO$~ok+@~sCLBTLTWJ.O~3_1@?h#e38qY{MsKd&J}H+ZELzdt{KP2P)$77e2Iz
::zse!hK^D!m1PRG9K3#s[cCj/.duEE8T{OXVrb,X!w46.fxKYGZxS!d&Zkjq4r8GAe5JB7n)pMS11/;gn&^45L9MTHCE=/$#R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[Qh~8q2A1DO9zB@7jSudYM3,bK(y6jeSbpzV~pz#;iAFIzBCC.rei(
::.vJjelqYwWyJT+qKpg?VBmkr4GVv4c{|e?[M(AiSdh{AFz4g2i9~1eEIM9}H_Ik)cAq?Ah|5-p_lbz]$Ig|(x9E^[/17c6^!9Oe&r(=4a[&PkY#&89jQuOqJ6!-;@
::E;cYytlU{I]-s2JmEU/fz?9=phq0F4L?s50?V.+a?+.$BUd.5.[!$7{4IH#@XAX+A@?HpyemPQahm^C#X&F,L,d3?Dt]s9wV4uVBSa9EVsB_U(HZM3NAN1CYQO{jL
::zv8Zhyhl8tw-RTjO5Tt}0sYysls]Kh;zH~Ek|}dv7E[Mv9jmvo[~PQnV}r_E2l9hQnYbD.)f2G}(VjQr2W{n?J|Z^?K?BttOu|oKT,dApeU}84y)jm;$-R5+7ZH6l
::a~dTf[6i!BKiqv7C[1DBdRx3/3bBOju^9u3#4^GorbYcyz(ek5n{45PBif3E]$$mRSl9(aB)~^|FqDssXXL8&WV2sFK{U=B?R|iZ{T0Y6]+GlKvtZ1pdm30qj)F&w
::-avecxX6/I]HU0Vq#3(nE6)L7Pz5L1@avDAj~8bBAT/[fnN3h3Md~X4NDBT@{73YOlO(J^2b3lKH.1pyUV@/&zPIrlAFuuVXxV=_3qp@A4-_tUx}jnelx6l&c4Hr)
::w|G7qW6Ppn(d_Ou|0f5-=D2+Mv,CZoyg?!?Mj~IN#Qb]@AX=EMcPi/sP-H]w7;BYff^xH~oml{Y
A single decoding block that needs to be placed before the file data. By default batch script decodes all bundled files in one go, but it can be split into individual files anywhere in the script:
powershell -noprofile -c "$f=[io.file]::ReadAllText('%~f0') -split ':bat2file\:.*';iex ($f[1]);X 2;"
...
powershell -noprofile -c "$f=[io.file]::ReadAllText('%~f0') -split ':bat2file\:.*';iex ($f[1]);X 4;"
where X 2;
calls the decoding block to extract the 2nd file data, while X 4;
- the 4th
PowerShell C# snippet BAT85 Encode and Decode class (bundled by generating script slightly uglified):
using System.IO; using System.Text;
public class BAT85 {
private static string a85="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$&()+,-./;=?@[]^_{|}~";
private static byte[] b85=new byte[85]; private static long n=0; private static int[] p85={52200625,614125,7225,85,1};
private static byte[] n4b(){ return new byte[4]{(byte)(n>>24),(byte)(n>>16),(byte)(n>>8),(byte)n}; }
private static byte[] n5b(){ byte[] k;k=new byte[5]; for(int j=0;j<5;j++){ k[4-j]=b85[(byte)(n % 85)]; n /= 85; } return k;}
public static void Encode(string filename, string batname, bool bLines, bool bPrefix) {
int l=0; int p=0; MemoryStream ms=new MemoryStream(); n = 0; for(byte i=0;i<85;i++){b85[i]=(byte)a85[i];}
byte[] SOL=new byte[2]{0x3A,0x3A}; byte[] EOL=new byte[1]{0xA};
foreach (byte b in File.ReadAllBytes(filename)){
if (bLines) { if (bPrefix && l == 1) {ms.Write(SOL, 0, 2);} if (l == 101) {ms.Write(EOL, 0, 1); l = 0; } l++; }
if (p == 3) { n |= b; ms.Write(n5b(), 0, 5); n = 0; p = 0; } else { n |= (uint)(b << (24 - (p * 8))); p++; }
if (bLines && n == 0 && l > 99) {ms.Write(EOL, 0, 1); l = 0;}
} // done byte array loop, pad bytes and save:
if(p>0){ for(int i=p;i<3-p;i++){ n |= (uint)(0 << (24 - (p * 8))); } n |= 0; ms.Write(n5b(), 0, p + 1); }
byte[] marker = Encoding.UTF8.GetBytes("\r\n:" + "bat2file" + ": " + filename + "\r\n");
using (FileStream fs = new FileStream(batname, FileMode.Append)){
fs.Write(marker, 0, marker.Length); fs.Write(ms.ToArray(), 0, (int)ms.Length); ms.SetLength(0);
}
}
public static void Decode(string fname, string s) {
MemoryStream ms=new MemoryStream(); n=0; for(byte i=0;i<85;i++){ b85[(byte)a85[i]]=i; }
bool k=false; int p=0;
foreach(char c in s){
switch(c){case'\0':case'\n':case'\r':case'\b':case'\t':case'\xA0':case' ':case':': k=false;break; default: k=true;break;}
if(k){ n+= b85[ (byte)c ] * p85[ p++ ]; if(p == 5){ms.Write(n4b(), 0, 4); n=0; p=0; } }
} // done char loop, pad bytes and save:
if(p>0){ for(int i=0;i<5-p;i++){ n += 84 * p85[ p+i ]; } ms.Write(n4b(), 0, p-1); }
File.WriteAllBytes(fname, ms.ToArray()); ms.SetLength(0);
}
}
Decoded result is binary and needs to be further expanded since it's cab LZX-compressed ( expand -R $file -F:* . )