I have compiled the following batch file to test_pswd.exe:
@for /f %%a in (c:\work_folder\password_file.txt) do @isql -Smy_server -Usa -P%%a
This works perfectly in calling the password_file.txt and runs my sql.
Now I need to compile the password_file.txt to a exe in order to hide the password.
When I do this and then run my test_pswd.exe nothing happens or I simply get the actual code from test_pswd.exe echoed back.
I have hundreds of scripts like this that I need to periodically change the password on. This requires a recompile of all my executables. It would be much easier to change it one place than in hundreds.
Any ideas, suggestions??
Thanks
calling a exe from a exe
I have only one idea:
1. change "password_file.txt" to "password_file.bat" and
replace your password with something like this:
if "%1"="secretkey" echo "your password"
Compile it.
Nobody can get your password without secret key.
2. In "test_pswd.exe"
set /p mypassword=< password_file.exe "secretkey"
@call isql -Smy_server -Usa -P%mypassword%
1. change "password_file.txt" to "password_file.bat" and
replace your password with something like this:
if "%1"="secretkey" echo "your password"
Compile it.
Nobody can get your password without secret key.
2. In "test_pswd.exe"
set /p mypassword=< password_file.exe "secretkey"
@call isql -Smy_server -Usa -P%mypassword%
support wrote:I have only one idea:
1. change "password_file.txt" to "password_file.bat" and
replace your password with something like this:
if "%1"="secretkey" echo "your password"
Compile it.
Nobody can get your password without secret key.
2. In "test_pswd.exe"
set /p mypassword=< password_file.exe "secretkey"
@call isql -Smy_server -Usa -P%mypassword%
Really appreciate the help, however the variable that gets passed here to the password is the entire if statement. Meaning that the %mypassword% is becoming: if "%1"="secretkey" echo "your password"
I am working with this though and trying to get it to work.
We are really in a bind here to make this work. All our batch jobs, roughly 300 of them, have to be re-compiled to do something like this soon.
Thanks for your help and time it is appreciated.
Hi,
The first solution would be this below:
But the project is put on hold for now as far as I know.
The next best thing is below:
What I mean is encrypt the file using commandline utilities such as the above tools, windows itself provide cipher as a commandline tool too.
If you dont want to use cipher, you can use commandline tools such as the above and embedded it into your Quick Batch File Compiler compiled exe.
The last option if you have ScriptCryptor, you could
put the password in it.
Eg.
Test.vbs contains:
Compiled it into console test.exe using ScriptCryptor.
Then use something like this batch file below:
Getoutput.bat contains:
Then run Getoutput.bat, it should call test.exe, then capture its output
into the variable OUTPUT.
The Getoutput.bat should echo the OUTPUT capture result.
The first solution would be this below:
Code: Select all
http://www.abyssmedia.com/forum/what-makes-quick-batch-file-compiler-better-than-the-others-t458,start,15.html
The next best thing is below:
Code: Select all
http://www.softpedia.com/get/Security/Encrypting/Codeode-Command-Line-Encrypt.shtml
http://www.softpedia.com/get/Security/Encrypting/Command-Line-Crypter.shtml
http://www.softpedia.com/get/Security/Encrypting/Krypter-Command-Line.shtml
http://www.f2ko.de/downloads/cmdtools/rc4.zip
http://www.softpedia.com/get/Programming/Other-Programming-Files/Base64-De-Encoder.shtml
http://www.techrepublic.com/article/use-cipherexe-for-command-line-encryption/
http://hcrypto.sourceforge.net/
http://technet.microsoft.com/en-us/library/bb490878.aspx
http://www.softspecialists.com/download.aspx (MiCry and Xor)
If you dont want to use cipher, you can use commandline tools such as the above and embedded it into your Quick Batch File Compiler compiled exe.
The last option if you have ScriptCryptor, you could
put the password in it.
Eg.
Test.vbs contains:
Code: Select all
Wscript.Echo "Password"
Then use something like this batch file below:
Getoutput.bat contains:
Code: Select all
@echo off
FOR /F "tokens=*" %%i in ('%~dp0test.exe') do SET OUTPUT=%%i
Echo %OUTPUT%
pause
exit
into the variable OUTPUT.
The Getoutput.bat should echo the OUTPUT capture result.