From 036746d7da9e9fecf19570fd9461dbb3f67c43a4 Mon Sep 17 00:00:00 2001 From: Andy Nguyen Date: Fri, 5 Nov 2021 18:23:20 +0100 Subject: [PATCH] Restructure source code. --- Makefile | 8 ++++---- src/com/bdjb/JIT.java | 1 + src/com/bdjb/{ => api}/API.java | 4 +--- src/com/bdjb/{ => api}/UnsafeInterface.java | 2 +- src/com/bdjb/{ => api}/UnsafeJdkImpl.java | 2 +- src/com/bdjb/{ => api}/UnsafeSunImpl.java | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) rename src/com/bdjb/{ => api}/API.java (99%) rename src/com/bdjb/{ => api}/UnsafeInterface.java (97%) rename src/com/bdjb/{ => api}/UnsafeJdkImpl.java (99%) rename src/com/bdjb/{ => api}/UnsafeSunImpl.java (99%) diff --git a/Makefile b/Makefile index cd0973c..3de036e 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,12 @@ TOOLS = tools CLASSES = \ $(SRC)/com/bdjb/ExploitXlet.java \ $(SRC)/com/bdjb/Exploit.java \ - $(SRC)/com/bdjb/UnsafeInterface.java \ - $(SRC)/com/bdjb/UnsafeJdkImpl.java \ - $(SRC)/com/bdjb/UnsafeSunImpl.java \ - $(SRC)/com/bdjb/API.java \ $(SRC)/com/bdjb/JIT.java \ $(SRC)/com/bdjb/Screen.java \ + $(SRC)/com/bdjb/api/API.java \ + $(SRC)/com/bdjb/api/UnsafeInterface.java \ + $(SRC)/com/bdjb/api/UnsafeJdkImpl.java \ + $(SRC)/com/bdjb/api/UnsafeSunImpl.java \ $(SRC)/com/bdjb/exploit/sandbox/ExploitSandboxInterface.java \ $(SRC)/com/bdjb/exploit/sandbox/ExploitDefaultImpl.java \ $(SRC)/com/bdjb/exploit/sandbox/ExploitUserPrefsImpl.java \ diff --git a/src/com/bdjb/JIT.java b/src/com/bdjb/JIT.java index 7f2a8db..e494b23 100644 --- a/src/com/bdjb/JIT.java +++ b/src/com/bdjb/JIT.java @@ -7,6 +7,7 @@ package com.bdjb; +import com.bdjb.api.API; import java.io.RandomAccessFile; /** diff --git a/src/com/bdjb/API.java b/src/com/bdjb/api/API.java similarity index 99% rename from src/com/bdjb/API.java rename to src/com/bdjb/api/API.java index bd1da1c..f31bfc3 100644 --- a/src/com/bdjb/API.java +++ b/src/com/bdjb/api/API.java @@ -5,7 +5,7 @@ * of the MIT license. See the LICENSE file for details. */ -package com.bdjb; +package com.bdjb.api; import java.io.ByteArrayOutputStream; import java.lang.reflect.Constructor; @@ -136,7 +136,6 @@ public final class API { } __Ux86_64_setcontext = dlsym(LIBKERNEL_MODULE_HANDLE, UX86_64_SETCONTEXT_SYMBOL); - if (__Ux86_64_setcontext == 0) { // In earlier versions, there's a bug where only the main executable's handle is used. executableHandle = JVM_NativePath & ~(4 - 1); @@ -148,7 +147,6 @@ public final class API { // Try again. __Ux86_64_setcontext = dlsym(LIBKERNEL_MODULE_HANDLE, UX86_64_SETCONTEXT_SYMBOL); } - if (__Ux86_64_setcontext == 0) { throw new IllegalStateException("Could not find __Ux86_64_setcontext."); } diff --git a/src/com/bdjb/UnsafeInterface.java b/src/com/bdjb/api/UnsafeInterface.java similarity index 97% rename from src/com/bdjb/UnsafeInterface.java rename to src/com/bdjb/api/UnsafeInterface.java index 511f38e..236dc59 100644 --- a/src/com/bdjb/UnsafeInterface.java +++ b/src/com/bdjb/api/UnsafeInterface.java @@ -5,7 +5,7 @@ * of the MIT license. See the LICENSE file for details. */ -package com.bdjb; +package com.bdjb.api; import java.lang.reflect.Field; diff --git a/src/com/bdjb/UnsafeJdkImpl.java b/src/com/bdjb/api/UnsafeJdkImpl.java similarity index 99% rename from src/com/bdjb/UnsafeJdkImpl.java rename to src/com/bdjb/api/UnsafeJdkImpl.java index be0b329..0a28542 100644 --- a/src/com/bdjb/UnsafeJdkImpl.java +++ b/src/com/bdjb/api/UnsafeJdkImpl.java @@ -5,7 +5,7 @@ * of the MIT license. See the LICENSE file for details. */ -package com.bdjb; +package com.bdjb.api; import java.lang.reflect.Field; import java.lang.reflect.Method; diff --git a/src/com/bdjb/UnsafeSunImpl.java b/src/com/bdjb/api/UnsafeSunImpl.java similarity index 99% rename from src/com/bdjb/UnsafeSunImpl.java rename to src/com/bdjb/api/UnsafeSunImpl.java index 3e53e4a..042e573 100644 --- a/src/com/bdjb/UnsafeSunImpl.java +++ b/src/com/bdjb/api/UnsafeSunImpl.java @@ -5,7 +5,7 @@ * of the MIT license. See the LICENSE file for details. */ -package com.bdjb; +package com.bdjb.api; import java.lang.reflect.Field; import sun.misc.Unsafe;