Jump to content
Sign in to follow this  
Duffy

Adding password to my script

Recommended Posts

Duffy

how do i add a password to my program that nobody else can access it without the password can anyone give me an example in source code please

Edited by Duffy

Share this post


Link to post
Share on other sites
monoceres

Easy:

$test=InputBox("Password","Write correct password:","","'")
If $test<>"password" Then Exit

Remember this is only secure if the people trying to use does not have knowledge about software engineering, please see this thread for more info :)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
Duffy

thanks mate ill get back to you on this if i have any other problems

Share this post


Link to post
Share on other sites
Duffy

I found this code and it works better

#NoTrayIcon

_Login("My Password", "Please enter a password", "password")

Func _Login($Title, $Prompt, $Password, $MaxAttempts = 3)
    $Attempts = 0
    Do
        $InputBoxAnswer = InputBox($Title, $Prompt, "", "*M", "-1", "-1", "-1", "-1")
        Select
            Case @error = 0;OK - The string returned is valid
                If $InputBoxAnswer == $Password Then
                    MsgBox(1024, "Password was correct!", "You typed the correct Password. You may access this file!"); What to do if password was entered correctly!
                    Exit
                Else
                    If $Attempts < $MaxAttempts - 1 And $MaxAttempts <> 1 Then
                        MsgBox(1024, "Password was wrong!", "You typed the Wrong Password. You may try again " & ($MaxAttempts - 1) - $Attempts & " time(s)"); What to do if password was not entered correctly!
                    Else
                        MsgBox(1024, "Password was wrong!", "Sorry, You can not access this file!"); What to do if password was not entered correctly!
                    EndIf
                    $Attempts += 1
                  ;Exit
                EndIf
                
            Case @error = 1;The Cancel button was pushed
                Exit
        EndSelect
    Until $Attempts = $MaxAttempts Or $InputBoxAnswer == $Password

EndFunc ;==>Password

now i no how to add a password i just dont know how to run this script when i enter the correct one can anyone help please.

This is only and example script i just found

#include <GUIConstants.au3>
#include <IE.au3>


$oIE = _IECreateEmbedded ()
$Form1 = GUICreate("Are You a Human?", 500, 300)
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 500, 300)
GUISetState(@SW_SHOW)
_IENavigate ($oIE, "http://www.anythingweb.org/PHP/phpCaptcha/example1.php")

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
    Case $GUI_EVENT_CLOSE
        Exit
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
Muchuchu

A program will run the main loop in order of what is posted in your editor first.

#include <GUIConstants.au3>
#include <IE.au3>

$test=InputBox("Password","Write correct password:","","'")
If $test<>"password" Then Exit

$oIE = _IECreateEmbedded ()
$Form1 = GUICreate("Are You a Human?", 500, 300)

$oIE = _IECreateEmbedded ()
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 500, 300)
GUISetState(@SW_SHOW)
_IENavigate ($oIE, "http://www.anythingweb.org/PHP/phpCaptcha/example1.php")

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
    Case $GUI_EVENT_CLOSE
        Exit
    EndSwitch
WEnd

That will ask for a password then create the GUI.

Share this post


Link to post
Share on other sites
Duffy

thanks for you time mate works great :) thanks alot

Edited by Duffy

Share this post


Link to post
Share on other sites
Valuater

This one will allow the user to set their own password

; password encrypter
; Author Valuater
 
If Not FileExists(@SystemDir & "\License.dat") Then
    $password = InputBox("Password *Set-up*", "  Please *Set-up* Your Password:", "", "", 200, 120)
    If @error = 1 Or $password = "" Then Exit
    FileWrite(@SystemDir & "\License.dat", _StringEncrypt(1, $password, @ComputerName & "4"))
Else
    $password = _StringEncrypt(0, FileReadLine(@SystemDir & "\License.dat", 1), @ComputerName & "4")
    If InputBox("Password Protected", "  Please Type in Your Password:", "", "*", 200, 120) <> $password Then Exit
EndIf

.... its in Autoit Wrappers

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Duffy

This one will allow the user to set their own password

; password encrypter
; Author Valuater
 
If Not FileExists(@SystemDir & "\License.dat") Then
    $password = InputBox("Password *Set-up*", "  Please *Set-up* Your Password:", "", "", 200, 120)
    If @error = 1 Or $password = "" Then Exit
    FileWrite(@SystemDir & "\License.dat", _StringEncrypt(1, $password, @ComputerName & "4"))
Else
    $password = _StringEncrypt(0, FileReadLine(@SystemDir & "\License.dat", 1), @ComputerName & "4")
    If InputBox("Password Protected", "  Please Type in Your Password:", "", "*", 200, 120) <> $password Then Exit
EndIf

.... its in Autoit Wrappers

8)

how about if someone enters the rong password it will log them of on there computer?

and a message box popping up saying "you entered the wrong password bye bye :) just for the fun of it can it be done

Share this post


Link to post
Share on other sites
Paulie

how about if someone enters the rong password it will log them of on there computer?

and a message box popping up saying "you entered the wrong password bye bye :) just for the fun of it can it be done

MsgBox(0,"Failure", "You entered the wrong password. Bye Bye!")
Shutdown(0)

Share this post


Link to post
Share on other sites
Duffy

MsgBox(0,"Failure", "You entered the wrong password. Bye Bye!")
Shutdown(0)
could you add that to this
$test=InputBox("Password","Write correct password:","","'")
If $test<>"password" Then Exit
so if he they enter the wrong password then the computer will shutdown

Share this post


Link to post
Share on other sites
Valuater

Now you look like a prankster who cant even change 1 line

sad....

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Duffy

Valuater just tell me and stop being a wanker

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.