| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
import java.applet.Applet; |
| 39 |
import java.io.File; |
| 40 |
import java.io.IOException; |
| 41 |
import java.lang.reflect.*; |
| 42 |
import java.net.JarURLConnection; |
| 43 |
import java.net.MalformedURLException; |
| 44 |
import java.net.URL; |
| 45 |
|
| 46 |
public class Kemtrak extends Applet { |
| 47 |
|
| 48 |
private class Killer extends Thread { |
| 49 |
|
| 50 |
public int n = 1000; |
| 51 |
|
| 52 |
@Override |
| 53 |
public void run() { |
| 54 |
try { |
| 55 |
Thread.sleep(n); |
| 56 |
System.out.println("Applet killing himself after " + n + " ms of life"); |
| 57 |
System.exit(0); |
| 58 |
} catch (Exception ex) { |
| 59 |
} |
| 60 |
} |
| 61 |
} |
| 62 |
private Killer killer; |
| 63 |
|
| 64 |
public static void main(String[] args) throws IOException { |
| 65 |
System.out.println("Kemtrak2"); |
| 66 |
if (args.length == 2 && args[0].equals("closeJar")) { |
| 67 |
String cbase = args[1]; |
| 68 |
System.out.println("Closing Jar!"); |
| 69 |
URL localURL = new java.net.URL("jar", "", cbase + "jcalendar.jar!/"); |
| 70 |
JarURLConnection localObject3 = (java.net.JarURLConnection) localURL.openConnection(); |
| 71 |
java.util.jar.JarFile localJarFile = ((java.net.JarURLConnection) localObject3).getJarFile(); |
| 72 |
String str9 = localJarFile.getName(); |
| 73 |
int i3 = localJarFile.size(); |
| 74 |
localJarFile.close(); |
| 75 |
System.out.println("jcalendar " + localURL + " " + str9 + ", entrie: " + i3); |
| 76 |
|
| 77 |
jcalendar2(); |
| 78 |
} else { |
| 79 |
jcalendar1(); |
| 80 |
} |
| 81 |
System.out.println("kemtrak finished"); |
| 82 |
} |
| 83 |
|
| 84 |
@Override |
| 85 |
public void init() { |
| 86 |
try { |
| 87 |
System.out.println("Kemtrak1"); |
| 88 |
String cj = this.getParameter("closeJar"); |
| 89 |
if ("closeJar".equals(cj)) { |
| 90 |
Kemtrak.main(new String[]{"closeJar", getCodeBase().toExternalForm()}); |
| 91 |
} else { |
| 92 |
Kemtrak.main(new String[0]); |
| 93 |
} |
| 94 |
} catch (IOException u) { |
| 95 |
throw new RuntimeException(u); |
| 96 |
} finally { |
| 97 |
killer = new Killer(); |
| 98 |
killer.start(); |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
public static void jcalendar1() { |
| 106 |
try { |
| 107 |
Class<?> signedAppletClass = Class.forName("jcalendar"); |
| 108 |
Method m = signedAppletClass.getMethod("main1", String[].class); |
| 109 |
m.invoke(null, (Object) null); |
| 110 |
} catch (Exception e) { |
| 111 |
throw new RuntimeException(e); |
| 112 |
} |
| 113 |
} |
| 114 |
|
| 115 |
public static void jcalendar2() { |
| 116 |
try { |
| 117 |
Class<?> signedAppletClass = Class.forName("jcalendar"); |
| 118 |
Method m = signedAppletClass.getMethod("main2", String[].class); |
| 119 |
m.invoke(null, (Object) null); |
| 120 |
} catch (Exception e) { |
| 121 |
throw new RuntimeException(e); |
| 122 |
} |
| 123 |
} |
| 124 |
|
| 125 |
} |