| 17 | import java.util.Set; |
| 18 | |
| 19 | public class ClassLoaderUtils { |
| 20 | // @FXML |
| 21 | // public ListView vullist_listview; |
| 22 | // public void initvullist() { |
| 23 | // String basePath = System.getProperty("user.dir")+ File.separator+"plugins"+ File.separator; |
| 24 | // File file = new File(basePath); |
| 25 | // // get the folder list |
| 26 | // File[] arrayfilename = file.listFiles(); |
| 27 | //// final Reflections reflections = new Reflections(Payload.class.getPackage().getName()); |
| 28 | //// final Set<Class<? extends Payload>> payloadTypes = reflections.getSubTypesOf(Payload.class); |
| 29 | // final Set<Class<? extends Payload>> payloadTypes = new HashSet<>(); |
| 30 | // |
| 31 | // try { |
| 32 | // URL[] urls = new URL[arrayfilename.length]; |
| 33 | // for (int i = 0; i <arrayfilename.length; i++) { |
| 34 | // URL url = arrayfilename[i].toURI().toURL(); |
| 35 | // urls[i] = url; |
| 36 | // System.out.println(arrayfilename[i].getAbsolutePath()); |
| 37 | // } |
| 38 | // ClassLoader classLoader = new URLClassLoader( urls, null ); |
| 39 | // Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); |
| 40 | // if (!method.isAccessible()) { |
| 41 | // method.setAccessible(true); |
| 42 | // } |
| 43 | // |
| 44 | // for (int i = 0;i < urls.length;i++){ |
| 45 | // try { |
| 46 | // method.invoke(classLoader, urls[i]); |
| 47 | // String theclassname = "vulpayload."+arrayfilename[i].getName().substring(0,arrayfilename[i].getName().indexOf(".")); |
| 48 | // Class<? extends Payload> tmpclass = (Class<? extends Payload>) classLoader.loadClass(theclassname); |
| 49 | // payloadTypes.add(tmpclass); |
| 50 | // }catch (Exception e){ |
| 51 | // e.printStackTrace(); |
| 52 | // } |
| 53 | // } |
| 54 | // Class.forName("ysoserial.payloads.URLDNS"); |
| 55 | // |
| 56 | // }catch (Exception e){ |
| 57 | // e.printStackTrace(); |
| 58 | // } |
| 59 | // |
| 60 | // |
| 61 | // |
| 62 | // |
| 63 | // System.out.print(Payload.class.getPackage().getName()); |
| 64 | // PayloadClasses = new ArrayList<Class<? extends Payload>>(payloadTypes); |
| 65 | // ObservableList strList = FXCollections.observableArrayList(); |
| 66 | // for(int i=0; i<PayloadClasses.size(); i++) { |
| 67 | //// Class selected_vulpaylod_class = PayloadClasses.get(i); |
| 68 | // String selected_vulpayload_name = PayloadClasses.get(i).getName().replace("vulpayload.",""); |
| 69 | // strList.add(selected_vulpayload_name); |
| 70 | // } |
| 71 | // |
| 72 | // //设置监听器 |
| 73 | // vullist_listview.setItems(strList); |
| 74 | // vullist_listview.getSelectionModel().selectedItemProperty().addListener(new FXMLDocumentController.ListItemChangeListener()); |
| 75 | // |
| 76 | // } |
nothing calls this directly
no outgoing calls
no test coverage detected