(String[] args)
| 75 | } |
| 76 | |
| 77 | public static void main(String[] args) { |
| 78 | ObjectMapper mapper = new ObjectMapper(); |
| 79 | JsonNode node = null; |
| 80 | try { |
| 81 | node = mapper.readTree(getData("data")); |
| 82 | } catch (IOException e) { |
| 83 | e.printStackTrace(); |
| 84 | } |
| 85 | |
| 86 | assert node != null; |
| 87 | JsonNode results = node.get("results"); |
| 88 | |
| 89 | Object object_input = null; |
| 90 | System.out.println("-----------------Loading data,including" + results.size() + "gadget chains!-----------------"); |
| 91 | |
| 92 | for (int i=0;i<results.size();i++) { |
| 93 | System.out.println("------------------------Gadget Chain" + (i+1) + "-----------------------"); |
| 94 | int SourceID = results.get(i).get("SourceID").intValue(); |
| 95 | int SinkID = results.get(i).get("Sink").intValue(); |
| 96 | System.out.println( "Source:" + get_ClassName(results, i, SourceID) + "." + get_MethodName(results, i, SourceID)); |
| 97 | System.out.println( "Sink:" + get_ClassName(results, i, SinkID) + "." + get_MethodName(results, i, SinkID)); |
| 98 | |
| 99 | try { |
| 100 | object_input = object_init(get_ClassName(results, i, SourceID)); |
| 101 | } catch (Exception e) { |
| 102 | e.printStackTrace(); |
| 103 | } |
| 104 | ArrayList<Object> object_list = new ArrayList<>(); |
| 105 | object_list.add(object_input); |
| 106 | |
| 107 | JsonNode Edges = results.get(i).get("Edges"); |
| 108 | a:for (int j = 0; j < Edges.size(); j++ ) { |
| 109 | String relation = Edges.get(j).get("relation").textValue(); |
| 110 | if (relation.equals("ALIAS")) { |
| 111 | String ReflectClass = get_ClassName(results, i, Edges.get(j).get("Exit_id").intValue()); |
| 112 | Class<?> clazz = null; |
| 113 | try { |
| 114 | clazz = Class.forName(ReflectClass); |
| 115 | } catch (ClassNotFoundException e) { |
| 116 | e.printStackTrace(); |
| 117 | } |
| 118 | assert clazz != null; |
| 119 | Class<?>[] interfaces = clazz.getInterfaces(); |
| 120 | String Polluted_Class = null; |
| 121 | for (Class<?> inter : interfaces) { |
| 122 | if (inter.getName().equals("java.io.Serializable")) |
| 123 | continue; |
| 124 | Polluted_Class = inter.getName(); |
| 125 | } |
| 126 | try { |
| 127 | object_list.add(object_init(ReflectClass)); |
| 128 | } catch (Exception e) { |
| 129 | e.printStackTrace(); |
| 130 | } |
| 131 | Field[] fields = object_list.get(object_list.size()-2).getClass().getDeclaredFields();//获取所有属性 |
| 132 | int count_fields = 1; |
| 133 | for (Field field : fields) { |
| 134 | field.setAccessible(true); |
nothing calls this directly
no test coverage detected