Jump to content

Password Mask


Recommended Posts

hi,

i have a script, that asks a user to enter a username and password, and then to make sure they got it right it throws up a message box saying

"you chose username xxxx

password xxxxx "

IS THIS CORRECT?

My boss just grilled me, he said its a security problem because someone else can see over the users shoulders as it throws up the password on the screen.

I thought seeing as I still need to verify its correct, maybe I could do something like this, say the password was elephant

"you chose username crystal

password e*e*h*n* "

The string will be random lengths depending on the password

Does anyone know how to do this to a string? And is this a good idea or does anyone have a better suggestion?

Cheers

C

Link to comment
Share on other sites

hi,

i have a script, that asks a user to enter a username and password, and then to make sure they got it right it throws up a message box saying

"you chose username xxxx

password xxxxx "

IS THIS CORRECT?

My boss just grilled me, he said its a security problem because someone else can see over the users shoulders as it throws up the password on the screen.

I thought seeing as I still need to verify its correct, maybe I could do something like this, say the password was elephant

"you chose username crystal

password e*e*h*n* "

The string will be random lengths depending on the password

Does anyone know how to do this to a string? And is this a good idea or does anyone have a better suggestion?

Cheers

C

it's a bad idea. if they're just setting up accounts, an e-mail confirmation should be enough. if they're logging in, no need to display the password.
Link to comment
Share on other sites

I'd do it like most password forms do: make the user verify the password in the input below the first (and don't allow copy/paste). If they don't match, clear them both and start over.

yeah good idea

how about this then when i verify them say its a 7 digit p/w

Your password is *******

and a 3 digit password

Your password is ***

Link to comment
Share on other sites

  • Moderators

I agree not to show the password at all, just for them to confirm... and GUICtrlRead() can read the $ES_PASSWORD anyway, and the confirmation is just a better idea IMHO... but to answer your question... this may work:

Local $Var = 'elephant1'
Local $NewVar = ''
For $i = 1 To StringLen($Var) Step 2
    $NewVar = $NewVar & StringMid($Var, $i, 1) & '*'
    If StringLen($NewVar) > StringLen($Var) Then $NewVar = StringTrimRight($NewVar, 1)
Next

MsgBox(0, StringLen($Var), $NewVar)

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I agree not to show the password at all, just for them to confirm... and GUICtrlRead() can read the $ES_PASSWORD anyway, and the confirmation is just a better idea IMHO... but to answer your question... this may work:

Local $Var = 'elephant1'
Local $NewVar = ''
For $i = 1 To StringLen($Var) Step 2
    $NewVar = $NewVar & StringMid($Var, $i, 1) & '*'
    If StringLen($NewVar) > StringLen($Var) Then $NewVar = StringTrimRight($NewVar, 1)
Next

MsgBox(0, StringLen($Var), $NewVar)
bugger!

InputBox ( "title", "Prompt" [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )

Im using input box but it doesnt have an on top function so it falls behind the "on top" gui :)

Link to comment
Share on other sites

  • Moderators

So make your own GUI Input box...

Edit:

For some reason, I thought you might be able to do this with one line with StringRegExpReplace(), but I can't figure it out :) ... This might make it easier for you in your coding:

Local $Var = 'elephant123titu'

MsgBox(0, 'Test', _MaskPassword($Var))

Func _MaskPassword($s_Var)
    Local $aArray = StringSplit($s_Var, ''), $aStore = ''
    For $i_Count = 1 To UBound($aArray) - 1 Step 2
        $aStore = $aStore & $aArray[$i_Count] & Chr(149)
    Next
    If StringLen($aStore) > StringLen($s_Var) Then $aStore = StringTrimRight($aStore, 1)
    Return $aStore
EndFunc
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

So make your own GUI Input box...

Edit:

For some reason, I thought you might be able to do this with one line with StringRegExpReplace(), but I can't figure it out :) ... This might make it easier for you in your coding:

Local $Var = 'elephant123titu'

MsgBox(0, 'Test', _MaskPassword($Var))

Func _MaskPassword($s_Var)
    Local $aArray = StringSplit($s_Var, ''), $aStore = ''
    For $i_Count = 1 To UBound($aArray) - 1 Step 2
        $aStore = $aStore & $aArray[$i_Count] & Chr(149)
    Next
    If StringLen($aStore) > StringLen($s_Var) Then $aStore = StringTrimRight($aStore, 1)
    Return $aStore
EndFunc
bugger it!!

no no no

i cant make another gui

there must be a way of either

- setting the existing gui to not on top before the input box

- forcing the input box on top?

Link to comment
Share on other sites

  • Moderators

bugger it!!

no no no

i cant make another gui

there must be a way of either

- setting the existing gui to not on top before the input box

- forcing the input box on top?

That makes NO sense... why can't you make another GUI?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

That makes NO sense... why can't you make another GUI?

because then i have 3 guis and when i delete the input box gui i lose the variables its created and it fuks up the other guis left behind

autoit isnt that hot at deleting 1 of 3 guis properly

my code

call inputbox func

rest of my code

func ...

$3rd=guicreate

my input box code

guidelete ($3rd)

return

endfunc

Link to comment
Share on other sites

I don't see what's wrong with that. Just return the value of the input box....

Or.. make the var global.

trust me its a pain in the arse, when the 3rd gui closes non of the button on the second work, it fucks the whole thing up

all for the sake of one @ONTOP command for the damn inputbox

Link to comment
Share on other sites

Post your code, I bet I can figure out what's going on.

i cant im not allowed to

all i want is an inputbox on top

but i have gui1

gui2

and then gui3 is the input box

when the inputbox closes at the return statement it leaves gui2 on the screen where witht he inputbox statement gui2 dissapears but now it just stays and none of the controls work

Edited by Larry
Link to comment
Share on other sites

i cant im not allowed to

fucking autoshite T

all i want is an inputbox on top

but i have gui1

gui2

and then gui3 is the input box

when the inputbox closes at the return statement it leaves gui2 on the screen where witht he inputbox statement gui2 dissapears but now it just stays and none of the controls work

fuck it

You don't mind being an insulting little git while asking for help, do you? :mellow:

You have had good answers based on best practices from people who have done this before. I've done the same password function myself (with friendly and patient help of people on this forum). Multiple GUIs is very doable also., and works fine with a properly coded script. So if yours are blowing up, post some sample code of your problem and I'll bet it's fixed in short order.

Till then, I hope that stress-induced ulcer is working out for you... :)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Moderators

Wow, I feel like a stupid ass, I started making an inputbox for him that had the window set on top... So since he's signed off, I'll post it for 10 or 20 mintues so others can see it ... and see if it's beneficial to them... then I'll edit it out!

Edit:

If anyone wants this... (other than the rude original poster) feel free to PM me for it... it's a custom InputBox that you can set on top, and set password chars etc... just like a normal one, but ontop option that doesn't affect the rest of your script at all.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Gah, get rid of it! Too much effort where it doesn't belong! People need to do some shit themselves. Seriously....

8 mins left :)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...