Sign in to follow this  
Followers 0
cppman

System Lockdown

3 posts in this topic

#1 ·  Posted (edited)

welll, here is another boring boring night...

I wrote a "System Lockdown" program. I know there are ways around it but... here..

woops, forgot to get rid of the HotKeySet("{ESC}") line(for debugging) :).. fixed now..

;System Lockdown
if (RegRead("HKEY_LOCAL_MACHINE\Software\SystemLockdown", "") == "") Then
    _CreatePassword()
Else
EndIf
;HotKeySet("{ESC}", "_Close")
#include <guiconstants.au3>
;#include <misc.au3>
$main = GUICreate("System Lockdown", @DesktopWidth, @DesktopHeight, 0, 0, BitOr($WS_POPUP, $WS_CLIPCHILDREN))
GUICtrlCreateLabel("System Lockdown", 350, 10, 500, 500)
GUICtrlSetFont(-1, 24, -1, -1, "Comic Sans MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetBkCOlor(0)
GUISetState()
           $hWnd = GUICreate("System Lockdown", 500, 170, 250, 150, BitOr($WS_POPUP, $WS_BORDER, $WS_THICKFRAME), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
GUISwitch($hWnd)
           $AdminPassword = GUICtrlCreateLabel("Admin Password: ", 5, 25)
           $AdminPasswordInput = GUICtrlCreateInput("", 125, 23, 200, -1, $ES_PASSWORD)
           $AdminLogin  = GUICtrlCreateButton("Login!", 400, 140, 90, 30, $BS_FLAT)
           $StatusLabel = GUICtrlCreateLabel("Please type in the Admin password to unlock the system.", 10, 150)
GUISetState()
While 1
    if (WinExists($hWnd)) Then WinSetOnTop($hWnd, "", 1)
    if (WinExists("Windows Task Manager")) Then WinSetState("Windows Task Manager", "", @SW_HIDE)
    if not (WinActive($hWnd)) Then WinActivate($main)
    $msg = GUIGetMsg()
    if ($msg == $AdminLogin) Then
        $Check = Decode(RegRead("HKEY_LOCAL_MACHINE\Software\SystemLockdown", ""))
        if ($Check == GUICtrlRead($AdminPasswordInput)) Then
            WinSetOnTop($hWnd, "", 0)
            GUIDelete($hWnd)
            ;Show User Options
            $hWnd = GUICreate("System Lockdown", 500, 170, 250, 150, BitOr($WS_POPUP, $WS_BORDER, $WS_THICKFRAME), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
            GUISwitch($hwnd)
            GUISetState()
            WinSetOnTop($hWnd, "", 1)
            GUICtrlCreateLabel("Welcome to your control panel! Hotkey: ESC to exit.", 150, 5)
            HotKeySet("{ESC}", "_Close")
            $UnlockSystemButton = GUICtrlCreateButton("Unlock System!", 75, 25, 100)
            $ChangePwdButton = GUICtrlCreateButton("Change Password!", 325, 25, 100)
            While 1
                $msg = GUIGetMsg()
                Select
                Case $msg = $UnlockSystemButton
                    Exit
                Case $msg = $ChangePwdButton
                    _CreatePassword()
                EndSelect
            WEnd
            
        Else
            _RecordAttempt()
            GUICtrlSetData($StatusLabel, "Invalid Password!")
            GUICtrlSetColor($StatusLabel, 0xFF0000)
        EndIf
    EndIf
    
WEnd

Func _Close()
    WinSetState("Windows Task Manager", "", @SW_SHOW)
    Exit
EndFunc

Func Decode($string)
    $str = StringSplit($string, "")
    Local $ret_str
    For $i = 1 to $str[0]
        $ret_str &= Chr(Asc($str[$i])-55) 
    Next
    Return $ret_str
EndFunc

Func Encode($string)
    $str = StringSplit($string, "")
    Local $ret_str
    For $i = 1 to $str[0]
        $ret_str &= Chr(Asc($str[$i])+55)
    Next
    Return $ret_str
EndFunc

Func _RecordAttempt($file = "log.txt", $hour = @Hour, $minute = @Min, $second = @SEC)
    $f = FileOpen($file, 1)
    FileWriteLine($f, "Login Attempt >> " & $hour & ":" & $minute & ":" & $second)
    FileCLose($f)
EndFunc

Func _CreatePassword()
    $NewPassword = InputBox("Welcome! First time user", "Please enter a password you would like to lock your computer with:", "", "*")
    RegWrite("HKEY_LOCAL_MACHINE\Software\SystemLockdown", "", "REG_SZ", Encode($NewPassword))
    MsgBox(0, "Thankyou!", "Thankyou, your password was set to: " & $NewPassword & @CRLF & ". Do not forget it!")
EndFunc
Edited by CHRIS95219

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Bugs.

if a user is not admin he cannot write to the setting HKEY_LOCAL_MACHINE, so the user is lock out for good.

that happened to me and i had to restart the computer.

so i suggest you use HKEY_Current_user for more user compatibulity. or you can add a check so when user admin it can write to HKEY_LOCAL_MACHINE and at other time to HKEY_Current_user.

Peace

Edited by Hello12345

Share this post


Link to post
Share on other sites

in addtion you can kill it, if you set the taskmanagets to be process explorer. Since process explorer says in focus.

peace

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  
Followers 0