1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-02 11:36:22 +01:00

Bridge the classloaders using self-reference

This commit is contained in:
Ashley Donaldson 2023-09-11 12:47:03 +10:00
parent 0a71bcd5ea
commit dba2cb9263

View File

@ -50,6 +50,12 @@ public class JarFileClassLoader extends ClassLoader {
@Override
public Class loadClass(String name) throws ClassNotFoundException {
// The dynamic loading requires knowledge of this classloader, but
// the default classloader doesn't know about it; so we bridge that
// gap by returning our own class when requested.
if (name.equals(getClass().getName())) {
return getClass();
}
try {
return super.loadClass(name);
} catch (ClassNotFoundException e) {