Jump to content

Locking/Unlocking the Screen with a hotkey? Security Measure I need. How can I do this? Thx


 Share

Recommended Posts

Hey, I have a question. I'm trying to add this feature to my current script, but no luck. I want to create 2 hotkeys

One hotkey freezes the screen and shows a spash saying "User is away", press Return(a button) to continue.

Another hotkey freezes the screen (maybe puts a big black image like a screensaver or game uses)/(or it could be just a splash, but with screen frozen), then to get back, I have to enter a password. If $input = (variable password already defined)

I've tried making these, but no luck. How can I go about doing this? Thx

btw: I can't use Lock Workstation b/c everyone knows the password to that here.

Link to comment
Share on other sites

<winkey>+L uses windows system lock.... Requires users name and password to unlock... You should give it a try ;)

<<Woops didn't see that last note there>>

Edited by SiC_Goat

I AM ORCA!! A VERY POWERFUL WHALE!!!

Link to comment
Share on other sites

For the first HotKeySet this code example may help you. I took the example out of autoit help files just modified a little...

HotKeySet("!c", "TogglePause") ;Alt-c
HotKeySet("{ESC}", "Terminate")

Global $Paused

;;;; Body of program would go here;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $title = ""
    $message = @CRLF & @CRLF & @CRLF & @CRLF & "User is away, press Alt-c to continue."
    $Paused = NOT $Paused
    
    If $Paused Then SplashTextOn($title, @CRLF & @CRLF & $message, -1, -1, -1, -1, 0, "", 20)
    While $Paused
        sleep(100)
       ;ToolTip('Script is "Paused"',0,0)
    WEnd
   ;ToolTip("")
    SplashOff()
EndFunc

Func Terminate()
    Exit 0
EndFunc

For the other Hotkey you can used this Visual Basic tool Secure Screen, is a password protection utility for your WinPE CD. The author of the script is Viceroy and his tool allow you to create multiplier users and password. The only problem is the tool was build for WinPe so if you running this tool on Windows 2000 or Windows Xp when pressing Ctrl+Alt+Del this will bring task manager and then you can kill the process.

If you know visual basic you can get the source code from Viceroy web page and modified to disable Ctrl+Alt+Del or find a way with AutoIt how to disable taskmanager....

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

thx for the replies, but I kind of meant like actually locking it. I've tried BlockInput, but then I can't unlock it, and I don't want them to use ctrl alt delete to get out of it.

Basically, I'm trying to get it so, you press a hotkey, set a password. Then a big splash image covers the entire screen. You can't press any keys except Alt-F5, which asks you for the password. Then if its right, it unlocks it. I want to protect my pc when I'm gone.

(Splash prevents anyone from clicking anything as it's above the other windows. Then maybe a mousetrap so no one can click the taskbar. Then some way to block the windows key, alt key, ctrl key, alttab, and ctrl alt delete)

Thx

Link to comment
Share on other sites

thx for the replies, but I kind of meant like actually locking it. I've tried BlockInput, but then I can't unlock it, and I don't want them to use ctrl alt delete to get out of it.

Basically, I'm trying to get it so, you press a hotkey, set a password. Then a big splash image covers the entire screen. You can't press any keys except Alt-F5, which asks you for the password. Then if its right, it unlocks it. I want to protect my pc when I'm gone.

(Splash prevents anyone from clicking anything as it's above the other windows. Then maybe a mousetrap so no one can click the taskbar. Then some way to block the windows key, alt key, ctrl key, alttab, and ctrl alt delete)

Thx

there was a post a while back to have script activated by a secret passcode to be entered without a prompt. i forget who the original poster was, but i know gary (Gafrost) posted a solution for them. you should be able to incorporate some of his code to allow for the unlocking. now for the locking; you could just make a splash screen (few ways to do that, just go to the index of your help file and type splash, you'll see text and image splashes wtih examples) with a loop that just checks if any other window is active, and reactivates the splash.... example: well crap i started to write up an example and ended up writing just about the whole thing.... here's the code, must be run with beta, pause button locks the screen, and then only the correct password (entered relatively quickly) will unlock. currently the password is set to "B" but you can change that to anything. Right now upon successful entering of the password the script exits, but you could change it a little to suit your needs.

#include <Misc.au3>
HotKeySet("{PAUSE}","UnLock")
While 1
    Sleep(1000)
WEnd

Func UnLock()
Dim $s_word = StringSplit("B","")
Dim $s_notword[112] = [111, _
"01","02","04","05","06","08","09","0C","0D","10", _
"11","12","13","14","1B","20","21","22","23","24", _
"25","26","27","28","29","2A","2B","2C","2D","2E", _
"30","31","32","33","34","35","36","37","38","39", _
"41","42","44","46","47","48","49","4A","4B","4C", _
"4D","4E","4F","50","51","55","56","57","58","59", _
"5A","5B","5C","60","61","62","63","64","65","66", _
"67","68","69","6A","6B","6C","6D","6E","6F","70", _
"71","72","73","74","75","76","77","78","79","7A", _
"7B","7C","7D","7E","7F","80H","81H","82H","83H","84H", _
"85H","86H","87H","90","91","A0","A1","A2","A3","A4","A5"]

For $x = 1 To $s_word[0]
    $s_word[$x] = String(Hex(Asc($s_word[$x]),2))
Next

$x = 1

$dll = DllOpen("user32.dll")
SplashTextOn("Locked",@UserName & " has locked this workstation.  Please type password.",@DesktopWidth,@DesktopHeight)
WinActivate("Locked",@UserName)
While 1
    Sleep ( 100 )
    if Not WinActive("Locked",@UserName) Then
        SplashTextOn("Locked",@UserName & " has locked this workstation.  Please type password.",@DesktopWidth,@DesktopHeight)
    EndIf
If (_IsPressed($s_word[$x], $dll) And $x = 1) Or (_IsPressed($s_word[$x], $dll) And $x = 2) Or _
         (_IsPressed($s_word[$x], $dll) And $x = 3) Or (_IsPressed($s_word[$x], $dll) And $x = 4) Or _
         (_IsPressed($s_word[$x], $dll) And $x = 5) Or (_IsPressed($s_word[$x], $dll) And $x = 6) Then 
         $x += 1
    Else
        For $y = 1 To $s_word[0]
            If _IsPressed($s_word[$y], $dll) Then 
                $x = 1
                ExitLoop
            EndIf
        Next
        For $y = 1 To $s_notword[0]
            If _IsPressed($s_notword[$y], $dll) Then 
                $x = 1
                ExitLoop
            EndIf
        Next
    EndIf
    If $x == 7 Then 
            EndIf
    ConsoleWrite("x = " & $x & @LF)
WEnd
DllClose($dll)
EndFunc
Link to comment
Share on other sites

Awesome, this will work great

But I have 2 questions:

The First:) When I entered b to test it, it exited, but it gave the error in the image attached

The Second:) It seems like it still does things in the background. Like when I press the start menu button, my screen keeps flashing, Is there any way to lock the keys?

Thx!

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