-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c59987
commit 1bb5584
Showing
5 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...mpl/src/test/java/uwu/narumi/deobfuscator/transformer/TestSandboxSecurityTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package uwu.narumi.deobfuscator.transformer; | ||
|
||
import uwu.narumi.deobfuscator.api.asm.ClassWrapper; | ||
import uwu.narumi.deobfuscator.api.context.Context; | ||
import uwu.narumi.deobfuscator.api.execution.SandboxClassLoader; | ||
import uwu.narumi.deobfuscator.api.transformer.Transformer; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
public class TestSandboxSecurityTransformer extends Transformer { | ||
@Override | ||
protected void transform(ClassWrapper scope, Context context) throws Exception { | ||
SandboxClassLoader sandboxClassLoader = new SandboxClassLoader(context); | ||
Class<?> clazz = Class.forName("TestSandboxSecurity", true, sandboxClassLoader); | ||
Method method = clazz.getDeclaredMethod("test"); | ||
// Invoke test method | ||
method.invoke(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
public class TestSandboxSecurity { | ||
public static int test() { | ||
int a = 3; | ||
int b = 4; | ||
int result = a + b; | ||
try { | ||
Files.createFile(Path.of("test.txt")); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return result; | ||
} | ||
} |