Skip to content

Latest commit

 

History

History
245 lines (208 loc) · 24.2 KB

README.md

File metadata and controls

245 lines (208 loc) · 24.2 KB

Compressed 2 TXT (formerly File2Batch / res2batch)

Windows 7 support ( PowerShell 2.0 / C# 2.0 )
Very fast encoding and decoding BAT85 and BAT91 classes
Multiple file(s) and folder(s) "Send to" menu selection

preview

What's new in v6.1 final:

GUI option 1: Input decoding key as password - saved in external file output~key.ini
GUI option 2: Randomize decoding key (use with 1)
GUI option 3: BAT91 encoder instead of BAT85 -1.7% size but uses web-problematic chars <*`%\>
GUI option 4: No long lines (adds more overhead)
GUI option 5: No LZX compression (for dense files)
GUI option 6: No txt encoding (cab archive only)

:: prefix to disable syntax highlight in advanced text viewers is always used
encoded text is either split at 128 chars or at <1024 chars to keep lame new windows notepad happy
improved MakeCab ddf generator to handle localized and special characters filenames better
two pass MakeCab to reduce size of filenames tree as well
improved BAT85 encoder / decoder and added BAT91 alternative
improved handling of multiple selected files and folders as source
prompt to accept or change the randomized decoding key
original cmd / powershell hybrid; script-friendlier $choices variable
skip inaccessible files
better test of non-writable dir with Desktop fallback
support for changed locations of default user folders
makecab single pass (2nd one did not reduce size much)
simplified expand function
fix no choices selected, now default
print total processing time

More about option 1: Input decoding key as password

Yes you can definitely put your own / reuse a randomized key, that's what the option is for and it works great!
but it must be strictly 85 chars long if using default BAT85 or 91 chars long if using new BAT91,
and it must use only non-repeating characters from the base dictionary.
In other words, you can only shuffle the characters around, not add new or repeat them (without editing the script)
That's still quite hard to crack: 85 or 91 minus 6 (MSCAB. :D) *factorial combinations!
Reusing the key is a must when adding multiple bundled files in the same script - all have to use the same key!
Script will verify if input key matches the length and base dictionary and if not provide the information

Finding the right options for your target files

Script has plenty of GUI choices to help you determine the best course of action for the specific file(s).
By default script will LZX compress files. This works best with deep directory structure and lots of small files.
For monolithic huge files that are rather incompressible, you should select option 5: No LZX compression (for dense files)
A ridiculous 259.45MB source file "achieving" 98.94% compression is not worth the extra 4min for saving 1.06%

Practical example (click here to show)

Let's say we want something pointless as encoding a huge boot.wim from a mounted iso:
Already know it's incompressible so we can save time, directly selecting option 5: No LZX compression (for dense files)

but just to confirm it, run with just the option 6: No text encoder (cab archive only)

F:\sources\boot.wim
cabonly

Cabinet Maker - Lossless Data Compression Tool

272,062,257 bytes in 1 files
Total files:              1
Bytes before:   272,062,257
Bytes after:    269,188,732
After/Before:            98.94% compression
Time:                   278.01 seconds ( 0 hr  4 min 38.01 sec)
Throughput:             955.66 Kb/second

not very compressible 256.78MB, and took almost 5 mins

let's see how long it takes after also adding option 5: No LZX compression (for dense files)

F:\sources\boot.wim
nocompress,cabonly

Cabinet Maker - Lossless Data Compression Tool

272,062,257 bytes in 1 files
Total files:              1
Bytes before:   272,062,257
Bytes after:    272,062,257
After/Before:           100.00% compression
Time:                    36.97 seconds ( 0 hr  0 min 36.97 sec)
Throughput:            7187.11 Kb/second

259.52MB, and took just 37 seconds, so it makes much more sense to encode with option 5

let's do the actual text encoding with option 5: No LZX compression

F:\sources\boot.wim
nolonglines,nocompress

Cabinet Maker - Lossless Data Compression Tool

272,062,257 bytes in 1 files
Total files:              1
Bytes before:   272,062,257
Bytes after:    272,062,257
After/Before:           100.00% compression
Time:                    40.91 seconds ( 0 hr  0 min 40.91 sec)
Throughput:            6494.56 Kb/second

BAT85 encoding C:\Users\z\Desktop\boot.wim~.bat ...
7.8508956 seconds

334.78MB in ~50s. As expected. For such large files is not worth saving 1-2MB for the cost of extra 4mins

Large files also benefit greatly from not using choice 4: No long lines (more overhead)

F:\sources\boot.wim
nocompress

Cabinet Maker - Lossless Data Compression Tool

272,062,257 bytes in 1 files
Total files:              1
Bytes before:   272,062,257
Bytes after:    272,062,257
After/Before:           100.00% compression
Time:                    40.75 seconds ( 0 hr  0 min 40.75 sec)
Throughput:            6519.90 Kb/second

BAT85 encoding C:\Users\z\Desktop\boot.wim~.bat ...
7.8476116 seconds

325.68MB. When I say more overhead with No long lines - I mean it.
Just unselecting choice 4 you save more than LZX compress, without the extra 4min time (for this file)!

How about using choice 3: BAT91 encoder instead of BAT85

F:\sources\boot.wim
bat91,nocompress

Cabinet Maker - Lossless Data Compression Tool

272,062,257 bytes in 1 files
Total files:              1
Bytes before:   272,062,257
Bytes after:    272,062,257
After/Before:           100.00% compression
Time:                    36.39 seconds ( 0 hr  0 min 36.39 sec)
Throughput:            7300.26 Kb/second

BAT91 encoding C:\Users\z\Desktop\boot.wim~.bat ...
7.6984016 seconds

320.33MB. BAM! The most efficient text encoder using just built-in tools in Windows 7+

Typical usage

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

Uninstall

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"  

BAT85 encoder/decoder details

Tweaked version of Ascii85 that works well with batch syntax highlighter used by pastebin and others

Dictionary (can be randomized):

.,;{-}[+](/)_|^=?O123456A789BCDEFGHYIeJKLMoN0PQRSTyUWXVZabcdfghijklmnpqrvstuwxz!@#$&~
BAT85 encoded example of 6.1 release with randomized key bundled for auto-extract:
@echo off & color 07 & chcp 65001 >nul
set "0=%~f0" & powershell -nop -c $f=[IO.File]::ReadAllText($env:0)-split':bat2file\:.*';iex($f[1]); X 1
@pause & exit/b

:bat2file: Compressed2TXT v6.1
$k='efNVd3#S0[R6^T_HlpmA8Xz&D=n|7E5OiI@4PW{}1bQjGC?;rw~.F-q)!+Mvct,YkBxy2Kh9oga$s/LuZJ]U('; 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 > p-1) {q--;o.WriteByte((byte)(n>>8*q));} } } }}}
'@; cd -lit (Split-Path $env:0); function X([int]$x=1) {[BAT85]::Dec([ref]$f,$x+1,$x,$k); expand -R $x -F:* .; del $x -force}

:bat2file:[ Compressed 2 TXT_bat
::DoW4QeeeeeYE3Oreeeee_^N!Geeeeee]3P3e||[f$osWonNhwJe||m=?N1d7eeeeeeedz5rRiS|X+XhvPBH|8iw$L7RIp}I_/_zpe&UC[=Gtx6py=K,C|Dkk{rz,liAi|~eR3+w_BY&Mp5?wTqFYb,X@S71&bBUI~9/jmd[-p$|5B_))uiV(&=F!=yK7/D0wSS+e8lWk6c[C[L7z!Yzx!9Qbd$+}eM-gtONCfC9V-kRPb=_Q2W$;de^CVs{5sCCqm^NDTiM68EErm|65vz_;(oqAE?v9Hir[FpQRcO~3Fa4T]z$38IP_N7efIGj8!gYp&C6|y4/p70)SsieR{G,#.quS[.!jkwK4a$HZ[?NpFcg,c&-S}Zw(rGtf3BzwWkS-up3wJBO;@08qrfTwRC1I[=Aw@p5_r~#[XxbiqQC!U}^efIeP5|[-R_WUeAzQFe?RUbN-v2!tsTC@&y}}S^HEFzTyWB,@;dl6Dd0Jw;=#T9@_n5Nr]lL07}4vqKrhP[C0t[]q.e[0nvMzLqtuc.e|@);6w$8wlqoCh&Jm/M_mfJqkEfV#q()9el]/.|_bvxiAyD[PO[8z8B#5X!VkftJBEjG|;{kJS$8N)K-Sf7O,-BU,!ni26&hE)+)gX8w8!-xxY1^1}i5FC.RFHs{8+K1CoNyb1ovZDdY5y)2c)9QUTWo7u}a&!JR3{/k~|7)f{Y12@x)yuui,RTMA[i?k]dL96QrlRr2e+i,SuG=33xVF6k95+}^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a@uT6fY@1UH0k#Uarik3ro?WgT83Yy3Ia6{c=c
:bat2file:]

BAT91 encoder/decoder details

Tweaked version of base91 that works ok with batch syntax highlighter used by pastebin and others.
Same dictionary as BAT85 plus <*`%\> characters that are less safe when posted online.
Generates 1.7% ~ 2% less size than BAT85, so if a BASE85 encode is just above a size limit - 512KB on pastebin for example,
BASE91 might make it fit, but otherwise keep using BASE85.

Dictionary (can be randomized):

.,;{-}[+](/)_|^=?O123456789ABCDeFGHyIdJKLMoN0PQRSTYUWXVZabcfghijklmnpqrstuvwxz!@#$&~E<*`%\>
BAT91 encoded example of 6.1 release with randomized key used as a password:
@echo off & color 07 & chcp 65001 >nul
set "0=%~f0" & powershell -nop -c $f=[IO.File]::ReadAllText($env:0)-split':bat2file\:.*';iex($f[1]); X 1
@pause & exit/b

:bat2file: Compressed2TXT v6.1
$b='Microsoft.VisualBasic';Add-Type -As $b;$k=iex "[$b.Interaction]::InputBox('Key',91)";if($k.Length-ne91){exit}Add-Type -Ty @'
using System.IO; public class BAT91 {public static void Dec (ref string[] f, int x, string fo, string key) { unchecked {
byte[] b91=new byte[256]; int n=0,c=255,v=91,q=0,z=f[x].Length; while (c>0) b91[c--]=91; while(c<91) b91[key[c]]=(byte)c++;
using (FileStream o=new FileStream(fo,FileMode.Create)) { for (int i=0; i != z; i++) { c=b91[ f[x][i] ]; if (c == 91) continue;
if (v == 91) {v = c;} else {v += c * 91; q |= v << n; if ((v & 8191) > 88) {n += 13;} else {n += 14;} v = 91;
do {o.WriteByte((byte)q); q >>= 8; n -= 8;} while (n>7);} } if (v != 91) o.WriteByte((byte)(q | v << n)); } }}}
'@; cd -lit (Split-Path $env:0); function X([int]$x=1) {[BAT91]::Dec([ref]$f,$x+1,$x,$k); expand -R $x -F:* .; del $x -force}

:bat2file:[ Compressed 2 TXT_bat
::gSuP2(((q{<z((((((kc((((((((}bE(I(((G&0Y((tf((yGDe-z[hG(((((((((g,6.LYj@m#DJRN#^R-5Gyn%<7q$xWs)b8_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<_P=./Nn<l^pq|3\aUv2~UukF4d6MpzxwwEy=}*UAbob_pqZ~)J}08NG6|4cuNa]\p.&ERM]\lLj51`SM1A3JA;*U1II>Gi!xMYi?ri}m%B}5VN?0>EMz~UsgSkQb{Pf>%KjW{F[ED0ADLw2`pB2}_2)eD?uXQW1J4,!m=)P*piDEkJ(Ia*raKE6*UOgh13C]ayA_HuQtg?zo]Ox9bQ?Ud!V~1*E2\gGc=-TUh@E#QU[5[=f4n]E+.};PZ};P/\tLqoo5>U/?1LNU<N%M;xnTtd/aX*!$~7qP5UBdEvPb=S2~lZ8Oy=Gtm`TY(ZSam_%+zyYCYWH{n+(L&u(S]4yv,p*6gxD2Q1t]~jT>}}}bG/f{^,cP[In..ppzmZr{*Ye,yd~=Mrtp#|*-L#rQL.~WHY&YHz6Fd1@2w+<4tw(|2=sO&{_7,%T_oy_Z9tLKEOro,.HIpyTrz8+AC,3R>.FdN4!a_`{IIZzO<(QBJ>#<}E|Sr+)Lw.|s*o{zBu{Wm&Ie<QekbuFYMjd9nnvz,_$rvvQ2/b?1ooq6sL1`=Z]Q(&x6M;@/Ap6s[7[`{vS,,2\jmKtb/FDODBT!|!_mu)BW~5hX6h$xEdU0]2dQr0I(y^N/8sY
:bat2file:]

Intuitive multiple encoded files support with low overhead

One-liner trigger for multiple bundled files expand in one go:

set "0=%~f0" & powershell -nop -c $f=[IO.File]::ReadAllText($env:0)-split':bat2file\:.*';iex($f[1]); X 2; X 4

Or split into individual triggers, can be anywhere in the batch script:

set "0=%~f0" & powershell -nop -c $f=[IO.File]::ReadAllText($env:0)-split':bat2file\:.*';iex($f[1]); X 4
:: ...  
set "0=%~f0" & powershell -nop -c $f=[IO.File]::ReadAllText($env:0)-split':bat2file\:.*';iex($f[1]); X 2

where X 2; calls the decoding block to expand the 2nd file data, and X 4; - the 4th
Tip: keep only the last :bat2file:] ending tag and skip intermediary ones to use consecutive X parameters.