On POSIX systems, this challenge is trivial because you can unlink ("delete") an executable while it's running. The file is then actually deleted once the program exits.
On Window, you can muck around with child processes that delete their parent. Perhaps more interestingly, you could try to abuse Software Restriction Policies [1]. In theory, you should be able to blacklist your own executable (by hash), so that it can't run ever again. This would also block any copy of the file that you might have kept.
This sort of reminded me of Phillip K. Dick's art book Agrippa [1], which was given a limited release on a floppy disk that would corrupt itself after its contents are displayed on a computer.
You mean William Gibson's. Note how despite the author's intentions (or perhaps because of them) "pirated text of the poem was
released the next day on MindVox."
I could argue that if you work for the DOD, it's entirely possible that all your code will only execute once. Sadly, I do work for a government agency, but my code only runs once because of mismanagement... :(
My first thought (from a sysadmin view, and only reading the title ;) ) is - firstboot scripts that only run once? The question sounds like they're looking for something a little more malicious I guess?...
Actually, bootscripts would probably count. The authors here mean code that can only run once and will unconditionally fail if it is executed more than once (such as #!/bin/rm), but a few of the examples can only be run once per session, which bootscripts would likely fit in.
Somehow involve Inspector Gadget's boss -- reading the instructions to you, a dot-picture, the sound of a muffled explosion in a trash can, whatever. "This script will self destruct in five seconds."
Why being so cautious? You can do it mission impossible style ... destroying the whole computer on which the message was displayed - with a white, thick and nasty smoke.
Back in the 80's the group I worked with got a VAX with VMS. Files are versioned in VMS, and you can delete specific versions. So we used that to prank each other for a while, editing someone's login script and deleting the newest version so they couldn't send the same prank back to you.
In Windows, the program should check for the presence of a unique, global atom via GlobalFindAtom(). If present, terminate. If not present, create the atom with GlobalAddAtom() and continue the initial execution of the program.
On Window, you can muck around with child processes that delete their parent. Perhaps more interestingly, you could try to abuse Software Restriction Policies [1]. In theory, you should be able to blacklist your own executable (by hash), so that it can't run ever again. This would also block any copy of the file that you might have kept.
[1] http://technet.microsoft.com/en-us/library/bb457006.aspx