Security Manager Cleanup

This commit is contained in:
Konloch 2021-07-12 05:13:35 -07:00
parent 216882c58e
commit 948ae90e50
8 changed files with 14 additions and 16 deletions

View file

@ -73,13 +73,14 @@ public class Constants
*/ */
private static void hideFile(File f) private static void hideFile(File f)
{ {
BytecodeViewer.sm.pauseBlocking();
try { try {
BytecodeViewer.sm.pauseBlocking();
// Hide file by running attrib system command (on Windows) // Hide file by running attrib system command (on Windows)
Runtime.getRuntime().exec("attrib +H " + f.getAbsolutePath()); Runtime.getRuntime().exec("attrib +H " + f.getAbsolutePath());
} catch (Exception e) { } catch (Exception e) {
BytecodeViewer.handleException(e); BytecodeViewer.handleException(e);
} } finally {
BytecodeViewer.sm.resumeBlocking(); BytecodeViewer.sm.resumeBlocking();
} }
} }
}

View file

@ -68,8 +68,8 @@ public class JavaCompiler extends InternalCompiler
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), cp.getAbsolutePath()); JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), cp.getAbsolutePath());
boolean cont = true; boolean cont = true;
BytecodeViewer.sm.pauseBlocking();
try { try {
BytecodeViewer.sm.pauseBlocking();
StringBuilder log = new StringBuilder(); StringBuilder log = new StringBuilder();
ProcessBuilder pb; ProcessBuilder pb;

View file

@ -65,9 +65,9 @@ public class KrakatauAssembler extends InternalCompiler
StringBuilder log = new StringBuilder(); StringBuilder log = new StringBuilder();
BytecodeViewer.sm.pauseBlocking();
try try
{ {
BytecodeViewer.sm.pauseBlocking();
ProcessBuilder pb = new ProcessBuilder( ProcessBuilder pb = new ProcessBuilder(
Configuration.python2, Configuration.python2,
"-O", //love you storyyeller <3 "-O", //love you storyyeller <3

View file

@ -88,12 +88,12 @@ public class FernFlowerDecompiler extends InternalDecompiler
{ {
try try
{ {
BytecodeViewer.sm.pauseBlocking();
ProcessBuilder pb = new ProcessBuilder(ArrayUtils.addAll( ProcessBuilder pb = new ProcessBuilder(ArrayUtils.addAll(
new String[]{ExternalResources.getSingleton().getJavaCommand(true), "-jar", ExternalResources.getSingleton().findLibrary("fernflower")}, new String[]{ExternalResources.getSingleton().getJavaCommand(true), "-jar", ExternalResources.getSingleton().findLibrary("fernflower")},
generateMainMethod(tempClass.getAbsolutePath(), generateMainMethod(tempClass.getAbsolutePath(),
new File(tempDirectory).getAbsolutePath()) new File(tempDirectory).getAbsolutePath())
)); ));
BytecodeViewer.sm.pauseBlocking();
Process p = pb.start(); Process p = pb.start();
BytecodeViewer.createdProcesses.add(p); BytecodeViewer.createdProcesses.add(p);
p.waitFor(); p.waitFor();

View file

@ -91,8 +91,8 @@ public class KrakatauDecompiler extends InternalDecompiler
String s = ExceptionUI.SEND_STACKTRACE_TO_NL; String s = ExceptionUI.SEND_STACKTRACE_TO_NL;
BytecodeViewer.sm.pauseBlocking();
try { try {
BytecodeViewer.sm.pauseBlocking();
ProcessBuilder pb = new ProcessBuilder( ProcessBuilder pb = new ProcessBuilder(
Configuration.python2, Configuration.python2,
"-O", //love you storyyeller <3 "-O", //love you storyyeller <3
@ -171,9 +171,8 @@ public class KrakatauDecompiler extends InternalDecompiler
JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath());
BytecodeViewer.sm.pauseBlocking();
try { try {
BytecodeViewer.sm.pauseBlocking();
ProcessBuilder pb = new ProcessBuilder( ProcessBuilder pb = new ProcessBuilder(
Configuration.python2, Configuration.python2,
"-O", //love you storyyeller <3 "-O", //love you storyyeller <3
@ -247,12 +246,10 @@ public class KrakatauDecompiler extends InternalDecompiler
final File tempDirectory = new File(Constants.tempDirectory + fs + ran + fs); final File tempDirectory = new File(Constants.tempDirectory + fs + ran + fs);
tempDirectory.mkdir(); tempDirectory.mkdir();
final File tempJar = new File(sourceJar); final File tempJar = new File(sourceJar);
BytecodeViewer.sm.pauseBlocking();
try { try {
BytecodeViewer.sm.pauseBlocking();
ProcessBuilder pb = new ProcessBuilder( ProcessBuilder pb = new ProcessBuilder(
Configuration.python2, Configuration.python2,
"-O", //love you storyyeller <3 "-O", //love you storyyeller <3

View file

@ -58,8 +58,8 @@ public class KrakatauDisassembler extends InternalDecompiler
final File tempJar = new File(Constants.tempDirectory + fs + "temp" + MiscUtils.randomString(32) + ".jar"); final File tempJar = new File(Constants.tempDirectory + fs + "temp" + MiscUtils.randomString(32) + ".jar");
JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath());
BytecodeViewer.sm.pauseBlocking();
try { try {
BytecodeViewer.sm.pauseBlocking();
ProcessBuilder pb = new ProcessBuilder( ProcessBuilder pb = new ProcessBuilder(
Configuration.python2, Configuration.python2,
"-O", //love you storyyeller <3 "-O", //love you storyyeller <3
@ -122,8 +122,8 @@ public class KrakatauDisassembler extends InternalDecompiler
final File tempJar = new File(sourceJar); final File tempJar = new File(sourceJar);
BytecodeViewer.sm.pauseBlocking();
try { try {
BytecodeViewer.sm.pauseBlocking();
ProcessBuilder pb = new ProcessBuilder( ProcessBuilder pb = new ProcessBuilder(
Configuration.python2, Configuration.python2,
"-O", //love you storyyeller <3 "-O", //love you storyyeller <3

View file

@ -57,9 +57,9 @@ public class ExternalResources
if(!empty) if(!empty)
return Configuration.java; return Configuration.java;
BytecodeViewer.sm.pauseBlocking();
try try
{ {
BytecodeViewer.sm.pauseBlocking();
//TODO read the version output to verify it exists //TODO read the version output to verify it exists
ProcessBuilder pb = new ProcessBuilder("java", "-version"); ProcessBuilder pb = new ProcessBuilder("java", "-version");
pb.start(); pb.start();

View file

@ -50,8 +50,8 @@ public class Enjarify {
return; return;
} }
BytecodeViewer.sm.pauseBlocking();
try { try {
BytecodeViewer.sm.pauseBlocking();
ProcessBuilder pb = new ProcessBuilder( ProcessBuilder pb = new ProcessBuilder(
Configuration.python3, Configuration.python3,
"-O", "-O",