Merge pull request #328 from ThexXTURBOXx/convenience-stuff

Convenience stuff
This commit is contained in:
Konloch 2021-07-20 09:20:47 -07:00 committed by GitHub
commit b9bf92adb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 38 additions and 23 deletions

32
pom.xml
View file

@ -226,7 +226,12 @@
<dependency> <dependency>
<groupId>com.github.weisj</groupId> <groupId>com.github.weisj</groupId>
<artifactId>darklaf-core</artifactId> <artifactId>darklaf-core</artifactId>
<version>2.6.2-SNAPSHOT</version> <!-- TODO Change to release when ready --> <version>2.6.2-20210719.010320-83</version> <!-- TODO Change to release when ready -->
</dependency>
<dependency>
<groupId>com.github.weisj</groupId>
<artifactId>darklaf-windows</artifactId>
<version>2.6.2-20210719.010320-83</version> <!-- TODO Remove when ready -->
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.weisj</groupId> <groupId>com.github.weisj</groupId>
@ -237,19 +242,6 @@
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version> <!-- 3.1.2 breaks build on JDK 9+ -->
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>the.bytecode.club.bytecodeviewer.BytecodeViewer</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
@ -287,9 +279,21 @@
<exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude> <exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/*LICENSE*</exclude>
<exclude>META-INF/*NOTICE*</exclude>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes> </excludes>
</filter> </filter>
</filters> </filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>the.bytecode.club.bytecodeviewer.BytecodeViewer</mainClass>
<manifestEntries>
<Implementation-Version>${project.version}</Implementation-Version>
</manifestEntries>
</transformer>
</transformers>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View file

@ -16,7 +16,7 @@ import java.io.PrintStream;
public class Constants public class Constants
{ {
/*per version*/ /*per version*/
public static final String VERSION = "2.10.14"; //could be loaded from the pom public static final String VERSION = BytecodeViewer.class.getPackage().getImplementationVersion();
public static String krakatauVersion = "12"; public static String krakatauVersion = "12";
public static String enjarifyVersion = "4"; public static String enjarifyVersion = "4";
public static final boolean BLOCK_TAB_MENU = true; public static final boolean BLOCK_TAB_MENU = true;

View file

@ -51,8 +51,6 @@ public class KrakatauAssembler extends InternalCompiler
if(!ExternalResources.getSingleton().hasSetPython2Command()) if(!ExternalResources.getSingleton().hasSetPython2Command())
return null; return null;
String origName = MiscUtils.randomString(20);
File tempD = new File(Constants.tempDirectory + fs + MiscUtils.randomString(32) + fs); File tempD = new File(Constants.tempDirectory + fs + MiscUtils.randomString(32) + fs);
tempD.mkdir(); tempD.mkdir();

View file

@ -11,7 +11,6 @@ import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.Deque; import java.util.Deque;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Objects;
import java.util.Random; import java.util.Random;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;

View file

@ -26,6 +26,8 @@ import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.SettingsSerializer; import the.bytecode.club.bytecodeviewer.SettingsSerializer;
import the.bytecode.club.bytecodeviewer.resources.Resource; import the.bytecode.club.bytecodeviewer.resources.Resource;
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer; import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
import the.bytecode.club.bytecodeviewer.translation.TranslatedStrings;
import the.bytecode.club.bytecodeviewer.translation.Translation;
import the.bytecode.club.bytecodeviewer.util.MethodParser; import the.bytecode.club.bytecodeviewer.util.MethodParser;
import static the.bytecode.club.bytecodeviewer.util.MethodParser.Method; import static the.bytecode.club.bytecodeviewer.util.MethodParser.Method;
@ -89,7 +91,14 @@ public class ClassViewer extends ResourceViewer
{ {
setPanes(); setPanes();
refreshTitle(); refreshTitle();
// Warn user if no Decompiler is selected
if (bytecodeViewPanel1.decompiler == Decompiler.NONE
&& bytecodeViewPanel2.decompiler == Decompiler.NONE
&& bytecodeViewPanel3.decompiler == Decompiler.NONE) {
BytecodeViewer.showMessage(TranslatedStrings.SUGGESTED_FIX_NO_DECOMPILER_WARNING.toString());
}
bytecodeViewPanel1.createPane(this); bytecodeViewPanel1.createPane(this);
bytecodeViewPanel2.createPane(this); bytecodeViewPanel2.createPane(this);
bytecodeViewPanel3.createPane(this); bytecodeViewPanel3.createPane(this);

View file

@ -117,16 +117,16 @@ public abstract class MalwareCodeScanner implements CodeScanner
public void foundLDC(MalwareScan scan, String ldc, String foundAt) public void foundLDC(MalwareScan scan, String ldc, String foundAt)
{ {
scan.sb.append(header() + " Found LDC \"").append(ldc).append("\" ").append(foundAt); scan.sb.append(header()).append(" Found LDC \"").append(ldc).append("\" ").append(foundAt);
} }
public void foundMethod(MalwareScan scan, String foundAt) public void foundMethod(MalwareScan scan, String foundAt)
{ {
scan.sb.append(header() + " Found Method call to ").append(foundAt); scan.sb.append(header()).append(" Found Method call to ").append(foundAt);
} }
public void found(MalwareScan scan, String found) public void found(MalwareScan scan, String found)
{ {
scan.sb.append(header() + " Found ").append(found); scan.sb.append(header()).append(" Found ").append(found);
} }
} }

View file

@ -84,6 +84,7 @@ public enum TranslatedStrings
FIRST_OPEN_A_RESOURCE, FIRST_OPEN_A_RESOURCE,
FIRST_OPEN_A_CLASS, FIRST_OPEN_A_CLASS,
FIRST_VIEW_A_CLASS, FIRST_VIEW_A_CLASS,
SUGGESTED_FIX_NO_DECOMPILER_WARNING,
DRAG_CLASS_JAR, DRAG_CLASS_JAR,
; ;

View file

@ -226,6 +226,7 @@ public enum Translation
ERROR, ERROR,
SUGGESTED_FIX_DECOMPILER_ERROR, SUGGESTED_FIX_DECOMPILER_ERROR,
SUGGESTED_FIX_COMPILER_ERROR, SUGGESTED_FIX_COMPILER_ERROR,
SUGGESTED_FIX_NO_DECOMPILER_WARNING,
PROCYON_DECOMPILER, PROCYON_DECOMPILER,
CFR_DECOMPILER, CFR_DECOMPILER,
FERNFLOWER_DECOMPILER, FERNFLOWER_DECOMPILER,

View file

@ -1,5 +1,6 @@
package the.bytecode.club.bytecodeviewer.util; package the.bytecode.club.bytecodeviewer.util;
import java.util.Objects;
import me.konloch.kontainer.io.HTTPRequest; import me.konloch.kontainer.io.HTTPRequest;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.Configuration;
@ -58,7 +59,7 @@ public class VersionChecker implements Runnable
} }
if (!VERSION.equals(version)) if (VERSION != null && !VERSION.equals(version))
{ {
MultipleChoiceDialogue outdatedDialogue = new MultipleChoiceDialogue("Bytecode Viewer - Outdated Version", MultipleChoiceDialogue outdatedDialogue = new MultipleChoiceDialogue("Bytecode Viewer - Outdated Version",
"Your version: " + VERSION + ", latest version: " "Your version: " + VERSION + ", latest version: "

View file

@ -126,6 +126,7 @@
"NEW_JAVASCRIPT_PLUGIN": "New Javascript Plugin", "NEW_JAVASCRIPT_PLUGIN": "New Javascript Plugin",
"SUGGESTED_FIX_DECOMPILER_ERROR": "Suggested Fix: Click refresh class, if it fails again try another decompiler.", "SUGGESTED_FIX_DECOMPILER_ERROR": "Suggested Fix: Click refresh class, if it fails again try another decompiler.",
"SUGGESTED_FIX_COMPILER_ERROR": "Suggested Fix: Try View>Pane>Krakatau>Bytecode and enable Editable.", "SUGGESTED_FIX_COMPILER_ERROR": "Suggested Fix: Try View>Pane>Krakatau>Bytecode and enable Editable.",
"SUGGESTED_FIX_NO_DECOMPILER_WARNING": "WARNING: No decompiler is currently selected. Try View>Pane and choose a decompiler.",
"COMPILER_TIP": "Keep in mind most decompilers cannot produce compilable classes", "COMPILER_TIP": "Keep in mind most decompilers cannot produce compilable classes",
"FIRST_OPEN_A_RESOURCE": "First open a resource inside of BCV (class, jar, zip or apk file)", "FIRST_OPEN_A_RESOURCE": "First open a resource inside of BCV (class, jar, zip or apk file)",
"FIRST_OPEN_A_CLASS": "First open a classfile resource inside of BCV (jar, zip, apk, dex)", "FIRST_OPEN_A_CLASS": "First open a classfile resource inside of BCV (jar, zip, apk, dex)",

View file

@ -93,6 +93,7 @@
"ERROR": "Fehler", "ERROR": "Fehler",
"SUGGESTED_FIX_DECOMPILER_ERROR": "Vorgeschlagene Lösung: Klicken Sie auf Klasse aktualisieren und wenn es wieder fehlschlägt, versuchen Sie einen anderen Dekompilierer.", "SUGGESTED_FIX_DECOMPILER_ERROR": "Vorgeschlagene Lösung: Klicken Sie auf Klasse aktualisieren und wenn es wieder fehlschlägt, versuchen Sie einen anderen Dekompilierer.",
"SUGGESTED_FIX_COMPILER_ERROR": "Vorgeschlagene Lösung: Aktivieren Sie unter Ansicht>Fenster>Krakatau>Bytecode Editierbar.", "SUGGESTED_FIX_COMPILER_ERROR": "Vorgeschlagene Lösung: Aktivieren Sie unter Ansicht>Fenster>Krakatau>Bytecode Editierbar.",
"SUGGESTED_FIX_NO_DECOMPILER_WARNING": "ACHTUNG: Derzeit ist kein Dekompilierer ausgewählt. Versuchen Sie unter Ansicht>Fenster einen Dekompilierer auszuwählen.",
"FILES": "Dateien", "FILES": "Dateien",
"QUICK_FILE_SEARCH_NO_FILE_EXTENSION": "Dateien-Schnellsuche öffnen (ohne Dateiendungen)", "QUICK_FILE_SEARCH_NO_FILE_EXTENSION": "Dateien-Schnellsuche öffnen (ohne Dateiendungen)",
"WORK_SPACE": "Arbeitsbereich", "WORK_SPACE": "Arbeitsbereich",