AutoHotkey Community

It is currently May 27th, 2012, 12:07 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: February 23rd, 2011, 9:07 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
Have you ever seen a movie where a government guy unlocks his computer with a USB stick, then removes it and the computer goes blank? Loosely based on another forum script out there, this one does just that!

It checks a list of drives to find a file(see config section,) reads the file, and MD5 hashes the read variable. DriveGet caused my Cd drive to make annoying noises so I use this instead

*Note* this script reads from your USB key regularly, so be sure you're using "Safely remove hardware" to avoid filesystem errors.

Now. Let's see how many different ways we can crack it!
Assume Autoplay and Autorun.inf are disabled, and you do not have the computer's password (so no restarts or logoffs, etc.)
No throwing rocks. (Assume the computer is expensive or something) If you can crack it, you get a feeling of self satisfaction, and my script updated to get around your crack!

The code: (pay attention to the config section, and don't change the MD5 if you want to try cracking)
The weird config section is due to having edited this in Notepad using tabs

Code:
/*

---------------------------------------------------
   Drop it in your startup folder if you want
---------------------------------------------------

#######################################################
#######################################################
                  __  .   . ___ .   .   __
\        /  /\   /  \ |\  |  |  |\  |  /
 \  /\  /  /--\  |__/ | \ |  |  | \ |  |  _
  \/  \/  /    \ |  \ |  \| _|_ |  \|  \__/

   THIS SCRIPT DISABLES TASK MANAGER WHEN
   THE COMPUTER IS LOCKED.

   THE AUTHOR OF THIS SCRIPT DOES NOT CLAIM
   IT TO BE A SECURE METHOD OF BLOCKING ACCESS

   THAT SAID, IT IS EXTREMELY DIFFICULT TO REGAIN
   CONTROL OVER YOUR COMPUTER WITHOUT THE KEY IF
   YOU DO NOT WISH TO RESTART.

   HOLD SHIFT DURING BOOT TO DISABLE STARTUP ITEMS

#######################################################
#####################################################
*/
;=====================CONFIG========================
;                     =
MD5Hash = 533568CD7C7BEA9B2FFB18A31D57A6E9
; The MD5 hash of the passkey            =
;                     =
Drives = E
;                     =
KeyFileName = lock.txt
; The name of the file where the key is stored      =
;                     =
CheckWait = 5000
; How long (in ms) to wait between each lock check =
;                     =
Trans = 230
; A number from 0 (invisible) to 255 (opaque)      =
; Which is the transparency of the lock screen      =
;===================================================


#NoEnv
#SingleInstance Force
SetWorkingDir %A_ScriptDir%

SetTimer, CheckKey, %CheckWait%

;Create 26 alphabetical HotKeys:
Loop, 26{
   KeyName := Chr(A_Index+96)
   Hotkey, *%KeyName%, Tab, Off
}
GoSub unlock

return

CheckKey:
   Locked := true
   Loop, PARSE, drives
      IF FileExist(A_LoopField ":\" KeyFileName)
      {
            FileRead, key, %A_LoopField%:\%Keyfilename%
            If ( MD5(Key, StrLen(key)) = MD5Hash )
               Locked := False
      }
   If ( !Locked ) and ( LockState )
      GoSub Unlock
   Else If ( Locked ) and ( !LockState )
      GoSub Lock
return

Lock:
   SetTimer, CloseTaskMgr, On
   ; Hide taskBar:
   WinHide, ahk_class Shell_TrayWnd

   ;Blocks all hotkeys which could be used to unlock the screen
   Loop 26{
      KeyName := Chr(A_Index+96)
      HotKey, *%KeyName%, On
   }

    Hotkey, Left, On
    Hotkey, Right, On
    Hotkey, up, On
    Hotkey, down, On

    Hotkey, Tab, On
    Hotkey, !Tab, On
   Hotkey, !F4, On
   Hotkey, LWin, On
   Hotkey, RWin, On
   Hotkey, AppsKey, On
   HotKey, ^Escape, On

   Hotkey, NumpadUp, On
   Hotkey, NumpadDown, On
    Hotkey, NumpadLeft, On
   Hotkey, NumpadRight, On

   ;Cover screen:
   SplashTextOn, A_ScreenWidth+2, A_ScreenHeight+2, Lock SCREEN, `n`n LOCKDOWN.`n`nTask Manager disabled.`n`n Mouseclicks disabled.`n`nArrow keys disabled.
   WinSet, Transparent, %trans%, Lock SCREEN
   LockState := true
   BlockInput, On
return

Unlock:
   WinShow, ahk_class Shell_TrayWnd
   SetTimer, CloseTaskMgr, Off
   Splashtextoff
   ;Enables All Blocked Keys
   Loop 26{
      KeyName := Chr(A_Index+96)
      HotKey, *%KeyName%, Off
   }

   Hotkey, Left, Off
   Hotkey, Right, Off
   Hotkey, up, Off
   Hotkey, down, Off

   Hotkey, Tab, Off
   Hotkey, !Tab, Off
   Hotkey, !F4, Off
   Hotkey, LWin, Off
   Hotkey, RWin, Off
   Hotkey, AppsKey, Off
   Hotkey, ^Escape, Off

   Hotkey, NumpadUp, Off
   Hotkey, NumpadDown, Off
   Hotkey, NumpadLeft, Off
   Hotkey, NumpadRight, Off
   LockState := false
   BlockInput, Off
return

CloseTaskmgr:
   Process, Wait, taskmgr.exe, 4
   Process, Close, taskmgr.exe
return

Left::
right::
up::
down::

Tab::
!Tab::
!F4::
Appskey::
^Escape::

LWin::
RWin::

NumpadUp::
NumpadDown::
NumpadLeft::
NumpadRight::

Return

MD5( Byref V, L=0 )
{
   VarSetCapacity( MD5_CTX,104,0), DllCall ( "advapi32\MD5Init", Str, MD5_CTX )
   DllCall( "advapi32\MD5Update", Str, MD5_CTX, Str, V, UInt, L ? L : StrLen(L) )
   DllCall( "advapi32\MD5Final", Str, MD5_CTX )
   Loop % StrLen( Hex := "123456789ABCDEF0" )
      N := NumGet( MD5_CTX, 87+A_Index, "Char"), MD5 .= SubStr(Hex,N>>4,1) . SubStr(Hex,N&15,1)
   Return MD5
}

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Last edited by nimda on March 7th, 2011, 4:17 pm, edited 9 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: I got it
PostPosted: February 26th, 2011, 11:51 pm 
Throw rocks at it until it does what you say


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2011, 10:57 pm 
Offline
User avatar

Joined: August 23rd, 2010, 6:22 pm
Posts: 781
Location: Ontario, Canada
1) Win + R
2) taskkill /f /im AutoHotkey.exe
3) {Enter}
4) ???
5) Profit

Tested, works. Also, Win + D shows the desktop regardless of AlwaysOnTop or parented windows.

_________________
AutoHotkey.net | GitHub

My default license.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2011, 2:30 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
Uberi wrote:
1) Win + R
2) taskkill /f /im AutoHotkey.exe
3) {Enter}
4) ???
5) Profit

Tested, works. Also, Win + D shows the desktop regardless of AlwaysOnTop or parented windows.


Easiest 6-line fix ever. Tested.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2011, 2:38 am 
Offline
User avatar

Joined: August 23rd, 2010, 6:22 pm
Posts: 781
Location: Ontario, Canada
Don't forget Win + M (almost the same thing as Win + D),pressing the Alt key (pauses script long enough to open task manager), and some of these media keys that can bring up other apps. Oh, and I think many of us use keyword launchers (Launchy, personally), which can have arbitrary hotkeys and launch anything. Maybe you should just disable the entire keyboard :lol:.

_________________
AutoHotkey.net | GitHub

My default license.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2011, 2:42 am 
Offline
User avatar

Joined: September 5th, 2009, 2:06 pm
Posts: 1718
Location: Somewhere near you
What if you unlock the PC when the USB is still plugged in, and lock if it doesn't plugged in? :P
Code:
#Persistent
SetTimer, Check, 1000
return

Check:
IfExist, %USB_Drive%\Key.txt
BlockInput, Off
else
BlockInput, On

_________________
Image
The quick onyx goblin jumps over the lazy dwarf


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2011, 4:37 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
Too easy. Then someone could just create the text file. This way it needs to be the right text file. I'm thinking about making it just BlockInput On instead of all these damn hotkeys.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2011, 4:42 am 
BlockInput, I hear, doesn't work for many, myself included. Hotkeys are still better for this kind of thing.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2011, 6:31 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
Tomorrow (today!?) I will throw in a block input, a hotkey loop (a-z), and maybe a few OnMessages


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2011, 7:18 am 
Offline

Joined: January 31st, 2008, 8:47 pm
Posts: 88
Two things you could do to lock computer:

1. Dim control keys:
Code:
   Hotkey, LWin, KeyDim
   Hotkey, RWin, KeyDim
   Hotkey, LCtrl, KeyDim
   Hotkey, RCtrl, KeyDim
   Hotkey, LAlt, KeyDim
   Hotkey, RAlt, KeyDim


But this does not help alone!

Here is the trick:

2. Use a full screen GUI window (maybe transparent or semi-) to cover any other windows that might come up:
Code:
   WinSet,AlwaysOnTop,OFF,ahk_id %TT%
   WinSet,Bottom,,ahk_id %TT%
   WinHide, ahk_class Shell_TrayWnd
   Gui, Show, H%Hg% W%Wd% X%VX% Y%VY%, full_screen_gui

This will switch off AlwaysOnTop, send it to bottom and hide the taskbar, which hides Start menu as well behind the full screen dimmer-window.

The full screen gui is used in a constant loop - so any window that comes above the full screen dimmer-window will be covered again in a few millisecs. This way Alt-Cntrl-Del is of no use - because if you start taskmgr, it will be covered immediatelly so you can't reach it.

It works for me and was unhackable so far...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2011, 11:37 am 
Hi,

Great program, I was put on a spot when I forgot to put the the pass key into a USB and the computer wouldn't unlock. Various other work arounds that could happen.

1. Logging into Remote Desktop brings the locked computer back into the Welcome Screen. This would enable a soft restart by clicking the shutdown button or enable the user to log in as another user (so many people leave the Administer account passwords blank).
2. Other hotkeys which are useful to disable are: Win+U (Accessibility utilities) and Shift+F10 (Sends Right Mouse click). Currently beyond reading what's out on the screen I can't think of much use for this.
3. Using tools to remotely execute programs I was able to a bunch of things include running the taskkill.exe. I also was able to run cmd.exe to run task scheduler, taskkill, and copy taskmgr.exe to a different name and execute it.
4. Was able to hold Ctrl+Shift+Esc constantly which brings up the task manager. Although it closed quickly, the split second is enough if you try hard enough to click the Shutdown -> Logoff menu item.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2011, 11:43 am 
5. Using Remote Desktop and logging in as another user you can choose an option to run a program on start up.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2011, 5:09 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
@blaq Well it's easy enough to hold down the power button. Hence the "assume you do not have the computer's password, so no restarts"

@fures: my script covers the screen AND kills the task manager process on a loop. This is a scripts & functions topic, not an Ask For Help.

Updated! Now this script disables ALL alphabetical hotkeys.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 7th, 2011, 1:58 pm 
Could be in situations where the computer is physically locked away (in a cupboard), but clicking a power button the screen is alot different. Also, logging off is technically not shutting down, since logging off would kill any running programs. And many computer do have the Administrator account enabled and password blank.

Also recommend reducing the time interval between checking to kill taskmanager.exe.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 7th, 2011, 3:30 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
@blaq, I will change the wording on that. However, if you are locking the computer screen with an AutoHotkey script and have a blank Administrator password, I would call you just plain stupid. In any case, if you lock yourself out, cutting the power is a failsafe.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], notsoobvious and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group