Can trusted 1.5 applets execute system commands?

If so, are there any limitations to this ability? In particular, I need to target Mac OSX.

+4
source share
3 answers

As it turned out, they can.

+4
source

I used this before to run things on a Windows system, I have never tried it on a Mac, though.

public void launchScript(String args) { String cmd = null; try { cmd = getParameter(PARAM_CMD); System.out.println("args value : = " + args); System.out.println("cmd value : = " + cmd); System.out.println("Full command: = " + cmd + " " + args); if (cmd != null && !cmd.trim().equals("")) { if (args == null || args.trim().equals("")) { final String tempcmd = cmd; AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { Runtime.getRuntime().exec(tempcmd); } catch (Exception e) { System.out.println("Caught exception in privileged block, Exception:" + e.toString()); } return null; // nothing to return } }); System.out.println(cmd); } else { final String tempargs = args; final String tempcmd1 = cmd; AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { Runtime.getRuntime().exec(tempcmd1 + " " + tempargs); } catch (Exception e) { System.out.println("Caught exception in privileged block, Exception:" + e.toString()); } return null; // nothing to return } }); System.out.println(cmd + " " + args); } } else { System.out.println("execCmd parameter is null or empty"); } } catch (Exception e) { System.out.println("Error executing command --> " + cmd + " (" + args + ")"); System.out.println(e); } } 
+5
source

The only related issue that I know of is that using the old “classic” PlugIn in Internet Explorer in Windows Vista, the applet started in a “low integrity” process, which prevented it from being particularly useful.

As always, my usual advice is to know what you are doing before signing any code.

0
source

All Articles