 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Muzzi
Joined: 15 Jun 2008 Posts: 111 Location: Sydney, Australia
|
Posted: Wed Sep 09, 2009 1:54 pm Post subject: PC Restraint ± Password Locked Kiosk Style Computer ©2oo9 ¿? |
|
|
PC Restraint - Password Locked Kiosk Style Computer
CURRENT UPDATE - 23 SEPT 2009
Features Include:
* Surf the net in full PC lock out mode.
* Now with INSTANT POPUP BLOCKER - Blocks download prompts and many various popups.
* Added with extra blocks on shortcut keys - ie/ very limited keyboard access.
* Create admin password when prompted on script start or use previous password when cancelled.
* Toggle forward and back through web pages with mouse on screen edges and then left clicking mouse. ie/ To go back a page just take the mouse to the left edge of the screen and then a single left click, and to go forward, right side of screen and left click.
* To terminate press and hold down the Escape key for 3 seconds and you will be prompted for your password to exit which you have 10 seconds to comply - if you fail then wait 5 minutes to retry - this was added to prevent possible hack attacks.
BTW... When the script is executed please be aware that a small password file is created in its working directory, so you may like to place the script in a remote folder on your hard drive and create a shortcut to it on the desktop.
If you forget your password you cannot recover it from this file either... so dont forget it!
UPDATES:
10/9/09
Alt & Tab now added - somehow I slipped on this one - thanks molinalr for picking up on this.
22/9/09
*Tidied up the startup interface.
*Fully disabled Task Manager Access.
*Beeping added to disabled keys to let you know they're disabled.
*Faster startup
23/9/09
*Now with added... popups blocker, downloads are blocked, any access to the PC's files is blocked, URL popups are blocked.
*Also added - 10 seconds comply to password on exit attempt and if password incorrect then wait 5 minutes to try again.
Credits fromaroundhere, MasterFocus, Shajul - thanks for your input... 8^)
Beta stage - Tested on Vista 32bit
If you fault anything please let me know.
**If anyone knows how to go back a page from an embedded internet explorer PDF viewer.. as the shortcut keys "Alt + Back Arrow" do not work for me.. could you kindly let me know. Muzzi
| Code: |
/* PC Restraint - Password Locked Kiosk Style Computer (Update Added 1:40 PM 24/09/2009)
This is in Beta stage - TESTED ON VISTA 32BIT
*Password lock your entire computers access and continue to google the internet.
*Create an Administrators password on start
*Locks out all keyboard keys accept alphanumerics, Enter, Backspace, Up/Down/Left/Right etc.. also right
and middle mouse button clicks are disabled.
>>> *Click on the GOOGLE LOGO to search the internet. <<<
*All usual escape attempts are locked out - Task Manager is disabled + more.
I'd be happy to know if you can find an alternative escape route to the desktop!
>>> *TO EXIT hold down the Escape key for 3 seconds and enter your password to exit. <<<
**IMPORTANT!** PLEASE REMEMBER YOUR PASSWORD as the only other way out (and not recommended) is the
power/reset button or pulling the power cord on your PC!
**NOTE: At the very end of the script I've placed an emergency escape for testing purposes. Simply by pressing the "Delete" key
exits the script and restores everything. This can be removed when its no longer needed.
*The password is stored in an unaccessible shortcut (lnk) file which is automatically placed in the
scripts working directory.
*Toggle forward and back through web pages with mouse on screen edges and then left clicking mouse.
ie/ To go back a page just take the mouse to the left edge of the screen and then a single
left click, and to go forward go to the right edge of screen and left click.
*Right Click = page refresh
*Now with Added... popups blocker, downloads are blocked, any access to the PC's files is blocked, URL popups are blocked,
Also added - 10 seconds comply to password on exit attempt and if password incorrect then wait 5 minutes to try again.
If you fault anything please let me know. ;)
By Muzz¡ - "©opyleft 2oo9 ± All Rights Reversed¿"
*/
#NoEnv
#MaxMem 2
#Persistent
#NoTrayIcon
#WinActivateForce
#SingleInstance force
SetBatchLines -1
Settitlematchmode 2
Settitlematchmode Fast
WinMinimizeAll
MxMod=-k http://www.google.com
WinHide ahk_class Shell_TrayWnd ;hide taskbar
WinHide Start ahk_class Button ;hide startbutton
UrlDownloadToFile, http://www.google.com/intl/en/images/logo.gif, %A_WorkingDir%\logo.gif
ClassList := "#32770|CabinetWClass|Internet Explorer_TridentDlgFrame|bosa_sdm_XL9|XLMAIN|MozillaUIWindowClass|Shell_TrayWnd|WMP Skin Host|WMPlayerApp|PrintUI_PrinterQueue|AcrobatSDIWindow|rctrl_renwnd32|Outlook Express Browser Class|OpusApp|" ;<< List of classes for blocking possible hacking attempts (Added 4:04 PM 23/09/2009)
ProcList := "procexp.exe|taskmgr.exe|sysconfig.exe|msconfig.exe" ; << Closes processes on any escape hack attempts (Added 3:58 PM 23/09/2009)
SetTimer, ProcessWatch, On
SetWidth:=(A_ScreenWidth/2)-138
SetHeight:=(A_ScreenHeight/2)-55
SetWidthB:=( A_ScreenWidth-55 )
SetHeightB:=( A_ScreenHeight-55 )
loading:=loading+ 1
nextpoint:
progress:= 0
Gui, Destroy
Gui Color, FFFFFF, 0
Gui -Caption +ToolWindow +E0x20
Gui Show, X0 Y0 W%A_ScreenWidth% H%A_ScreenHeight%, ScreenMask
Gui, Add, Progress, x0 y%SetHeightB% w%SetWidthB% h30 vprogress, 0
Loop, 100 ;loading progress bar
{
Progress+= (100 / 100)
GuiControl,, Progress, %Progress%
Sleep, 1
}
Gui, Destroy
Gui Color, FFFFFF, 0
Gui -Caption +ToolWindow +E0x20
Gui Show, X0 Y0 W%A_ScreenWidth% H%A_ScreenHeight%, ScreenMask
Gui -Caption +ToolWindow +E0x20
Gui Color, FFFFFF, 0
Gui Show, X0 Y0 W%A_ScreenWidth% H%A_ScreenHeight%, ScreenMask
Gui Add, Picture, x%SetWidth% y%SetHeight% gIE, logo.gif
Gui Font, S12 c12447F, Lucida Console
Gui Add, Text, x17 y75, REMEMBER, TO EXIT HOLD DOWN THE "ESC" KEY FOR 3 SECONDS AND ENTER PASSWORD
Gui Font, S56 c12447F, Lucida Console
Gui Add, Text, x10 y10, FOR SAFETYS SAKE!
InputBox, AssignPass, Administrator, Please enter a new password`nor cancel for no changes`n(you have 30 secs), hide, 300, 200,,,, 30 ; enter password here - you have 30 seconds to comply!
if errorlevel= 1 ;if cancel pressed or 30 seconds passed then use the same password as previous time.
{
Soundbeep, 330, 500 ; negative style beep confirms cancel was pressed or 30 sec timeout, therefore old password will be used.(Added 12:45 PM 24/09/2009)
Tooltip, please use your old password to exit........now click the Google logo to start
Sleep 5000
Tooltip
Return
}
Else
{
FileDelete, %A_WorkingDir%\±¡nterl¡nk.lnk.lnk ; destroys old password
Sleep 500
Soundbeep, 3300, 100 ; 2x positive beeps confirm your password is saved otherwise cancel was pressed (Added 12:46 PM 24/09/2009)
Sleep 20
Soundbeep, 3300, 100
FileAppend, %AssignPass%, %A_WorkingDir%\±¡nterl¡nk.lnk.lnk ; creates new password
Tooltip, your password is set........now click the Google logo to start
Sleep 5000
Tooltip
}
Return
IE:
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, DisableTaskMgr, 1 ; Disables all access to the task manager. !!tested on Vista only!!
Run iexplore.exe %MxMod% ;starts Google on your default web browser
WinWaitActive, ahk_class IEFrame
SetTimer, MouseWatch, 300
SetTimer, terminator, On
WinGet, KIDList, list, ahk_class IEFrame ;used in identifying and locking down the web browsers primary window and to prevent any future popups from ocurring.
Return
;KeysLocked - extra blocked keys added (12:53 PM 24/09/2009)
*F1::
*F2::
*F3::
*F4::
*F5::
*F6::
*F7::
*F8::
*F9::
*F10::
*F11::
*F12::
*F13::
*F14::
*F15::
*F16::
*F17::
*F18::
*F19::
*F20::
*F21::
*F22::
*F23::
*F24::
*AppsKey::
*LWin::
*RWin::
*LControl::
*RControl::
*LShift::
*RShift::
*LAlt::
*RAlt::
*PrintScreen::
*CtrlBreak::
*Pause::
*Break::
*Help::
*Sleep::
*Browser_Back::
*Browser_Forward::
*Browser_Refresh::
*Browser_Stop::
*Browser_Search::
*Browser_Favorites::
*Browser_Home::
*Volume_Mute::
*Media_Next::
*Media_Prev::
*Media_Stop::
*Media_Play_Pause::
*Launch_Mail::
*Launch_Media::
*Launch_App1::
*Launch_App2::
*Up::
*Down::
*Left::
*Right::
*Numpad0::
*NumpadIns::
*Numpad1::
*NumpadEnd::
*Numpad2::
*NumpadDown::
*Numpad3::
*NumpadPgDn::
*Numpad4::
*NumpadLeft::
*Numpad5::
*NumpadClear::
*Numpad6::
*NumpadRight::
*Numpad7::
*NumpadHome::
*Numpad8::
*NumpadUp:
*Numpad9::
*NumpadPgUp::
*NumpadDot::
*NumpadDel::
*NumpadDiv::
*NumpadMult::
*NumpadAdd::
*NumpadSub::
*NumpadEnter::
*Insert::
*Home::
*End::
*PgUp::
*PgDn::
*ScrollLock::
*NumLock::
*'::
*+::
*,::
*.::
*-::
*SC056::
*SC029::
Control & Escape::
Alt & Space::
Control & F4::
Control & L::
Control & O::
Control & AppsKey::
Shift & AppsKey::
LShift & LButton::
LShift & RButton::
LShift & MButton::
LShift & WheelDown::
LShift & WheelUp::
LShift & XButton1::
LShift & XButton2::
LShift & Tab::
LShift & Escape::
LShift & Backspace::
LShift & Delete::
LShift & Insert::
LShift & Home::
LShift & End::
LShift & PgUp::
LShift & PgDn::
LShift & ScrollLock::
LShift & CapsLock::
LShift & NumLock::
LShift & F1::
LShift & F2::
LShift & F3::
LShift & F4::
LShift & F5::
LShift & F6::
LShift & F7::
LShift & F8::
LShift & F9::
LShift & F10::
LShift & F11::
LShift & F12::
LShift & F13::
LShift & F14::
LShift & F15::
LShift & F16::
LShift & F17::
LShift & F18::
LShift & F19::
LShift & F20::
LShift & F21::
LShift & F22::
LShift & F23::
LShift & F24::
LShift & AppsKey::
LShift & LWin::
LShift & RWin::
LShift & PrintScreen::
LShift & CtrlBreak::
LShift & Pause::
LShift & Break::
LShift & Help::
LShift & Sleep::
LShift & Browser_Back::
LShift & Browser_Forward::
LShift & Browser_Refresh::
LShift & Browser_Stop::
LShift & Browser_Search::
LShift & Browser_Favorites::
LShift & Browser_Home::
LShift & Volume_Mute::
LShift & Volume_Down::
LShift & Volume_Up::
LShift & Media_Next::
LShift & Media_Prev::
LShift & Media_Stop::
LShift & Media_Play_Pause::
LShift & Launch_Mail::
LShift & Launch_Media::
LShift & Launch_App1::
LShift & Launch_App2::
LShift & Up::
LShift & Down::
LShift & Left::
LShift & Right::
LShift & Space::
LShift & Enter::
LShift & Numpad0::
LShift & NumpadIns::
LShift & Numpad1::
LShift & NumpadEnd::
LShift & Numpad2::
LShift & NumpadDown::
LShift & Numpad3::
LShift & NumpadPgDn::
LShift & Numpad4::
LShift & NumpadLeft::
LShift & Numpad5::
LShift & NumpadClear::
LShift & Numpad6::
LShift & NumpadRight::
LShift & Numpad7::
LShift & NumpadHome::
LShift & Numpad8::
LShift & NumpadUp::
LShift & Numpad9::
LShift & NumpadPgUp::
LShift & NumpadDot::
LShift & NumpadDel::
LShift & NumpadDiv::
LShift & NumpadMult::
LShift & NumpadAdd::
LShift & NumpadSub::
LShift & NumpadEnter::
LShift & a::
LShift & b::
LShift & c::
LShift & d::
LShift & e::
LShift & f::
LShift & g::
LShift & h::
LShift & i::
LShift & j::
LShift & k::
LShift & l::
LShift & m::
LShift & n::
LShift & o::
LShift & p::
LShift & q::
LShift & r::
LShift & s::
LShift & t::
LShift & u::
LShift & v::
LShift & w::
LShift & x::
LShift & y::
LShift & z::
LShift & 0::
LShift & 1::
LShift & 2::
LShift & 3::
LShift & 4::
LShift & 5::
LShift & 6::
LShift & 7::
LShift & 8::
LShift & 9::
LShift & '::
LShift & +::
LShift & ,::
LShift & .::
LShift & -::
LShift & SC056::
LShift & SC029::
Shift & F10::
Alt & F1::
Shift & F1::
Control & T::
Alt & F4::
Control & W::
Control & P::
Control & H::
Control & N::
Control & A::
Control & S::
Control & V::
Control & F::
Control & I::
Control & D::
Control & J::
Control & B::
LWin & E::
LWin & R::
LWin & U::
LWin & D::
LWin & F::
LWin & L::
LWin & B::
LWin & M::
RWin & E::
RWin & R::
RWin & U::
RWin & D::
RWin & F::
RWin & L::
RWin & B::
RWin & M::
*+J::
*+H::
*+I::
Alt & Home::
Alt & Tab::
*!Del::
*LButton::
*RButton::
*MButton::
*WheelDown::
*WheelUp::
*XButton1::
*XButton2::
Soundbeep, 100, 10
return
*a::a
*b::b
*c::c
*d::d
*e::e
*f::f
*g::g
*h::h
*i::i
*j::j
*k::k
*l::l
*m::m
*n::n
*o::o
*p::p
*q::q
*r::r
*s::s
*t::t
*u::u
*v::v
*w::w
*x::x
*y::y
*z::z
*0::0
*1::1
*2::2
*3::3
*4::4
*5::5
*6::6
*7::7
*8::8
*9::9
*Space::Space
*Enter::Enter
*CapsLock::CapsLock
*Escape::Escape
*Tab::Tab
*Backspace::Backspace
*Delete::Delete
LButton::Click ; limits mouse usage for simple weblink clicks (Added 3:58 PM 23/09/2009)
RButton::
Send, {F5} ; page refresh
Return
MouseWatch:
mouseGetPos, posX, posY
if (posX < 2) & (posY > 0)
{
Keywait, LButton, D, T0.3
If ErrorLevel
Return
Else
{
Send, !{Left}
sleep 300
Return
}
}
Else if (posX > (A_ScreenWidth - 2)) & (posY > 0)
{
Keywait, LButton, D, T0.3
If ErrorLevel
Return
Else
{
Send, !{Right}
sleep 300
Return
}
}
Return
;Popup window exterminator (Added 4:06 PM 23/09/2009)
terminator:
WinGet, PopUpID, list, ahk_class IEFrame
If (PopUpID > KIDList)
{
WinGet, Last, ID, ahk_class IEFrame
WinActivate, ahk_id %Last%
WinKill, ahk_id %Last%
}
Else
Loop, Parse, ClassList, | ;<< Kills most if not all popup windows (Added 4:06 PM 23/09/2009)
{
WinKill, ahk_class %A_LoopField%
}
Return
ProcessWatch:
Loop, Parse, ProcessList, | ;<< Closes processes on any escape hack attempts (Added 4:15 PM 23/09/2009)
{
Process, Close, %A_LoopField%
}
Return
; This is the only Way Out - Press ESC key for 3 seconds to get password access screen to exit program
Esc::
sleep 3000
Keywait, Esc, U, T0.1
If ErrorLevel
{
SetTimer, Terminator, Off
FileRead, validate, %A_WorkingDir%\±¡nterl¡nk.lnk.lnk ;confirms password
WinSet, AlwaysOnTop, On, Administrator
InputBox, Insertion, Administrator, Please Enter your Password`n(you have 10 seconds), hide, 300, 200,,,, 10 ; << 10 sec password comply time (Added 3:58 PM 23/09/2009)
WinSet, Style, -0xC00000, Administrator
If (validate = Insertion)
{
Gosub, Return2Windows
Return
}
Else
{
SetTimer, Terminator, On
Tooltip, Sorry`, access not granted. You must wait 5 minutes to try again.
Sleep 7000
Tooltip
;Sleep 293000 ;<< password retry delay (Added 3:58 PM 23/09/2009)
Soundbeep, 3300, 100 ; lets you know for password retry at end of 5 minutes with an audible beep (Added 12:20 PM 24/09/2009)
Sleep 20
Soundbeep, 3300, 100
Sleep 20
Soundbeep, 3300, 100
Sleep 20
Soundbeep, 3300, 100
Sleep 20
Soundbeep, 3300, 100
Return
}
}
Return
Return2Windows: ;this is where windows returns to normal
Process, Close, iexplore.exe
Gui, Destroy
;Revert Taskbar
WinShow ahk_class Shell_TrayWnd
WinShow Start ahk_class Button
WinExist("ahk_class Progman")
Control, Show,, SysListView321
;Revert Task Manager
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, DisableTaskMgr, 0
WinMinimizeAllUndo
ExitApp
Return
; REMOVE THESE FINAL LINES - For testing purposes - in emergency just press the "delete" key as it is not blocked
Delete::
Process, Close, iexplore.exe
Gui, Destroy
WinShow ahk_class Shell_TrayWnd
WinShow Start ahk_class Button
WinExist("ahk_class Progman")
Control, Show,, SysListView321
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, DisableTaskMgr, 0
WinMinimizeAllUndo
ExitApp
Return
|
Last edited by Muzzi on Thu Sep 24, 2009 4:45 am; edited 13 times in total |
|
| Back to top |
|
 |
molinalr
Joined: 21 Jul 2009 Posts: 1
|
Posted: Thu Sep 10, 2009 9:54 am Post subject: molinalr |
|
|
Its ok your code, very usefull, but the user still can use the ALT+TAB combination....
Best Regards, from Argentina. |
|
| Back to top |
|
 |
Muzzi
Joined: 15 Jun 2008 Posts: 111 Location: Sydney, Australia
|
Posted: Thu Sep 10, 2009 12:04 pm Post subject: |
|
|
| Thank you for picking up on this molinalr... not sure why or how I overlooked this. It's now added. |
|
| Back to top |
|
 |
Muzzi
Joined: 15 Jun 2008 Posts: 111 Location: Sydney, Australia
|
Posted: Tue Sep 22, 2009 6:40 am Post subject: |
|
|
| ^UPDATED^ |
|
| Back to top |
|
 |
fromaroundhere Guest
|
Posted: Tue Sep 22, 2009 10:26 am Post subject: Re: |
|
|
Hey mate!
Interesting idea!
I took your code for a test run, here's my experience (mainly concerning security):
- after doing a little stress test I was able to get the Win Key stuck on multiple occasions, so I could use Win+anything from then on (+r for Run for example)
- I'm pretty sure it can be done with any of the modifier keys
- ctrl+esc, and
- alt+space are working too.
in iexplorer:
- ctrl+enter/left click ctrl+shift+enter/left click to open links in new windows/tasb:
if you open a link in a new window, you get a window with all the menus, and url bar, and thus gain run/write access to all the files on the PC, and can easily kill the script or anything...
if you open a link in a new tab, you get access to various settings via the statusbar
- ctrl+l and ctrl+o to open files or new urls, full run/write access to the files on the PC
- ctrl+app key shift+f10 shift+app key to access context menu, and thus printing, saving files and pages to the PC etc.
-when download files, one gains access to virtually all the files on the PC via running the downloaded file or opening containing directory
- alt or shift + f1 opens help, and through help one gains access to the internet settings, via the local menu
- ctrl+F4 closes the iexplorer window
- and there's the possibility of gaining access to the PC through installed java or activex controls
I think I'd do a little more polishing on the GUI:D
I was testing it on Windows XP SP2 with Internet Explorer 6 on default settings.
Best regards and thanks for sharing:
fromaroundhere |
|
| Back to top |
|
 |
shajul
Joined: 15 Sep 2006 Posts: 564
|
Posted: Tue Sep 22, 2009 11:42 am Post subject: |
|
|
| dont ask me why or how, but for me the Ctrl+Alt+Del combo worked.. Also, i terminated the process and now i am left with no taskbar.. |
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 3035 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Tue Sep 22, 2009 2:37 pm Post subject: |
|
|
You should add a timer to really avoid Task Manager Access, like that code I adapted once. _________________ "Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried."
Antonio França
My stuff: Google Profile |
|
| Back to top |
|
 |
Muzzi
Joined: 15 Jun 2008 Posts: 111 Location: Sydney, Australia
|
Posted: Wed Sep 23, 2009 6:40 am Post subject: |
|
|
^UPDATED^
| Quote: |
dont ask me why or how, but for me the Ctrl+Alt+Del combo worked.. Also, i terminated the process and now i am left with no taskbar.. |
Hi Shajul, what operating system are you on as I forgot to mention that this was only tested on Vista 32bit.
It does not block the keys but it will disable the task manager access points as I've tested in Vista as working.
As far as the taskbar goes, it will reappear on normal program exit through correct password entry.
Otherwise if all else fails you can use this...
| Code: | F4:: ;press F4 key to toggle taskbar and escape key when you're done!
if toggle := !toggle
{
WinHide ahk_class Shell_TrayWnd
WinHide Start ahk_class Button
}
else
{
WinShow ahk_class Shell_TrayWnd
WinShow Start ahk_class Button
}
return
escape::exitapp |
Otherwise reboot the system and good luck! |
|
| Back to top |
|
 |
shajul
Joined: 15 Sep 2006 Posts: 564
|
Posted: Wed Sep 23, 2009 8:20 am Post subject: |
|
|
| Oh sorry, i am using win xp pro sp3 |
|
| Back to top |
|
 |
Muzzi
Joined: 15 Jun 2008 Posts: 111 Location: Sydney, Australia
|
Posted: Thu Sep 24, 2009 4:54 am Post subject: |
|
|
^UPDATED^
*Slight improvement on GUI aesthetics.
*Added emergency exit key whilst testing - just press the "Delete" key. (it can and should be removed when finished - it's located at the end of script)
*Beeps added on password input confirmation and at end of 5 min wait if the password is incorrect.
*Tooltip gestures added.
Further details and changes are outlined in original post update. |
|
| Back to top |
|
 |
maximo3491
Joined: 10 Feb 2007 Posts: 92
|
Posted: Fri Jan 29, 2010 9:20 pm Post subject: |
|
|
You should add a few variables that people can modify
For example:
enable or disable browser
time allowed to input password
etc.. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|