Jump to content
Sign in to follow this  
Lakai[NL]

password protection

Recommended Posts

Hello,

I have created a loader type of menu, with other things, but I want to password protect it. Pasword protect as in, having a little messagebox popup, saying please enter your password, and if it gets it right, it will load this menu, and if it gets wrong, it wont allow the menu to load. How would I do this? Here is the script:

#include <GUIConstants.au3>
#include <Process.au3>

HotKeySet("{INSERT}", "hideloadit")
HotKeySet("{DELETE}", "showloadit")

Opt("GUIOnEventMode", 1)
$mainwindow = GUICreate("LoadIt! verSion 1", 200, 500)
$solitarebutton = GUICtrlCreateButton("Load Solitare", 75, 65, 90)
GUICtrlSetOnEvent($solitarebutton, "loadsolitare")
$pinballbutton = GUICtrlCreateButton("Load Pinball", 75, 95, 90)
GUICtrlSetOnEvent($pinballbutton, "loadpinball")
$addictinggamesbutton = GUICtrlCreateButton("Addicting Games", 75, 185, 90)
GUICtrlSetOnEvent($addictinggamesbutton, "addictinggames")
$hideitbutton = GUICtrlCreateButton("Load HideIt!", 75, 215, 90) 
GUICtrlSetOnEvent($hideitbutton, "hideit")
$exitbutton = GUICtrlCreateButton("Exit", 75, 245, 90)
GUICtrlSetOnEvent($GUI_EVENT_CLOSE, "quite")
$miniclipbutton = GUICtrlCreateButton("Miniclip", 75, 125, 90)
GUICtrlSetOnEvent($miniclipbutton, "miniclip")
$mofunzonebutton = GUICtrlCreateButton("MoFunZone", 75, 155, 90)
GUICtrlSetOnEvent($mofunzonebutton, "mofunzone")
$filemenu = GUICtrlCreateMenu("File")
$fileclose = GUICtrlCreateMenuItem("Close", $filemenu)
GUISetOnEvent($fileclose, "quite")
$helpmenu = GUICtrlCreateMenu("Help")
$helpabout = GUICtrlCreateMenuItem("About", $helpmenu)
GUISetOnEvent($helpabout, "helpabout")
GUISetState(@SW_SHOW)

While 1
  Sleep(100)
WEnd

Func loadsolitare()
  If FileExists ("H:\sol.exe") Then
    Run("H:\sol.exe")
 Else
    MsgBox(4096,"LoadIt! v1", "Error: Unable to load Solitare!")
 EndIf
EndFunc

Func loadpinball()
  If FileExists ("H:\pinball.exe") Then
    Run("H:\pin.exe")
 Else
    MsgBox(4096, "LoadIt! v1", "Error: Unable to load Pinball!")
 EndIf
EndFunc

Func miniclip()
  $rc = _RunDos("start http://www.miniclip.com")
EndFunc

Func mofunzone()
  $rc = _RunDos("start http://www.mofunzone.com")
EndFunc

Func addictinggames()
  $rc = _RunDos("start http://www.addictinggames.com")
EndFunc

Func hideit()
  If FileExists ("H:\HideIt! v2.exe") Then
    Run("H:\HideIt! v2.exe")
  Else
    MsgBox(4096, "LoadIt! v1", "Error: Unable to load HideIt!")
EndIf
EndFunc

Func hideloadit()
 GUISetState(@SW_HIDE)              
EndFunc

Func showloadit()
 GUISetState(@SW_SHOW)
EndFunc

Func helpabout()
    MsgBox(4096, "LoadIt! v1", "Error: Unable to load HideIt!")
EndFunc

Func quite()
  Exit
EndFunc
Edited by Lakai[NL]

Share this post


Link to post
Share on other sites

Any ideas?  I know its possible, but I don't know how to do it :lmao:

<{POST_SNAPBACK}>

Something like :

If NOT (InputBox('Security', 'Password:', '', '*', 250, 120) == "YourPassword") Then Exit

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

This should help get you started:

$PASSWORD = "secret"
$retryCount = 0
While $retryCount < 3
    $input = InputBox("Password dialog", "Enter the password to continue", "", "*")
    If @error Or $input <> $PASSWORD Then
        MsgBox(4096,"Error", "Incorrect password")
        $retryCount = $retryCount + 1
    Else
        MsgBox(4096,"Success", "Good password")
        Exit
    EndIf
Wend
MsgBox(4096,"Error","Retry count exceeded")

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

I'm kind of a noob at AutoIt, anwyas, I added that code into my code, and when i get the password right, it automatically exits out. If you could help me incorporate that code into my original one, so that when it gets it right, you can use it, and if u cant, it will exit.

Note: This will be very helpful in the future, for my programs, if i could learn this, but I am not very good with autoit yet, so if u could explain, that would b e great.

Thanks,

Lakai

Share this post


Link to post
Share on other sites

I'm kind of a noob at AutoIt, anwyas, I added that code into my code, and when i get the password right, it automatically exits out.  If you could help me incorporate that code into my original one, so that when it gets it right, you can use it, and if u cant, it will exit.

Note: This will  be very helpful in the future, for my programs, if i could learn this, but I am not very good with autoit yet, so if u could explain, that would b e great.

Thanks,

Lakai

<{POST_SNAPBACK}>

This modified version will continue when the password is valid and exit when the password was wrong 3 times....

$PASSWORD = "secret"
$retryCount = 0
While 1
    if $retryCount > 2 then Exit
    $input = InputBox("Password dialog", "Enter the password to continue", "", "*")
    If @error Or $input <> $PASSWORD Then
        MsgBox(4096,"Error", "Incorrect password")
        $retryCount = $retryCount + 1
    Else
        MsgBox(4096,"Success", "Good password")
        ExitLoop
    EndIf
Wend

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Hrm, i have just tried that code, but when I run the file, the password prompt doesn't showup at all. Here is my code:

#include <GUIConstants.au3>
#include <Process.au3>

HotKeySet("{INSERT}", "hideloadit")
HotKeySet("{DELETE}", "showloadit")

Opt("GUIOnEventMode", 1)
$mainwindow = GUICreate("LoadIt! verSion 1", 200, 500)
$solitarebutton = GUICtrlCreateButton("Load Solitare", 75, 65, 90)
GUICtrlSetOnEvent($solitarebutton, "loadsolitare")
$pinballbutton = GUICtrlCreateButton("Load Pinball", 75, 95, 90)
GUICtrlSetOnEvent($pinballbutton, "loadpinball")
$addictinggamesbutton = GUICtrlCreateButton("Addicting Games", 75, 185, 90)
GUICtrlSetOnEvent($addictinggamesbutton, "addictinggames")
$hideitbutton = GUICtrlCreateButton("Load HideIt!", 75, 215, 90)
GUICtrlSetOnEvent($hideitbutton, "hideit")
$exitbutton = GUICtrlCreateButton("Exit", 75, 245, 90)
GUICtrlSetOnEvent($GUI_EVENT_CLOSE, "quite")
$miniclipbutton = GUICtrlCreateButton("Miniclip", 75, 125, 90)
GUICtrlSetOnEvent($miniclipbutton, "miniclip")
$mofunzonebutton = GUICtrlCreateButton("MoFunZone", 75, 155, 90)
GUICtrlSetOnEvent($mofunzonebutton, "mofunzone")
$filemenu = GUICtrlCreateMenu("File")
$fileclose = GUICtrlCreateMenuItem("Close", $filemenu)
GUISetOnEvent($fileclose, "quite")
$helpmenu = GUICtrlCreateMenu("Help")
$helpabout = GUICtrlCreateMenuItem("About", $helpmenu)
GUISetOnEvent($helpabout, "helpabout")
GUISetState(@SW_SHOW)

While 1
  Sleep(100)
WEnd

$PASSWORD = "secret"
$retryCount = 0
While 1
    if $retryCount > 2 then Exit
    $input = InputBox("Password dialog", "Enter the password to continue", "", "*")
    If @error Or $input <> $PASSWORD Then
        MsgBox(4096,"Error", "Incorrect password")
        $retryCount = $retryCount + 1
    Else
        MsgBox(4096,"Success", "Good password")
        ExitLoop
    EndIf
Wend

Func loadsolitare()
  If FileExists ("H:\sol.exe") Then
    Run("H:\sol.exe")
Else
    MsgBox(4096,"LoadIt! v1", "Error: Unable to load Solitare!")
EndIf
EndFunc

Func loadpinball()
  If FileExists ("H:\pinball.exe") Then
    Run("H:\pin.exe")
Else
    MsgBox(4096, "LoadIt! v1", "Error: Unable to load Pinball!")
EndIf
EndFunc

Func miniclip()
  $rc = _RunDos("start http://www.miniclip.com")
EndFunc

Func mofunzone()
  $rc = _RunDos("start http://www.mofunzone.com")
EndFunc

Func addictinggames()
  $rc = _RunDos("start http://www.addictinggames.com")
EndFunc

Func hideit()
  If FileExists ("H:\HideIt! v2.exe") Then
    Run("H:\HideIt! v2.exe")
  Else
    MsgBox(4096, "LoadIt! v1", "Error: Unable to load HideIt!")
EndIf
EndFunc

Func hideloadit()
GUISetState(@SW_HIDE)               
EndFunc

Func showloadit()
GUISetState(@SW_SHOW)
EndFunc

Func helpabout()
    MsgBox(4096, "LoadIt! v1", "Error: Unable to load HideIt!")
EndFunc

Func quite()
  Exit
EndFunc

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>
; GUI
$passwd = InputBox("Security Check", "Enter your password.", "", "*")
if $passwd = "qwerty" Then 
    MsgBox (0,"","Greatings") 
Else 
    Exit
EndIf   

GuiCreate("Wireless Policy Deleter", 225, 50)
$Button_1 = GUICtrlCreateButton ("Delete the Wireless Policy", 0, 0, 225)

$password = "qwerty"

; MENU 
GuiCtrlCreateMenu("File")
GUISetState () 

Do
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button_1
RegDelete ("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Wireless"); Delte Reg
EndSelect

; GUI MESSAGE LOOP
GuiSetState()
Until GuiGetMsg() = $GUI_EVENT_CLOSE

found that code on the forum a while back and cant remmeber who made it :S sorry but if it is someones feel free to take the credit and the password is qwerty

cheers C.W


C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...