Jump to content

Password Protection


 Share

Recommended Posts

Hey i have got a user friendly password protection .exe but i can't find a way to attach it to a folder like my documents to give my documents the password protection it deserves can anyone find out how?

Here's what i've got so far

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$mainwindow = GUICreate("Password Please", 225, 150)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$okbutton_1 = GUICtrlCreateButton("CheckPassword", 25, 100, 100, 30)
GUICtrlSetOnEvent($okbutton_1, "Checkpassword")
$okbutton_2 = GUICtrlCreateButton("Change", 170, 100, 50, 30)
GUICtrlSetOnEvent($okbutton_2, "changepassword1")
$Input = GUICtrlCreateInput("", 25, 20, 150, 60,BitOR($ES_PASSWORD,$ES_CENTER))
GUISetState(@SW_SHOW)

$window_2 = GUICreate("Password Change 1", 200, 150)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$okbutton_3 = GUICtrlCreateButton("Check", 50, 100, 100, 30)
GUICtrlSetOnEvent($okbutton_3, "changepassword2")
$Input_2 = GUICtrlCreateInput("", 25, 20, 150, 60, BitOR($ES_PASSWORD,$ES_CENTER))
GUICtrlCreateLabel("enter current password", 50, 10)
GUISetState(@SW_HIDE)

$window_3 = GUICreate("Password Change 2", 150, 150)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$okbutton_4 = GUICtrlCreateButton("Ok", 50, 110, 50, 30)
GUICtrlSetOnEvent($okbutton_4, "changepassword3")
GUICtrlCreateLabel("Enter new password", 25, 10)
$Input_3 = GUICtrlCreateInput("", 25, 50, 100, 50,BitOR($ES_PASSWORD, $ES_CENTER))
GUISetState(@SW_HIDE)

While 1
    Sleep(2000)  ; Just idle around
WEnd



Func Checkpassword()
    $Password = IniRead("password.ini", "section_1", "key", "password")
    GUICtrlRead($Input)
    If GUICtrlRead($Input) = $Password Then;password is correct
    ;Note: at this point @GUI_CtrlId would equal $okbutton,
    ;And @GUI_WinHandle would equal $mainwindow
    ;Note: option to put other func here
        Exit
        
    Else;Pasword is incorrect
    ;Note: option to put other func here
            MsgBox(48,"Oops!", "Wrong Password! Try Again...", 2)
    EndIf
EndFunc

Func changepassword1()
    GUISetState(@SW_SHOW, $window_2)
EndFunc

Func changepassword2()
    $Password = IniRead("password.ini", "section_1", "key", "password")
    GUICtrlRead($Input_2)
    If GUICtrlRead($Input_2) = $Password Then;password is correct
    ;Note: at this point @GUI_CtrlId would equal $okbutton,
    ;And @GUI_WinHandle would equal $mainwindow
    ;Note: option to put other func here
        GUISetState(@SW_SHOW, $window_3)
        
    Else;Pasword is incorrect
    ;Note: option to put other func here
            MsgBox(48,"Oops!", "Wrong Password! Try Again...", 2)
    EndIf
EndFunc
    
Func changepassword3()
    IniWrite("Password.ini", "section_1", "key", GUICtrlRead($Input_3))
    GUISetState(@SW_HIDE, $window_3)
    GUISetState(@SW_HIDE, $window_2)
EndFunc

Func CLOSEClicked()
 ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, 
  MsgBox(0, "Credits", "Created by Teh Grasshoppa")
  Exit
EndFunc

Any help would be appreciated

Why is it that Poilitics is made up of the word poli meaning many and tics being blood sucking creatures?

Link to comment
Share on other sites

you mean this?

$passwd="test"
while 1
sleep(1);decrease cpu peformance
if WinExists("C:\Documents and Settings\All Users\Documenten")Then;the name of your folder
WinSetState("C:\Documents and Settings\All Users\Documenten","",@sw_hide);the name of your folder
ExitLoop
Else
EndIf
WEnd
$passwd = InputBox("Security Check", "Enter your password.", "", "*")
If @error Then
MsgBox(4096,"Error", "Division by Zero")
Else
WinSetState("C:\Documents and Settings\All Users\Documenten","",@SW_SHOW);the name of your folder
EndIf
Link to comment
Share on other sites

Something that can be done about this: create a new file type (extension) and associate it with your AutoIt password thingy.

Rename all your files in your folder (change the file extension) to the new one you just created.

When attempting to open the file, your app will pop asking for password - if a correct one is entered then your app must read the file header, find what type of file it is and ShellExecute it.

This is "kinda risky" - I mean to rename all your files - be sure you do this in a test folder so you can't mess your original files.

This is not a complete solution (password protection) because if some1 will try to open one of your renamed file with the correct application then the file WILL open.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Got it to play with my documents and hide it but now I need to find a way to have it open with my documents because at the moment you have to have the script running already and then open my documents. Is there anyway to have it open with my documents?

this is what I have so far

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$mainwindow = GUICreate("Password Please", 225, 150)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$okbutton_1 = GUICtrlCreateButton("CheckPassword", 25, 100, 100, 30)
GUICtrlSetOnEvent($okbutton_1, "Checkpassword")
$okbutton_2 = GUICtrlCreateButton("Change", 170, 100, 50, 30)
GUICtrlSetOnEvent($okbutton_2, "changepassword1")
$Input = GUICtrlCreateInput("", 25, 20, 150, 60,BitOR($ES_PASSWORD,$ES_CENTER))
GUISetState(@SW_HIDE)

$window_2 = GUICreate("Password Change 1", 200, 150)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$okbutton_3 = GUICtrlCreateButton("Check", 50, 100, 100, 30)
GUICtrlSetOnEvent($okbutton_3, "changepassword2")
$Input_2 = GUICtrlCreateInput("", 25, 30, 150, 50, BitOR($ES_PASSWORD,$ES_CENTER))
GUICtrlCreateLabel("enter current password", 50, 10)
GUISetState(@SW_HIDE)

$window_3 = GUICreate("Password Change 2", 150, 150)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$okbutton_4 = GUICtrlCreateButton("Ok", 50, 110, 50, 30)
GUICtrlSetOnEvent($okbutton_4, "changepassword3")
GUICtrlCreateLabel("Enter new password", 25, 10)
$Input_3 = GUICtrlCreateInput("", 25, 50, 100, 50,BitOR($ES_PASSWORD, $ES_CENTER))
GUISetState(@SW_HIDE)

While 1
    Sleep(2000)  ; Just idle around
    If WinExists("My Documents") Then
    WinSetState("My Documents", "", @SW_HIDE)
    GUISetState(@SW_SHOW, $mainwindow)
    Else
EndIf

WEnd


Func Checkpassword()
    $Password = IniRead("Password.ini", "Section1", "Password", "password")
    GUICtrlRead($Input)
    If GUICtrlRead($Input) = $Password Then;password is correct
    ;Note: at this point @GUI_CtrlId would equal $okbutton,
    ;And @GUI_WinHandle would equal $mainwindow
    ;Note: option to put other func here
        WinSetState("My Documents", "", @SW_SHOW)
        Exit
        
    Else;Pasword is incorrect
    ;Note: option to put other func here
            MsgBox(48,"Oops!", "Wrong Password! Try Again...", 2)
    EndIf
EndFunc

Func changepassword1()
    GUISetState(@SW_SHOW, $window_2)
EndFunc

Func changepassword2()
    $Password = IniRead("Password.ini", "Section1", "Password", "password")
    GUICtrlRead($Input_2)
    If GUICtrlRead($Input_2) = $Password Then;password is correct
    ;Note: at this point @GUI_CtrlId would equal $okbutton,
    ;And @GUI_WinHandle would equal $mainwindow
    ;Note: option to put other func here
        GUISetState(@SW_SHOW, $window_3)
        
    Else;Pasword is incorrect
    ;Note: option to put other func here
            MsgBox(48,"Oops!", "Wrong Password! Try Again...", 2)
    EndIf
EndFunc
    
Func changepassword3()
    IniWrite("Password.ini", "Section1", "Password", GUICtrlRead($Input_3))
    GUISetState(@SW_HIDE, $window_3)
    GUISetState(@SW_HIDE, $window_2)
EndFunc

Func CLOSEClicked()
 ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, 
  MsgBox(0, "Credits", "Created by Teh Grasshoppa")
  Exit
EndFunc

sorry if its a bit messy

Why is it that Poilitics is made up of the word poli meaning many and tics being blood sucking creatures?

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...