/* MrBean.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 MainPanel.class of Sun's HotJava HTML Component Version 1.1.1. In this case, the Maginot licensing software is harmless and works as follows. Each time you use the beans in HotJavaBean.jar to construct a browser in the BDK BeanBox, when the HotJavaBrowserBean class is loaded, it will pop up a window with the following message: "Notice: This is an evaluation copy of the HotJava Browser software. The evaluation license expires 30 days after initial installation. Please visit the JavaSoft web site at http://java.sun.com/products/hotjava for additional licensing information." It will also call System.err.println() to print the same message to stderr. By changing two bytes in MainPanel.class, we disable the licensing software and avoid the annoying messages. To use this Java application, do the following: 1. Create a new folder, say HotJavaBean, and place in it a copy of the jar file HotJavaBean.jar. 2. Move into the new folder, HotJavaBean, and issue the command: jar xvf HotJavaBean.jar Note: You may have to do this twice in order for it to work. It's java, so go figure. 3. Compile MrBean.java to obtain MrBean.class. 4. Place MrBean.class in the new folder in which you "unjarred" HotJavaBean.jar. 5. Run the program with the command "java MrBean". This changes the necessary bytes in MainPanel.class. 6. Create a file, call it MRBEAN.MF, in the new folder, HotJavaBean, and put the following text in it: Name: sunw/hotjava/bean/HotJavaDocumentStack.class Java-Bean: True Name: sunw/hotjava/bean/AuthenticatorBean.class Java-Bean: True Name: sunw/hotjava/bean/HotJavaSystemState.class Java-Bean: True Name: sunw/hotjava/bean/HotJavaBrowserBean.class Java-Bean: True 7. Create a new jar file using the following command: jar cvmf MRBRAN.MF HotJavaBean.jar sunw lib hjResourceBundle.properties Note: If your platform produces different files and folders when it's "unjarred," you should "jar" all but the folder META-INF 8. Place the resulting file, HotJavaBean.jar, in the "jar" folder of the BDK, and remove any files in the folder HotJavaBean that you don't want to keep. Now when you create browsers in the BeanBox, they no longer pop up the annoying frame and print messages about licensing to stderr. Had the licensing software been rigged as a logic bomb to disable software with an expired license, we could just as easily have disarmed it.*/ import java.io.*; class MrBean { public static void main(String[] argv) { String sep = System.getProperty("file.separator"); String hack = "sunw" + sep + "hotjava" + sep + "bean" + sep + "MainPanel.class"; try { // Start by opening the file for reading and writing RandomAccessFile victim = new RandomAccessFile(hack, "rw"); // Put an "iconst_0" instruction (opcode 3) in place of the "iconst_1" // instruction (opcode 4) at byte 1801 victim.seek(1800); victim.writeByte(3); // Put a "goto" instruction (opcode 167) in place of the "ifnonnull" // instruction (opcode 199) at byte 1981 victim.seek(1980); victim.writeByte(167); // That's all for now victim.close(); } catch (IOException ioe) {System.err.println("Oops!");} System.out.println("MainPanel.class has been hacked successfully."); } }