blob: 30f56a392779cedfb006d351a433a04a55c1c70e (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/* TrustedApplet.java */
import java.awt.*;
import java.applet.*;
import java.util.*;
import java.io.*;
public class TrustedApplet
extends Applet
{
static final String ALLOWED_DIR = "c:\\tmp\\applets\\";
static final String FNAME = "TrustedApplet.log";
static final String LOGMSG = "Erzeugt von Applet: ";
String msg;
public void init()
{
msg = "Uninitialisiert";
FileWriter out = null;
try {
//Ausgabedatei erzeugen
out = new FileWriter(ALLOWED_DIR + FNAME);
//Logmessage schreiben
out.write(LOGMSG);
//Zeitstempel schreiben
GregorianCalendar cal = new GregorianCalendar();
out.write(cal.get(Calendar.DATE) + ".");
out.write((cal.get(Calendar.MONTH) + 1) + ".");
out.write(cal.get(Calendar.YEAR) + " ");
out.write(cal.get(Calendar.HOUR_OF_DAY) + ":");
out.write(cal.get(Calendar.MINUTE) + ":");
out.write(cal.get(Calendar.SECOND) + "");
out.write(System.getProperty("line.separator"));
//System-Properties lesen und in Datei schreiben
out.write(getProp("user.name"));
out.write(getProp("user.home"));
out.write(getProp("user.dir"));
//Datei schlie�en
msg = "Alle Sicherheitshuerden ueberwunden!";
} catch (Exception e) {
msg = e.toString();
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
//silently ignore
}
}
}
}
public void paint(Graphics g)
{
g.drawString(msg, 20, 20);
}
private String getProp(String prop)
{
return prop + "=" +
System.getProperty(prop) +
System.getProperty("line.separator");
}
}
|