Most of us are familiar with the virus that used to block Orkut and Youtube websites. If you are curious about creating such a virus on your own, here is how it can be done.
As usual I am using my favorite programming language ‘C’ to create this website blocking virus. I will give a brief introduction about this virus before I jump into the technical jargon.
This virus has been exclusively created in ‘C’. So, anyone with a basic knowledge of ‘C’ will be able to understand the working of this virus program. When this program is executed, it will block all those websites that are listed in the source code. In the following example, the sites that are listed in the source code are Google, Yahoo and Youtube. When you download the source code of this program, you have a choice to include your own list of sites that you want this virus to block.
I have just removed the source code of this program from this post as it is lengthy and makes the post look messy. You can still download the source code of this virus program from the following link:
How Virus Program Works?
The Windows operating system maintains a special file called HOSTS which can be used to block any given hostname or domain name (website) by adding new entries onto it. This program works by modifying the HOSTS file by adding new entries of those sites that are intended to be blocked. The HOSTS file is located at:
So, when you execute this program, all it does is add the entries of the list of those sites (mentioned in the source code) to this HOSTS file. Once this is done, the site will be blocked from your computer. So, none of the browsers would be able to load those sites on your computer.
For more information on HOSTS file, I recommend reading my other post on How to use HOSTS file to block websites.
Now, as far as the technical part of this program is concerned, people who have a working knowledge of ‘C’ should be easily able to understand the working of this virus program. However, for those who are new to ‘C’ programming, here is the algorithm of this program:
- Determine the Root drive. ie: Find the drive (C:, D:, E: or F:) on which the Windows is installed.
- Navigate to: %windir%\system32\drivers\etc
- Open/Load the HOSTS file.
- Copy a list of those websites that are mentioned in the ARRAY to the END of the file.
- Save the file and Exit.
How to Compile the Source Code?
For a step-by-step compilation guide, refer my post: How to compile C Programs?
Testing the Virus:
-
To test, run the compiled module. It will block the sites that are listed in the source code.
-
Once you run the file block_Site.exe, restart your browser program. Then, type the URL of the blocked site and you’ll see the browser showing error “Page cannot displayed“.
-
To remove the virus type the following command in the Run.
%windir%\system32\drivers\etc -
There, open the file named “hosts” using the notepad. At the bottom of the opened file you’ll see something like this:
127.0.0.1 google.com -
Delete all such entries which contain the names of blocked sites.















I am Srikanth Ramesh, a computer engineer from India.
65 Comments
Victor
December 4, 2008 at 7:50 PMSrikanth
December 5, 2008 at 7:01 AMAchintya
December 11, 2008 at 11:47 PMshrinidhi
December 24, 2008 at 8:14 PMsubhasis
December 26, 2008 at 9:23 AMnick
December 26, 2008 at 12:13 PMvishal
December 26, 2008 at 4:16 PMSrikanth
December 26, 2008 at 5:27 PMSrikanth
December 26, 2008 at 5:29 PMnick
December 26, 2008 at 11:32 PMsiddhant
December 28, 2008 at 12:16 PMlal
January 5, 2009 at 7:04 AMSantanu
January 5, 2009 at 3:47 PMSrikanth
January 5, 2009 at 5:41 PMPrshntrnjn
January 5, 2009 at 8:46 PMSrikanth
January 5, 2009 at 10:30 PMrock
January 12, 2009 at 4:55 AMSrikanth
January 12, 2009 at 6:32 AMravi
January 16, 2009 at 3:41 PMpranab
January 27, 2009 at 4:38 PMhelloman
January 31, 2009 at 4:45 AMhelloman
January 31, 2009 at 5:02 AMSrikanth
January 31, 2009 at 10:19 AMlaw
January 31, 2009 at 3:32 PMSrikanth
January 31, 2009 at 5:54 PMforasking
February 3, 2009 at 10:59 PMitanium89
February 12, 2009 at 10:14 AMSrikanth
February 13, 2009 at 10:26 PMfaizan
February 16, 2009 at 9:17 PMSrikanth
February 16, 2009 at 10:42 PMfaizan
February 17, 2009 at 5:17 PMSrikanth
February 17, 2009 at 11:39 PMfaizan
February 18, 2009 at 4:31 PMSrikanth
February 20, 2009 at 12:12 AMrohit
February 24, 2009 at 12:10 PMDileep Maharaj
March 8, 2009 at 5:23 PMNarendran
March 8, 2009 at 6:50 PMSrikanth
March 8, 2009 at 11:26 PMRahul
March 10, 2009 at 2:34 PMRahul
March 10, 2009 at 2:40 PMDan
April 4, 2009 at 6:32 AMaditya
April 10, 2009 at 8:08 PMshakka
April 24, 2009 at 5:03 AMAashee
April 26, 2009 at 2:41 PMRaj
April 29, 2009 at 12:18 PMMr Paranormal
May 4, 2009 at 8:44 AMSrikanth
May 6, 2009 at 11:40 AMMr Paranormal
May 4, 2009 at 8:45 AMMr Paranormal
May 8, 2009 at 6:16 AMImran
May 21, 2009 at 6:44 PMImran
May 21, 2009 at 6:48 PMNeer
May 28, 2009 at 4:53 PMSrikanth
May 30, 2009 at 7:02 AMGuruvigneshwaran
May 29, 2009 at 7:07 PMSrikanth
May 30, 2009 at 6:50 AMsylvester
June 5, 2009 at 7:18 PMsylvester
June 5, 2009 at 7:23 PMKhurram
June 8, 2009 at 2:58 PMKhurram
June 10, 2009 at 4:45 PMKhurram
June 11, 2009 at 4:10 PMprettylicious
June 19, 2009 at 6:00 PMaditya
July 7, 2009 at 6:50 PMSrikanth
July 8, 2009 at 12:19 PMZaigham
July 23, 2009 at 11:56 PMkiran
August 15, 2009 at 12:26 PM