mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 16:49:10 +00:00
[TASK]Added getResource() to catch error and fixed inverted statement
This commit is contained in:
@@ -7,6 +7,7 @@ import org.parabot.environment.scripts.Script;
|
||||
import java.io.InputStream;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.*;
|
||||
import java.net.URL;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.ProtectionDomain;
|
||||
@@ -58,6 +59,15 @@ public class ClassRedirect {
|
||||
return Class.forName(name);
|
||||
}
|
||||
|
||||
public static URL getResource(Class<?> c, String path) {
|
||||
if(validStack() || validRequest(c)) {
|
||||
return c.getResource(path);
|
||||
}
|
||||
|
||||
System.err.println(c.getName() + "#getResource(" + path + ") Blocked.");
|
||||
throw RedirectClassAdapter.createSecurityException();
|
||||
}
|
||||
|
||||
public static ClassLoader getClassLoader(Class<?> c) {
|
||||
System.err.println(c.getName() + "#getClassLoader()" + " Blocked.");
|
||||
throw RedirectClassAdapter.createSecurityException();
|
||||
@@ -213,6 +223,6 @@ public class ClassRedirect {
|
||||
|
||||
private static boolean validRequest(Class c) {
|
||||
Core.verbose("Got request for class: " + c.getName());
|
||||
return !c.getName().toLowerCase().contains("parabot");
|
||||
return c.getName().toLowerCase().contains("parabot");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user