AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Computer Lock

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
dicanus



Joined: 04 Sep 2007
Posts: 24

PostPosted: Sun Aug 09, 2009 1:36 pm    Post subject: Computer Lock Reply with quote

I wrote this within the past week. Its simple and probably could use some major improvements, but I wanted to see how it fared against someone trying to crack it. It is made to be set off by another program at a certain time, then turn off at a set time. The password is stored within the INI along with those times. The times and password can easily be hard-coded for a more secure aproach, but as for the person who I am attempting to block, I am not concerned with him finding the INI. Please criticize away!!

Code:

#NoTrayIcon
IniRead, Key#, %A_ScriptDir%\PASS.INI, Pressed, #
IniRead, PASS, %A_ScriptDir%\PASS.INI, PASS, PASS
PASS=qwerty
StringSplit, PASS, PASS
#=1

BlockInput, MouseMove
MouseMove, 5000, 0
SendMessage,0x112,0xF170,2,,Program Manager
WinMinimizeAll
Return
Loop,
{
   Sleep, 20000
   SendMessage,0x112,0xF170,2,,Program Manager
   If A_Hour > %OFF%
      Break
   If A_Hour < %ON%
      Break
}
IniWrite, %Key#%, %A_ScriptDir%\PASS.INI, Pressed, #

Run, %A_ScriptDir%\TimeCheck.ahk

ExitApp



;******************************************************************************************************************************************************************

*LButton::
Key=LButton
Goto, Key
*RButton::
Key=RButton
Goto, Key
*MButton::
Key=MButton
Goto, Key
*XButton1::
Key=XButton1
Goto, Key
*XButton2::
Key=XButton2
Goto, Key
*LWin::
Key=LWin
Goto, Key
*RWin::
Key=RWin
Goto, Key
*Tab::
Key=Tab
Goto, Key
*Enter::
Key=Enter
Goto, Key
*Escape::
Key=Escape
Goto, Key
*Backspace::
Key=Backspace
Goto, Key
*Delete::
Key=Delete
Goto, Key
*Insert::
Key=Insert
Goto, Key
*Home::
Key=Home
Goto, Key
*End::
Key=End
Goto, Key
*PgUp::
Key=PgUp
Goto, Key
*PgDn::
Key=PgDn
Goto, Key
*Up::
Key=Up
Goto, Key
*Down::
Key=Down
Goto, Key
*Left::
Key=Left
Goto, Key
*Right::
Key=Right
Goto, Key
*ScrollLock::
Key=ScrollLock
Goto, Key
*CapsLock::
Key=CapsLock
Goto, Key
*NumLock::
Key=NumLock
Goto, Key
*NumpadDiv::
Key=NumpadDiv
Goto, Key
*NumpadMult::
Key=NumpadMult
Goto, Key
*NumpadAdd::
Key=NumpadAdd
Goto, Key
*NumpadSub::
Key=NumpadSub
Goto, Key
*NumpadEnter::
Key=NumpadEnter
Goto, Key
*NumpadDel::
Key=NumpadDel
Goto, Key
*NumpadIns::
Key=NumpadIns
Goto, Key
*NumpadUp::
Key=NumpadUp
Goto, Key
*NumpadDown::
Key=NumpadDown
Goto, Key
*NumpadLeft::
Key=NumpadLeft
Goto, Key
*NumpadRight::
Key=NumpadRight
Goto, Key
*NumpadHome::
Key=NumpadHome
Goto, Key
*NumpadEnd::
Key=NumpadEnd
Goto, Key
*NumpadPgUp::
Key=NumpadPgUp
Goto, Key
*NumpadPgDn::
Key=NumpadPgDn
Goto, Key
*Numpad0::
Key=Numpad0
Goto, Key
*Numpad1::
Key=Numpad1
Goto, Key
*Numpad2::
Key=Numpad2
Goto, Key
*Numpad3::
Key=Numpad3
Goto, Key
*Numpad4::
Key=Numpad4
Goto, Key
*Numpad5::
Key=Numpad5
Goto, Key
*Numpad6::
Key=Numpad6
Goto, Key
*Numpad7::
Key=Numpad7
Goto, Key
*Numpad8::
Key=Numpad8
Goto, Key
*Numpad9::
Key=Numpad9
Goto, Key
*NumpadDot::
Key=NumpadDot
Goto, Key
*Browser_Back::
Key=Browser_Back
Goto, Key
*Browser_Forward::
Key=Browser_Forward
Goto, Key
*Browser_Refresh::
Key=Browser_Refresh
Goto, Key
*Browser_Stop::
Key=Browser_Stop
Goto, Key
*Browser_Search::
Key=Browser_Search
Goto, Key
*Browser_Favorites::
Key=Browser_Favorites
Goto, Key
*Browser_Home::
Key=Browser_Home
Goto, Key
*Volume_Mute::
Key=Volume_Mute
Goto, Key
*Volume_Down::
Key=Volume_Down
Goto, Key
*Volume_Up::
Key=Volume_Up
Goto, Key
*Media_Next::
Key=Media_Next
Goto, Key
*Media_Prev::
Key=Media_Prev
Goto, Key
*Media_Stop::
Key=Media_Stop
Goto, Key
*Media_Play_Pause::
Key=Media_Play_Pause
Goto, Key
*Launch_Mail::
Key=Launch_Mail
Goto, Key
*Launch_Media::
Key=Launch_Media
Goto, Key
*Launch_App1::
Key=Launch_App1
Goto, Key
*Launch_App2::
Key=Launch_App2
Goto, Key
*Space::
Key=Space
Goto, Key
*q::
Key=q
Goto, Key
*w::
Key=w
Goto, Key
*e::
Key=e
Goto, Key
*r::
Key=r
Goto, Key
*t::
Key=t
Goto, Key
*y::
Key=y
Goto, Key
*u::
Key=u
Goto, Key
*i::
Key=i
Goto, Key
*o::
Key=o
Goto, Key
*p::
Key=p
Goto, Key
*a::
Key=a
Goto, Key
*b::
Key=b
Goto, Key
*c::
Key=c
Goto, Key
*f::
Key=f
Goto, Key
*g::
Key=g
Goto, Key
*h::
Key=h
Goto, Key
*j::
Key=j
Goto, Key
*k::
Key=k
Goto, Key
*l::
Key=l
Goto, Key
*z::
Key=z
Goto, Key
*x::
Key=x
Goto, Key
*d::
Key=d
Goto, Key
*v::
Key=v
Goto, Key
*s::
Key=s
Goto, Key
*n::
Key=n
Goto, Key
*m::
Key=m
Goto, Key
*1::
Key=1
Goto, Key
*2::
Key=2
Goto, Key
*3::
Key=3
Goto, Key
*4::
Key=4
Goto, Key
*5::
Key=5
Goto, Key
*6::
Key=6
Goto, Key
*7::
Key=7
Goto, Key
*8::
Key=8
Goto, Key
*9::
Key=9
Goto, Key
*0::
Key=0
Goto, Key
*`::
Key=`
Goto, Key
*-::
Key=-
Goto, Key
*=::
Key==
Goto, Key
*[::
Key=[
Goto, Key
*]::
Key=]
Goto, Key
*\::
Key=\
Goto, Key
*`;::
Key=`;
Goto, Key
*'::
Key='
Goto, Key
*,::
Key=,
Goto, Key
*.::
Key=.
Goto, Key
*/::
Key=/
Goto, Key
;******************************************************************************************************************************************************************
^!DEL::
WinWait, Windows Task Manager
WinClose, Windows Task Manager
Return

Exit:
IniWrite, %Key#%, %A_ScriptDir%\PASS.INI, Pressed, #
Run, %A_ScriptDir%\PasswordHold.ahk
ExitApp


Return

Key:
Key#++
IniWrite, %Key%, %A_ScriptDir%\PASS.INI, Pressed, %Key#%
If PASS%#% <> %Key%
{
   #=1
   Return
}

#++

If # > %PASS0%
   Goto, Exit


As I said, the password and times are in an INI, so for the sake of testing I have disabled the time-check loop and set the password internally. To the users knowledge it appears as though no input is being taken, until the monitor turns on, or task manager is brought up, but I believe I have taken care of that. Is there a better way to keep the monitor off without a loop?
Back to top
View user's profile Send private message
dicanus



Joined: 04 Sep 2007
Posts: 24

PostPosted: Sun Aug 09, 2009 1:42 pm    Post subject: Reply with quote

Additionally, the script will save the keys pressed and successful unlocks to the INI, so they can be read later to ensure that the program is still keeping the computer locked.

I also just remembered that when the password is entered, another program is run, while closing the blocking program. The new program is simply a msgbox, which states that the lock is paused and when the user presses OK, the locking program will be run again. I assume that while testing, you will get an error when you enter the password. It will unlock, but will not be able to open the other program.
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Aug 09, 2009 10:41 pm    Post subject: Reply with quote

if i am that "person" and need to use the computer desperately
i would:
1. restart computer
2. safe mode with networking
i can stop here if i am just normal using a computer, but i can..
3. disable the startup program of this program
4. restart computer
5. back to normal system
Back to top
dicanus



Joined: 04 Sep 2007
Posts: 24

PostPosted: Mon Aug 10, 2009 12:11 am    Post subject: Reply with quote

This will be in the startup folder, and the person which this is made for does not know what safe-mode is.
Back to top
View user's profile Send private message
Guest






PostPosted: Mon Aug 10, 2009 12:56 am    Post subject: Reply with quote

ok fine
not sure what that "person" can do
but i assume most ppl should at least know how to do:
open taskmanger to kill process
or
startup folder > delete program > restart
or
(if the file is hidden or something)
msconfig > disable startup programs > restart
or
when the "person" can control computer, make a guest account > logout > login guest account
Back to top
Hezzu



Joined: 08 Aug 2008
Posts: 117
Location: Raahe, Finland

PostPosted: Mon Aug 10, 2009 1:12 am    Post subject: Reply with quote

or the person uses vista then the script is just finished!

otherwise pretty neat contraption quickly scrolled trough

I use my own version which I made back in college out of boredom Laughing
_________________
Hezzu - excuse the english!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
aaffe



Joined: 17 May 2007
Posts: 1002
Location: Germany - Deutschland

PostPosted: Mon Aug 10, 2009 9:58 am    Post subject: Reply with quote

If the Script is in the autostart-folder, you just can hold Shift pressed when starting windows, so the script doesnt run.
Back to top
View user's profile Send private message
dicanus



Joined: 04 Sep 2007
Posts: 24

PostPosted: Wed Aug 12, 2009 3:59 am    Post subject: Reply with quote

Quote:
If the Script is in the autostart-folder, you just can hold Shift pressed when starting windows, so the script doesnt run.

I had no idea of this... I will have to keep it in mind. Thanks!!
Back to top
View user's profile Send private message
dicanus



Joined: 04 Sep 2007
Posts: 24

PostPosted: Wed Aug 12, 2009 4:03 am    Post subject: Reply with quote

Quote:
I use my own version which I made back in college out of boredom


That's basically why I made this. I don't know if I will actually be using it, just screwing around.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group