Jump to content

Drive Lock


erifash
 Share

Recommended Posts

Thanks for the positive reply! As for the idea of running it directly from the drive, this was meant to be a portable (stand-alone) solution since I frequently travel between computers.

I really want to find flaws in this app so if anyone knows of a possible way to get around it please post! :P

what would work is to have a scanner like my second script on all the computers you frequent. This would scan for a thumb drive, it would then cache the "key" that was made on the host computer. This key would not have any special software on it. What I mean about the timer file is to keep a file on the drive that has an encoded timestamp so that only that timestamp and that drive can unlock the computer.

But, if you want it to run fron the drive (as I do) then your software works great. for that. add this line too:

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", 0000001)

that disables taskmanager so that you can't kill the process.

Edited by orange
Link to comment
Share on other sites

  • Replies 117
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

what happens if i hit the power button, then re-boot?

as for this my next version has included in it a cache so that if the computer is rebooted while locked then it would lock on successful reboot.

The only thing that is tough to get around is the fact that there is always safemode. Damn. If we could lock out safemode, that would be ubersweet.

Link to comment
Share on other sites

Ummm, I still don't really get how exactly this works. Do I have to have some special USB device to store the "key"? Or do you like put this script on a CD or sumtin.... I'm confused please help.

the way that this EXCELLENT program works is that you compile the script for the "lock" then put this script on a removeable media (a CD might work, but this is designed for USB flash drives) and execute the program from the drive.

Then remove the drive and viola! the computer is locked.

Good point though, someone should try this on a CD

Link to comment
Share on other sites

I did it with a floppy drive, it worked but the floppy drive continued to make a noise every half a second, I think it was checking for the floppy to get back and it was quite annoying. I'm guessing a cd might work the same way

Link to comment
Share on other sites

OK here are the "finalized" scripts that I have running as my PC lock. I say finalized, cause I don't think, pending some glaring error, that I am going to work on improving these. I think that they work pretty well.

It will autolock when the computer is rebooted. (thats the big thing)

let me know what you think of the improvements.

Here is the "lock.exe" that includes both scripts. Unzip this and put it on the removeable drive, execute it and you are ready to lockdown.

edit: I just realized that I still have some superfluous code in there. Functions unused and such. Ignore please. :P

first file: "lock.au3"

#include<guiconstants.au3>
#include<file.au3>
#include<misc.au3>

filedelete("C:\locksearch.exe")

fileinstall("locksearch.exe","C:\locksearch.exe")

FileCreateShortcut("C:\locksearch.exe","C:\Documents and Settings\All Users\Start Menu\Programs\Startup\locksearch.ink")

if not ProcessExists("locksearch.exe") then run ("c:\locksearch.exe")
            
Opt("WinTitleMatchMode", 4)
Opt("OnExitFunc")
Opt("TrayAutoPause",0)

$hwnd = WinGetHandle("classname=Progman")
$user32 = DllOpen("user32.dll")
Global Const $lciWM_SYSCommand = 274
Global Const $lciSC_MonitorPower = 61808
Global Const $lciPower_Off = 2
Global Const $lciPower_On = -1
global  $scriptfullpath = @ScriptFullPath
global  $drive = StringLeft($scriptfullpath, 2) & "\"

if regread("HKEY_LOCAL_MACHINE\SOFTWARE\XLock","Status") = 1 then 
    $scriptfullpath = regread("HKEY_LOCAL_MACHINE\SOFTWARE\XLock","Path")
    global $code = regread("HKEY_LOCAL_MACHINE\SOFTWARE\XLock","Code")
    $drive = StringLeft($scriptfullpath, 2) & "\"
Else    
    global  $code = _DriveInfo($drive)
EndIf


Regwrite("HKEY_LOCAL_MACHINE\SOFTWARE\XLock","Code","REG_SZ",$code)

While 1
    $msg = guigetmsg()
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", 00000000) 
    Regwrite("HKEY_LOCAL_MACHINE\SOFTWARE\XLock","Status","REG_DWORD",0)    
    Regwrite("HKEY_LOCAL_MACHINE\SOFTWARE\XLock","Path","REG_SZ",$scriptfullpath)
    
    While FileExists($scriptfullpath) 
      Sleep(100)
  WEnd
  
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", 00000001)
    Regwrite("HKEY_LOCAL_MACHINE\SOFTWARE\XLock","Status","REG_DWORD",1)
    While not ( _DriveInfo($drive) = $code )
    
          While not FileExists($scriptfullpath)
            BlockInput(1)
            DllCall($user32, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_Off)
            Sleep(50)
            WEnd
        
      WEnd
      
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", 00000000) 
    Regwrite("HKEY_LOCAL_MACHINE\SOFTWARE\XLock","Status","REG_DWORD",0)
    DllCall($user32, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_On)
    BlockInput(0)
WEnd
Exit

; --------------------begin functions------------------

func lock()
       While not ( _DriveInfo($drive) = $code )
          RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", 00000001)
          Regwrite("HKEY_LOCAL_MACHINE\SOFTWARE\XLock","Status","REG_DWORD",1)
          
          While not FileExists($scriptfullpath)
            BlockInput(1)
            DllCall($user32, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_Off)
            Sleep(50)
          WEnd
      WEnd
      
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", 00000000) 
    Regwrite("HKEY_LOCAL_MACHINE\SOFTWARE\XLock","Status","REG_DWORD",0)
    DllCall($user32, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_On)
    BlockInput(0)
       
    Return
   EndFunc
   

Func _DriveInfo( $drv )
    $keycode = DriveGetFileSystem($drv)&DriveGetLabel($drv)&DriveGetSerial($drv)&DriveGetType($drv)&DriveSpaceTotal($drv)&DriveStatus($drv)
    Return $keycode
EndFunc

Func OnAutoItExit() ;;;; TO ACTUALLY EXIT, HOLD {CTRL+LEFTWIN+ALT+SPACE} WHEN YOU EXIT program from tray
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", 00000001)
    for $var = 1 to 3000
        if _ispressed(11) and _ispressed(12)and _ispressed("5B")and _ispressed(20) then exit            
        Next
    blockinput(1)
    guicreate("Invalid",@desktopwidth,@desktopheight,0,0,$WS_popup)
    GUISetBkColor(0x000000)
    guictrlcreatelabel("Invalid Exit Procedure." & @crlf & "Lock is Active.",40,40)
    GUICtrlSetColor(-1,0xffffff)
    winsettrans("Invalid","",255)
    GUISetState()
        
        sleep(2000)

    
    for $var = 255 to 0 step -15
        winsettrans("Invalid","",$var)
    Next
    guidelete()
    blockinput(0)
    run("lock.exe")   
EndFunc

And attached is the executable with both.

lock.zip

Edited by orange
Link to comment
Share on other sites

well, when you compile lock.au3 it includes locksearch.exe if it is comiled in the same directory.

So comile them both, and drag LOCK.exe to the removeable drive. From there it will install the files that it needs to.

HOWEVER, LET IT BE KNOWN THAT THIS DOES INSTALL INTO THE STARTUP DIRECTORY. COMMENT OUT THOSE LINES IF YOU DONT WANT THAT. I DID, SO THAT IS WHY I PUT IT IN.

Edited by orange
Link to comment
Share on other sites

well dont put it on a floppy. It has to ping every 100 ms to see if the drive is plugged in. In a floppy that would mean spinning it up.

USE FLASH!!! :P

Actually I put it on my ipod, I too at first thought i accidentially put it on a floppy... i'm to tired to see whats causing it right now so tommorow i'lll check it out

Link to comment
Share on other sites

I was just wondering... How much does one of these "flash" thingys cost? I wonder if maybe it's something worth investing in.

Edit: Would it work on one of those usb memory stick things? I needa get me one of those.

Edited by dandymcgee

- Dan [Website]

Link to comment
Share on other sites

I was just wondering... How much does one of these "flash" thingys cost? I wonder if maybe it's something worth investing in.

Edit: Would it work on one of those usb memory stick things? I needa get me one of those.

they are cheap these days if you dont need too much memory. most people that I know use harddrives or otherwise to transfer large files, so these are better used for documents and PC locking programs.

I am sure that if you are going to get this just for this program (or at least just to test it) then you can find one that has 16-256mb for less than $10 shipped. They are a dime a dozen.

However, if you are looking into getting this for general file transfer as well then I am sure that you would want one that is a bit larger. They are commercially available up to 4GB (and actually up to 8gb if you dig deep enough, but those are not common or easy to find) In increments usually of 1 gb. Those can go for $30 and up.

I think that they are worth the price and the time -- they have relatively fast read-write speed when compared to a floppy and a CD, and eject easier than both.

In my opinion , they are too damn convienent to ignore. Get one.

Link to comment
Share on other sites

I was just wondering... How much does one of these "flash" thingys cost? I wonder if maybe it's something worth investing in.

Edit: Would it work on one of those usb memory stick things? I needa get me one of those.

in peripheral verancular, "flash" memory and USB thumb drives are in the same family.

USB thumb drives are a form of flash memory.

Digital Camera Memory cards are a form of flash memory.

What I am using on this program is a USB Thumb Drive.

Link to comment
Share on other sites

@orange: Wouldn't 00000001 be the same as 1?

With yours when you press ctrl-alt-del when the computer is locked, you get a box that says this feature has been disabled or something. Only one instance of task manager can be open at a time so running it in the background will disable it. I don't even know what would happen if it was already open when the computer was locked.

Locking it on restart is a smart idea. I will try to add it to the script once I have time. :P

Link to comment
Share on other sites

@orange: Wouldn't 00000001 be the same as 1?

With yours when you press ctrl-alt-del when the computer is locked, you get a box that says this feature has been disabled or something. Only one instance of task manager can be open at a time so running it in the background will disable it. I don't even know what would happen if it was already open when the computer was locked.

Locking it on restart is a smart idea. I will try to add it to the script once I have time. :P

as for unlocking without the key, even with CTRL ALT DEL I can't unlock it. Can you unlock successfully with an open instance of task manager?

yes 1 = 000000001

I copied it from another script, and didn't care to make the change. That REG line does disable the taskmanager, but waht i didn't do is a winkill function, which I am going to do when I get home tonight. I didn't notice that until you pointed it out, so thanks.

As far as my version goes, I have successfully tested it to run on restart. I have it save they key, directory, and the lock status to the registry.

Does it work on your comp[tuer? works on mine.

Edited by orange
Link to comment
Share on other sites

OK here are the "finalized" scripts that I have running as my PC lock. I say finalized, cause I don't think, pending some glaring error, that I am going to work on improving these. I think that they work pretty well.

It will autolock when the computer is rebooted. (thats the big thing)

let me know what you think of the improvements.

Here is the "lock.exe" that includes both scripts. Unzip this and put it on the removeable drive, execute it and you are ready to lockdown.

edit: I just realized that I still have some superfluous code in there. Functions unused and such. Ignore please. :P

first file: "lock.au3"

{clip!}

And attached is the executable with both.

update the first post with those...

and, i cant test it, but it looks cool...i want a flash drive lol

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

heh, i tried buring it to a cd... NOT a good idea. Had to restart computer and delete it from startup folder before it loaded. CD's DO NOT work for this program, and it did the same thing as the floppy made wierd noises, except wasn't as loud with cd drive. Anyways, I'm seriously gonna look into one of those usb devices. My birthday is September 1st, so maybe I can get my completely computer illiterate grandmother to bring me to Circuit City and buy me one :P Well, anyways, nice program idea.

- Dan [Website]

Link to comment
Share on other sites

Can you unlock successfully with an open instance of task manager?

Yes. Even if task manager was already opened when it was locked.
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...