Looking to encrypt batch scripts but need to edit in-between

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Aacini
Expert
Posts: 1914
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Looking to encrypt batch scripts but need to edit in-bet

#46 Post by Aacini » 21 Apr 2013 13:03

pditty8811 wrote:Hi Aacini,

I don't think your solution works for my agenda.

I have 3 batch files and they have filepaths in them of 3 different types. That's 3 batch files, and they all use 3 different variables that I'd like to change. I need these 3 batch files to be permanently edited because they will be ran continously over and over again after the three variables have been changed. So a permanent edit to the files is necessary.

My program was designed to encode and install ONE Batch file. If you have 3 Batch files, I think you could encode each one in individual form and give the user 3 installer files. However, if you prefer that my program encode and install the 3 Batch files, I need to modify it. I have no problem with that, but it will take some time (please read the last phrase of this reply).
pditty8811 wrote:I don't need user input every time these batch files are ran, just the first time in order to permanently edit the 3 variables.

This is precisely the way it works. The user run the installer just one time and this operation permanently edit the 3 variables IN THE INSTALLED PROGRAM. Perhaps you may understand the process in a clearer way with this scheme: In your computer you have PROGRAM.BAT file you want to encode and give to the users, so:

Code: Select all

PROGRAM.BAT -> BatchEncoder.bat -> INSTALLPROGRAM.BAT
In words: my BatchEncoder program read your PROGRAM.BAT file and create INSTALLPROGRAM.BAT; this is the file that you give to the users. When an user receive INSTALLPROGRAM.BAT, and execute it for the first time, the installer create the original program:

Code: Select all

INSTALLPROGRAM.BAT -> PROGRAM.BAT
The user needs to run INSTALLPROGRAM.BAT just one time (and answer the installation questions just one time). After that, he/she will run PROGRAM.BAT file every time he/she wants to use your program (and answer no questions).
pditty8811 wrote:You've only listed 2 variables, source and directory.
Of course! This is an EXAMPLE on how to use the installation variables! I included some other examples below.

Example of a program that does NOT use installation variables, just the encoding feature:

Code: Select all

@echo off
setlocal
rem In this line should be the SET /P command intended for installation variables
echo Hello World!
Example of a program that use one installation variable:

Code: Select all

@echo off
setlocal EnableDelayedExpansion
set /P "color=What is the color you prefer? "
cls
echo This program have one installation variable: a color
echo The value permanently edited for the color variable in this file is: %color%
Example of a program that uses three installation variables:

Code: Select all

@echo off
setlocal EnableDelayedExpansion
set /P "name=Your name, please: "
set /P "min=Minimum value: "
set /P "max=Maximum value: "
echo These are the values permanently edited in this file:
echo Name: "%name%", Minimum: %min%, Maximum: %max%

pditty8811 wrote:Perhaps I don't understand what your code does, but it doesn't seem like it will work for my needs.

Well, the basic tool to check any application capabilities is TO TEST IT! All your questions about my program could be easily answered by yourself with a simple test. It is really funny to try to explain you how something should work if you have not even tried to run it. In my previous posts I included several very simple examples on how to use my solution, and I explained the same things several times in different ways, but I could explain the same things more times and you still don't understand what I am talking about if you don't see it with your own eyes. For example:
pditty8811 wrote:I know how I could do this.

I could encrypt all my batch files, the 3 plus the installer, with your program of encryption.

Then I could echo the 3 user input variables to 3 different text files, then have the other 3 batch files read from the text files to get the variables. Everything would be encrypted too.

Wont this work?

I don't know. You could send me your 3 Batch files plus the installer, so I could do a test. Or you could give the 3 Batch files plus the installer plus my BatchEncoder.bat program to a friend and ask him if it worked after he did the test. Or you could do the test by yourself.

I am sorry, but I will not answer any further question on this thread based on speculations or rhetorical questions about how my program supposedly works. I will gladly answer any question based on results you obtain after you used my program, including any modification to it (like the possibility to encode and install more than one Batch file at the same time).

Antonio

pditty8811
Posts: 184
Joined: 21 Feb 2013 15:54

Re: Looking to encrypt batch scripts but need to edit in-bet

#47 Post by pditty8811 » 21 Apr 2013 23:54

Hi Antonio,

I will use your program but not the way you describe. I've decided to echo the variables to text files and then have the batch files read the text files. I will have all my batch files converted using your program so the code will be scrambled.

Will people be able to read the batch script in the temporary folder when it is ran if I use your encryption .bat?

pditty8811
Posts: 184
Joined: 21 Feb 2013 15:54

Re: Looking to encrypt batch scripts but need to edit in-bet

#48 Post by pditty8811 » 22 Apr 2013 05:36

Even your encryption .bat file can still be read by people from the temp files?

Aacini
Expert
Posts: 1914
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Looking to encrypt batch scripts but need to edit in-bet

#49 Post by Aacini » 22 Apr 2013 13:24

pditty8811 wrote:Even your encryption .bat file can still be read by people from the temp files?

This point has been discussed in detail in a previous reply. Read it, please, and also the related answers from Liviu and carlos.
pditty8811 wrote:Will people be able to read the batch script in the temporary folder when it is ran if I use your encryption .bat?

Why don't test this point by yourself? Encode and install a testing Batch file, run it and try to read the running Batch script, and then said me how easy or difficult was this task for you. This information may help me to improve my encoding method.

In my first post in this thread (two weeks ago), I said: "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". I have no received a single suggestion at this respect, and I think that the first person interested in improve my encoding method is the people that will use it!

However, if your Batch program get any input from the user, you must carefully read the paragraph that start with "Remember that your program will be protected as long as..." and end at "... so the user have no chance to locate it".

Antonio

pditty8811
Posts: 184
Joined: 21 Feb 2013 15:54

Re: Looking to encrypt batch scripts but need to edit in-bet

#50 Post by pditty8811 » 22 Apr 2013 13:51

The batch files I want to protect do not have pauses or ask for user input, only the install batch does. So that is ok.

But the batch files do run over and over again continuously while a game is running, so perhaps people can see the code still if the batch files are looping continiously?

pditty8811
Posts: 184
Joined: 21 Feb 2013 15:54

Re: Looking to encrypt batch scripts but need to edit in-bet

#51 Post by pditty8811 » 22 Apr 2013 14:26

Using what I said, all should be OK?

I'd like to release my work "mods" to the community, and you'll know soon enough if your encyption is good enough because well see if anyone cracks it. I'm sure my mod will be quite popular as it is a dynamic campaign to one of the most modded simulation games in existance.

So time will tell. My worry is that I don't want someone stealing the code I've worked hard over the past 2 months to compile, and to sell it at a store or something as I've seen people do to other modders in the past.

I highly doubt anyone will sell it as the game is over 7 years old now.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Looking to encrypt batch scripts but need to edit in-bet

#52 Post by foxidrive » 22 Apr 2013 15:18

In the spirit of open source software and free information, as you have received here in this forum in creating this mod, you should release the code in plain text format - and allow others to learn from what you have done and perhaps to improve it.

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: Looking to encrypt batch scripts but need to edit in-bet

#53 Post by carlos » 22 Apr 2013 15:33

Is not for do spam, but I have a 40% of my tiny batch compiler, it uses a new technique ,coming soon.

pditty8811
Posts: 184
Joined: 21 Feb 2013 15:54

Re: Looking to encrypt batch scripts but need to edit in-bet

#54 Post by pditty8811 » 22 Apr 2013 15:43

foxidrive wrote:In the spirit of open source software and free information, as you have received here in this forum in creating this mod, you should release the code in plain text format - and allow others to learn from what you have done and perhaps to improve it.


I agree with this notion. They're welcome to ask me for the code, and I'll give it to them.
I just don't want to see some European publisher jack my and other peoples' here hard work and sell it. That'd upset me, ALOT.

Example to some of this taking place are these mods published by some publisher, for the same game I created my mod for:

http://secure.simmarket.com/combat-plan ... lves.phtml
http://secure.simmarket.com/combat-plan ... s-ii.phtml

Those paid "expansion" packs are just a compilation of free mods from this site:
subsim.com/radioroom/forumdisplay.php?f=195

I'd go beserk if I spent years putting together mods and just see someone try to make a profit off of it. I'm not sure what I'd do.

Am I a bad guy for wanting people to ask first? Having them ask might thrawt any attempt of such a thing happening.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Looking to encrypt batch scripts but need to edit in-bet

#55 Post by foxidrive » 22 Apr 2013 16:39

pditty8811 wrote:
foxidrive wrote:In the spirit of open source software and free information, as you have received here in this forum in creating this mod, you should release the code in plain text format - and allow others to learn from what you have done and perhaps to improve it.


I agree with this notion. They're welcome to ask me for the code, and I'll give it to them.


So if three people ask you and they get the code, it's suddenly out of your hands anyway.

As I said, my opinion is that you should release the code in plain text format, so others can learn.

Liviu
Expert
Posts: 470
Joined: 13 Jan 2012 21:24

Re: Looking to encrypt batch scripts but need to edit in-bet

#56 Post by Liviu » 22 Apr 2013 23:34

pditty8811 wrote:My worry is that I don't want someone stealing the code I've worked hard over the past 2 months to compile, and to sell it at a store or something as I've seen people do to other modders in the past.

I highly doubt anyone will sell it as the game is over 7 years old now.

Maybe you shouldn't "worry" so much about something that you "highly doubt" ;-)

First off, I agree with foxidrive's advice "you should release the code in plain text format, so others can learn".

Then, as technicalities... Interpreted code, batch in particular, will always be vulnerable to snooping. So, instead of wasting time to obfuscate/protect sources that are known to be breakable anyway, why not leave everything in plain text and just add your terms in a comment (e.g. "don't remove attribution, don't redistribute for profit") then post both the batch source and a hash like MD5 to a publicly timestamped place such as a forum or a usenet newsgroup. That way, you retain and can verify ownership of the original code, while anyone can detect/report code tampering by checking against the MD5.

Liviu

pditty8811
Posts: 184
Joined: 21 Feb 2013 15:54

Re: Looking to encrypt batch scripts but need to edit in-bet

#57 Post by pditty8811 » 23 Apr 2013 00:35

Liviu wrote:
pditty8811 wrote:My worry is that I don't want someone stealing the code I've worked hard over the past 2 months to compile, and to sell it at a store or something as I've seen people do to other modders in the past.

I highly doubt anyone will sell it as the game is over 7 years old now.

Maybe you shouldn't "worry" so much about something that you "highly doubt" ;-)

First off, I agree with foxidrive's advice "you should release the code in plain text format, so others can learn".

Then, as technicalities... Interpreted code, batch in particular, will always be vulnerable to snooping. So, instead of wasting time to obfuscate/protect sources that are known to be breakable anyway, why not leave everything in plain text and just add your terms in a comment (e.g. "don't remove attribution, don't redistribute for profit") then post both the batch source and a hash like MD5 to a publicly timestamped place such as a forum or a usenet newsgroup. That way, you retain and can verify ownership of the original code, while anyone can detect/report code tampering by checking against the MD5.

Liviu


So post the code publicly and add a disclaimer? Sounds like a logical solution.

Post Reply