Looking to encrypt batch scripts but need to edit in-between
Moderator: DosItHelp
-
- Posts: 184
- Joined: 21 Feb 2013 15:54
Re: Looking to encrypt batch scripts but need to edit in-bet
I am releasing a mod for a game. The main reason why I want to encrypt it is because we've had a history in the past, of people selling the work of modders by taking their work and publishing for sale, and trying to make a buck on their free work.
Could I perhaps add a disclaimer or something? What are my options here?
Could I perhaps add a disclaimer or something? What are my options here?
Re: Looking to encrypt batch scripts but need to edit in-bet
Edited.
Last edited by carlos on 13 Apr 2013 20:02, edited 2 times in total.
Re: Looking to encrypt batch scripts but need to edit in-bet
Edited.
Last edited by carlos on 13 Apr 2013 20:02, edited 1 time in total.
-
- Posts: 184
- Joined: 21 Feb 2013 15:54
Re: Looking to encrypt batch scripts but need to edit in-bet
if the code can still be gotten with a hex editor, then there is no point in encrypting it.
Thank you for your efforts.
Perhaps I should use a disclaimer and not worry about people making money on my free work?
Thank you for your efforts.
Perhaps I should use a disclaimer and not worry about people making money on my free work?
-
- Posts: 184
- Joined: 21 Feb 2013 15:54
Re: Looking to encrypt batch scripts but need to edit in-bet
How about this:
How do I create a shortcut of a .bat file and choose an icon via script?
Please sepparate the two process so I can use them separately in the future.
How do I create a shortcut of a .bat file and choose an icon via script?
Please sepparate the two process so I can use them separately in the future.
Re: Looking to encrypt batch scripts but need to edit in-bet
carlos wrote:About codification I mistake: The codification is UTF 16 Little Endian.
No, it's not UTF-16LE either. It's just a single byte encoding which happens to start with two characters matching the UTF-16LE BOM marker (0xFF 0xFE).
Granted, that's enough to fool notepad into attempting to display the whole file as UTF-16LE text and, since your default font probably doesn't cover the entire UTF-16 range, end up displaying boxes as placeholders, instead. If notepad used a CJK font, instead, the first character would display as "㈠" (u+3220).
But the rest of the file is single-byte-encoded, and cmd.exe (whether with or without /u) only parses single-byte-encodings (according to the current codepage). I guess you know that already, since the first line in the encoded file (" 2>nul &cls") specifically tries to hide the error message caused by the BOM. If you remove that line and run the rest of the batch, the output is...
Code: Select all
C:\tmp>chcp 1252
Active code page: 1252
C:\tmp>color20.enc.cmd
C:\tmp>ÿþ
'ÿþ' is not recognized as an internal or external command,
operable program or batch file.
##############
This is a test
##############
So, fact remains that cmd.exe cannot read/parse/execute Unicode-encoded batch files, whether UTF-16LE/UTF-16BE/UTF-8. That was my point, and I'll cut this short now since it's not directly related to the main topic.
Liviu
Re: Looking to encrypt batch scripts but need to edit in-bet
pditty8811 wrote:How about this:
How do I create a shortcut of a .bat file and choose an icon via script?
Please sepparate the two process so I can use them separately in the future.
This is a Function I used Before, it's a VB-script code to create shortcuts and add other properties:
:CreateShortcut <shortcut location+name.lnk> <shortcut application> <shortcut Icon>
( FOR /F "tokens=1*" %%a IN ('findstr "^:scut: " ^< "%~F0"') DO Echo.%%b)>"%TEMP%\Shortcut.vbs"
Cscript //nologo "%TEMP%\Shortcut.vbs" "%~1" "%~2" "%~3"
Goto :EOF
:scut: set WshShell = WScript.CreateObject("WScript.Shell" )
:scut: set oShellLink = WshShell.CreateShortcut( WScript.Arguments(0) )
:scut: oShellLink.TargetPath = chr(34) & WScript.Arguments(1) & chr(34)
:scut: oShellLink.IconLocation = WScript.Arguments(2)
:scut: oShellLink.WindowStyle = 4
:scut: oShellLink.Save
REM ===========================================================
REM >>> IMPORTANT <<< Must Leave Empty Line At The End of Your Batch File ...
Blue text is the options you give to the function, and don't forget to add .lnk to the shortcut name (important)
Red number can be one of three: 3 means maximized window when the application run, 4 means normal window & 7 means minimized window.
and this is how to use it:
Code: Select all
CALL :CreateShortcut "%USERPROFILE%\Desktop\My Link.lnk" "%PROGRAMFILES%\7-Zip\7zFM.exe" "C:\7z Icon.ico"
you can set other options like working directory, hot key, add arguments to the application when it runs and add description.
For more information have a look at this : Link
Just make sure to add the ":scut: " at the begining of the line and make sure to leave empty line at the end of your batch file.
Also add "WScript.Arguments(X)" in the place where you will input your data ( works like %1 in batch files ) and X is the number in sequence.
-
- Posts: 184
- Joined: 21 Feb 2013 15:54
Re: Looking to encrypt batch scripts but need to edit in-bet
Thank you.
So the blue texts are all filepaths of the target, application and then the icon?
So the blue texts are all filepaths of the target, application and then the icon?
Re: Looking to encrypt batch scripts but need to edit in-bet
Sorry for late answer,
The Function take 3 arguments,
The first is the location (where you will place the shortcut) and the shortcut name including the ".Lnk" extension.
The second is the location of the original file (the one you are creating the shortcut for).
The third is the location to an icon that you will add it to the shortcut.
The Function take 3 arguments,
The first is the location (where you will place the shortcut) and the shortcut name including the ".Lnk" extension.
The second is the location of the original file (the one you are creating the shortcut for).
The third is the location to an icon that you will add it to the shortcut.
-
- Posts: 184
- Joined: 21 Feb 2013 15:54
Re: Looking to encrypt batch scripts but need to edit in-bet
Thank you for the reply. Looks easy enough.
Re: Looking to encrypt batch scripts but need to edit in-bet
I developed a method intended to hide the source code of a Batch program, so it may be distributed but preserving the code hidden. Of course, there is no way to keep Batch source code hidden in all cases, but a method that hide Batch programs from most end users is useful without doubt. However, I need some feedback to test my method. The file below is a simple example program that create a text file called Example.txt with a couple lines in it. I invite you to try to break the Batch source code of this program and report how easy/difficult was this task for you. I will appreciate if you made some suggestions in order to improve my encoding method.
To get the real Example.bat program, download the file below and both HexToBin.bat and HexChar.vbs programs from this site and execute: HEXTOBIN EXAMPLE.BAT.HEX
Example.bat.hex:
I used my encoding method to write a solution for pditty8811's specific needs. The program below is a Batch Encoder that allows to install a Batch program via the modification of certain variables, but keep both the installer and the installed program code in unreadable form.
To get the real BatchEncoder.bat program, download the file below and both HexToBin.bat and HexChar.vbs programs from this site and execute: HEXTOBIN BATCHENCODER.BAT.HEX
BatchEncoder.bat.hex:
Previous program create an installer for the original Batch file called InstallOriginalName.bat; when this Batch file run, it ask the user for the value of certain Install Variables and create an installed version of the program called OriginalName.bat again. WARNING! Please note that the installer delete the original file with OriginalName.bat, so you must back up this file with another name if you want to create and test the installed version of a program. The Install Variables must be placed in the Batch file from the third line on with this format:For example:Previous program is prepared for distribution this way:This way, you may distribute InstallMYPROG.BAT file. Any user may install this program this way:Previous step produce MYPROG.BAT encoded file with this installed code:Only consecutive "SET /P" commands placed in the Batch file from the line number 3 on will be processed this way.
Because some restrictions in the encoder program, you can't use apostrophes in the Batch file; if you require they, use %apostrophe% value instead. For example:The definition of apostrophe variable will be inserted by the encoder after the initialization of installation variables. I will eliminate this restriction in a future version of the encoder.
Remember that your program will be protected as long as the user have not chance to review its code. The original Batch code exist only when the Batch program run, so you should NOT use any pauses in the program. If a Batch program read input from the user, you may use a first program that just read the data and store it in variables or in a text file and then execute the encoded program. The idea is that the encoded code run and terminate as fast as possible, so the user have no chance to locate it.
NOTE: You may cheat and use the encoder to write test programs that aids you to break the encoding method used, but remember that the end user have NOT the encoder, just the encoded program. When you attempt to break the code of the first example above you should NOT use any idea provided by the use of the encoder, otherwise your results will not reflect the ones that normal users can get. If you devise a recipe that allows to break the code produced by my encoder, DON'T POST IT PLEASE!
Antonio
To get the real Example.bat program, download the file below and both HexToBin.bat and HexChar.vbs programs from this site and execute: HEXTOBIN EXAMPLE.BAT.HEX
Example.bat.hex:
Code: Select all
406966202840436F646553656374696F6E203D3D204042617463682920407468656E0A4043736372697074202F2F6E6F6C6F
676F202F2F453A4A5363726970742E456E636F64652022257E46302220262040676F746F203A454F4620262040656E640A2F
2F2A2A537461727420456E636F64652A2A23407E5E46774D4141413D3D4026376C2E2C2F5557454D6D7F6F6B5E2B7E272C42
40246E3174572C4730362D784540267E502C503350762F6E4F5E575E6C5E7E66622F43385E2B666E736D586E4E4161616C55
6B6B4B782D094240267E502C505150452F6E4F2C6C774B64594D5777346E782D452D09424026507E7E2C5F7E424D6E3A2C32
61437377566E7E4B307E6C2C246D595E3450366B567F507F556D4B4E6E4E2C68724F3450416D4F6D34327831475B2B4D5228
6C4F2D55764026507E502C5150452B5E344B50436E735E577E7F4B2E5E4E5A402A5041366C73775E6E5244364F2D09424026
7E2C5050337E426B2B595E475E6C5E5041784334736E472B736C486E4E41363243092F6B475527787640262C7E2C50512C42
6B2B592C5662552B7B2D55424026507E7E2C5F504557574D505D75437E6B0950764B346B647E6144476F4D433A2C6843642C
2B785E47392B5B232C5B4B50632778454026502C502C515045507E506B2B4F7E72566B096E2765566B096E5A5D756C2C4A77
787640262C507E50337E422A2D5576402650507E7E3350766027554540267E2C502C5F50452F7F4F504A6E7E4A7B5D737209
2B5D5372593450416D4F5E74417831575B2B2E20286C4F50612E5754444368725040217E48605377784540262C507E2C5F2C
422B31744B262D09424026502C507E512C42232C402A402A2C32366D6832567F5244364F2D557640265C43442C477355727E
782C7F3F5E2E62774F523B2E7F6C4F7F72284C2B315976453F31447277446B554C63736B5E6E3F482F597F6836344E2B3159
4523494026376C2E504B3378317372737F50277E47773F36523B2E7F6C4F7F4B7F3659776B5E6E6072A032616C7377736E63
346C4445237040265741555E7362567F520944724F7F60643F4B3B44312B6F725E2B234940264B32556D77725E2B203B564B
2F2B76237040265C6D447E7F6B746A347F56562C7850713F6D4D723259635A4D2B43596E36284C6E6D44634A713F5E2E6277
59206A342B73567262704026096B7455742B5E56635D450960452D72A03261437377567F20346D592D727E2750392B5E5077
4AA033616D3A32567F20346D59774572236940263375774141413D3D5E237E40[1]
I used my encoding method to write a solution for pditty8811's specific needs. The program below is a Batch Encoder that allows to install a Batch program via the modification of certain variables, but keep both the installer and the installed program code in unreadable form.
To get the real BatchEncoder.bat program, download the file below and both HexToBin.bat and HexChar.vbs programs from this site and execute: HEXTOBIN BATCHENCODER.BAT.HEX
BatchEncoder.bat.hex:
Code: Select all
406966202840436F646553656374696F6E203D3D204042617463682920407468656E0D0A0D0A406563686F206F66660D0A0D
0A52454D204261746368456E636F6465722E6261743A2043726561746520616E20696E7374616C6C657220666F7220616E20
656E636F6465642042617463682066696C650D0A52454D20416E746F6E696F20506572657A204179616C610D0A0D0A696620
6E6F742065786973742022257E3122206563686F2046696C65206E6F7420666F756E643A202531202620676F746F203A454F
460D0A43736372697074202F2F6E6F6C6F676F202F2F453A4A5363726970742E456E636F64652022257E4630222025310D0A
676F746F203A454F460D0A0D0A40656E640D0A0D0A2F2F2043726561746520616E20496E7374616C6C6174696F6E2070726F
6772616D20666F7220612042617463682066696C65207769746820696E697469616C697A6564207661726961626C6573200D
0A2F2F20616E6420456E636F64652074686520736F7572636520636F646520696E2061206E6F6E2D7265616461626C652077
61790D0A2F2F2A2A537461727420456E636F64652A2A23407E5E7378414141413D3D40234026402340264A7A2C72777F782C
4F747F50645721445E6E2C306B5E6E506D784E2C2E6E6C395044746E5057724D2F4F504434447F2B7E7362782B6440234026
5C43442C5762566E3A5741786D4B4E7F7E272C7F6A6D4D6B324F636244543B3A7F78596B206978096C732B5B52284F7F3A63
212A49402340265C432E2C306B736E41785E57396E3950782C42272D2D274A457E5F2C3F4F4462784C20364457732F746D44
5A4B5B6E6038765A237E5F7E5762566E4B4B337831575B6E2C5F507677272D774A4549402340262D6D442C577355722C7850
713F5E4462774F203B442B6D4F2B7D344C7F5E4F60723F314472774F72096F207362732B5558644F7F3A7238257F6D4F4A2A
49402340262D6D442C577362567F7E272C576F3F7D52216E44736B5E6E60366B567F504732096D4B4E6E2349402340265C43
442C473F44446E437350277E47776B732B6336612B557A2F3A2B36443F442E2B6D3A63462A6940234026376C442C643F4B45
44316E4A6B092B38507850476A44446E6C7320497F6C5B4A62782B636270402340265C6D2E2C2F6A4B454D6D2B646B096E20
2C277E5755592E6E6D3A52226E6C39536B096E632370402340265C43447E6455573B44316E5362786E7E2C2750476A44446E
6C7320222B43395362782B7623704023402640234026267A2C7155647F44592C4F747F50747F435B2B4D504B307E59346E2C
6B552F4443565E6C4F724B785057725E2B535044347F50347F6C392B442C57367E59342B7E2B096D475B7F4E503672567F7E
506D555B5044747F50576B2E6444504F684B7E5662786E64402340265C432E2C2F6A57212E312B6F62567F50272C4A402472
302C6040245A4B4E6E6A7F6D596247782C27272C4024246C446D34237E40244F347F78774427554A2C5F402340262C50507E
7E2C507E502C7E2C507E2C502C504A40242B3134572C5757302744775572505F40234026502C50502C7E7E502C502C507E50
7E7E2C5045447F68502678644F6D5656434F62575550612E4B6F2E6D3A2C30574D50727E5F2C3072567F4B4733096D57396E
5033504A272E777872503340234026507E7E2C507E502C7E502C507E7E2C50507E454D2B68503B2E7F6C4F7F4E2C686B4474
2C246C446D3432096D475B7F44522843592C34582C2955594B7862577E6E6E2E7F797E624843566D2D2E77094A5051402340
26507E502C7E2C507E2C502C50502C502C7E50455A646D4D6B324F2C7A7A0947564B6F572C2626323D39556D2E6B324F6332
556D4B5B2B2C4A593D77214A7E272C6F47594B7E3D323677504C5040247F783977442778765033402340267E2C50502C7E50
2C50502C7E7E502C502C50457A264D433F4F6C4D4F5041785E47392B654D77094A7E5F402340262C507E2C502C50502C502C
7E502C507E502C4A2D434D502F5547454D6D2B7772732B2C272C4240246B577E7640242F57396E3F7F6D4F724B785078782C
4024246C445E34237E402459342B78272D4D772D094277787250514023402650502C7E502C50502C7E7E502C502C507E507E
7E2C5045502C7E5033507640243B2F6D2E7261597E7A4A554B564754572C7A7A4129786A6D4D6B32596332555E4B4E2B2C77
4A7555735A7745504C5040246F4759477E3D3236732C275040242B555B272D44777709427778727E33402340262C502C5050
2C502C7E502C507E502C507E7E2C50502C45502C5050337E767A4A65433F4F6C2E4F2C32556D4B5B2B4365777709422D5545
2C5F402340262C7E2C507E2C502C50502C502C7E502C507E502C507E452C50502C5150455C6C4D7E643F4B454D6D6E737273
7F5078502777427250517E6B3F573B2E312B4A6B096E3850512C4A272D2D2778277742272D55422778457E33402340262C7E
502C50502C7E7E502C502C507E507E7E2C507E50727E502C50517E4550507E7E3350772D45452C5F7E6B3F4B4544312B6472
787F207E5F2C4A7777272D78277742272D784577554A7040234026402340267A267E2678642B4D4F506278644F6D5656434F
6257555037434D6B4328567F2F506278444750627864596D567343446B57097E3062562B2C346E6C392B4D7E7E6B577E6D78
7A4023402672302C607E645557452E5E7F5372787F206B45386B594D602142762A20594B6A32777F442F436B2B602A7E277B
504A553350504A6E725062506040234026507E506B6A5721445E6E776B566E7E33277E42716A3144726159633F593957214F
52714472597F5372557F604A4155597F4450625564596D565E6C4F6B47552C5C4356216E2F272D55452A692D55762C5F4023
40262C7E2C507E2C502C50502C502C7E502C507E42376C2E7E376C56216E69277842402340267E502C68346B732B7E632C2F
6A57212E6D7F5372557F522F3B386B592E605A532B232044576077777F443B432F7F6062507B277E4555324B2C266E725023
2C60402340262C502C507E5026262C4B342B2C57574D3A434F2C57307E72092F4F6C5E736D59724B782C5C6C4D6B6D38567F
2F7E6B6B297E6A414B504A4B50722E62224829484127684936484B507240234026502C7E502C502D434D507747642C277E2F
554721445E7F5362782B636B095B2B587257607227456270402340262C7E502C505037432E50376C4D31433A6E7E7B50643F
4B3B44312B4A72092B526473626D6E6052536157642A6940234026502C502C7E50376C2E50614447686159502C78506B3F57
212E5E2B646B092B202F7372312B63774B645F387E52712A69402340267E2C507E502C6455573B4D6D7F736B5E2B2C51272C
42093F3144723244523F445B57215952712E72597F6072427E5F7E324D576877447E5F2C424562702D78767E334023402650
2C7E2C507E2C502C50502C502C7E502C507E502C422D435E452B2C7850713F6D4D723259633F444E7278205D7F6C5B536255
2B762349770942505140234026507E502C7E2C507E2C502C50502C502C7E502C507E4A6B3F473B4D6D2B7772567F505F7B7E
76502C502C5F7E2D77766B2B4F5027454A2C5F7E2D6D443143687F50515072784550512C5C6D56457F50337E42274A772D27
2D557727422D27554227784A402340267E502C502C50643F473B4D6D6E5362552B2C277E475559446E4373525D2B6D5B646B
557F602A6940234026502C7E38402340264E4023402640234026264A507109642B4D595044346E50392B366B556B4F724B78
7E57367E4A6D77476444445732347F4A7E5C6D2E626C385E2B2C6C78395044342B2C786E3644507372092B40234026643F4B
4544316E6F6B5E2B2C5F7850456455573B44316E7362566E7E332750767E2C507E5F2C772742647F592C6C774B2F442E5761
746E27272D7777272D4227772D27782D2776772D0942277845505140234026507E502C7E502C507E7E2C50507E7E72507E50
2C512C427E2C502C5F50272D4545503350643F4B452E5E7F536B096E5033504A2777772D092D2742772D5576277845694023
4026402340267A267E222B6C5B7E092B61592C7362786E6B50364457735044342B2C2F47454D6D6E7E366B567F7E6C094E50
6255642B4D592C59342B687E62784F572C6E7831575B6E39503072737F50342B6D5B7F444023402668346B567F50767E224B
3F4F447F6C68207A5932095B72363F594D6E433A2C232C09402340267E7E2C2F6A57212E6D7F5372557F50277E4755592E2B
6D6863496E6D4E646B787F602A4940234026507E506B3F473B4D6D2B7772567F505F7B7E45502C502C5F7E427E7E2C505150
2777427250517E6B3F573B2E312B4A6B096E2C5F7E722D272D2D092D27762D2778762D094A49402340263840234026473F44
442B6D68205A5E576B2B63234940234026402340267A4A7E71092F6E2E445059346E2C2B556D4B5B7F4E7E366B5E2B50446C
6273402340262F6A5721445E6E776B567F7E5F7B50422C7E7E50335027422D6C2E7E4B736A722C7850713F5E2E627759202F
4D2B43597F36284C6E3159764A3F314462325962784C52776B736E55582F446E3A7D344C7F5E4F4A2A69272D552D76770942
7E5F40234026502C507E7E2C50507E7E2C507E502C762C507E2C5F2C2D42376C4D7E5741785E7362566E7E7B5057776A7263
5A447F434F2B3A2B58596F6B736E764A7650337E3F444472555452302E47735A346C4D2F4B4E6E76462B21232C5F2C576B5E
2B505741785E47392B50337E427223692777552D452D09427E5F402340262C507E502C7E502C507E7E2C50507E762C507E50
337E274247417831736B5E2B63094462596E606B3F473B4D6D2B7772567F23692777552D452D09427E5F402340262C507E50
2C7E502C507E7E2C50507E762C507E50337E274247417831736B5E2B632F564B2F6E602A697777092D422755422C5F402340
267E7E502C502C507E507E7E2C507E50457E502C50517E27425C432E2C7F647455347F56732C272C7F3F3144623259635A2E
2B6D596E36284C2B314F60727F3F312E7277445255746E5673452A69772D0977422778767E33402340267E7E2C507E502C7E
2C507E2C502C50422C502C7E5F2C2D767F6B746A347F5656635D4509604A457E5150366B5E2B33785E47392B5B50337E422C
5B7E5B7F5650767E3350576B5E6E41785E4B4E7F4E503350454523702D7778274277554540234026402340267A4A50710964
6E44445044746E5072556B5943565E43596257557E366B566E7E446C7256402340266B3F472144312B7362567F7E5F7B5076
5C6D447E4741786D4B5B2B4D50272C096A6D4D6B6159205A2E6E6D596E7228252B31596345556D447232446B556F6333096D
47392B4D4A23702D0976503340234026502C507E7E2C50502C7E502C50502C762D6C4D506B32556D475B7F4E7E272C473209
6D475B7F4452335531575B2B555E4D6B32447362562B764A63252F727E643F4B452E5E7F736B5E6E7E5A7E4A7262492D0942
2C5F402340267E7E2C507E502C7E502C507E7E2C50422D434D50477355362C277E713F31446B6159632F447F6C4F2B7D3425
6E315960726A6D4D6B774472556F637362566E3F7A64442B687228252B31594562702D78767E3340234026502C7E2C507E2C
502C50502C502C7E42376C2E504B32555E776B567F7E272C57735536205A4D2B6D596E4B6E61447372567F634A4550517E36
6B566E504B32556D4B5B7F50512C427223692778457E5F402340267E502C507E7E2C50502C7E502C50504547337831736256
6E52092E62596E606B337831575B6E3923697755455051402340267E2C507E2C502C50502C502C7E502C424732096D6F725E
2B523B73576B2B602A49777845503340234026507E7E2C507E502C7E502C507E7E2C427F6A5E4D6B32596333317447764A45
505F2C3062732B3A57337831575B6E2C5F50457E3062562B2C5E2E2B6D597F4E772D55452A69777845402340264023402626
262C32785E47392B7E59346E2C30725E2B2C6C783950532E6B442B7E59342B7E6E096D57396E4E2C5C2B4D64725709402340
265C43447E4741785E57396E442C277E09556D44723244522F447F43442B36284C7F6D59764A555E4462774F6B096F203309
6D57396E44722369402340262D6C4D506B32556D475B7F4E7E272C4732096D475B7F4452335531575B2B555E4D6B32447362
562B764A63252F727E643F4B452E5E7F736B5E6E7E5A7E4A726249402340265C6D447E573355317372567F7E272C576F6A7D
525A2E6E6D596E4B7F614473725E2B764A71092F4443565E4A7E5F2C3072737F4B5741556D4B4E2B2A49402340264B32096D
6F6B736E637F2E6B446E606B32555E4B4E2B5B6270402340265741553173725E2B635A564B2F7F632370402340267F556D2E
72615952415E744B604A265564596D565E4A7E5F7E5762566E4B4B337831575B6E2C5F50457E366B732B2C5E4D2B43442B39
2D78722370402340266F61734541413D3D5E237E40[1]
Previous program create an installer for the original Batch file called InstallOriginalName.bat; when this Batch file run, it ask the user for the value of certain Install Variables and create an installed version of the program called OriginalName.bat again. WARNING! Please note that the installer delete the original file with OriginalName.bat, so you must back up this file with another name if you want to create and test the installed version of a program. The Install Variables must be placed in the Batch file from the third line on with this format:
Code: Select all
set /p "varName=prompt"
Code: Select all
C:\>TYPE MYPROG.BAT
@echo off
setlocal EnableDelayedExpansion
set /P "source=Source directory: "
set /P "destination=Destination directory: "
echo The installed source directory is: %source%
echo The installed destination directory is: %destination%
Code: Select all
C:\>BATCHENCODER MYPROG.BAT
InstallMYPROG.BAT file created
Code: Select all
C:\>INSTALLMYPROG
Enter installation values
Source directory: C:\MY FOLDER\MY SOURCE
Destination directory: C:\MY FOLDER\MY DESTINATION
Code: Select all
@echo off
setlocal EnableDelayedExpansion
set "source=C:\MY FOLDER\MY SOURCE"
set "destination=C:\MY FOLDER\MY DESTINATION"
echo The installed source directory is: %source%
echo The installed destination directory is: %destination%
Because some restrictions in the encoder program, you can't use apostrophes in the Batch file; if you require they, use %apostrophe% value instead. For example:
Code: Select all
for /F "delims=" %%a in (%apostrophe%dir /B /AD%apostrophe%) do echo %%a
Remember that your program will be protected as long as the user have not chance to review its code. The original Batch code exist only when the Batch program run, so you should NOT use any pauses in the program. If a Batch program read input from the user, you may use a first program that just read the data and store it in variables or in a text file and then execute the encoded program. The idea is that the encoded code run and terminate as fast as possible, so the user have no chance to locate it.
NOTE: You may cheat and use the encoder to write test programs that aids you to break the encoding method used, but remember that the end user have NOT the encoder, just the encoded program. When you attempt to break the code of the first example above you should NOT use any idea provided by the use of the encoder, otherwise your results will not reflect the ones that normal users can get. If you devise a recipe that allows to break the code produced by my encoder, DON'T POST IT PLEASE!
Antonio
Last edited by Aacini on 15 Apr 2013 19:33, edited 1 time in total.
Re: Looking to encrypt batch scripts but need to edit in-bet
Aacini wrote:The file below is a simple example program that create a text file called Example.txt with a couple lines in it. I invite you to try to break the Batch source code of this program and report how easy/difficult was this task for you.
In the name of obfuscation, I've left some columns out
Code: Select all
@echo off
setlocal DisableD
set apostrophe='
rem Example of a
echo Hello World!
setlocal EnableDe
set line=
for %%a in (This
set "line=!lin
)
(
set /P "=%line%wi
echo/
) >> Example.txt
Aacini wrote:I will appreciate if you made some suggestions in order to improve my encoding method.
What you have is good enough to deter casual snooping. My advice would be to not waste much time trying to foolproof it beyond that, since it's simply not possible given that any batch encoding technique will need a temp file and a cmd instance running it at some point.
Liviu
Re: Looking to encrypt batch scripts but need to edit in-bet
I read the code and I understand that it is a encoded vbs = vbe file.
Continue with technique I have a "tiny batch compiler". If someone is interested I can posted it.
Continue with technique I have a "tiny batch compiler". If someone is interested I can posted it.
Last edited by carlos on 13 Apr 2013 20:04, edited 1 time in total.
Re: Looking to encrypt batch scripts but need to edit in-bet
Aacini wrote:If you devise a recipe that allows to break the code produced by my encoder, DON'T POST IT PLEASE!
Antonio
carlos wrote:I removed the first characters until end of comment with a hexadecimal editor and run a decoder from:Code: Select all
Thanks a lot, buddy
Continuing with technique, I don't see how your "tiny batch compiler" may help to solve OP's request. Even if he could give the compiler to end users to compile the code after the installing modifications was made, they still could see the Batch source code before the modifications, isn't it?
On the other hand, my program is a complete solution for OP's request that give a certain protection that should be enough for casual users. Well, this would work as long as they don't see your recipe to break the code!
Antonio
Last edited by Aacini on 15 Apr 2013 19:40, edited 1 time in total.
Re: Looking to encrypt batch scripts but need to edit in-bet
My tiny batch compiler, it uses a technique never used before, and it can really help.
I updating and reviewing the code of it for publish it as a commercial software, available for download with a donation.
I don't have many free time, then I think that can done it in a month.
The algorithm is clear in my mind, but I spend time in write optimized and tested code.
I updating and reviewing the code of it for publish it as a commercial software, available for download with a donation.
I don't have many free time, then I think that can done it in a month.
The algorithm is clear in my mind, but I spend time in write optimized and tested code.