I need some help testing a new version of KiXcrypt.

This version uses a new method of hiding the primary script, but at this stage it is experimental.

VERY IMPORTANT 1
This updated requires a version of KiXtart which supports IsDeclared()

Activate the experimental routine by using the "-x" command line switch.

The new features are:
  • New environment variable %KIXCRYPTDEBUG% set to "1" if the package was made with the "-d" debug flag.
  • New environment variable %KIXCRYPTEXE% which is the full path to the package name when started. This is also quite experimental, so let me know your findings.
  • %COMSPEC% is no longer included in the default execution command.
  • "-x" experimental script protection
VERY IMPORTANT 2
There is a problem with environment variables being expanded when starting the unencrypted script under the control of a command interpreter. To avoid this issue, either:
1) Don't use environment variables in your script or disguise them so that they don't appear as %ENVVAR%.
2) Don't use %COMSPEC% (command.com or cmd.exe) in your execution (-e) string. The default command no longer includes %COMSPEC%.
If you don't use the "-x" switch KiXcrypt works as it always has (or at least it should [Wink] let me know about any regressions)

For those of you interested in how it works, the "-x" option writes a boot script rather than the encrypted script. The encrypted script is passed as command line variables, which are then catenated in memory to form the original script. This is then Executed().

If you create the package with the debug option the recreated script is saved as "bsdebug.kix" so you can compare it with the original script if there are problems.

Note, if you have a very large script you may get problems with environment space.

To save you hacking it, here is the boot script:
code:
Break OFF
$KIXCRYPTCOUNT=0
$KIXCRYPTLINES='Exit 1'
While Execute('Exit IsDeclared($$sKIXCRYPT$KIXCRYPTCOUNT)')
Redim Preserve $KIXCRYPTLINES[$KIXCRYPTCOUNT]
$KIXCRYPTNULL=Execute('$$KIXCRYPTLINES[$KIXCRYPTCOUNT]=$$sKIXCRYPT$KIXCRYPTCOUNT')
If $KIXCRYPTLINES[$KIXCRYPTCOUNT]='0' $KIXCRYPTLINES[$KIXCRYPTCOUNT]='' EndIf
$KIXCRYPTCOUNT=$KIXCRYPTCOUNT+1
Loop
If %KIXCRYPTDEBUG%
$KIXCRYPTNULL=RedirectOutput('bsdebug.kix',1)
Join($KIXCRYPTLINES,@CRLF)
$KIXCRYPTNULL=RedirectOutput('')
EndIf
Exit Execute(Join($KIXCRYPTLINES,@CRLF))

VERY IMPORTANT 3
There is a small problem passing in a blank variable. If you start KiXtart with a variable specified as '$sVar=""' it gets converted to a numeric zero. This would mean that a blank line in your script would be converted to a zero, and the zero would be dumped to the console when you ran the script. To avoid this, the boot script changes any line which is "0" to "". In the unlikely event that you need a line in your script which is just "0" you will need to code around it.

This may apply to any line which can be converted to a numeric, so beware.

Right, if you've got this far and are still interested, the files are here