1984
(Starting to like KiXtart)
2004-02-07 04:04 PM
How to password protect a script?

Hi,

Wonder how to force user to validate and enter a password using kixforms GUI before execute a kix script.

Any good tips?

/Cy



Sealeopard
(KiX Master)
2004-02-07 04:07 PM
Re: How to password protect a script?

Create a KiXforms form with two text input objects, one of them in password mode. Upon valid data entry launch the separate KiXtart script.

1984
(Starting to like KiXtart)
2004-02-07 04:15 PM
Re: How to password protect a script?

what do u meen with "password mode"? is it a buildin mode state? if so, how do i call it then?

Once the user enter his/her password it sould be "*******" in the passwd textbox. How do i make it hide the input passwd?




Sealeopard
(KiX Master)
2004-02-07 04:52 PM
Re: How to password protect a script?

See the KiXforms Manual under the TextBox object and the PasswordChar property.

1984
(Starting to like KiXtart)
2004-02-08 12:39 AM
Re: How to password protect a script?

It works fine. thnx a lot \C

1984
(Starting to like KiXtart)
2004-03-18 05:51 PM
Re: How to password protect a script?

I want the authentication script to be in the same script, insted of call and launching the secound script if authentication is OK. I try using goto and gosub to make it run the rest of script if passwd is ok. But its not working.
.
.
$PSWB.OnClick = "PasswdC()"

Function PasswdC()
.
.
Endfuction

:Start (run the script if passwd ok)
.
.


Sealeopard
(KiX Master)
2004-03-18 05:55 PM
Re: How to password protect a script?

You don't show any code. Never use GOTOs!

1984
(Starting to like KiXtart)
2004-03-18 06:39 PM
Re: How to password protect a script?

Sorry, Here is the code:

$=SetConsole("minimize")

Break On
;Dim $Form
$Form = CreateObject("Kixtart.FORM")
$Form.CAPTION = "Authentication for @FULLNAME"
$Form.SCALEWIDTH = 300
$Form.SCALEHEIGHT = 60
$Form.FONTSIZE = 8
$Form.FONTNAME = "Verdana"
$Form.PrintXY(15,6,"Enter authenticity Key and press Button")
$Form.CENTER

$txtpassword = $form.textbox("",15,30,100,20)
$txtpassword.passwordchar = "*"
$txtpassword.text = ""
$PSWB = $form.Button("Validate",125,30,100,20)
$PSWB.OnClick = "PasswdC()"

$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents())
;Loop
Exit 1

Function PasswdC()

If $txtpassword.text = 'validate'
Dim $Form
$Form = CreateObject("Kixtart.FORM")
$Form.CAPTION = "Done!"
$Form.SCALEWIDTH = 325
$Form.SCALEHEIGHT = 30
$Form.FONTSIZE = 10
$Form.FONTNAME = "Verdana"
$Form.PrintXY(10,6,"Passwd OK")
$Form.CENTER
$Form.Show
Sleep 3
; (Somewhere here i want to jump to start of secound script)
Else Dim $Form1
$Form1 = CreateObject("Kixtart.FORM")
$Form1.CAPTION = "Faild"
$Form1.SCALEWIDTH = 325
$Form1.SCALEHEIGHT = 30
$Form1.FONTSIZE = 10
$Form1.FONTNAME = "Verdana"
$Form1.PrintXY(10,6,"Wrong code")
$Form1.CENTER
$Form1.Show
Sleep 3
EndIf
Exit
;(Here i will to give the user one more chance or make it exit the script)
EndFunction

; (Here will the secound script begins, if Authentication is OK )
Break On

$Form = CreateObject('Kixtart.Form')
$Form.BackColor = 212,208,200
$Form.ControlBox = "True"
$Form.DrawGrid = "True"
$Form.FontBold = "False"
$Form.FontItalic = "False"
$Form.FontName = "Tahoma"
$Form.FontSize = 8
$Form.FontUnderline = "False"
$Form.ForeColor = 0,0,0
$Form.FormBorderStyle = 3
$Form.Height = 580
$Form.Left = 11
$Form.MaximizeBox = "False"
$Form.MinimizeBox = "True"
$Form.SizeGripStyle = 2
$Form.StartPosition = 4
$Form.Tag = ""
$Form.Text = "My Script"
$Form.Top = 3
$Form.ToolTipText = ""
$Form.TopMost = "False"
$Form.Width = 800
$Form.WindowState = 0
.
.
.



1984
(Starting to like KiXtart)
2004-03-19 11:30 AM
Re: How to password protect a script?

Jens, need your help on this one too.
Could u please check the code and see what Im doing wrong or how should i do?

Thanx
/C


Sealeopard
(KiX Master)
2004-03-19 03:53 PM
Re: How to password protect a script?

I'd completely rewrite the whole thing along these liens:
Code:

$=SetConsole("minimize")

Break On
;Dim $Form
$Form = CreateObject("Kixtart.FORM")
$Form.CAPTION = "Authentication for @FULLNAME"
$Form.SCALEWIDTH = 300
$Form.SCALEHEIGHT = 60
$Form.FONTSIZE = 8
$Form.FONTNAME = "Verdana"
$Form.PrintXY(15,6,"Enter authenticity Key and press Button")
$Form.CENTER

$txtpassword = $form.textbox("",15,30,100,20)
$txtpassword.passwordchar = "*"
$txtpassword.text = ""
$PSWB = $form.Button("Validate",125,30,100,20)
$PSWB.OnClick = "PasswdC()"

$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
$Form=0
IF not $authenticated
exit 2
endif

; do the main form
; (Here will the secound script begins, if Authentication is OK )
Break On

$Form = CreateObject('Kixtart.Form')
$Form.BackColor = 212,208,200
$Form.ControlBox = "True"
$Form.DrawGrid = "True"
$Form.FontBold = "False"
$Form.FontItalic = "False"
$Form.FontName = "Tahoma"
$Form.FontSize = 8
$Form.FontUnderline = "False"
$Form.ForeColor = 0,0,0
$Form.FormBorderStyle = 3
$Form.Height = 580
$Form.Left = 11
$Form.MaximizeBox = "False"
$Form.MinimizeBox = "True"
$Form.SizeGripStyle = 2
$Form.StartPosition = 4
$Form.Tag = ""
$Form.Text = "My Script"
$Form.Top = 3
$Form.ToolTipText = ""
$Form.TopMost = "False"
$Form.Width = 800
$Form.WindowState = 0

sleep 10

Function PasswdC()

If $txtpassword.text = 'validate'
$Authenticated = 1
EndFunction




there are other ways to do thsi, e.g. initializing the KiXforms system first, then create the password prompt. If success create the main form else display a messagebox and exit.


Les
(KiX Master)
2004-03-19 04:06 PM
Re: How to password protect a script?

Maybe I'm missing something, but what is the point of password protecting a script if the user can edit the script and read or bypass the password? That, to me, is just security by ignorance.

I would opt for another approach. Setup a resource that the user needs to authenticate against and put the second script in that resource. If the user fails to authenticate, it is end of story. There is no way for the user to circumvent the security.


Sealeopard
(KiX Master)
2004-03-19 04:15 PM
Re: How to password protect a script?

I'm giving up on wondering why people want to do things in a certain (non-secure) way.

Les
(KiX Master)
2004-03-19 04:29 PM
Re: How to password protect a script?

Security has to be commensurate with what one is securing. You don't protect a $2,000 bike with a $10 lock.

I wonder though, what ppl are thinking when they protect (???) their head with a $10 crash helmet?


Sealeopard
(KiX Master)
2004-03-19 04:41 PM
Re: How to password protect a script?

Maybe the contents is only worth $10? How much does some hot air cost nowadays? ;-)

1984
(Starting to like KiXtart)
2004-03-19 04:58 PM
Re: How to password protect a script?

Dont get me wrong. I will compile the script to make a exe file of that. I suppose once its compiled user cannot read the code inside the script. Or mayby Im wrong.... Should I do it in otherway?

Thanx a lot Jens :-)



Les
(KiX Master)
2004-03-19 05:05 PM
Re: How to password protect a script?

Quote:

Or mayby Im wrong



There is no such thing as a KiX compiler (secure or other). All that exist are packagers and their security can easily be defeated.


1984
(Starting to like KiXtart)
2004-03-19 05:32 PM
Re: How to password protect a script?

Hummm, That was not good... so what are u then suggesting?
Mayby I could package it and then use Installshield.....

There is always a way :-)
(at least I hope it is)


Sealeopard
(KiX Master)
2004-03-19 05:34 PM
Re: How to password protect a script?

Since we have absolutely no clue at all what exactly you try to do, we won't be able to help you.

1984
(Starting to like KiXtart)
2004-11-17 09:14 PM
Re: How to password protect a script?

Have to admit, Les is right:

Security has to be commensurate with what one is securing. You don't protect a $2,000 bike with a $10 lock.
I wonder though, what ppl are thinking when they protect (???) their head with a $10 crash helmet?

:-)

This case is closed!


LonkeroAdministrator
(KiX Master Guru)
2004-11-17 09:41 PM
Re: How to password protect a script?

not really.
no real solutions here yet...


1984
(Starting to like KiXtart)
2004-11-18 02:32 AM
Re: How to password protect a script?

eyyy dont blame me :-)

I solve my issue, using
if @Userid not ingroup "balblabla" ...

dont realy need any password...

If u got better idea.... lets rock then :-)


Sealeopard
(KiX Master)
2004-11-18 02:51 AM
Re: How to password protect a script?

Code:

if @Userid not ingroup "balblabla"


is not KiXtart-compliant code and thus will not have solved your problem.


1984
(Starting to like KiXtart)
2004-11-18 06:01 PM
Re: How to password protect a script?

This will:

Break On
If NOT InGroup ("kixart")

$Form = CreateObject("Kixtart.FORM")
$Form.CAPTION = "Authentication for @FULLNAME"
$Form.SCALEWIDTH = 300
$Form.SCALEHEIGHT = 70
$Form.FONTSIZE = 8
$Form.forecolor = &000AAA
$Form.FONTbold = "true"
$Form.FONTNAME = "Verdana"
$Form.PrintXY(15,5," Authentication faild!")
$Form.PrintXY(15,20,"Please conntact your local helpdesk!")

$Form.CENTER


$Obtn = $form.Button("OK",100,40,100,20)
$Obtn.OnClick = "OKbtn()"

$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
$Form=0

Exit
EndIf

Function OKbtn()

Quit

EndFunction


NTDOCAdministrator
(KiX Master)
2004-11-18 07:25 PM
Re: How to password protect a script?

Two items I see.

If NOT InGroup ("kixart")
Would be faster and easier to find if you also specified the Domain
If NOT InGroup ("MyDomain\kixart")


When using the QUIT it might be a good idea to set some sort of error level as well.


1984
(Starting to like KiXtart)
2004-11-18 07:39 PM
Re: How to password protect a script?

Will do, thanx Doc :-)

What r u suggesting on the other thread Tracking/log system