Pages

Showing posts with label USB. Show all posts
Showing posts with label USB. Show all posts

Saturday, 28 July 2012

A Virus Program to Disable USB Ports


In this post, I will show how to create a simple virus that disables/blocks the USB ports on the computer (PC). As usual, I am using my favorite C programming language to create this virus. Anyone with a basic knowledge of C language should be able to understand the working of this virus program.
Once this virus is executed it will immediately disable all the USB ports on the computer. As a result you’ll will not be able to use your pen drive or any other USB peripheral devices on the computer. The source code for this virus is available for download. You can test this virus on your own computer without any worries since I have also given a program to re-enable all the USB ports.

Download the USB_Block.rar file on to your computer
  1. It contains the following 2 files:
    • block_usb.c (source code)
    • unblock_usb.c (source code)
  2. You need to compile them before you can run it. A step-by-step procedure to compile C programs is given in my post -How to Compile C Programs.

    1. 3. Upon compilation of block_usb.c you get block_usb.exe which is a simple virus that will block (disable) all the USB ports on the computer upon execution (double click).
    2. To test this virus, just run the block_usb.exe file and insert a USB pen drive (thumb drive). Now you can see that your pen drive will never get detected. To re-enable the USB ports just run the unblock_usb.exe  (you need to compile unblock_usb.c) file. Now insert the pen drive and it should get detected.
    3. You can also change the icon of this file to make it look like a legitimate program. For more details on this refer my post – How to Change the ICON of an EXE file (This step is also optional).

    How it Works?

    The idea behind the working of this virus is pretty straightforward. It works by gaining access to the Windows registry and modifying it’s settings to disable the USB device support on the computer.
    On the other hand, the other program will re-set the registry settings back to the normal so that the support for USB devices is re-enabled. I hope you like this post. Please pass your comments.

Friday, 27 July 2012

How to Write-Protect Your USB Flash Drive




Many a time, it becomes necessary for us to write protect our USB flash drive so as to protect it from viruses and other malware programs. Because flash drives are so popular and most widely used to move data between computers, they are the prime target for attackers as a means to get infections spread around the computer world. Also, since USB drive is not a Read-Only Memory (ROM), the data inside it can easily be modified or deleted by malware programs.
But unfortunately, most of the new flash drives do not come with a write-protect feature as the manufacturers wish to cut down the cost of production. Hence, the only way to write-protect your USB flash drives is to enable this feature on your own computer.
This can be done by adding a small entry to the Windows registry which acts as a switch that can be enabled to make use of the write protection or disabled to allow write access. Just follow these steps:
  1. Open the Registry Editor (Open the “Run” dialog box, type regedit and hit “Enter”).
  2. Navigate to the following Registry key:
  3. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\
  4. Create a New Key named as StorageDevicePolicies. To do this, right-click onControl, again click on New->Key and name it as StorageDevicePolicies.
  5. Now right-click on  StorageDevicePolicies and create a New->DWORD (32-bit) Value and name it as WriteProtect.


    5.Double-click on WriteProtect and set the Value data to 1.
    Now the right-protection for USB drives is enabled on your computer (no restart required) and thus it would not be possible for anyone or any program to add/delete the contents from your USB flash drive. Any attempt to copy or download the files onto the USB drive will result in the following error message being displayed.



    To revert and remove the write-protection, all you need to do is just change the Value data for WriteProtect (Step-5) from 1 back to 0. Now write access to all the USB devices is re-enabled.
    Sometimes it may seem difficult to remember and follow the above mentioned steps each time you want to enable/disable the write protection. Hence as an alternative way, there are many tools available to automatically enable/disable the write-protection feature. One of my favorite tool is USB Write Protect by Naresh Manadhar.
    Using this tool, you can limit write access to your USB drives with just a click of a button. You can download this tool from the following link:


    www.gohacking.com/downloads/resourses/USBWriteProtect.rar