Click here to Skip to main content
15,896,606 members
Articles / Programming Languages / C#
Article

Kill Brontok A HVM 32 Virus Files

Rate me:
Please Sign up or sign in to vote.
2.69/5 (8 votes)
25 Aug 20062 min read 82.1K   3.4K   19   9
This is an antivirus solution to deal with the Brontok A HVM 32 Virus.

Sample Image - Kill_Brontok.jpg

Introduction

Well, half a year back my system and infect many systems in our institute got infected with a strange virus Brontok A HVM 32. This virus spreads through shared folders on networks. It affects system in many ways:

  1. It creates an EXE file with the name of the parent folder. For example if there is a folder with name 'Abhishek' then this virus will create a file with the name 'Abhishek.exe' inside that folder and does the same for all subfolders. Sometimes the file name are also like Data.exe or with other names like [username].exe
  2. Corrupts the 'Folder Option' button in Control panel.
  3. Corrupts the cmd.exe.

As usually I searched for a solution on net but did not find a complete one. There is a solution available but it only reverts back the effects of the virus and does not delete the folder.exe kind of files. If you by mistake click these file, the virus will again come. So I developed this small but good enough program to get rid of all those infected files.

Prerequisite for Running this Program

As I already mentioned that this program only deletes the infected files so be sure to run the solution CS_DevEvil. This antivirus can reverse the effects of Brontok A HVM 32 virus and need to be run before this program.

Download CS_DevEvil.zip

How to Use Executable

Well, if somebody is interested only in removing the infected files. Then here are the steps:

  1. Click 'Set virus File's properties' to set the properties of the infected files on your system (Sometimes they are different for different systems). Otherwise, default attributes will be used.
  2. In the default mode the program removes only [folder].exe kind of files. If you want to remove others like 'Data Abhishek.exe' than click 'Kill file with this name also'.
  3. Finally click 'start' and the rest is obvious.
  4. If you suspect that your system has files with the name 'Data example.exe' but you could not select it through 'Kill file with this name also' button, than just make a text file, rename it to 'Data example.exe' and select for removal.

Using the Code

The code for this program is very simple. I have used two main functions - searchFolder and removeVirus.

searchFolder

This function searches each folder recursively for virus files and calls the function removeVirus only when all of its subfolders are cleaned.

C#
void searchfolder(string path)
{
    if(this.progressBar1.Value==100)
    progressBar1.Value=0; 
    this.progressBar1.Increment(5);
    try
    {
        string []folders=Directory.GetDirectories(path);
        this.Update(); 
        statuslabel.Text="Cleaning "+path;

        for(int i=0;i<folders.Length ;i++)
        {
            //recursively search folders
            searchfolder(folders[i]);
        }    
        //check if we are in root directory. if not than proceed further
        if(!Path.GetPathRoot(path).Equals(path))
        removeVirus(path);
    }    
    catch{}
}
removeVirus

This function cleans the folder and removes all the infected files.

C#
void removeVirus(string path)
{
    string folder=Path.GetFileName(path); 

    //get all the executable files in the folder
    string []files=Directory.GetFiles(path,folder+"*.exe"); 
    int i=0;
    FileInfo fi;
    try
    {
        for(i=0;i<files.Length;i++)
        {
            fi=new FileInfo(files[i]);
            if(fi.Length ==filesize)
            {
                File.Delete(files[i]);
                logBox.Text +="\n"+files[i]+" deleted ";        
                counter++;
            }
        }
    }
    catch
    {
        logBox.Text +="\nThe file "+files[i]+" cannot be deleted";
    }

    foreach(object o in killfiles)
    {
        string fname=(string)o; 
        files=Directory.GetFiles(path,fname); 
        try
        {    
            for(i=0;i<files.Length;i++)
            {
                fi=new FileInfo(files[i]);
                if(fi.Length ==filesize)
                {
                    File.Delete(files[i]);        
                    logBox.Text +="\n"+files[i]+" deleted";
                    counter++;
                }
            }
        }
        catch
        {
            logBox.Text +="\nThe file "+files[i]+" cannot be deleted";
        }
    }
}

Conclusion

Have nothing to write here. Enjoy!!!!!!!!!!!!!!!!!!!!!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Generalhi its regarding brontok virus.. Pin
Parminder Singh Saini9-Dec-07 4:16
Parminder Singh Saini9-Dec-07 4:16 
GeneralRe: hi its regarding brontok virus.. Pin
Abhishek _Agarwal13-Aug-08 12:27
Abhishek _Agarwal13-Aug-08 12:27 
GeneralYeah that might work... but... Pin
vahnrey29-May-07 22:31
vahnrey29-May-07 22:31 
GeneralRe: Yeah that might work... but... Pin
Paul Chin PC6-Sep-07 21:53
Paul Chin PC6-Sep-07 21:53 
This is an excellent article. It deletes the virus files. It is not supposed to kill resident virus. That was made abundantly clear in the article. We may know how to use the search function to search for files but this article shows us how to do it programmatically. If the previous reader wanted to kill resident virus then by all means, take this code and add the kill method. This article is a good template for future improvements and if i wanted to write a program to hunt and kill virus, this is probably where i would begin - with this code.

Thanks for the article.



"We are disturbed not by events, but the views we take of them" - Epictetus

GeneralRe: Yeah that might work... but... Pin
Abhishek _Agarwal13-Aug-08 12:24
Abhishek _Agarwal13-Aug-08 12:24 
GeneralRe: Yeah that might work... but... Pin
Abhishek _Agarwal13-Aug-08 12:27
Abhishek _Agarwal13-Aug-08 12:27 
QuestionDangerous? Pin
neilarnold28-Aug-06 0:10
neilarnold28-Aug-06 0:10 
AnswerRe: Dangerous? Pin
Abhishek _Agarwal28-Aug-06 5:34
Abhishek _Agarwal28-Aug-06 5:34 
GeneralRe: Dangerous? Pin
Tyler454-Jan-07 16:10
Tyler454-Jan-07 16:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.