Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to write a program that deletes itself?

 
tejaswini vasist
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone give me the logic as to how a program can delete itself?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This forum is for puzzle questions. Moving to Java Forum, but it might be moved again...

Eric
 
Jeffrey Hunter
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 815
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Sania Marsh
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cannot think any positive thought why someone would want something like that. Why?
 
Jeffrey Hunter
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 469
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, if it's some Al-Qaeda bonehead running a communications network like the one they caught not too long ago.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic