AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Password on a script?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Devila
Guest





PostPosted: Mon Mar 07, 2005 9:57 am    Post subject: Password on a script? Reply with quote

Hiya

Can anyone help me with putting a password prompt at the start of a script
this is what i have so far
Code:
Gui, add, text,, Password:
Gui, add, edit,password vPW,
Gui, add, button,, OK
Gui, show,, Password
return
I'm not sure on how to do the whole password part, anyone help? i would appreciate it
Back to top
Loeppi



Joined: 11 Feb 2005
Posts: 2
Location: Duesseldorf, Germany

PostPosted: Mon Mar 07, 2005 10:17 am    Post subject: Reply with quote

It could look like this:
Code:
Gui,add,text,,User:
Gui,add,edit,vUser
Gui,add,text,,Passwort:
Gui,add,edit,vPw +Password

The Password will be shown with *'s

The result is:
variable User
variable Pw

Good Luck, hope it works!
Back to top
View user's profile Send private message AIM Address
Serenity



Joined: 07 Nov 2004
Posts: 1276

PostPosted: Mon Mar 07, 2005 10:42 am    Post subject: Reply with quote

Code:
; password: Secret!

Gui, add, text,, Password:
Gui, add, edit, password vpwd
Gui, add, button, gOK default, OK
Gui, show,, Password
return

OK:
GuiControlGet, input, , pwd
if input = Secret!
  msgbox, correct password
else
  msgbox, wrong password


GuiControlGet

The script above will keep the password window showing when the user clicks OK. To make brute-force attempts more difficult, hide when the user clicks OK with Gui, Submit like so:

Code:
; password: Secret!

Gui, add, text,, Password:
Gui, add, edit, password vpwd
Gui, add, button, gOK default, OK
Gui, show,, Password
return

OK:
Gui, Submit
if pwd = Secret!
  msgbox, correct password
else
  msgbox, wrong password

_________________
"Anything worth doing is worth doing slowly." - Mae West
Back to top
View user's profile Send private message Visit poster's website
sleepyy35



Joined: 22 Jul 2004
Posts: 194
Location: cedar city UT

PostPosted: Tue Mar 08, 2005 5:10 am    Post subject: Reply with quote

very good topic i been wondering for sometime how to make a password script thanks for a good topic
_________________
^sleepy^
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Titan



Joined: 11 Aug 2004
Posts: 5390
Location: /b/

PostPosted: Tue Mar 08, 2005 10:03 am    Post subject: Reply with quote

You don't have to always use Gui's, InputBoxes work equally as good:
Code:
Password = pass

InputBox, InputPass, User Authentication, Enter Password:, HIDE
If ErrorLevel = 1 ;Cancel Pressed
   {
   MsgBox, 48, Cancel, User cancelled`, script will terminate
   ExitApp
   }
else
   {
   If InputPass <> %Password%
   MsgBox, 16, Access Denied, Invalid Password.

   If InputPass = %Password%
   MsgBox, 64, Access Permitted, Welcome user
      Goto, Script_PostValidate
   }
Return

Script_PostValidate:
; ....:: Your Script ::... ;
Return

_________________

Back to top
View user's profile Send private message Visit poster's website
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Mar 08, 2005 4:19 pm    Post subject: Reply with quote

You could also use a msgbox in combination with Input and ControlSetText, but that isn't as easy to use and extensible, now is it? Laughing
Back to top
View user's profile Send private message
d3m0n1x



Joined: 04 May 2005
Posts: 16

PostPosted: Thu Jun 09, 2005 7:28 pm    Post subject: Reply with quote

Was wondering ... if some1 went 2 the "AutoHotKey" folder & opened the autohotkey.ini file wouldn't they b able 2 access the pass from the file & in that case wouldn't the script b useless? Might b better 2 make a script that encrypts the pass & saves it in a different file or something. It’s just a suggestion but then again i could b wrong.

Last edited by d3m0n1x on Thu Jun 09, 2005 7:45 pm; edited 2 times in total
Back to top
View user's profile Send private message
TeknoMusicMan



Joined: 14 Apr 2005
Posts: 188
Location: Wisconsin, USA

PostPosted: Thu Jun 09, 2005 7:39 pm    Post subject: Reply with quote

d3m0n1x:
you are right in a way. Most people don't create their scripts inside the AHK.ini they create individual .ahk files and run those. But they can be opened up and looked at as plain text just as the ini file can be.

I found this post about doing a RC4 encryption on a string, have a look-see.
http://www.autohotkey.com/forum/viewtopic.php?t=598
_________________

"Make it idiot-proof, and someone will make a better idiot."
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
d3m0n1x



Joined: 04 May 2005
Posts: 16

PostPosted: Thu Jun 09, 2005 7:46 pm    Post subject: Reply with quote

Well I was trying 2 do something sim. Busy working on a script that encrypts the pass & saves it in a different file & in the script I have some "RCON" commands that use a password so it would have 2 retrieve the pass & decrypt it aswell. Can u plz help me. Rolling Eyes

example of rcon command :

Code:

$Numpad1::

  Send,\

      Sleep, 100

  Send, rcon password sv_players

return


Last edited by d3m0n1x on Thu Jun 09, 2005 8:12 pm; edited 1 time in total
Back to top
View user's profile Send private message
d3m0n1x



Joined: 04 May 2005
Posts: 16

PostPosted: Thu Jun 09, 2005 8:02 pm    Post subject: Reply with quote

Yeah I have seen the post. Been searching 4 something that could help me put 2gether a script that would encrypt the pass & save it 2 a file & then decrypt it when I ran commands.

I came across this post as well & was wondering if any1 could help me create a script that u could edit the pass & then the script would encrypt & save it in 2 a different file then when u ran commands it would decrypt the pass & place it in command.

My Clan & I use "RCON" commands 2 run an online Game Server so we use AHK which makes things much easier when it comes 2 kicking/banning ppl or even during a KW. We sometimes change the pass so I figured this would also help if the Leader of the clan decided 2 change the pass, he could send the file 2 some1 instead of typing the pass over the net & they could then replace the older file with the new 1. Tx 4 the help & the quick response. Very Happy
Back to top
View user's profile Send private message
Serenity



Joined: 07 Nov 2004
Posts: 1276

PostPosted: Thu Jun 09, 2005 9:38 pm    Post subject: Reply with quote

You could simply compile the script instead, that way the password would be inside the exe, no need for more files/encryption. I doubt the variable name would be readable/searchable with a hex editor. Use a password when compiling too.
_________________
"Anything worth doing is worth doing slowly." - Mae West
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Thu Jun 09, 2005 10:05 pm    Post subject: Reply with quote

Serenity wrote:
I doubt the variable name would be readable/searchable with a hex editor [in a compiled script].
Yes, a compiled script is both compressed and encrypted, so there is no way to view the file with an editor and see any of the contents in plain text. But as Serenity said, be sure to specify a password when compiling so that no one else can decompile the script.
Back to top
View user's profile Send private message Send e-mail
d3m0n1x



Joined: 04 May 2005
Posts: 16

PostPosted: Fri Jun 10, 2005 4:17 am    Post subject: Reply with quote

I c ... but in my case it would still b better 2 save it 2 a different file coz like i said a few of my clan members & i use the same RCON password & sometimes the password is changed. So thought it would b easier if it was saved & encrypted 2 a new file then decrypted when u ran commands. This way if the Clan Leader changed the password he could send encrypted file over net & we would just have 2 replace the old file.

I did the following as example so it's not yet complete + not sure if code is fully functional:

Code:


$NumPadSub::

NoRCONPassFound = RCON
EnterRCONPass = Please enter Password.

iniread, RemRCONPass, SETTINGS.INI,Remember,RCONPass,0
iniread, RCONPass, SETTINGS.INI, DATA, RCONPass, 00
iniread, RemRCONPassState, SETTINGS.INI, Remember, RCONPassState, 1
iniread, RCONPassState, SETTINGS.INI, DATA, RCONPassState, 1

ifnotexist SETTINGS.INI

ifequal, RCONPass, 00
   RCONPass =

start:

Gui, Add, Checkbox, x185 y82 w20 h20 vRCONPassState Checked%RCONPassState%
Gui, Add, Text, x45 y10 w145 h20, %EnterRCONPass%
ifequal, RCONPassState, 1
Gui, Add, Edit, x20 y35 w160 h20 vRCONPass Password, %RCONPass%
ifequal, RCONPassState, 0
Gui, Add, Edit, x20 y40 w160 h20 vRCONPass, %RCONPass%
Gui, Add, Button, x35 y70 w50 h20, OK
Gui, Add, Button, x120 y70 w50 h20, Cancel
ifequal, DialogCaption, 0
gui, -caption
Gui, Show, h100 w200, %NoRCONPassFound%
Return

GuiClose:
ButtonCancel:
gui, submit
gui, destroy
 
ButtonOK:
Gui, submit
gui, destroy
ifequal, RemRCONPass, 0
   iniwrite, %RCONPass%, SETTINGS.INI, DATA, RCONPass
ifequal, RemRCONPassState, 1
iniwrite, %RCONPassState%, SETTINGS.INI, DATA, RCONPassState
return

$Numpad1::
Send,\
Sleep, 100
Send, rcon %RCONPass% sv_players
return



It still needs the encryption/decryption part + the checkbox also doesn't work 100% coz if u click on it while the gui is open it doesnt change settings.Will only change after pressing "OK" then opening gui again. Sad
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2436

PostPosted: Fri Jun 10, 2005 6:04 am    Post subject: Reply with quote

d3m0n1x wrote:
I c ... but in my case it would still b better 2 save it 2 a different file coz like i said a few of my clan members & i use the same RCON password & sometimes the password is changed. So thought it would b easier if it was saved & encrypted 2 a new file then decrypted when u ran commands. This way if the Clan Leader changed the password he could send encrypted file over net & we would just have 2 replace the old file.
A script could be compiled with a new pass and sent...
Back to top
View user's profile Send private message Visit poster's website
sleepyy35



Joined: 22 Jul 2004
Posts: 194
Location: cedar city UT

PostPosted: Sat Jun 11, 2005 4:51 am    Post subject: Reply with quote

Titan wrote:
You don't have to always use Gui's, InputBoxes work equally as good:
Code:
Password = pass

InputBox, InputPass, User Authentication, Enter Password:, HIDE
If ErrorLevel = 1 ;Cancel Pressed
   {
   MsgBox, 48, Cancel, User cancelled`, script will terminate
   ExitApp
   }
else
   {
   If InputPass <> %Password%
   MsgBox, 16, Access Denied, Invalid Password.

   If InputPass = %Password%
   MsgBox, 64, Access Permitted, Welcome user
      Goto, Script_PostValidate
   }
Return

Script_PostValidate:
; ....:: Your Script ::... ;
Return



hi all i cant seem to fig out how to fix this password script of Titans works ok it's just when you enter the wrong password it will load the script
i try'd a few things like return ExitApp no luck
i'm thinking the problom is between access denied and access permitted
any ideas on this
thanks
michael

Code:
If InputPass <> %Password%
   MsgBox, 16, Access Denied, Invalid Password.

   If InputPass = %Password%
   MsgBox, 64, Access Permitted, Welcome user
      Goto, Script_PostValidate

_________________
^sleepy^
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group