Home » C SOURCE CODES

A Self Destructing Program in C

Submitted by Srikanth on Saturday, 1 March 200816 Comments

This program will destroy itself upon execution. The program will cause the .exe file to be deleted upon execution. That is this program is capable of destroying itself upon execution. Here is the code
 

 
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
printf(“This program will destroy itself if u press any key!!!\n”);
getch();
remove(_argv[0]);/*array of pointers to command line arguments*/
}
 

HOW TO COMPILE ?

Load the source code to the compiler and compile (press Alt-F9) and then press F9. This will generate the .exe file in the current directory (Bin directory). Execute this .exe file it will destroy itself upon execution.

Popularity: 2% [?]

Visitors who read this post, also read:

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


  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

16 Comments »

  • anarghya said:

    i donot understand remove(_argv[0])

  • Srikanth (author) said:

    Whenever we run any program the element _argv[0] (array of ptrs to command line arguments) contains the name of the program itself.For eg: If we are running a program(.exe file) whose name is “sample.exe” then the _argv[0] would contain this name.That is why we are passing _argv[0](nothing but the name of the program) as an argument to remove() function which will delete itsef eventually

  • Anonymous said:

    hi,
    i am bharadwaj and i want to destroy orkut account with a simple program is there any posibility pls

    check it

  • Srikanth (author) said:

    @ Bharadwaj

    Are you joking? It’s not possible yaar…

  • josh said:

    i didn’t get it. do i need to copy and paste this code and save in any format . will i be runnig it later or wat?????? pls help me m confused
    Pls reply ASAP

  • Srikanth (author) said:

    @ josh

    Copy and paste the code to a notepad. Rename the extension from .txt to .C, now compile it to get an executable(.exe file). Now if you execute/run this file it’ll destroy itself upon execution.

  • abhishek said:

    hi frnd………from which website,i can free download jdk1.6.0_02????????

  • Srikanth (author) said:

    @ abhishek

    You can download it from sun microsystem’s site… or search it on google.

  • Atinder said:

    Mr.srikanth….er!!!rather Mr. bardwaj it is possible to delete orkut account u wish after having access…this cat be done easily by making a trojan …bypassing firewall….stealing data frm secure connection…not easy man…keep learning…and ur space filler…its beaten…kaspersky don’t let it execute if self defence is enabled…one thing more…a virus must be self replicating thus urs is only a mere pro….for more info ….read von nuemans self replication….keep it up man….njoy life

  • Yasir Ali said:

    nice Shot SRIKANTH……io like ur work.i am beginer.and i m very Glad that u r helping others.Keep It up.my Prayers r with u.

  • rexter said:

    hello srikanth….
    would u plz submit a c coading that will delete a file(any extention) in my hard disk…
    thnx…

  • dr.xhacker said:

    Use of a program like this?

    Like your site its self destructive

  • Chris said:

    You’ve done a great job dude..

  • vipan said:

    whats command line argument ??
    srikanth

  • Ayush said:

    Nice one….

  • Tirtharaj said:

    stdio.h is the header file in the above program

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.