Sunday, 5 May 2013

How to Create Autorun for Pendrives or disks


AutoPlay is a feature introduced in Windows XP which examines removable media and devices and, based on content such as pictures, music or video files, launches an appropriate application to play or display the content.If available, settings in an autorun.inf file can add to the options presented to the user.

AutoPlay is based on a set of handler applications registered with the AutoPlay system. Each media type (Pictures, Music, Video) can have a set of registered handlers which can deal with playing or display that type of media.
Autorun.inf is the primary instruction file associated with the Autorun function. Autorun.inf itself is a simple text-based configuration file that tells the operating system which executable to start, which icon to use, and which additional menu commands to make available. Then, if the "Auto insertnotification" feature is enabled (it is by default), Windows checks in the new disk's root directory for the existence of an "autorun.inf" file. If found, Windows then reads and follows the specific instructions this file defines. If no autorun.inf file is found, then Windows refers to the new disk by itsserial number and executes the default actions associated with the (data or audio) content on the disk.

This is so far the postive concepts of autorun.inf file.But now a days its being used commonly to spread viruses through USB drives by auto installing the virus file when any USB drive is plugged in.We have already discussed how to defend yourselves from autorun viruses and other attacks through USB drives.The autorun.inf file is always located in the root of the usb drive and tells Windows what to do automatically.

This autorun can be used to make good, or bad USB’s depending on what you like.

CREATING A USB AUTORUN.INF FILE

To create an autorun file, open Notepad and save ‘autorun.inf’’ (with quotes) and save it to the root of the drive. All it needs to have is in the first line;
[autorun]
Done!

Changing label\icon of thumbdrive:

Follow the steps in Creating a USB Autorun.inf. Before you save it, type this in in this order!

[autorun]
icon=myicon.ico
label=MyLabel

And save. Make sure the icon file is in the root of your drive.

Making a new option appear in the autorun menu:

so make your autorun file and type this into Notepad:
[autorun]
icon=default
label=[yourlabelhere]
action=program.exe

To Open Program

Save it and exit. Once again, the program has to be in the root. Now, when you plug it in, the option should appear in the menu.

Making programs automatically run when the USB is plugged in:

Follow the same instructions, 

[autorun]
Icon=default
label=YourLabelHere
open=program.exe

A simple Autorun.inf example:
[autorun]
open=autorun.exe
icon=autorun.ico
A complex Autorun.inf example:
This example is used in the following section for complete definition and descriptions.
[autorun]
open=filename.exe /argument1
icon=\foldername\filename.dll,5
[autorun.mips]
open=filenam2.exe
icon=filename.ico
[autorun.alpha]
open=filenam3.exe
icon=filename.ico
[autorun.ppc]
open=filenam4.exe
icon=filename.ico
shell\install = &Install
shell\install\command = setup.exe
shell\uninstall = &UnInstall
shell\uninstall\command = Uninstall.exe
shell\readme = &Read Me
shell\readme\command = notepad readme.txt
shell\help = &Help
shell\help\command = helpfilename.hlp

This section describes the configuration of the Autorun.inf file and each of the potential items.

Example Autorun File:Description:
[autorun][autorun] is the primary, required section name.
open=filename.exe /argument1Open is the keyword to determine what action to take upon insert notification.
filename.exe is the value defining the application that will be automatically started.
/argument1 is the argument, parameter or switch passed to the application being run. Logically, any command line parameters used must be supported by the application.
icon=\foldername\filename.dll,5Icon is the keyword to determine the icon used for the disk.
filename.dll is the value defining the file containing the icon.
,5 is the argument to the icon resource defining which icon to display.
Note: By default, the system looks for the file in the root directory of the inserted disk. If you want to access a file located in a specific folder or subdirectory, specify a path relative to the root. 
Example: open = foldername\filename.exe This will not change the current directory.
Although AutoPlay is the default menu item, you can define a different command to be the default by including the following line. shell = verb
When the user double-clicks on the icon, the command associated with this entry will be carried out. 
Note: a more common method of defining the icon resouce is an explicit reference to a .ico file. Example: icon=autorun.ico
Note: The icon defined representing your application's CD or DVD is the drive icon as viewed with My Computer or Explorer. Valid file types containing icons include .ICO .BMP .EXE .DLL If the file includes more than one icon, by default, the second icon in the files icon resource will be displayed.

Example Autorun File:Description:
[autorun.mips]Defining the autorun items for a mips machine
open=filenam2.exeThe platform specific application to run
icon=filename2.icoThe platform specific autorun icon
[autorun.alpha]Defining the autorun items for a DEC Alphamachine
open=filenam3.exeThe platform specific application to run
icon=filename3.icoThe platform specific autorun icon
[autorun.ppc]Defining the autorun items for a Power PC
open=filenam4.exeThe platform specific application to run
icon=filename4.icoThe platform specific autorun icon
shell\install = &InstallThe Keyword defining a menu item and the Hot key for that item
shell\install\command = setup.exeThe keyword defining the operation to perform when the user selects this item
shell\uninstall = &UnInstallAdditional menu item example
shell\uninstall\command = Uninstall.exeAdditional menu item example
shell\readme = &Read MeAdditional menu item example
shell\readme\command = notepad readme.txtAdditional menu item example
shell\help = &HelpAdditional menu item example
shell\help\command = helpfilename.hlp                     Additional menu item example


NOTE: After creating a autorun.inf just hide it and if you are using any icons hide that too. 

Hope you all got a well idea about autorun and how it is working.


No comments:

Post a Comment