Page 1 of 1 1
Topic Options
#58595 - 2001-08-26 10:13 PM Encrypt KiXtart scripts?
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Is there a way to encrypt Kix scripts, so that users are unable to read them? Some scripts contain information that user's shouldn't see. For BAT files, there's BAT2EXEC, and also a way to encrypt these EXE files, does something like KIX2EXE exist? Any other ideas?
_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#58596 - 2001-08-26 10:27 PM Re: Encrypt KiXtart scripts?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Are you looking for something more thorough than MCA's KiXStrip? It doesn't encrypt, but makes it difficult to reverse engineer. I seem to recall that someone mentioned in a post how they package up everything including the Bat2Exe using a WinZip style self-extractor with encryption but it is still security-by-ignorance. The savy ones can still hack out your secrets.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#58597 - 2001-08-26 11:16 PM Re: Encrypt KiXtart scripts?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Oops, should have given more info on MCA's site. THe link to KixStrip is for KiX version 3.63.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#58598 - 2001-08-27 11:35 AM Re: Encrypt KiXtart scripts?
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Hi,

I've tried it, but all the commands are still easy to read.. I probably have to license the program before other functions can be used, and that's not an option..
Isn't there a (freeware/free) way to convert it to an executable or something like that?

_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#58599 - 2001-08-27 11:42 AM Re: Encrypt KiXtart scripts?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there yet isn't kix2exe kind of tool.
but it's not so easy to make.
there is this method, which is used in some tool (name? can't remember) that includes kix.exe in package and this way does it as executable. but it's pretty huge 'cause only the exe part of kix is 200k.

if someone remembers it's name could prompt it out.

_________________________
!

download KiXnet

Top
#58600 - 2001-08-27 11:45 AM Re: Encrypt KiXtart scripts?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Jeroen,

This program is released as freeware by MCA

What can be done is that this program can strip out all comments, blank lines, and place ALL the commands on one single line.

If you have a small script then yes it is probably still understandable. However if you have any kind of real length to a script it is very hard to tell what or how things are done when you have a line with a 1,000 characters all on one line.

KiXtart is an interpreted language and as such can not be "compiled" The KiXtart engine reads all the lines and then interprets the commands to perform.

To my knowledge there is no way to "encrypt or compile" the code and still be useable.

Some have tried things like ARJ or LHX etc to encrypt and decrypt on the fly. Not sure how well these solutions have worked out for them though.

Try searching the board for Encrypt and ARJ, etc... You may find more information on this topic.

Top
#58601 - 2001-08-27 11:50 AM Re: Encrypt KiXtart scripts?
Anonymous
Unregistered


There is an other script language witch is able to encrypt scripts. It's called AutoIT but unfortunately it has only few commands. We use these both script languages together and it works very good

You can get Autoit at http://www.hiddensoft.com/autoit

Top
#58602 - 2001-08-27 11:57 AM Re: Encrypt KiXtart scripts?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ntdoc, kixstrip has the problem, that if your script really isn't that huge, it does not matter if it's on one line. it can be understood anyway.

but, when thinking of this, the crypting can be done with kix script itself!

using kix version 2001 one can do a script that with execute lines converts stuff to not understandable format. this can be used as script that then translates the actual script.

_________________________
!

download KiXnet

Top
#58603 - 2001-08-28 12:00 AM Re: Encrypt KiXtart scripts?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Lonkero,

Perhaps you can give an example of what your thinking of. I'm not sure what you mean....

Well, it's 2:00 am here and the girlfriend keeps waking up telling me to go to bed. Better shut down now

[ 27 August 2001: Message edited by: NTDOC ]

Top
#58604 - 2001-08-27 04:04 PM Re: Encrypt KiXtart scripts?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Jeroen,
Have you looked at the other tools on MCA's site that I directed you to? For what reason do you want to encrypt? To prevent reverse engineering or to hide security stuff like passwords? Follow some of the links on MCA's site (they point back to this forum). They go into good detail on the pitfalls of encryption. Namely, that the decription is done entirely on the client side. Meaning, what the software can do, I savy person can as well!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#58605 - 2001-08-27 10:31 PM Re: Encrypt KiXtart scripts?
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
To give you an idea;

The company I work for has a lot of engineers employed. It seems some of them have nothing else to do but check out the latest on the Netlogon shares, as soon as they detect a change in the logon script, or in how their computer reacts to certain commands etc.

Some time ago, we had to use the local administrator password in a script. We made it as difficult as (then) possible for the users to find it, even put in in unreadable form, but a couple of days later, one of the (honest) technical users gave us a call, and told us the password. After this, we made a 180 degrees turn, and we will never put anything like that in any script again, unless we're absolutely sure that users are unable to find it. (read it/crack it). We have learned our lesson.

To still perform a similar function, we made a .BAT file containing a command with the password needed for this command. (say for example, a NET USE command, providing username and password). What we did, was convert the BAT file to EXE, and encrypt this EXE to a new EXE using a password and an encrypting util. This file cannot be read as easily.

Of course; all passwords can be cracked, but if they can crack this file within reasonable time, they will be employed by IT. (haha!). I've unleached crack programs on this file, but the time they would need to crack it, is very satisfactory !! (More than a year). Since the passwords for these functions are changed more often, this is an unlikely event.

What I'm looking for, is a way to prevent that users can read scripts that easily, thus preventing that when we write a script, for example disabling the File and Printer sharing button, they won't create a regpatch enabeling it again for themselves. Even if the encryption is simple, and the client decrypts the file, the users most likely won't go through the trouble of trying..
Even if they do, we still won't place password or thing like that in there, so...

_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#58606 - 2001-08-28 05:25 AM Re: Encrypt KiXtart scripts?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Some things are best done with policies rather than Kix. That way, users have no code to rip and reverse. The savy ones can undo those quite easily too. If you really need to lockdown machines as in an industrial / institutional setting there's Fortres 101 and Cooler from http://www.fortres.com
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#58607 - 2001-10-15 06:52 AM Re: Encrypt KiXtart scripts?
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

An interesting discussion which you can find many times on the board.

A little reaction about "how to make your script secure" and our suggestion
"how to implement it by kixtart".

We are using not only codec to make our script secure.
We are using

  • kixstrip: to remove additional comment and unwanted spaces and combine
    statements to one line. One long unstructured line is hard to read.
  • codec: to encrypt/decrypt any type of file. by using dynamic encryption
    method no encryption result looks the same. by a CRC check mechanism any
    possible modification to that file will ignore decryption.
  • bat2exec: to convert your BAT file to an EXE file. mostly such file
    can contain passwords, special programs or special pathnames.
    the result is readable by users, but the secure21.zip package can
    encrypt the result to something unreadable.
  • secure21.zip package: using to encrypt in 1-way your EXE files.

An example how to use a set of above programs you can read topic
http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=1&t=002750

The result of kixstrip for

code:

IF setconsole("hide")
ENDIF
;
; NT/95 create description list of KiXtart errors - Kixtart 4.00
;
; (c) scripting@wanadoo.nl - 2001
;
; vs 1.00 - program
;
; 1.00 (20010715) original version
;
FUNCTION SetError($error_number) EXIT $error_number ENDFUNCTION
;
$tmp_directory=ExpandEnvironmentVars("%tmp%")
IF (substr($tmp_directory,len($tmp_directory),1) <> "\")
$tmp_directory=$tmp_directory+"\"
ENDIF
;
$info_file=$tmp_directory+"kix-code.txt"
IF RedirectOutput($info_file,1)
ENDIF
? "KiXtart "+@kix+" - Summary Error Codes"
?
FOR $i=0 TO 9999
SetError($i)
IF (len(@serror) <> 0) AND (Instr(@serror,"Error retrieving error information for") = 0) AND (Instr(@serror,", 13D)") = 0)
$result=@serror
$pos=Instr($result,CHR(13)+CHR(10))
WHILE ($pos <> 0)
IF ($pos <> 0)
$result=substr($result,1,$pos-1)+" "+substr($result,$pos+2,len($result)-$pos-1)
ENDIF
$pos=Instr($result,CHR(13)+CHR(10))
LOOP
IF (Substr($result,len($result),1) = CHR(10)) OR (Substr($result,len($result),1) = CHR(13))
? Substr(" ",1,7-len("@error"))+"@error "+Substr($result,1,len($result)-1)
ELSE
? Substr(" ",1,7-len("@error"))+"@error "+$result
ENDIF
ENDIF
NEXT
IF RedirectOutput("")
ENDIF
? "Informative KIX: create an actual description list of KiXtart "+@kix+" errors."
? " file created '"+LCASE($info_file)+"'."
EXIT


isn't easily to read, when we also convert the variable name to mnemonic name.
Result is one long line of 967 characters.
code:

if setconsole("hide") endif function SetError($x1) exit $x1 endfunction $x2=ExpandEnvironmentVars("%tmp%")
if (substr($x2,len($x2),1)<>"\") $x2=$x2+"\" endif $x3=$x2+"kix-code.txt" if RedirectOutput($x3,1) endif
? "KiXtart "+@kix+" - Summary Error Codes" ? for $x4=0 to 9999 SetError($x4)
if (len(@serror)<>0) AND (Instr(@serror,"Error retrieving error information for")=0) AND (Instr(@serror,", 13D)")=0)
$x5=@serror $x6=Instr($x5,CHR(13)+CHR(10)) while ($x6<>0) if ($x6<>0)
$x5=substr($x5,1,$x6-1)+" "+substr($x5,$x6+2,len($x5)-$x6-1) endif
$x6=Instr($x5,CHR(13)+CHR(10)) loop if (Substr($x5,len($x5),1)=CHR(10)) OR (Substr($x5,len($x5),1)=CHR(13))
? Substr(" ",1,7-len("@error"))+"@error "+Substr($x5,1,len($x5)-1) else
? Substr(" ",1,7-len("@error"))+"@error "+$x5 endif endif next
if RedirectOutput("") endif ? "Informative KIX: create an actual description list of KiXtart "+@kix+" errors."
? " file created '"+LCASE($x3)+"'." exit


How interesting is such code for analyzing by even kixtart programmers?

Biggest problem is for kixtart (= kix32.exe): it need an input file.

Our suggestion is:
1. create additional program which make a 1-way encryption.
2. extend kix32.exe to handle a normal and a 1-way encrypted input file.
This method is must easier for implementation.
The piping of scripts to kix32.exe will be a better solution. No temporary
readable file must be created.
Greetings.


btw: some reactions on reactions to this topic.

  • NTDOC we hope you had a good weekend. With some other tools it
    is possible to get your kixtart script very secure. Only for heavy users
    it can be possible to get the code, but he will never get the original
    one after using our kixstrip and codec tools.
    Very important for us was to create an encryption method which will return
    always another result and it is independent of how many times your are running
    the program.
    Good weekend mine comment to topic
    http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=1&t=002750
    But your reaction results in new ideas.
  • Lonkero. Of course small script can be read easily, but after removing
    your comment it can be hard to understand. Once we read a very small script
    which was rewritten for speed up by another, but it was very hard to see "both
    scripts do the same things".
    For people who are knowing the programming language Algol68 knows that
    all boldsymbols can representated by a single character. After modifying in
    such way such script - even for a short one - isn't interesting for a very great
    amount of guys.
    The compress facility (= combining to one line) in kixstrip was not for
    security reasons, but for speed. We doesn't need to transfer comment and unused
    characters.
  • LLigetfa. By using the method specified in topic "Forum1-2750" it
    is very hard for an user to get all the information necessary for encryption.
    It isn't necesarry to use the local client for the decryption task. Any loca-
    tion can be possible.
    Possible he will never find the encrypted script files on your server, because
    you can give them any name you like and you can put them anywhere you like.
    Our netlogon directory contains only one executable (= bat2exec + secure21
    result), which activates the whole process and gets its files from 'black hole' in
    the system.
    Most important element is: user can't replace kix32.exe. After replacing
    that file it is must easier to catch your script. How: by simple reading it and
    writting it to a floppy-disk.
  • Jeroen. we agree "never put a password in a readable piece of code".
    Your method of BAT2EXEC + encrypt that EXE to a new EXE we are using all the
    time. One simple, harmless encrypted EXE is for nobody interesting.
  • in other topics about this issue we make following suggestion for the threat
    of
    a trojan KIX32.EXE which simply prints the script rather than running it:
    code:

    encrypt your scripts with an additional program (one-way)
    and
    make it possible that kix32.exe can handle plain text scripts or an encrypted scripts.

    possible kixtart CALL commands can also handle both script files.
    temporary files are not necessary by such method.



    Benefit: for a torjan KIX32.EXE is an one-way encryption not interesting.
    Only the released KIX32.EXE program can decrypt your encrypted file and he
    isn't using any temporary file at all.

    for complete story and other suggestions see topic
    http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=4&t=000108

_________________________
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
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2009 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.115 seconds in which 0.053 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