AutoHotkey Community

It is currently May 26th, 2012, 2:04 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Password on a script?
PostPosted: March 7th, 2005, 10:57 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 7th, 2005, 11:17 am 
Offline

Joined: February 11th, 2005, 3:17 pm
Posts: 2
Location: Duesseldorf, Germany
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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 7th, 2005, 11:42 am 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2005, 6:10 am 
Offline

Joined: July 22nd, 2004, 6:33 am
Posts: 193
Location: cedar city UT
very good topic i been wondering for sometime how to make a password script thanks for a good topic

_________________
^sleepy^


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2005, 11:03 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
You don't have to always use Gui's, InputBoxeswork 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

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2005, 5:19 pm 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
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? :lol:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2005, 8:28 pm 
Offline

Joined: May 4th, 2005, 7:07 pm
Posts: 16
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 June 9th, 2005, 8:45 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2005, 8:39 pm 
Offline

Joined: April 14th, 2005, 11:11 am
Posts: 186
Location: Wisconsin, USA
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

_________________
Image
"Make it idiot-proof, and someone will make a better idiot."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2005, 8:46 pm 
Offline

Joined: May 4th, 2005, 7:07 pm
Posts: 16
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. :roll:

example of rcon command :

Code:
$Numpad1::

  Send,\

      Sleep, 100

  Send, rcon password sv_players

return


Last edited by d3m0n1x on June 9th, 2005, 9:12 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2005, 9:02 pm 
Offline

Joined: May 4th, 2005, 7:07 pm
Posts: 16
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. :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2005, 10:38 pm 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2005, 11:05 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 10th, 2005, 5:17 am 
Offline

Joined: May 4th, 2005, 7:07 pm
Posts: 16
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. :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 10th, 2005, 7:04 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2542
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...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 11th, 2005, 5:51 am 
Offline

Joined: July 22nd, 2004, 6:33 am
Posts: 193
Location: cedar city UT
Titan wrote:
You don't have to always use Gui's, InputBoxeswork 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^


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Exabot [Bot], poserpro, Tilter_of_Windmills and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group