1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Detect worms in VBScript

Discussion in 'JavaScript and AJAX' started by sun_kangane, Dec 10, 2008.

  1. sun_kangane

    sun_kangane New Member

    Joined:
    Mar 20, 2007
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    0

    Background



    Many time we found the file worm.vbs in our computer in each dir.
    worm.vbs may or may not be malicious. but when they execute's they consume CPU.

    So, Better option is to remove them. but it is tough job as they exist in each dir.
    I written a vbScript to that...........................

    The Code



    Code:
    
    Dim Obj
    Dim Drive
    Dim Worm,VirName
    Dim WinDir
    Dim DLetter,DriveSet
    
    Set Obj = CreateObject("Scripting.FileSystemObject") 
    Set DriveSet = CreateObject("Scripting.FileSystemObject")
    WinDir = Obj.GetSpecialFolder(0)
    Worm = "\autorun.inf"
    VirName = WinDir & Worm
    MsgBox "Don't Worry I will delete All Worm.vbs in Ur PC !!!!!!"
    'Obj.CopyFile ".\Worm.vbs" ,VirName,1
    
    do 
    For Each DLetter in DriveSet.Drives
           MsgBox DLetter
    	If (DLetter.IsReady And (DLetter.DriveType = 1 Or DLetter.DriveType = 2 Or DLetter.DriveType = 3)) Then
    		call SearchComputer(DLetter)
    	End If
    Next
    loop while 1	
    
    
    sub SearchComputer(Fold)
    	Dim File,FSO
    	Dim temp,TempFile
    	dim filesys
    	Set filesys = CreateObject("Scripting.FileSystemObject") 
    	
    	For Each FSO in Obj.GetFolder(Fold).SubFolders
    		temp = FSO & "\*.txt"
    		File = FSO & Worm
    		'MsgBox File
    		If filesys.FileExists(File) Then
       		 filesys.DeleteFile File
    		End if
    		On Error Resume Next
               
    		SearchComputer(FSO)
    	Next
    	
    End sub
    
    MsgBox " For any Problem Please e_Mail me: sun_kangane@yahoo.co.in"
    
    wscript.Quit() 
    
    
    this script run through each dir. so will take some time to execute.................
     
  2. NDL

    NDL New Member

    Joined:
    Oct 20, 2008
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    SL,colombo
    Home Page:
    will see tnx anyway
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
  4. alinaboom

    alinaboom New Member

    Joined:
    Jun 19, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    USA
    Location:
    USA
    How would I handle the error if no printer is installed?Getting quite frustrated, can I even suppress the error?Any help please... All i need to do is detect whether or not a printer is installed, but I get "a nil value" if no printer is found.
     
  5. naimish

    naimish New Member

    Joined:
    Jun 29, 2009
    Messages:
    1,046
    Likes Received:
    18
    Trophy Points:
    0
    Occupation:
    Software Engineer
    Location:
    On Earth
    This itself is worms, I started it, it's simply asking me a hell times to press ok button, still i am pressing ok button and it's not getting closed :(
     
  6. Full Zip Hoody

    Full Zip Hoody New Member

    Joined:
    Sep 29, 2010
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Programer
    Location:
    US of A
    it did took me some time to execute but eventually it worked well.
     

Share This Page