|
81 | 81 | * fix the randomly sometimes fucked up names on file navigation bug |
82 | 82 | * make zipfile not include the decode shit |
83 | 83 | * |
84 | | - * -----2.9.0-----: |
85 | | - * 02/11/2015 - Added ZStringArray String Decrypter. (Thanks Righteous) |
86 | | - * 02/20/2015 - Moved the decompilers/disassemblers around. |
87 | | - * 02/20/2015 - Fixed a resource leak with Krakatau Decompiler/Disassembler/Assembler. |
88 | | - * 02/21/2015 - Fixed regex searching if your regex search contained a syntax error. |
89 | | - * 02/21/2015 - Added the compiler/decompiler instances to the BytecodeViewer API class. |
90 | | - * 02/21/2015 - Sped up the decompilers, each view pane runs its own decompiler thread. |
91 | | - * 02/21/2015 - Added Janino compiler, you can now compile the decompiled source code inside of BCV. |
92 | | - * 02/21/2015 - Added the editable option for almost all of the decompilers/disassemblers. |
93 | | - * 02/21/2015 - Cached the next/previous icons and added a resources class for all resources. |
94 | | - * 01/21/2015 - Renamed EZ-Injection as File-Run, however kept the plugin named EZ-Injection. |
95 | | - * 02/21/2015 - Dropped Groovy support, added .Java plugin compilation instead (now only 10mb). |
96 | | - * 02/21/2015 - Added support for reading resources, including displaying images, detecting pure ascii files and more. |
97 | | - * 02/21/2015 - Fixed an issue with loading an already selected node in the file navigation pane. |
98 | | - * 02/22/2015 - Added an error console to the Java compiler |
99 | | - * 02/22/2015 - Ensured the spawned Python/Krakatau processes are killed when closing BCV. |
100 | | - * 02/22/2015 - Made it more beginner friendly. |
101 | | - * 02/22/2015 - Fixed? The file navigation search. |
102 | | - * 02/22/2015 - Added a shit ton more comments to non-api related classes. |
103 | | - * 02/23/2015 - Added APK resources. |
104 | | - * 02/23/2015 - MORE ANDROID LOVE! Added APKTool.jar's decode. (Takes a while so it's a setting, also pumped the jar back to 16MB :() |
105 | | - * 02/23/2015 - Added close all but this tab menu. |
106 | | - * 02/23/2015 - Not really code related, but added _install.bat and _uninstall.bat for the exe version of BCV. |
107 | | - * 02/23/2015 - Back to ASM5, packed dex2jar in its own obfuscated jar. |
108 | | - * 02/23/2015 - Added the annotations back to the Bytecode Decompiler. (Once again, thanks Bibl) |
109 | | - * 02/23/2015 - It once again works with Java 8 Jars. |
| 84 | + * -----2.9.1-----: |
| 85 | + * 02/24/2015 - Fixed the third pane window not showing the search buttons. |
| 86 | + * 02/24/2015 - Fixed some issues with the compiler functionality. |
110 | 87 | * |
111 | 88 | * @author Konloch |
112 | 89 | * |
|
115 | 92 | public class BytecodeViewer { |
116 | 93 |
|
117 | 94 | /*per version*/ |
118 | | - public static String version = "2.9.0"; |
| 95 | + public static String version = "2.9.1"; |
119 | 96 | public static String krakatauVersion = "2"; |
120 | 97 | /*the rest*/ |
121 | 98 | public static MainViewerGUI viewer = null; |
@@ -431,63 +408,80 @@ public static boolean compile(boolean message) { |
431 | 408 | if(getLoadedClasses().isEmpty()) |
432 | 409 | return false; |
433 | 410 |
|
| 411 | + boolean actuallyTried = false; |
| 412 | + |
434 | 413 | for(java.awt.Component c : BytecodeViewer.viewer.workPane.getLoadedViewers()) { |
435 | 414 | if(c instanceof ClassViewer) { |
436 | 415 | ClassViewer cv = (ClassViewer) c; |
437 | | - Object smali[] = cv.getSmali(); |
438 | | - if(smali != null) { |
439 | | - ClassNode origNode = (ClassNode) smali[0]; |
440 | | - String smaliText = (String) smali[1]; |
441 | | - byte[] smaliCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.smali.compile(smaliText, origNode.name); |
442 | | - if(smaliCompiled != null) { |
443 | | - ClassNode newNode = JarUtils.getNode(smaliCompiled); |
444 | | - BytecodeViewer.updateNode(origNode, newNode); |
445 | | - } else { |
446 | | - BytecodeViewer.showMessage("There has been an error with assembling your Smali code, please check this. Class: " + origNode.name); |
447 | | - return false; |
| 416 | + if((cv.smali1 != null && cv.smali2 != null && cv.smali3 != null) && |
| 417 | + (cv.smali1.isEditable() || cv.smali2.isEditable() || cv.smali3.isEditable())) { |
| 418 | + actuallyTried = true; |
| 419 | + Object smali[] = cv.getSmali(); |
| 420 | + if(smali != null) { |
| 421 | + ClassNode origNode = (ClassNode) smali[0]; |
| 422 | + String smaliText = (String) smali[1]; |
| 423 | + byte[] smaliCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.smali.compile(smaliText, origNode.name); |
| 424 | + if(smaliCompiled != null) { |
| 425 | + ClassNode newNode = JarUtils.getNode(smaliCompiled); |
| 426 | + BytecodeViewer.updateNode(origNode, newNode); |
| 427 | + } else { |
| 428 | + BytecodeViewer.showMessage("There has been an error with assembling your Smali code, please check this. Class: " + origNode.name); |
| 429 | + return false; |
| 430 | + } |
448 | 431 | } |
449 | 432 | } |
450 | 433 |
|
451 | 434 |
|
452 | | - Object krakatau[] = cv.getKrakatau(); |
453 | | - if(krakatau != null) { |
454 | | - ClassNode origNode = (ClassNode) krakatau[0]; |
455 | | - String krakatauText = (String) krakatau[1]; |
456 | | - byte[] krakatauCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.krakatau.compile(krakatauText, origNode.name); |
457 | | - if(krakatauCompiled != null) { |
458 | | - ClassNode newNode = JarUtils.getNode(krakatauCompiled); |
459 | | - BytecodeViewer.updateNode(origNode, newNode); |
460 | | - } else { |
461 | | - BytecodeViewer.showMessage("There has been an error with assembling your Krakatau Bytecode, please check this. Class: " + origNode.name); |
462 | | - return false; |
| 435 | + if((cv.krakatau1 != null && cv.krakatau2 != null && cv.krakatau3 != null) && |
| 436 | + (cv.krakatau1.isEditable() || cv.krakatau2.isEditable() || cv.krakatau3.isEditable())) { |
| 437 | + actuallyTried = true; |
| 438 | + Object krakatau[] = cv.getKrakatau(); |
| 439 | + if(krakatau != null) { |
| 440 | + ClassNode origNode = (ClassNode) krakatau[0]; |
| 441 | + String krakatauText = (String) krakatau[1]; |
| 442 | + byte[] krakatauCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.krakatau.compile(krakatauText, origNode.name); |
| 443 | + if(krakatauCompiled != null) { |
| 444 | + ClassNode newNode = JarUtils.getNode(krakatauCompiled); |
| 445 | + BytecodeViewer.updateNode(origNode, newNode); |
| 446 | + } else { |
| 447 | + BytecodeViewer.showMessage("There has been an error with assembling your Krakatau Bytecode, please check this. Class: " + origNode.name); |
| 448 | + return false; |
| 449 | + } |
463 | 450 | } |
464 | 451 | } |
465 | 452 |
|
466 | | - Object java[] = cv.getJava(); |
467 | | - if(java != null) { |
468 | | - ClassNode origNode = (ClassNode) java[0]; |
469 | | - String javaText = (String) java[1]; |
470 | | - |
471 | | - SystemErrConsole errConsole = new SystemErrConsole("Java Compile Issues"); |
472 | | - errConsole.setText("Error compiling class: " + origNode.name + nl + "Keep in mind most decompilers cannot produce compilable classes"+nl+nl); |
473 | | - |
474 | | - byte[] javaCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.java.compile(javaText, origNode.name); |
475 | | - if(javaCompiled != null) { |
476 | | - ClassNode newNode = JarUtils.getNode(javaCompiled); |
477 | | - BytecodeViewer.updateNode(origNode, newNode); |
478 | | - errConsole.finished(); |
479 | | - } else { |
480 | | - errConsole.pretty(); |
481 | | - errConsole.setVisible(true); |
482 | | - errConsole.finished(); |
483 | | - return false; |
| 453 | + if((cv.java1 != null && cv.java2 != null && cv.java3 != null) && |
| 454 | + (cv.java1.isEditable() || cv.java2.isEditable() || cv.java3.isEditable())) { |
| 455 | + actuallyTried = true; |
| 456 | + Object java[] = cv.getJava(); |
| 457 | + if(java != null) { |
| 458 | + ClassNode origNode = (ClassNode) java[0]; |
| 459 | + String javaText = (String) java[1]; |
| 460 | + |
| 461 | + SystemErrConsole errConsole = new SystemErrConsole("Java Compile Issues"); |
| 462 | + errConsole.setText("Error compiling class: " + origNode.name + nl + "Keep in mind most decompilers cannot produce compilable classes"+nl+nl); |
| 463 | + |
| 464 | + byte[] javaCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.java.compile(javaText, origNode.name); |
| 465 | + if(javaCompiled != null) { |
| 466 | + ClassNode newNode = JarUtils.getNode(javaCompiled); |
| 467 | + BytecodeViewer.updateNode(origNode, newNode); |
| 468 | + errConsole.finished(); |
| 469 | + } else { |
| 470 | + errConsole.pretty(); |
| 471 | + errConsole.setVisible(true); |
| 472 | + errConsole.finished(); |
| 473 | + return false; |
| 474 | + } |
484 | 475 | } |
485 | 476 | } |
486 | 477 | } |
487 | 478 | } |
488 | 479 |
|
489 | 480 | if(message) |
490 | | - BytecodeViewer.showMessage("Compiled Successfully."); |
| 481 | + if(actuallyTried) |
| 482 | + BytecodeViewer.showMessage("Compiled Successfully."); |
| 483 | + else |
| 484 | + BytecodeViewer.showMessage("You have no editable panes opened, make one editable and try again."); |
491 | 485 |
|
492 | 486 | return true; |
493 | 487 | } |
|
0 commit comments