Jump to content

Drive Lock


erifash
 Share

Recommended Posts

  • Replies 117
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

lol, damn you safe mode!!! aw well, i guess it's useful in some cases eh?

like, if you break or lose your key, yes it would be useful :nuke::P

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

@M4M: Thanks, I really appreciate the input. I will add lock on restart in the next update. Your idea is basically the same as mine though, except it writes to a file.

Link to comment
Share on other sites

@M4M: Thanks, I really appreciate the input. I will add lock on restart in the next update. Your idea is basically the same as mine though, except it writes to a file.

lol, it IS your idea. it came to me after testing your drive lock. those were just some ideas I had to improve apon it, if you chose to. the only thing that could cause problems is if you were in the middle of working on something (say writing a report), locked the PC, and someone came along and wanted to use the PC, it would appear that the PC is just locked up (the screen is blank and mouse/keyboard doesnt respond), they would just hit the reset button, thus loosing everything that you were working on. instaid of shutting down the monitor, have some indication on the screen that says the PC is locked.

anyway, your welcome to the input, keep up the good work!

Link to comment
Share on other sites

Thanks, I will look into that. Right now I am currently working on adding the lock on restart and I have a great idea that will require a total rewrite of the code. Don't worry, it will still use the same idea of portability and everything! :nuke: Hopefully I will have some free time to work this weekend, as I was sick up until a couple days ago. :P

Link to comment
Share on other sites

This code can potentially screw up your computer!

I am having trouble with this. For some reason it won't do the FileCopy to @SystemDir. If I manually copy the file and restart when it's locked, it displays the GUI but doesn't turn off the monitor and won't constantly activate the GUI. Here is the code I am testing:

CODE
Opt("WinTitleMatchMode", 4)

$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

$last = WinGetHandle("active")
Global Const $WS_POPUP = 0x80000000
Global Const $WS_EX_TOOLWINDOW = 0x00000080
$gui = GUICreate("", 1, 1, -2, -2, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUISetBkColor(0, $gui)
WinSetOnTop($gui, "", 1)
GUISetState()
WinActivate($last)

$drive = StringLeft(@ScriptFullPath, 2) & "\"
$code = _DriveInfo($drive)
$orig = @ScriptFullPath
$temp = @SystemDir & "\drivelock.exe"

If $CmdLine[0] = 1 and $CmdLine[1] = "lock" and @ScriptFullPath = $temp Then _Lock(1)

While 1
   While FileExists(@ScriptFullPath)
      Sleep(50)
   WEnd
   _Lock()
WEnd

Func _Lock( $reg = 0 )
   If $reg Then
      $drive = RegRead("HKLM\Software\DriveLock", "Drive")
      $code = RegRead("HKLM\Software\DriveLock", "Info")
      $orig = RegRead("HKLM\Software\DriveLock", "Orig")
   Else
      RegWrite("HKLM\Software\Microsoft\Windows\CurrentVersion\Run", "DriveLock", "REG_SZ", $temp & " lock")
      RegWrite("HKLM\Software\DriveLock", "Drive", "REG_SZ", $drive)
      RegWrite("HKLM\Software\DriveLock", "Info", "REG_SZ", $code)
      RegWrite("HKLM\Software\DriveLock", "Orig", "REG_SZ", $orig)
      FileCopy(@ScriptFullPath, $temp, 1)
   EndIf
   ProcessClose("taskmgr.exe")
   $pid = Run("taskmgr.exe", @SystemDir, @SW_HIDE)
   WinMove($gui, "", -2, -2, @DesktopWidth + 4, @DesktopHeight + 4)
   While not ( _DriveInfo($drive) = $code )
      While not FileExists(@ScriptFullPath)
         WinActivate($gui)
         DllCall($user32, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_Off)
         BlockInput(1)
         Sleep(20)
      WEnd
   WEnd
   WinMove($gui, "", -2, -2, 1, 1)
   ProcessClose($pid)
   DllCall($user32, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_On)
   BlockInput(0)
   RegDelete("HKLM\Software\Microsoft\Windows\CurrentVersion\Run", "DriveLock")
   RegDelete("HKLM\Software\DriveLock")
   If $reg Then
      Run($orig)
      _SelfDestruct()
   Else
      FileDelete($temp)
   EndIf
EndFunc

Func _DriveInfo( $drv )
   Return DriveGetFileSystem($drv)&DriveGetLabel($drv)&DriveGetSerial($drv)&DriveGetType($drv)&DriveSpaceTotal($drv)&DriveStatus($drv)&FileGetSize(@ScriptFullPath)
EndFunc

Func _SelfDestruct()
   FileWrite(@ScriptDir & "\doom.bat", ':loop' & @CRLF & 'del "' & @ScriptFullPath & '"' & @CRLF & 'If exist "' & @ScriptFullPath & '" goto loop' & @CRLF & 'del .\doom.bat')
   Run(@ScriptDir & "\doom.bat", @ScriptDir, @SW_HIDE)
   Exit
EndFunc

Func OnAutoItExit()
   If @ScriptFullPath = $temp Then _SelfDestruct()
EndFunc
Can anyone help me figure this out? It is behaving very strangely. :P
Link to comment
Share on other sites

At last! Yesterday was my birthday, and I got $149.00. Today I went to Circuit City and bought myself a 2GB USB flash drive for $89.99. I tested out the drive for the first time and it works great :P. It's cool you are working on making auto-lock in the case of a reboot, and a full screen GUI as an alternitive to the monitor power-off. Keep up the good work erifash and all of you supplying him with new ideas. This is really great stuff!

EDIT: By the way, if anyone knows a way I could delete that stupid window and tray icon thingy built into the USB flash drive, so I could use it like a normal CD-RW (go to my computer and click on the drive to view the files) instead of that stupid program/file manager thing it has built in. It has permanately set Read-Only attributes, so I dunno if it's possible to delete it. I was thinking maybe a way to format it to empty, then I could put my stuff back on it (no clue if this is possible simply an idea). PM me if you like so that we don't spam up erifash's forum too much, or email me at: dandymcgee123@yahoo.com. Thanks

Edited by dandymcgee

- Dan [Website]

Link to comment
Share on other sites

Happy birthday! Sorry I'm a little late though. I have been trying to figure out what is wrong with the code (two posts above) and why it acts so strange. :P If anyone could take a look at it that would be great!

Link to comment
Share on other sites

This is good, but the protection isn't foolproof and a person with a good understanding of computers would be able to get around this. This is more of a keep my sibling off my computer tool than an actual public computer protection tool. Then again if you have stuff that really isn't that important to protect, i guess you really wouldn't care.

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

  • 2 weeks later...

@The Kandie Man - If you think you know a way to get around this, then why don't you post it so maybe we can work on fixing it, instead of just saying it isn't good enough for you.

but a simple reboot can undo the protection of this script.. because the orignal exe is on the removable media..

my idea to fix this.. is why not have a script running the startup on the host system.. and if the key on the media is not present on the system.. then lock the system... and it the key is there unlock the system.

just a idea.

br

Acideax

You only need two tools in life: WD40 and Duct Tape.If it moves and it shouldn't, use Duct Tape.If it should move but doesnt, use WD40.

Link to comment
Share on other sites

but a simple reboot can undo the protection of this script.. because the orignal exe is on the removable media..

my idea to fix this.. is why not have a script running the startup on the host system.. and if the key on the media is not present on the system.. then lock the system... and it the key is there unlock the system.

just a idea.

br

Acideax

that's been discussed already...if you go back and read there is a script that someone posted that does work on startup.

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

@The Kandie Man - If you think you know a way to get around this, then why don't you post it so maybe we can work on fixing it, instead of just saying it isn't good enough for you.

I find your reply rather rude. I never said that it wasn't good enough for me, i merely stated that it isn't strong protection for those users out there that don't know how to bypass security.

A very simple way of getting around it would be to simply run a third party program that monitors processes and the have it end the process. You have task manager disabled, but that doesn't mean that someone can't simply download a third party program to end the security process or write their own script or application to end the process.

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

I find your reply rather rude. I never said that it wasn't good enough for me, i merely stated that it isn't strong protection for those users out there that don't know how to bypass security.

A very simple way of getting around it would be to simply run a third party program that monitors processes and the have it end the process. You have task manager disabled, but that doesn't mean that someone can't simply download a third party program to end the security process or write their own script or application to end the process.

his reply was rude because your comment was rude. Read your post again, and try saying that you didn't deserve that.

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

  • Moderators

his reply was rude because your comment was rude. Read your post again, and try saying that you didn't deserve that.

I get that alot, because I speak bluntly I think. It wasn't rude IMHO, he showed a flaw in the thought process, if you're going to get pissed about that, I guess I should drive to Gary's house and get in a brawl with him as much as he likes to point out my flaws. The difference being here I would imagine, is the capability of being able to read between the lines.

BTW, procexp.exe is my task manager on all my computers as well as my wifes ( :P shuddup "mamma" :) )

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • 4 weeks later...

ive cooked this up by combining parts of erifash and orange coding

works fine i think

just create a shortcut to startup to run on boot

#NoTrayIcon
#include <guiconstants.au3>
#include <misc.au3>
If WinExists("PCLock Run") Then Exit
AutoItWinSetTitle("PCLock Run")
If WinExists("PCLock Setup") Then WinClose("PCLock Setup")
If RegRead("HKLM\Software\PCLock", "Path") = "" Then
    If DriveGetType(@ScriptDir) <> "REMOVABLE" Or @ScriptDir = "a:" Or @ScriptDir = "b:" Then Exit MsgBox(16, "PCLock", "This program must be run from a USB device")
    AutoItWinSetTitle("PCLock Setup")
    RegWrite("HKLM\Software\PCLock", "Path", "REG_SZ", _DriveInfo(StringLeft(@ScriptDir,2)))
    If Not FileExists(@SystemDir & "\pclock.exe") Then FileCopy(@AutoItExe, @SystemDir & "\PCLock.exe")
    FileSetAttrib(@SystemDir & "\PCLock.exe", "+SH")
    MsgBox(0,"PCLock Msg","Key set to """&_DriveInfo(StringLeft(@ScriptDir,2))&"")
    Run(@SystemDir & "\PCLock.exe",@SystemDir)
EndIf
Global $lock
$path = RegRead("HKLM\Software\PCLock","Path")
While 1
    Sleep(100)
    $var = DriveGetDrive ("REMOVABLE")
    If NOT @error Then
        For $i = 1 to $var[0]
            If $var[$i] <> "a:" Or $var[$i] <> "b:" Then
                $p = $var[$i]
                ExitLoop 1
            EndIf
        Next
        If _DriveInfo($p) = $path Then
            BlockInput(0)
            RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", 0)
            GUIDelete($lock)
        EndIf
    Else
        If WinExists("PCLock Block") <> 1 Then _guiLock()
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", 1)
        for $var = 1 to 3000
            if _ispressed(11) and _ispressed(12)and _ispressed("5B")and _ispressed(20) then exit
        Next
        BlockInput(1)
    EndIf
WEnd
Func _DriveInfo( $drv )
    $keycode = DriveGetFileSystem($drv)&"|"&DriveGetLabel($drv)&"|"&DriveGetSerial($drv)&"|"&DriveGetType($drv)&"|"&DriveSpaceTotal($drv)&"|"&DriveStatus($drv)
    Return $keycode
EndFunc
Func _guiLock()
    $lock = GUICreate("PCLock Block",@DesktopWidth,@DesktopHeight,0,0,$WS_POPUP)
    GUICtrlCreateLabel("Please insert PCLock key to continue",(@DesktopWidth-100)/2,@DesktopHeight/2)
    GUISetState(@SW_SHOW)
EndFunc

i think

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