From a2c94f9267bc1a36d94c610b206f8897ee012d29 Mon Sep 17 00:00:00 2001 From: Jeroen Ketelaar Date: Mon, 2 Jul 2018 15:06:39 +0200 Subject: [PATCH 1/3] [BUGFIX] Added support for ImagePS --- .../core/asm/redirect/ClassRedirect.java | 81 ++++++++++++++++--- 1 file changed, 70 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java b/src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java index dde1499..c36a8a2 100644 --- a/src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java +++ b/src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java @@ -6,8 +6,7 @@ import org.parabot.environment.scripts.Script; import java.io.InputStream; import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.lang.reflect.Method; +import java.lang.reflect.*; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.ProtectionDomain; @@ -25,7 +24,7 @@ public class ClassRedirect { } public static Object newInstance(Class c) throws IllegalAccessException, InstantiationException { - if (validStack()) { + if (validStack() || validRequest(c)) { return c.newInstance(); } @@ -34,7 +33,7 @@ public class ClassRedirect { } public static Field getDeclaredField(Class c, String s) throws NoSuchFieldException, SecurityException { - if (validStack()) { + if (validStack() || validRequest(c)) { return c.getDeclaredField(s); } @@ -43,7 +42,7 @@ public class ClassRedirect { } public static Method getDeclaredMethod(Class c, String name, Class... params) throws NoSuchMethodException, SecurityException { - if (validStack()) { + if (validStack() || validRequest(c)) { return c.getDeclaredMethod(name, params); } @@ -65,7 +64,7 @@ public class ClassRedirect { } public static Field[] getDeclaredFields(Class c) { - if (validStack()) { + if (validStack() || validRequest(c)) { return c.getDeclaredFields(); } System.err.println(c.getName() + "#getDeclaredFields()" + " Blocked."); @@ -73,7 +72,7 @@ public class ClassRedirect { } public static Method[] getDeclaredMethods(Class c) { - if (validStack()) { + if (validStack() || validRequest(c)) { return c.getDeclaredMethods(); } System.err.println(c.getName() + "#getDeclaredMethods()" + " Blocked."); @@ -81,7 +80,7 @@ public class ClassRedirect { } public static Field[] getFields(Class c) { - if (validStack()) { + if (validStack() || validRequest(c)) { return c.getFields(); } System.err.println(c.getName() + "#getFields()" + " Blocked."); @@ -89,7 +88,7 @@ public class ClassRedirect { } public static Annotation[] getAnnotations(Class c) { - if (validStack()) { + if (validStack() || validRequest(c)) { return c.getAnnotations(); } System.err.println(c.getName() + "#getFields()" + " Blocked."); @@ -105,7 +104,7 @@ public class ClassRedirect { } public static Method getMethod(Class c, String name, Class... params) throws NoSuchMethodException, SecurityException { - if (validStack()) { + if (validStack() || validRequest(c)) { return c.getMethod(name, params); } System.err.println(c.getName() + "#getMethod()" + " Blocked."); @@ -114,7 +113,7 @@ public class ClassRedirect { public static Field getField(Class c, String name) throws NoSuchFieldException, SecurityException { - if (validStack()) { + if (validStack() || validRequest(c)) { return c.getField(name); } System.err.println(c.getName() + "#getField()" + " Blocked."); @@ -146,6 +145,62 @@ public class ClassRedirect { return !c.getName().contains("parabot") && c.desiredAssertionStatus(); } + public static Type getGenericSuperclass(Class c) { + return c.getGenericSuperclass(); + } + + public static boolean isArray(Class c) { + return c.isArray(); + } + + public static int getModifiers(Class c) { + return c.getModifiers(); + } + + public static Class getEnclosingClass(Class c) { + return c.getEnclosingClass(); + } + + public static boolean isPrimitive(Class c) { + return c.isPrimitive(); + } + + public static boolean isAssignableFrom(Class c1, Class c2) { + return c1.isAssignableFrom(c2); + } + + public static boolean isAnonymousClass(Class c) { + return c.isAnonymousClass(); + } + + public static boolean isLocalClass(Class c) { + return c.isLocalClass(); + } + + public static boolean isInterface(Class c) { + return c.isInterface(); + } + + public static Class[] getInterfaces(Class c) { + return c.getInterfaces(); + } + + public static Type[] getGenericInterfaces(Class c) { + return c.getGenericInterfaces(); + } + + public static TypeVariable[] getTypeParameters(Class c) { + return c.getTypeParameters(); + } + + public static Annotation getAnnotation(Class c, Class annotationClass) { + return c.getAnnotation(annotationClass); + } + + public static Constructor getDeclaredConstructor(Class c, Class[] parameterTypes) throws NoSuchMethodException, SecurityException { + return c.getDeclaredConstructor(parameterTypes); + } + private static boolean validStack() { Exception e = new Exception(); for (StackTraceElement elem : e.getStackTrace()) { @@ -155,4 +210,8 @@ public class ClassRedirect { } return false; } + + private static boolean validRequest(Class c) { + return !c.getName().toLowerCase().contains("parabot"); + } } From e6605c4a75ab3b4bdeece7b818100593117b9489 Mon Sep 17 00:00:00 2001 From: Jeroen Ketelaar Date: Mon, 2 Jul 2018 15:08:24 +0200 Subject: [PATCH 2/3] [TASK] Added verbose line --- src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java b/src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java index c36a8a2..0925aeb 100644 --- a/src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java +++ b/src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java @@ -212,6 +212,7 @@ public class ClassRedirect { } private static boolean validRequest(Class c) { + Core.verbose("Got request for class: " + c.getName()); return !c.getName().toLowerCase().contains("parabot"); } } From 0c79df81eb3ad8118d4e9180eb5ad2cb292f6177 Mon Sep 17 00:00:00 2001 From: Jeroen Ketelaar Date: Tue, 14 Aug 2018 12:32:48 -0500 Subject: [PATCH 3/3] [BUGFIX] Fixed yaml file for labels --- .github/labels.yml | 61 +++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/.github/labels.yml b/.github/labels.yml index b2323c2..0c578ea 100644 --- a/.github/labels.yml +++ b/.github/labels.yml @@ -1,30 +1,31 @@ -- name: priority:low - color: bfe5bf -- name: priority:medium - color: bfe5bf -- name: priority:high - color: bfe5bf -- name: status:accepted - color: fef2c0 -- name: status:unconfirmed - color: fef2c0 -- name: status:needs more info - color: fef2c0 -- name: status:rejected - color: fef2c0 -- name: status:under consideration - color: fef2c0 -- name: type:bug - color: f7c6c7 -- name: type:feature - color: f7c6c7 -- name: type:improvement - color: f7c6c7 -- name: type:question - color: f7c6c7 -- name: os:windows - color: "666699" -- name: os:mac - color: "666699" -- name: os:other - color: "666699" \ No newline at end of file +labels: + - name: priority:low + color: bfe5bf + - name: priority:medium + color: bfe5bf + - name: priority:high + color: bfe5bf + - name: status:accepted + color: fef2c0 + - name: status:unconfirmed + color: fef2c0 + - name: status:needs more info + color: fef2c0 + - name: status:rejected + color: fef2c0 + - name: status:under consideration + color: fef2c0 + - name: type:bug + color: f7c6c7 + - name: type:feature + color: f7c6c7 + - name: type:improvement + color: f7c6c7 + - name: type:question + color: f7c6c7 + - name: os:windows + color: "666699" + - name: os:mac + color: "666699" + - name: os:other + color: "666699" \ No newline at end of file