Re: Can I make a class file self destruct?




"JuanValdex" <0360com@xxxxxxxxx> wrote in message news:1149085527.257404.59510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I would like to be able to access a class file remotely, and send it a
command to self-destruct if it is unlicensed. (We have thieves
distributing our class files without license.)

Can I put some code in the class file to do this?

Maybe access it remotely with...

<applet codebase="http://www.remotesite.com/"; code="myfile.class"...>
<param name="destroyClassFile" value="DoIt">
...

In the class file's code, something like...

String s=getParameter(destroyClassFile");
if (s == "DoIt") {
...code to destroy it
or
...overwrite itself on the server with junk
or
...turn on a function inside the class file to always display a
"this appears to be unlicensed" message
or
... ???
}

Any ideas? How can I send commands to the class file to permanently
change itself?

Probably not. Consider what actually happens when an applet is run:

The client makes an HTTP request to download the applet.
The server reads the class file from disk, and sends whatever bytes it read to the client.
The client takes these bytes and assembles them together to create its own copy of the class file.
The client then runs this class file it has locally.

So what is your applet going to do? It could erase it's own bytecode, in which case you've just destroyed the client's local copy, and not the copy on the server. Or it could tell the client to send nasty messages to the server, in hopes of coaxing it to delete those files, but the server is likely to refuse.


Thank you for your ideas!

Your licensing these applets out to customers, right? How about having the customer specify exactly what domain they plan on using their applets on, and hardcoding the address into the source code of the applet (meaning every customer gets a different .class file). The applet could then check that it's being hosted on the appropriate domain.

- Oliver

.



Relevant Pages

  • Re: Vicki, Is There A Difference ?
    ... in my experience lots of images being called ... up to one applet class file dont work well unless you have the appropriate ... class file which is designed to accomodate multiple images...and the images ... Do you think the removal of the flashing frames made a difference in download time? ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress.stationery)
  • Re: Expiration Date
    ... this server can be running a small java app). ... this will contain the name of the internal class to execute. ... pass back to the client, then implement a "classloader" type setup in the ...
    (comp.lang.java.programmer)
  • Re: Sun Server and applets
    ... since it is a class file. ... A servlet gets executed on the server, while an applet ... Since nothing under WEB-INF is visible to client browsers, ...
    (comp.lang.java.programmer)
  • Re: Applets and Inner class problems
    ... Alex Hunsley wrote: ... >> eclipse, the applet runs fine, given the proper parameters are passed. ... > Internal classes get compiled to seperate class file. ... > your jar! ...
    (comp.lang.java.help)
  • Re: Applets and Inner class problems
    ... > eclipse, the applet runs fine, given the proper parameters are passed. ... Internal classes get compiled to seperate class file. ... your jar! ...
    (comp.lang.java.help)