aspose file tools*
The moose likes Beginning Java and the fly likes How to write a program that deletes itself? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to write a program that deletes itself?" Watch "How to write a program that deletes itself?" New topic
Author

How to write a program that deletes itself?

tejaswini vasist
Greenhorn

Joined: Apr 10, 2004
Posts: 17
Can anyone give me the logic as to how a program can delete itself?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
This forum is for puzzle questions. Moving to Java Forum, but it might be moved again...

Eric
Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
Didn't you ever see the Matrix? Programs don't like to delete themselves.

Anyhow, it seems that you would need to fork a new process (not a lightweight child thread, but an independent process), that would then have its way with the original process (aka, shutting it down, deleting it, etc.). You may be able to pass the PID of the parent to the child, the child then uses the PID to kill the parent process, and remove it from the disk. This is theoretical of course, but seems like a sound theory.

Of course, the primary purpose of doing such a thing seems to be the need to erase one's footprint? Strategically dropping a bomb which serves its purpose then erases any indication that it was ever there? In this case, I deny any knowledge of this thread and any and all contents therein and should any cracking attempts be made as a result of this thread I do not speak English and I know nothing about computers.
Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
Originally posted by Jeffrey Hunter:
You may be able to pass the PID of the parent to the child, the child then uses the PID to kill the parent process, and remove it from the disk.


And marry its mother?


I've heard it takes forever to grow a woman from the ground
Sania Marsh
Ranch Hand

Joined: Jul 12, 2004
Posts: 469
Cannot think any positive thought why someone would want something like that. Why?
Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
Originally posted by Rita Moore:
Cannot think any positive thought why someone would want something like that. Why?


Dump a password harvestor, set up a remote socket to listen for the passwords, once the procedure is complete -- kill socket, erase footprint of harvestor. Just one of the many possibilities.
Sania Marsh
Ranch Hand

Joined: Jul 12, 2004
Posts: 469
Originally posted by Jeffrey Hunter:


Dump a password harvestor, set up a remote socket to listen for the passwords, once the procedure is complete -- kill socket, erase footprint of harvestor. Just one of the many possibilities.


That's considered positive?
Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
Sure, if it's some Al-Qaeda bonehead running a communications network like the one they caught not too long ago.
 
Don't get me started about those stupid light bulbs.
 
subject: How to write a program that deletes itself?