/* Timeout.java by Mark D. LaDue */

/* December 7, 1997 */

/* Copyright (c) 1997 Mark D. LaDue
   You may study, use, modify, and distribute this example for any purpose.
   This example is provided WITHOUT WARRANTY either expressed or implied.  */

/* This Java application hacks the class Admin.class of JTimer 1.0.
   JTimer is protected by itself, and it includes a license that expired
   on Sun Nov 23 23:53:12 CST 1997.  While it still runs with the expired
   license, it prints the following error message:

   "The evaluation period has expired
    Please purchase a copy or stop using the software"

   By changing a single byte in Admin.class, we disable the JTimer licensing
   software and avoid the annoying message.  The same technique will work
   for any software "protected" by JTimer.

   To use this Java application, do the following:

   1. Compile Timeout.java to obtain Timeout.class.

   2. Place Timeout.class in the "timer" folder, JTimer's home, where you'll
      see other folders such as "bin," "guide," "man," and "tea."

   3. Run the program with the command "java Timeout".

   This changes the necessary byte in Admin.class. */

import java.io.*;

class Timeout {
    public static void main(String[] argv) {

        String sep = System.getProperty("file.separator");
        String hack = "tea" + sep + "set" + sep + "timer" + sep + "Admin.class";

        try {

// Start by opening the file for reading and writing
            RandomAccessFile victim = new RandomAccessFile(hack, "rw");

// Now put a "goto" instruction (opcode 167) at byte 4192
            victim.seek(4191);
            victim.writeByte(167);

// That's all for now
            victim.close();
        } catch (IOException ioe) {System.err.println("Oops!");}
    System.out.println("JTimer 1.0 has been hacked successfully.");
    }
}
