Skip to content

Commit

Permalink
v1.1.1
Browse files Browse the repository at this point in the history
    Fixed bug where Deobfuscator doesn't care about the file in the input box
    Set extension filters
  • Loading branch information
pandaninjas committed Jul 30, 2022
1 parent eb73226 commit 5d2a4de
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

import java.io.File;
import java.io.FileNotFoundException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;

public class DeobfuscatorGUIController {

private File inputFile;
private File outputFile;
private final HashMap<CheckBox, Transformer> deobfuscatorHashMap = new HashMap<>();

@FXML
Expand All @@ -39,25 +38,31 @@ public class DeobfuscatorGUIController {
protected void chooseInputFile() {
FileChooser fileChooser = new FileChooser();
fileChooser.setInitialDirectory(new File(System.getProperty("user.dir")));
fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("Jar Files", "*.jar", "*.zip"),
new FileChooser.ExtensionFilter("Other Files", "*.*")
);
File input = fileChooser.showOpenDialog(DeobfuscatorGUIApp.stage);
if (input == null) {
return;
}
inputName.setText(input.getPath());
this.inputFile = input;
}

@FXML
protected void chooseOutputFile() {
FileChooser fileChooser = new FileChooser();
fileChooser.setInitialDirectory(new File(System.getProperty("user.dir")));
fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("Jar Files", "*.jar", "*.zip"),
new FileChooser.ExtensionFilter("Other Files", "*.*")
);
File output = fileChooser.showSaveDialog(DeobfuscatorGUIApp.stage);
if (output == null) {
return;
}
String path = output.getPath();
outputName.setText(path);
this.outputFile = output;
}

@FXML
Expand All @@ -79,7 +84,7 @@ public void initialize() {

@FXML
protected void deobfuscate() {
if (inputFile == null || outputFile == null){
if (inputName.getText() == null || outputName.getText() == null || inputName.getText().isBlank() || outputName.getText().isBlank()){
result.setText("You need to specify both input and output files!");
return;
}
Expand All @@ -96,15 +101,16 @@ protected void deobfuscate() {
usedTransformers.toArray(transformers);
try {
Deobfuscator.builder()
.input(inputFile.toPath())
.output(outputFile.toPath())
.input(Path.of(inputName.getText()))
.output(Path.of(outputName.getText()))
.transformers(transformers)
.classReaderFlags(ClassReader.SKIP_FRAMES)
.classWriterFlags(0)
.consoleDebug()
.build()
.start();
} catch (FileNotFoundException e) {
result.setText("One or both of the files don't exist");
return;
}
result.setText("Deobfuscation complete");
Expand Down

0 comments on commit 5d2a4de

Please sign in to comment.