Caml Light

CMD: OPTION to jump

33 posts in this topic

Hi guys! If my batch file contains this:

:Sorry

ECHO Sorry!

:Welcome

ECHO Welcome!

Is it possible to jump to the ":Sorry" label if i open the cmd file and to jump to the ":Welcome" label if i open the same cmd file followed by an option (for example: batch.cmd /jump)?

Thank you!!

0

Share this post


Link to post
Share on other sites

goto %1

:sorry
Echo Sorry!
Goto :end

:welcome
echo welcome
Goto :end

:end

just use the label name for the switch

0

Share this post


Link to post
Share on other sites

a last question... if i convert my CMD batch to EXE, for a person that doesn't know the label i've given, is it possible to jump directly to the "Welcome" label, or anyway to find it's name? I'd to protect my batch file.. so do you think it's a secure solution? Thanks! :hello:

Edited by Caml Light
0

Share this post


Link to post
Share on other sites

It just depends on how secure you want it to be: if you use a batch to exe converter, most of them will only unpack the batch in a temporary folder and run it from there and then the protection will be very light.

0

Share this post


Link to post
Share on other sites

..and what do you suggest me to protect better my cmd script? Thanks in advance!

0

Share this post


Link to post
Share on other sites

Make it into a autoit file and compile it with password...

0

Share this post


Link to post
Share on other sites

Make it into a autoit file and compile it with password...

....and make it longer than 12 characters and make sure you insert "strange" non alpha-numeric characters and not a-z/A-Z ones.

Examples:

  • h1_1_@m_@_|33t_p@§§vv0rd
  • ÿ00_vv0n*t_cr@ç#-m3

:angel

BTW, IcemanND's nice batch may be "bettered" (assuming you are on a 2K/XP or later NT based system):

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
IF NOT "%1"=="" FOR /F %%A in ('type %~nx0 ^|FIND ":%1" ^| FIND /V "FIND"') DO GOTO :%1
Echo A suffusion of yellow ...
GOTO :EOF

:sorry
Echo Sorry!
GOTO :EOF

:welcome
echo welcome

OR (to follow your original post):

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
IF NOT "%1"=="" FOR /F %%A in ('type %~nx0 ^|FIND ":%1" ^| FIND /V "FIND"') DO GOTO :%1
Echo Sorry!
GOTO :EOF
:welcome
echo welcome

OR:

@ECHO OFF
SETLOCAL
IF /I "%1"=="welcome" GOTO :%1
Echo Sorry!
GOTO :EOF
:welcome
echo welcome

jaclaz

Edited by jaclaz
0

Share this post


Link to post
Share on other sites

•h1_1_@m_@_|33t_p@§§vv0rd

•ÿ00_vv0n*t_cr@ç#-m3

OMG LOLZ

0

Share this post


Link to post
Share on other sites

You can use an obfuscator (some batch to exe do this but most of them aren't free) or use another language like autoit (which is a little more secure when using a password ).

You could also change the code to make it so complex that just reading it would not help "the man in the middle" to understand it.

Edited by allen2
0

Share this post


Link to post
Share on other sites

IIRC, the password in AutoIT is only for their decompiler that is meant for AutoIT v2 executables. It was this entire purpose (they lock topics over there if you ask about it) that this function was removed in v3, although you can still put a password in it. But this password does nothing for other decompilers.

0

Share this post


Link to post
Share on other sites

thank you for your reply guys! I want to specify that to protect my batch i can't use any password to type in.

To convert to EXE my batch i've used "Bat To Exe Converter 1.5.1.0". Do you think it's enough secure? Better Offuscator?

Now i've added the code by jaclaz:

@ECHO OFF

SETLOCAL

IF /I "%1"=="welcome" GOTO :%1

Echo Sorry!

GOTO :EOF

:welcome

echo welcome

But if an expert user will decrypt my batch, this method will be vain.

0

Share this post


Link to post
Share on other sites

This seem to me "good enough":

http://www.f2ko.de/programs.php?lang=en&pid=b2e

But we also have an IDE for batch files :w00t::

http://sourceforge.net/projects/batchcompiler/

And also a new thingy , Visualbatch :ph34r: :

http://visualbatch.sourceforge.net/

The good ol' way:

http://www.ericphelps.com/batch/samples/obfuscating.txt

jaclaz

Edited by jaclaz
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.