Page 1 of 1 1
Topic Options
#59550 - 2001-10-03 04:02 PM Need some input on SU thingie...
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Hi again...

Well, i've gotten SU working properly now... but I cannot seem to get it working when i've bat2exec (v.1.5), and secure.exe'd it.. :/

What I wanted to do was from the main script decide whether SU needs to be used or not (if @INWIN = 1, user has admin privilegues?), if SU needs to be launched for a separate script to work properly, I copy that script to the users %TEMP% (always renaming it to "AdmInst.kix") from within my main script, and then call the bat2exec'd + secure'd batch which launches a new KiX process that executes the script, like this:

code:

@ECHO OFF
REM *** Make a copy of the local kix32.exe file, so that another session can
REM *** be started with the administrator account.
REM *** "CD" to make sure that the system finds XCOPY & SU/SUSS...
CD "%WINDIR%\System32"
IF NOT EXIST "%TEMP%\kix32.exe" XCOPY "C:\kix32.exe" "%TEMP%\" /D /H /I /R >NUL

REM *** Start the KiXtart script as <domain>\Administrator.
REM *** Environment variable "SU_PASSWORD" must be set, otherwise SU might mess up...
SET SU_PASSWORD=<password>
IF NOT EXIST "%TEMP%\kix32.exe" GOTO NOCOPY
IF NOT EXIST "%TEMP%\AdmInst.kix" GOTO NOFILE
ECHO <password>|su Administrator "%TEMP%\kix32 %TEMP%\AdmInst.kix" <domain>

GOTO END

:NOCOPY
ECHO Couldn't copy kix32.exe!
GOTO END

:NOFILE
ECHO Couldn't find the script!

:END
EXIT


This script works flawlessly before I bat2exec + secure it... Any ideas?

[ 03 October 2001: Message edited by: masken ]

_________________________
The tart is out there

Top
#59551 - 2001-10-03 08:16 PM Re: Need some input on SU thingie...
Anonymous
Unregistered


I don't see any problems with your script. However, I do things slightly differently when using SU. Instead of setting a SU_PASSWORD Environment variable, I just pipe the password directly to SU. I also omit the <domain> at the end of the SU command line options.

I don't see any reason that these would be causing a problem, but those differ from the way I've used SU successfully several times.

I'm not sure what BAT2EXEC your using, but I use BAT2EXEC 1.5 from Ziff Communications Co. To encrypt my ".com" file, I use Secure v2.1b.

Top
#59552 - 2001-10-04 01:33 PM Re: Need some input on SU thingie...
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Hi Deception, thanks for your reply!

I also pipe the password to SU, as you can see. The reason why I set the environment variable is that I didn't get SU working until I declared that variable.

As mentioned, this batch work if I run it just as it is, but it doesn't work after i've bat2exec'd + secure'd it... :/

What options for bat2exec, repectively secure do you use?

_________________________
The tart is out there

Top
#59553 - 2001-10-04 05:50 PM Re: Need some input on SU thingie...
Anonymous
Unregistered


There are no options for BAT2EXEC than I'm aware of.

For SECURE, I use option 1 (print 'this is corrupted' then stop) for the "Pick Fail Option". I also enable the check file length.

Also, instead of CALLing your com/executable file, try using SHELL and see if it works.

Does it copy over your AdmInst.kix script when your executable is called from kix?

Top
#59554 - 2001-10-04 08:30 PM Re: Need some input on SU thingie...
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
I was tyring to use bat2exec to cover up my administrator password when kix is started to install software. I noticed that it would not run when i converted it. The problem lied in the fact that when i tried to set the environment variable it had no room for the variable to be set. This caused the problem of not running. what I did was exchange the line set su_password=xxxx to a file that had the password in it and the line looked like this
su administrator "notepad.exe" < c:\password.txt
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#59555 - 2001-10-04 09:04 PM Re: Need some input on SU thingie...
Anonymous
Unregistered


Masken and Will:
What version of SU are you using? I use SU v2.99 Jun 4 1997 and it has never given me a problem with wanting an environment variable to be set for SU_PASSWORD.

Will:
FYI: Simply using BAT2EXEC will not secure your password (if it had worked in your case). One could easily read your username and password by looking at it in a Hex editor or even notepad. However, since you can redirect the password to SU from a text file, you should be able to pipe the password to it using echo (ie: ECHO password|su administrator "notepad.exe"). Run BAT2EXEC on that, then ENCRYPT it with a program like SECURE.

Top
#59556 - 2001-10-04 10:35 PM Re: Need some input on SU thingie...
Anonymous
Unregistered


i found an application for windows 2000 that beats su , it can encrypt it's own command line and put it in a file you can pipe to the program itself. If interested, i will post the url here tomorrow.

Greetings,
Kamikaze

Top
#59557 - 2001-10-05 09:44 AM Re: Need some input on SU thingie...
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
I don't knw which version it is.. it's the one from Bryce's homepage I belive, fileversion is "4.0.1381.1" (28th may 1997).

I do not believe it's the environment variable, since I tried without it before (see this thread) with the same results...

But what I HAVE discovered is that secure.exe v.2.10 is really screwed. It somehow remembers the old inputname and if that file doesn't exists it creates one... no miracle that the encrypted *.exe could go wrong... check this out:

code:

╔════════════════════════λ 2;═════════════════════════ 552;════════════════════════╗
║ UNINST2.COM secured successfully to RUNINST3.COM ║
║ ║
║ ║
║ old file length (on disk) 0 new file length (on disk) 538 ║
║ security check devices PASS encoding devices PASS ║
║ old header length 0 new header length 0 ║
║ start address ffset FFFFFFF0h : 100h ║
║ time taken 0.0 min. ║
║ ║
║ ║
║ ║
╚════════════════════════λ 2;═════════════════════════ 552;════════════════════════╝



The input file here was "runinst2.com", and the output "runinst2.com"...?!!?! I tried it several times..

I'll download a new version of secure and try again..

[ 05 October 2001: Message edited by: masken ]

_________________________
The tart is out there

Top
#59558 - 2001-10-05 10:03 AM Re: Need some input on SU thingie...
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
[UPDATE]
This is getting weirder and weirder by the minute!

Wanna know what happened now? You'll NEVER guess! I bat2exec'd this:

code:

@ECHO OFF
SET SU_PASSWORD=<password>
ECHO <password>|su Administrator "%TEMP%\kix32 %TEMP%\AdmInst.kix" <domain>
EXIT


I then secured it with secure.exe.

Then I ran it, and here's the interesting part, the marker started wandering in the DOSprompt, and my printer started printing out it's contents! Wooot! How''s that on a weirdness scale?

_________________________
The tart is out there

Top
#59559 - 2001-10-05 06:09 PM Re: Need some input on SU thingie...
Anonymous
Unregistered


I have seen similar behavior in Secure myself where the input and output files are incorrect. I notice this happens once you run Secure and secure a file. Any file you try to secure after that will fail. I simply just opened another cmd prompt and it worked fine, so just exit and open a new cmd prompt if your securing multiple files. Secure may not be the best program, but it DOES work and it is one of the few programs that will encrypt .com files.

Try this..

code:

ECHO <password>|su Administrator "%TEMP%\kix32 %TEMP%\AdmInst.kix"

Leave out the @ECHO OFF, SU_PASSWORD, ETC. What happens with the above code when you run it? If that doesn't work, try replacing %TEMP% with the actual path (just for the sake of argument).

As far as your printer, that is rather odd.

Top
#59560 - 2001-10-15 02:12 PM Re: Need some input on SU thingie...
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Deception, thanks for your reply. I've been trying like crazy to get the script working, also with just one line and static paths, but no luck...

I'm going crazy here... It works like a charm before the bat2exec and encryption... :/

_________________________
The tart is out there

Top
#59561 - 2001-10-15 04:02 PM Re: Need some input on SU thingie...
Anonymous
Unregistered


Hate to hear it's still giving you problems.

I just got done trying to replicate your problem, but of course things worked fine on my end.

Here's what I did...

code:

echo password|su ADMIN "%TEMP%\kix32.exe %TEMP%\AdmInst.kix"

I used BAT2EXEC to convert the above code to an executable. Then I ran the .com file to make sure it still worked. Then I secured it, and ran it again with no problems.

Then AdmInst.kix I used was just a simple registry check (ReadValue) and a couple things to output some text to make sure it was actually working.

What exactly is it doing or not doing on your end? Is it successfully launching your kix script?

BTW.. This test was done using KIX 3.63.

Top
#59562 - 2001-10-17 02:00 AM Re: Need some input on SU thingie...
MCA Offline
KiX Supporter
*****

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

The bat2exec and secure21 files you can find also on our site
http://home.wanadoo.nl/scripting
Topic
http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=1&t=002750
let see how we are using both tools to create extremly secure
EXE file from a BAT file. At the moment we didn't discover any problem
with them.
A possible problem can be: you aren't using the standard of BATch language.
Sometimes we see such structures on the board.
An example of such structure is

code:

dir 1>file1 2>file2


which is not an implementation for (all) official BATch versions.
Be aware of that.
Greetings.


Symbol on our homepage has been linked to related http://kixtart.org topic.

[ 17 October 2001: Message edited by: MCA ]

_________________________
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 1110 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.06 seconds in which 0.024 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