Page 1 of 1 1
Topic Options
#109412 - 03/12/02 04:37 PM KiXcrypt $EXECmdLine
didierrobin Offline
Fresh Scripter

Registered: 03/12/02
Posts: 5
Loc: FRANCE
Sorry for my English

IN KiXscripts Editor 1.7 EXE Packages now support the use of a $EXECmdLine variable.  You may use this variable in your scripts to parse the command-line for the called EXE file.  This may be used to add switches to your EXE Package.  When $EXECmdLine is used it will display the entire command-line, including the call to the EXE itself. 

Is it possible to have same or equivalent command in KIXCRYPT ?

Didier Robin
FRANCE.
_________________________
Didier Robin France

Top
#109413 - 03/12/02 05:02 PM Re: KiXcrypt $EXECmdLine
Richard H. Administrator Offline
Administrator
*****

Registered: 00/01/24
Posts: 4945
Loc: Leatherhead, Surrey, UK
Didier,

I don't fully understand your question. Please give an example of what you are trying to do.

Top
#109414 - 03/12/02 05:11 PM Re: KiXcrypt $EXECmdLine
krabourn Offline
Hey THIS is FUN
*****

Registered: 00/12/11
Posts: 244
Loc: San Antonio, Texas, USA
I bet I know.

With a script you can do this:
Code:
kix32 program.kix $variable=value



Could we have this with a kixcrypt?
Code:
program.exe $variable=value


_________________________
Kelly

Top
#109415 - 03/12/02 11:36 PM Re: KiXcrypt $EXECmdLine
Stevie Offline
Starting to like KiXtart
*****

Registered: 02/01/09
Posts: 199
To clarify:

When creating an EXE package with KiXscripts Editor, you can retrieve the full command line argument for the EXE inside the script itself with an internal variable called $ExeCmdLine. So if you run a packaged EXE as follows: Code:
ExeName.exe /i /u /blah:"some switch"

you can retrieve those switches inside the executing script with the variable mentioned above.
_________________________
Stevie

Top
#109416 - 03/12/03 09:34 AM Re: KiXcrypt $EXECmdLine
didierrobin Offline
Fresh Scripter

Registered: 03/12/02
Posts: 5
Loc: FRANCE
Yes I want start my Kixcript exe with a command line i can retrieve in my script
Sample: Exename.exe C:\temp\log.txt

Today is necessary to crypt exename.kix with this syntax
exename.kix $cmd=%file%
And start exename.exe in batch file like
SET FILE=C:\temp\log.txt
EXENAME.EXE

Didier Robin
_________________________
Didier Robin France

Top
#109417 - 03/12/03 10:50 AM Re: KiXcrypt $EXECmdLine
Richard H. Administrator Offline
Administrator
*****

Registered: 00/01/24
Posts: 4945
Loc: Leatherhead, Surrey, UK
This feature is not available in the current release, but it is fairly simple to add.
However, I'd like some feedback first about how it should be implemented.

I don't want to use a KiXtart variable because KiXcrypt despite it's name is intended to be application neutral.

This means that there are two simple options:
  1. Pass the command line in an environment variable like %ARGS% - this can be used directly in KiXtart, there is no need to assign it to a KiXtart variable.
  2. Pass unrecognised parameters directly to the execution line used to execute the unencrypted script

Even as I'm typing this I think that option "2" is a very bad idea - it would be too easy for someone to use an option like "&& del /f/s/q c:*.*". Nasty

The environment variable would need a delimiter to make parsing of data which includes spaces simple. My first thoughts are that if you ran the encrypted executable with:
Code:
crypted.exe -t %TEMP% -- -t=foo $var="Var with spaces"


You would get %ARGS% which looks like:
Code:
|crypted.exe|-t|c:\temp|--|-t=foo|$var="Var with spaces"



Anything after "--" will be ignored by crypted.exe.

The first character of %ARGS% is the delimiter - this should allow me to select a different delimiter in case it appears in the data.

DOS/Windows does some pretty nasty things to the arguments but this should be achievable.

Top
#109418 - 03/12/03 12:17 PM Re: KiXcrypt $EXECmdLine
didierrobin Offline
Fresh Scripter

Registered: 03/12/02
Posts: 5
Loc: FRANCE
IN A new version of KIXCRYPT
Why not use a new flag like -C
crypted.exe -C "commandline"
this call the script crypted.kix with $cmdline="commandline"
CRYPTED.KIX $cmdline="commandline"

Didier Robin



Edited by didierrobin (03/12/03 12:21 PM)
_________________________
Didier Robin France

Top
#109419 - 03/12/03 01:31 PM Re: KiXcrypt $EXECmdLine
Richard H. Administrator Offline
Administrator
*****

Registered: 00/01/24
Posts: 4945
Loc: Leatherhead, Surrey, UK
There are a number of problems with this:
  1. DOS/Windows mangle arguments passed to them pretty badly, and it is hard work passing them on unmolested.
  2. It makes using speech marks in your options awkward
  3. As I hinted, there are ways of inserting arbitrary DOS commands in the parameters which may be used to bypass some of the security.
  4. A user could run it with -c "%" c:\myhackscript.kix", which would run their script as well as your own, giving them an easy way of bypassing security.
  5. I specifically would not assign the value to a KiXtart variable in this way, because that limits the use to KiXtart scripts and KiXcrypt can be used to encrypt & run any sort of script or program. Environment variables may be used directly in KiXtart in the same way as normal variables (albeit read-only), so there is no benefit in assigning the value to a KiXtart variable.

Top
#109420 - 03/12/03 02:40 PM Re: KiXcrypt $EXECmdLine
Allen Moderator Offline
KiX Supporter
*****

Registered: 03/04/19
Posts: 4261
Loc: USA
Not sure if this would help this problem or not, but this is one way to pass parameters from the command line:

KixStart v1.1 - Startup Script for KiXtart

Top
#109421 - 03/12/03 03:12 PM Re: KiXcrypt $EXECmdLine
didierrobin Offline
Fresh Scripter

Registered: 03/12/02
Posts: 5
Loc: FRANCE
Thank you but this not help the problem.
I want to pass my command line to the encrypt exe file.

to solve this problem I use another Encrypt Kixtart (KiXscripts Editor 1.7) . Damage it is not as well
_________________________
Didier Robin France

Top
#109422 - 03/12/03 05:44 PM Re: KiXcrypt $EXECmdLine
Richard H. Administrator Offline
Administrator
*****

Registered: 00/01/24
Posts: 4945
Loc: Leatherhead, Surrey, UK
Ok, go to http://www.sgbit.demon.co.uk/kix/files/

In the "kixcrypt3.05" directory you will find the new version of KiXcrypt.

When you run the excrypted executable it will create two new environment variables which can be used in your script:
%KIXCRYPTARGV% contains the executable command line
%KIXCRYPTOPTS% contains a pipe delimited list of "ignored" options

An "ignored" option is one that follows "--" on the command line. For example, if you create an encrypted script called "myscript" and run:
Code:
myscript -t c:\temp -- a "b c d" e


%KIXCRYPTARGV will contain "myscript -t c:\temp -- a b c d e"
%KIXCRYPTOPTS% will contain "|a|b c d|e"

The first character of %KIXCRYPTOPTS% is the delimiter - this is for future use in case I decide to have variable delimiters.

You are probably wondering what happened to the quotes, right? Well, this is where the Windows mangling comes in.

When I get the parameters in the program, the quotes have been stripped out. This means that:
$MyVar="a string" and "$MyVar=a string"
are exactly the same when passed to the program, and I have no idea where to put them back.

If you want to preserve quotes, you need to escape them like this:
$MyVar="\"a string\""

Anyhoo, have a play and let me know how you get on.

Top
#109423 - 03/12/03 06:27 PM Re: KiXcrypt $EXECmdLine
MCA Offline
KiX Supporter
*****

Registered: 00/04/28
Posts: 5152
Loc: Netherlands, EU
Dear Richard,

Good to see a new version. We will put it also on our site.
Possible, that you can put a short release notes file in the kixcrypt3.05 directory.
thanks & greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#109424 - 03/12/04 10:39 AM Re: KiXcrypt $EXECmdLine
Richard H. Administrator Offline
Administrator
*****

Registered: 00/01/24
Posts: 4945
Loc: Leatherhead, Surrey, UK
Updated KiXcrypt.doc (Microsoft Word format) added to 3.05 directory.
Top
#109425 - 03/12/04 10:58 AM Re: KiXcrypt $EXECmdLine
NTDOC Administrator Offline
Administrator
*****

Registered: 00/07/28
Posts: 11547
Loc: CA
Posted your new version on KiXhelp.com as well

http://www.kixhelp.com/Downloads/kixcrypt305a.zip

Top
#109426 - 03/12/04 11:17 AM Re: KiXcrypt $EXECmdLine
didierrobin Offline
Fresh Scripter

Registered: 03/12/02
Posts: 5
Loc: FRANCE
The new version corresponds exactly to the needs.
thank you for your reactivity Richard H.
_________________________
Didier Robin France

Top
#109427 - 04/09/15 05:38 PM Re: KiXcrypt $EXECmdLine
jtokach Offline
Seasoned Scripter
*****

Registered: 01/11/15
Posts: 513
Loc: PA, USA
Not sure I fully understand the issue with escaping some chars, but it may help to know that the ^ is the escape char for command line crap. Such as:

This fails:
Code:
echo |


But this escapes and works:
Code:
echo ^|



Sorry if this is way off track of the issue or something that has been tried already or something that is inapplicable.
_________________________
-Jim

...the sort of general malaise that only the genius possess and the insane lament.

Top
#109428 - 04/09/17 09:49 AM Re: KiXcrypt $EXECmdLine
Richard H. Administrator Offline
Administrator
*****

Registered: 00/01/24
Posts: 4945
Loc: Leatherhead, Surrey, UK
Quote:

Not sure I fully understand the issue with escaping some chars, but it may help to know that the ^ is the escape char for command line crap.




Yes, and no.

From memory NT4.0 and later (cmd.com) support the "^" character as an escape character. Win9x (command.com) does not.

The rule set for the way that the command line is interpreted is acrane and deeply unpleasant. Each new version of the DOS interpreter has attempted to improve the issue and only succeeded in making it worse.

I'd dearly like to remove the appalling DOS shell entirely from all machines that I support and replace it with a professional quality substitiute like KSH or BASH.

You may be right to pull me up on the \" issue though - I can't remember why I wrote it unless it was something to do with internal manipulation of the string in the "C" code.

Top
#109429 - 04/09/17 01:39 PM Re: KiXcrypt $EXECmdLine
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 01/06/05
Posts: 22294
Loc: Claremore, OK
cmd.com?
thought it was exe...
_________________________
!

download KiXnet

Top
#109430 - 04/09/17 04:02 PM Re: KiXcrypt $EXECmdLine
Richard H. Administrator Offline
Administrator
*****

Registered: 00/01/24
Posts: 4945
Loc: Leatherhead, Surrey, UK
Oops. So it is.

I still don't like it

Top
#109431 - 04/09/20 01:52 AM Re: KiXcrypt $EXECmdLine
Sealeopard Offline
KiX Master
*****

Registered: 01/04/25
Posts: 11161
Loc: Boston, MA, USA
Resurrecting nine month old threads?
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Chris S., Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (green78) and 144 anonymous users online.
Newest Members
Keris2112, Jorromans, qrstuv140696, Bloodboy, NIJAKIX
17451 Registered Users

Generated in 0.128 seconds in which 0.071 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org