Page 1 of 1 1
Topic Options
#181021 - 2007-10-02 01:46 PM Using passowrds in scripts
Casper Offline
Lurker

Registered: 2007-09-30
Posts: 1
Hey
I need to pass a password to a function in kix. Anyone had to do this, and found a good way to protect it?

Top
#181024 - 2007-10-02 01:56 PM Re: Using passowrds in scripts [Re: Casper]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
If you're embedding the password, simply tokenize your script (kix32 -t script.kix). Distribute and run the resulting .KX file. Be sure to have a backup first!!!

If you need to store the password in a file, you can search for the CODEC UDF, which does a reasonable job of obfuscating the data or password. We use that medhod, storing a few scrambled passwords in an INI file.

We get creative by storing part of the decode key in the data file and part somewhere else. You need both parts to decode the passwords. There's other ways, and someone with enough time/resources could eventually decode the data, but it isn't that easy.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#181025 - 2007-10-02 02:00 PM Re: Using passowrds in scripts [Re: Casper]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
There are several options.
For example you could tokenize the script, use runas (single N), runnas (double N), sanur, kix2exe or create an exe from the editor (eg ASE). All these options are discussed here on the board so a search would give you all kinds of possible solutions.

[edit]
Glenn got there first.
[/edit]

[edit2]
Oh.....and don’t forget that some of the options are NOT SECURE. The pw and username are displayed as plain text so the users can (ab)use it if he or she wants to.
[/edit2]


Edited by Mart (2007-10-02 02:02 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#181033 - 2007-10-02 04:46 PM Re: Using passowrds in scripts [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
I'm not sure what using Runas or RunnAs has to do with passing a password to a function (it could be a database or application password), but there is an issue with Mart's reference to RunAs.

Windows RunAs (one "N") will not work for unattended scripted solutions, as you cannot specify the password on the command line. Shawn's RunnAs does allow the password to be specified, and can encode the credentials into the task. It's an excellent (and free) method for running scripts as a specific user. Don't overlook the task scheduler, either, since you can control it remotely and specify the account to run as.

Mart's references are all appropriate for running scripts in an specific Windows or AD account environment. Just keep the RunAs limitation in mind, as it will prompt the user for the password.

The CoDec UDF provides a high level of obfuscation, and there's a ROT13 UDF that provides very simple and widely used obfuscation of alpha characters. Keep in mind that Obfuscation is not encryption. It's usually enough for scripts, especially when combined with appropriate account access (ie - not Domain or Enterprise admin account access!)

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#181036 - 2007-10-02 05:04 PM Re: Using passowrds in scripts [Re: Glenn Barnas]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
I'm not sure what the original poster means. Does he want to give a pw to a function/udf (like somefunction($pw, $otherstuff) or something like it) or run a function with a different pw then the one used by the currently logged in user. Some posts just have to little or to cryptic information.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#181038 - 2007-10-02 05:10 PM Re: Using passowrds in scripts [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Well, Casper's covered either way now, don't ya think? \:D

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#181039 - 2007-10-02 06:06 PM Re: Using passowrds in scripts [Re: Glenn Barnas]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Yep. Let's wait and see what he exactly needs.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#181051 - 2007-10-02 10:25 PM Re: Using passowrds in scripts [Re: Mart]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Well have not played with RuNNas from Shawn in a while but his utility as I recall uses an actual encryption algorithm instead of just obfuscation.

Using a policy would be best if possible, if not then perhaps the task scheduler. My next choice would probably be RuNNas - while testing it a long time ago now, it was a very powerful tool for this type of thing I just rarely have a need for using this type of utility.

The tokenized files from KiXtart according to the author are not using encryption (though spending a few days attempting to crack it resulted in no valid results) so for the most part a tokenized file would seem semi-secure but Ruud does recommend not putting passwords in it.
Using RuNNas along with a Tokenized file would seem a reasonable measure to prevent most from discovering it (though in time who knows, someone could make a cracking tool for it, so again not a good practice) but sometimes real life work has to get done somehow so I would choose the native methods of Windows first before using these other tools.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 476 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.059 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

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