Sign in to follow this  
Followers 0
Yashied

USBProtect

9 posts in this topic

#1 ·  Posted (edited)

LAST VERSION - 1.1

28-Jun-10

The program consists of only one executable file (USBProtect.exe), and is intended to lock any removable storage devices, such as Flash Drive, Hard Drive (external), etc. Just run USBProtect and all removable drives will be locked. If you try to open them, you get the "Access is denied" message. If the user's account is not included in the administrators group, the user not be able to unload the process by using Windows Task Manager. In this case, USBProtect can be unloaded only by using the "/u" command line parameter (see below). I must say that USBProtect is designed to work only in Windows Vista/7 (USBResolve, see below, works in any systems).

A distinctive feature of USBProtect is that you can create (mark) a "favorites" removable drives. These drives will not be locked by USBProtect. To create the "favorite" drive you have to do the following.

  • Create a text file named "Volume.dat" in the root directory of the required drive, for example "D:Volume.dat".
  • Place in this file a unique identifier which returns the following function. This identifier is based on the serial number of drive's file system, so if you format it, this process must be repeated again.

    #Include <Crypt.au3>
    
    Func _GetVolumeUniqueID($sVolume)
    
        Local $Serial = DriveGetSerial($sVolume)
    
        If @error Then
            Return ''
        EndIf
    
        Local $Hash = StringTrimLeft(_Crypt_HashData($Serial, $CALG_MD5), 2)
    
        If $Hash Then
            Return StringMid($Hash, 1, 8) & '-' & StringMid($Hash, 9, 4) & '-' & StringMid($Hash, 13, 4) & '-' & StringMid($Hash, 17, 4) & '-' & StringMid($Hash, 21, 12)
        Else
            Return ''
        EndIf
    EndFunc   ;==>_GetVolumeUniqueID

  • Set "Hidden" and "Read only" attributes for this file.
Now USBProtect will not lock this drive, and you can safely use it while all other drives will be locked. To not do every time this steps, I wrote a small utility USBResolve (inside the archive) which makes all the same but much faster and safer. Just select a drive from the list and click "Change Status" button for lock/unlock its. Naturally, this should be done while USBProtect is not launched, otherwise, drive will not be present in the list, or on another computer. Note, you can unlock only drives that have the FAT32 or NTFS file systems. And lastly, USBProtect does not write any data in the registry, it's does not need them.

You can use the following command line parameters:

"/c" or "/cd"

Locks access to all the internal CD/DVD/BD-ROM devces while the process is in memory.

"/u" or "/unload"

Unloads USBProtect from memory.

 

USBProtect.png

Supported operating systems

Windows Vista, 7

Files to download

Binary

Redirection to USBProtect_bin.7z, 605 KB

USBProtect_bin.html

Source

Redirection to USBProtect_source.7z, 125 KB

USBProtect_source.html

Note

Source code inside the archive is fully functional, but for security reasons I excluded from it a function that is responsible for protecting the process. I think that if someone who written something which really needed a protection of the process, he can independently implement that.

Edited by Yashied

Share this post


Link to post
Share on other sites



Good Idea, thanks to share !

and for xp users like me, is there another version ? Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Really nice example Yashied... especially the exe protection feature.

BTW, if you have Unlocker installed, you can actually unlock your USB... but overall, it's a very nice program ;)


AUTOIT[sup] I'm lovin' it![/sup]

Share this post


Link to post
Share on other sites

Hmm, it requires Windows Vista that I don't have. Can you develop a version for XP?

USBProtect uses the WinAPI functions to lock a devices that will not work properly in Windows XP. The program is designed only for Windows Vista or later. I'm sorry.

;)

Share this post


Link to post
Share on other sites

Yashied,

In relation to your comment "Source code inside the archive is fully functional, but for security reasons, I excluded from it a function that is responsible for protecting the process", I can't help but wonder....

is this 'protection' a method to prevent the process from being 'ProcessClosed' or does it hide the process?

Regards,

4Eyes

Share this post


Link to post
Share on other sites

Yashied,

In relation to your comment "Source code inside the archive is fully functional, but for security reasons, I excluded from it a function that is responsible for protecting the process", I can't help but wonder....

is this 'protection' a method to prevent the process from being 'ProcessClosed' or does it hide the process?

Regards,

4Eyes

Prevents a closure process.

Share this post


Link to post
Share on other sites

Share this post


Link to post
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
Sign in to follow this  
Followers 0