CyberFunk Productions Posted June 14, 2005 Share Posted June 14, 2005 I made this script a while ago in my spare time. What it does is it password protects folders on your computer. It asks for a user name and password. How it works is that if the name of the folder you want to protect is opened it hidesn it then asks for a user name and password. If either is rejects the window closes and you have to try again. I know what your thinking, just change the name of the file and you can easily get passed it. But thats not the case. i have windows xp pro and when you try to change the name of the file it will give an error saying that another program is using it or it will actually ask you for the user and pass and if you enter the wrong one it freezes that window(or the desktop depending on where the file is). The first version i made you had to hard code the user pass and name of folder. I also made a version where it reads the data from an ini file but that is less secure. If you put the file in the folder your protecting then theres no way anyone can delete it while its running either. The only way that i found you can get around it is if your know what the exe is called(i made it so you can call it whatever you want to trick people) and its stopped with ctr-alt-del.(shows up in processes tab). or if you delete the reg entry(i made it so its starts when your comp starts up) and then restart the computer. Just want to know what people think and if there are any ways of improving it. Its not perfect and never will be. Its just an easy way to protect documents on your computer from other family members and such. Anyway enjoy! this is the hard code version expandcollapse popup#Shift-Alt-q HotKeySet("+!q", "Close") #call startup Start() Func Start() Opt("TrayIconHide",1) $regVal = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName) if $regVal = 1 OR -1 OR -2 Then RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", @ScriptDir) EndIf Loop() EndFunc Func Loop() Do $x = WinExists ( "Ryan" ) Until $x = 1 WinSetState ( "Ryan", "", @SW_HIDE) Password() EndFunc Func Password() $user = InputBox ( "User", "Please enter user name","", "*" ) If $user = "user" Then $pass = InputBox( "Password", "Please enter password", "", "*") If $pass = "pass" Then MsgBox( 1, "Accepted", "Password and user name accepted!", 30) WinSetState ( "Ryan", "", @SW_SHOW) keepOpen() Else WinClose ( "Ryan" ) MsgBox( 1, "Rejected!", "Password rejected!", 5) keepOpen() EndIf Else WinClose ( "Ryan" ) MsgBox( 1, "Rejected!", "User name rejected!", 5) keepOpen() EndIf EndFunc Func keepOpen() Do $x = WinExists ( "Ryan" ) Until $x = 0 Loop() EndFunc Func Close() Exit 0 EndFunc this is the version with the ini expandcollapse popupGlobal $fileName #Shift-Alt-q HotKeySet("+!q", "Close") If FileExists("Data.ini") = 0 Then IniWrite("Data.ini", "Data", "UserName", "user") IniWrite("Data.ini", "Data", "PassWord", "pass") IniWrite("Data.ini", "Data", "FileName", "Ryan") Restart() Else $fileName = IniRead("Data.ini", "Data", "FileName", "not") Start() EndIf Func Start() Opt("TrayIconHide",1) $regVal = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName) if $regVal = 1 OR -1 OR -2 Then RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", @ScriptDir) EndIf Loop() EndFunc Func Loop() If $fileName = "not" Then MsgBox(1, "Error:1", "No file name in data.ini!! Shutting Down... ", 3) Else Do $x = WinExists ( $fileName ) Until $x = 1 WinSetState ( $fileName, "", @SW_HIDE) Password() EndIf EndFunc Func Password() $userIni = IniRead("Data.ini", "Data", "UserName", "not") $passIni = IniRead("Data.ini", "Data", "PassWord", "not") If $userIni = "" OR "not" Then WinClose($fileName) MsgBox(1, "Error:2", "No password to match in Data.ini! Shutting Down...", 3) Else If $passIni = "" OR "not" Then WinClose($fileName) MsgBox(1, "Error:3", "No password to match in Data.ini! Shutting Down...", 3) Else $user = InputBox ( "User", "Please enter user name","", "*" ) If $user = $userIni Then $pass = InputBox( "Password", "Please enter password", "", "*") If $pass = $passIni Then MsgBox( 1, "Accepted", "Password and user name accepted!", 30) WinSetState ( $fileName, "", @SW_SHOW) keepOpen() Else WinClose ( $fileName ) MsgBox( 1, "Rejected!", "Password rejected!", 5) keepOpen() EndIf Else WinClose ( $fileName ) MsgBox( 1, "Rejected!", "User name rejected!", 5) keepOpen() EndIf EndIf EndIf EndFunc Func keepOpen() Do $x = WinExists ( $fileName ) Until $x = 0 Loop() EndFunc Func Restart() MsgBox(1, "Restart", "Please restart the program after configuring settings.", 3) Exit 0 EndFunc Func Close() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
Moonchild Posted April 6, 2006 Share Posted April 6, 2006 The general idea of your program is better than the other similar ones out in the forum, but i have win XP Professional SP2, and the renaming trick works everytime. Also, the folder is still completely accessible via the DOS command prompt running within Windows (folder can be opened, thus leaving the contents easy to copy to another folder!). The program works great otherwise. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now