(String jarName,String classname)
| 4 | |
| 5 | public class JarFileReader { |
| 6 | public static void Test(String jarName,String classname) throws IOException { |
| 7 | URL url1 = new URL("jar:file:"+jarName.replaceAll("\\","/")+"!"+classname); |
| 8 | URL url2 = new URL("jar:file:"+jarName.replaceAll("\\","/")+"!"+classname); |
| 9 | // 标准输入流 |
| 10 | try { |
| 11 | InputStream is1 = url1.openStream(); |
| 12 | InputStream is2 = url2.openStream(); |
| 13 | if (processEvilPackage(is1)&&processReadObject(is2)) { |
| 14 | System.out.println(classname + " this class maybe have XXE!!!!!!!!!"); |
| 15 | } |
| 16 | }catch (Exception e) |
| 17 | { |
| 18 | System.out.println(classname + " java.io.FileNotFoundException"); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | private static boolean processEvilPackage(InputStream input) throws IOException { |
| 23 | InputStreamReader isr = new InputStreamReader(input); |
no test coverage detected