U-drives are very popular nowadays, they have generally replace floppys, and even CDs. Many light-weight virus or trojans are aiming for creating a hidden file which is called autorun.inf that stores the auto-run information when U-drives or CDs are automatically connected. I name such light-weight because they can normally be detected easily, by virus-detecting software e.g. Norton or sometimes, by observation. The autorun.inf file provides the most important infection link.
The fact is that when a directory with the same file name exists, the operating system will fail to create or even overwrite with a file that has the same name. Therefore, if the directory named autorun.inf exists, the virus or trojan will fail to replace/create a file that has malicious script code. The following Windows batch script will check for each possible driver and create the directory. If there exists already the autorun.inf file, it will remove it first. The directory will be given hidden, archive, system and read-only attribute.
@echo off rem A Batch Script to Create Folder 'autorun.inf' rem This can prevent autorun.inf virus. rem Free to use, put at startup recommended. rem by justyy, 2 - Dec - 2008 for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do call :sub %%i goto end :sub echo Checking %1: ... if not exist %1:\nul goto notfound if exist %1:\autorun.inf\nul goto already if exist %1:\autorun.inf goto clean goto done :clean echo removing File %1:\autorun.inf ... attrib -r -a -s -h %1:\autorun.inf del %1:\autorun.inf :done echo Making directory '%1:\autorun.inf' ... mkdir %1:\autorun.inf :already echo Attributing directory '%1:\autorun.inf' ... attrib +r +a +s +h %1:\autorun.inf goto end :notfound echo Skipping %1: ... :end
–EOF (The Ultimate Computing & Technology Blog) —
loading...
Last Post: Math Example using Windows Batch Script
Next Post: Jagged arrays and Multidimensional array in C#