Jump to content
Sign in to follow this  
AutoProgramming

Scan all drives for autorun.inf

Recommended Posts

AutoProgramming

;~ scan all drives for autorun.inf

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Users\alexander\Documents\AutoIt\projects\AntiVir\Forms\autorun_editor.kxf
$Form1 = GUICreate("Autorun.inf Scanner // by AutoProgramming", 635, 444, 193, 125)
$Edit1 = GUICtrlCreateEdit("", 8, 40, 617, 393)
$CButton = GUICtrlCreateButton("Close", 8, 8, 75, 25, 0)
$IButton = GUICtrlCreateButton("Search for autorun.inf", 96, 8, 131, 25, 0)
$RCheckbox = GUICtrlCreateCheckbox("Search Removable Drives?", 240, 16, 169, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $IButton
            GUICtrlSetData($Edit1, "")
            
            If GUICtrlRead($RCheckbox) = 1 Then
                GetAll("removable")
            EndIf
            
            GetAll("fixed")
            GetAll("cdrom")
            
        Case $CButton
            Exit

    EndSwitch
WEnd


GetAll("fixed")
GetAll("cdrom")

Func GetAll($type)
    $var = DriveGetDrive($type)
    If NOT @error Then    
        For $i = 1 to $var[0]
            $path = $var[$i] & "\autorun.inf"
            
            If FileExists($path) Then
                GUICtrlAddData($Edit1, "--------------------------------------------------" & @CRLF)
                GUICtrlAddData($Edit1, "Autorun.inf @ " & $path & @CRLF)
                GUICtrlAddData($Edit1, "--------------------------------------------------" & @CRLF)
                $autorun = FileRead($path)
                GUICtrlAddData($Edit1, $autorun)
                GUICtrlAddData($Edit1, @CRLF & @CRLF)
            EndIf
        Next
    EndIf
EndFunc

Func GUICtrlAddData($GUIElement, $Data)
    GUICtrlSetData($GUIElement, GUICtrlRead($GUIElement) & $Data)
EndFunc

I think it's quite self-explainig -> This tool searches for autorun.inf in all drives and displays its content. Enjoy.


[u]My OpenSource Projects:[/u]- [BEEP] proMusiX- Search autorun.inf

Share this post


Link to post
Share on other sites
Yashied
A. Percy

unless you have disabled the autorun function before, it may not be effective. Like that question: which came first, the chicken or the egg?


Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator[center] VW Bug user[/center]Pinheiral (Pinewood) city: http://pt.wikipedia.org/wiki/Pinheiral

Share this post


Link to post
Share on other sites
GEOSoft

unless you have disabled the autorun function before, it may not be effective. Like that question: which came first, the chicken or the egg?

If AutoRun is disabled, it won't matter if the AutoRun.inf file exists or not.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
A. Percy

If AutoRun is disabled, it won't matter if the AutoRun.inf file exists or not.

But if isn't, it won't matter if you can see the contents of autorun.inf or not, your machine is infected if the file have bad content.


Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator[center] VW Bug user[/center]Pinheiral (Pinewood) city: http://pt.wikipedia.org/wiki/Pinheiral

Share this post


Link to post
Share on other sites
killerofsix

glad to see I inspired something :o

But for most PC's autorun is disabled and only appears as an option. For my USB finder it's just another way to lure the person who has your USB to run your app. This is a good defense against any malicious attempts to destroy your system through a usb or cd. good job with this script :D


"The quieter you are, the more you are able to hear..."

My AppsUSB Finder

Share this post


Link to post
Share on other sites
rajeshontheweb
rajeshontheweb

Here it is ,

> shows which drives user has scanned already - as a confirmation that the program has run already :-)

> alerts user if the drive was not ready (typically if the memory card / zipdrive / removable media not inserted properly )

> Selects removable media also by default

<edited>

> search button on default focus

Scan4Autorun_old.au3

Edited by rajeshontheweb

Share this post


Link to post
Share on other sites
rajeshontheweb

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  

×