diff --git a/.gitignore b/.gitignore index b177b003..b64d1edc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,4 @@ .classpath .project *.iml -.idea/ -target/ -dependency-reduced-pom.xml - +.idea/ \ No newline at end of file diff --git a/BytecodeViewer 2.9.8-fatjar.jar b/BytecodeViewer 2.9.8-fatjar.jar deleted file mode 100644 index b80b4dc0..00000000 Binary files a/BytecodeViewer 2.9.8-fatjar.jar and /dev/null differ diff --git a/BytecodeViewer 2.9.8.jar b/BytecodeViewer 2.9.8.jar deleted file mode 100644 index c275e9ee..00000000 Binary files a/BytecodeViewer 2.9.8.jar and /dev/null differ diff --git a/BytecodeViewer 3.0.0-preview2.jar b/BytecodeViewer 3.0.0-preview2.jar deleted file mode 100644 index c4cc1b51..00000000 Binary files a/BytecodeViewer 3.0.0-preview2.jar and /dev/null differ diff --git a/LICENSE b/LICENSE index e587591e..b966d674 100644 --- a/LICENSE +++ b/LICENSE @@ -618,4 +618,57 @@ an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - END OF TERMS AND CONDITIONS \ No newline at end of file + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + Bytecode Viewer - Java & Android Reverse Engineering Suite + Copyright (C) 2014 Kalen "Konloch" Kinloch - http://bytecodeviewer.com - http://the.bytecode.club + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Bytecode Viewer(BCV) Copyright (C) 2014 Kalen "Konloch" Kinloch - http://bytecodeviewer.com - http://the.bytecode.club + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/README.txt b/README.txt index 1a26d884..ab894300 100644 --- a/README.txt +++ b/README.txt @@ -28,9 +28,6 @@ Contributors: sahitya-pavurala priav03 Afffsdd - Szperak - Zooty - samczsun If I missed you, please feel free to contact me @Konloch or konloch@gmail.com Contribution Guide Lines/Coding Conventions: diff --git a/libs/Krakatau-10.zip b/libs/Krakatau-10.zip new file mode 100644 index 00000000..36964650 Binary files /dev/null and b/libs/Krakatau-10.zip differ diff --git a/libs/Krakatau-9.zip b/libs/Krakatau-9.zip deleted file mode 100644 index 075a540c..00000000 Binary files a/libs/Krakatau-9.zip and /dev/null differ diff --git a/libs/cfr_0_115.jar b/libs/cfr_0_125.jar similarity index 50% rename from libs/cfr_0_115.jar rename to libs/cfr_0_125.jar index 746003ed..a4651fa6 100644 Binary files a/libs/cfr_0_115.jar and b/libs/cfr_0_125.jar differ diff --git a/libs/enjarify-2.zip b/libs/enjarify-2.zip deleted file mode 100644 index 1d0b3cd6..00000000 Binary files a/libs/enjarify-2.zip and /dev/null differ diff --git a/libs/enjarify-3.zip b/libs/enjarify-3.zip new file mode 100644 index 00000000..a0bb48b6 Binary files /dev/null and b/libs/enjarify-3.zip differ diff --git a/libs/fernflower-2016.jar b/libs/fernflower-2016.jar deleted file mode 100644 index b34beb34..00000000 Binary files a/libs/fernflower-2016.jar and /dev/null differ diff --git a/libs/fernflower-2017.jar b/libs/fernflower-2017.jar new file mode 100644 index 00000000..40a33ac2 Binary files /dev/null and b/libs/fernflower-2017.jar differ diff --git a/libs/slf4j-api-1.7.18.jar b/libs/slf4j-api-1.7.18.jar deleted file mode 100644 index acf68c0b..00000000 Binary files a/libs/slf4j-api-1.7.18.jar and /dev/null differ diff --git a/libs/slf4j-nop-1.7.18.jar b/libs/slf4j-nop-1.7.18.jar deleted file mode 100644 index f4659f16..00000000 Binary files a/libs/slf4j-nop-1.7.18.jar and /dev/null differ diff --git a/libs/zt-zip-1.8.jar b/libs/zt-zip-1.8.jar deleted file mode 100644 index f3347d0e..00000000 Binary files a/libs/zt-zip-1.8.jar and /dev/null differ diff --git a/out/production/bytecode-viewer/META-INF/MANIFEST.MF b/out/production/bytecode-viewer/META-INF/MANIFEST.MF new file mode 100644 index 00000000..429686e7 --- /dev/null +++ b/out/production/bytecode-viewer/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Class-Path: . BytecodeViewer 2.9.9-preview2_lib/byteanalysis-1.0.jar B + ytecodeViewer 2.9.9-preview2_lib/commons-codec-1.9.jar BytecodeViewer + 2.9.9-preview2_lib/commons-io-2.4.jar BytecodeViewer 2.9.9-preview2_ + lib/commons-lang3-3.3.2.jar BytecodeViewer 2.9.9-preview2_lib/imgscal + r-lib-4.2.jar BytecodeViewer 2.9.9-preview2_lib/jar-rename-1.6.jar By + tecodeViewer 2.9.9-preview2_lib/jasmin-p2.5.jar BytecodeViewer 2.9.9- + preview2_lib/jgraphx.jar BytecodeViewer 2.9.9-preview2_lib/rsyntaxtex + tarea.jar BytecodeViewer 2.9.9-preview2_lib/smali-2.0.3-obf-patched.j + ar BytecodeViewer 2.9.9-preview2_lib/baksmali-2.0.3.jar BytecodeViewe + r 2.9.9-preview2_lib/fernflower2015.jar BytecodeViewer 2.9.9-preview2 + _lib/commons-compiler.jar BytecodeViewer 2.9.9-preview2_lib/apktool_2 + .0.0rc4_obf.jar BytecodeViewer 2.9.9-preview2_lib/dex2jar_2.0_obf.jar + BytecodeViewer 2.9.9-preview2_lib/jd-gui-1.0.0-RC4.jar BytecodeViewe + r 2.9.9-preview2_lib/procyon-decompiler-0.5.29.jar BytecodeViewer 2.9 + .9-preview2_lib/cfr_0_101.jar BytecodeViewer 2.9.9-preview2_lib/commo + ns-net-3.1.jar BytecodeViewer 2.9.9-preview2_lib/janino.jar +Main-Class: the.bytecode.club.bytecodeviewer.BytecodeViewer + diff --git a/out/production/bytecode-viewer/Skeleton.class b/out/production/bytecode-viewer/Skeleton.class new file mode 100644 index 00000000..76b27e3f Binary files /dev/null and b/out/production/bytecode-viewer/Skeleton.class differ diff --git a/out/production/bytecode-viewer/Skeleton.gy b/out/production/bytecode-viewer/Skeleton.gy new file mode 100644 index 00000000..c9d45583 --- /dev/null +++ b/out/production/bytecode-viewer/Skeleton.gy @@ -0,0 +1,14 @@ +import the.bytecode.club.bytecodeviewer.api.*; +import java.util.ArrayList; +import org.objectweb.asm.tree.ClassNode; +import the.bytecode.club.bytecodeviewer.decompilers.*; + +public class Skeleton extends Plugin { + + @Override + public void execute(ArrayList classNodesList) { + PluginConsole gui = new PluginConsole("Skeleton"); + gui.setVisible(true); + gui.appendText("executed skeleton"); + } +} \ No newline at end of file diff --git a/out/production/bytecode-viewer/Skeleton.rb b/out/production/bytecode-viewer/Skeleton.rb new file mode 100644 index 00000000..e69de29b diff --git a/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor$1.class b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor$1.class new file mode 100644 index 00000000..423db812 Binary files /dev/null and b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor$1.class differ diff --git a/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor$Caja.class b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor$Caja.class new file mode 100644 index 00000000..ad303286 Binary files /dev/null and b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor$Caja.class differ diff --git a/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor$Columnas.class b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor$Columnas.class new file mode 100644 index 00000000..57069d04 Binary files /dev/null and b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor$Columnas.class differ diff --git a/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor$Filas.class b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor$Filas.class new file mode 100644 index 00000000..3cfff295 Binary files /dev/null and b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor$Filas.class differ diff --git a/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor.class b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor.class new file mode 100644 index 00000000..944e2186 Binary files /dev/null and b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditor.class differ diff --git a/out/production/bytecode-viewer/com/jhe/hexed/JHexEditorASCII.class b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditorASCII.class new file mode 100644 index 00000000..6dd62ad0 Binary files /dev/null and b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditorASCII.class differ diff --git a/out/production/bytecode-viewer/com/jhe/hexed/JHexEditorHEX.class b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditorHEX.class new file mode 100644 index 00000000..d69f27f7 Binary files /dev/null and b/out/production/bytecode-viewer/com/jhe/hexed/JHexEditorHEX.class differ diff --git a/out/production/bytecode-viewer/jd/cli/Main.class b/out/production/bytecode-viewer/jd/cli/Main.class new file mode 100644 index 00000000..b89ddcb0 Binary files /dev/null and b/out/production/bytecode-viewer/jd/cli/Main.class differ diff --git a/out/production/bytecode-viewer/jd/cli/loader/BaseLoader.class b/out/production/bytecode-viewer/jd/cli/loader/BaseLoader.class new file mode 100644 index 00000000..f5a21ecd Binary files /dev/null and b/out/production/bytecode-viewer/jd/cli/loader/BaseLoader.class differ diff --git a/out/production/bytecode-viewer/jd/cli/loader/DirectoryLoader.class b/out/production/bytecode-viewer/jd/cli/loader/DirectoryLoader.class new file mode 100644 index 00000000..50d59ea5 Binary files /dev/null and b/out/production/bytecode-viewer/jd/cli/loader/DirectoryLoader.class differ diff --git a/out/production/bytecode-viewer/jd/cli/loader/JarLoader.class b/out/production/bytecode-viewer/jd/cli/loader/JarLoader.class new file mode 100644 index 00000000..aa3d14f6 Binary files /dev/null and b/out/production/bytecode-viewer/jd/cli/loader/JarLoader.class differ diff --git a/out/production/bytecode-viewer/jd/cli/loader/LoaderManager.class b/out/production/bytecode-viewer/jd/cli/loader/LoaderManager.class new file mode 100644 index 00000000..19a5615a Binary files /dev/null and b/out/production/bytecode-viewer/jd/cli/loader/LoaderManager.class differ diff --git a/out/production/bytecode-viewer/jd/cli/preferences/CommonPreferences.class b/out/production/bytecode-viewer/jd/cli/preferences/CommonPreferences.class new file mode 100644 index 00000000..82664c23 Binary files /dev/null and b/out/production/bytecode-viewer/jd/cli/preferences/CommonPreferences.class differ diff --git a/out/production/bytecode-viewer/jd/cli/printer/html/HtmlPrinter.class b/out/production/bytecode-viewer/jd/cli/printer/html/HtmlPrinter.class new file mode 100644 index 00000000..5941d07c Binary files /dev/null and b/out/production/bytecode-viewer/jd/cli/printer/html/HtmlPrinter.class differ diff --git a/out/production/bytecode-viewer/jd/cli/printer/text/PlainTextPrinter.class b/out/production/bytecode-viewer/jd/cli/printer/text/PlainTextPrinter.class new file mode 100644 index 00000000..cbfb2727 Binary files /dev/null and b/out/production/bytecode-viewer/jd/cli/printer/text/PlainTextPrinter.class differ diff --git a/out/production/bytecode-viewer/jd/cli/util/ClassFileUtil.class b/out/production/bytecode-viewer/jd/cli/util/ClassFileUtil.class new file mode 100644 index 00000000..18580ba1 Binary files /dev/null and b/out/production/bytecode-viewer/jd/cli/util/ClassFileUtil.class differ diff --git a/out/production/bytecode-viewer/jd/cli/util/CommonTypeNameUtil.class b/out/production/bytecode-viewer/jd/cli/util/CommonTypeNameUtil.class new file mode 100644 index 00000000..9f17571d Binary files /dev/null and b/out/production/bytecode-viewer/jd/cli/util/CommonTypeNameUtil.class differ diff --git a/out/production/bytecode-viewer/jd/cli/util/VersionUtil.class b/out/production/bytecode-viewer/jd/cli/util/VersionUtil.class new file mode 100644 index 00000000..1cac1132 Binary files /dev/null and b/out/production/bytecode-viewer/jd/cli/util/VersionUtil.class differ diff --git a/out/production/bytecode-viewer/me/konloch/kontainer/io/DiskReader.class b/out/production/bytecode-viewer/me/konloch/kontainer/io/DiskReader.class new file mode 100644 index 00000000..1e9b7d3b Binary files /dev/null and b/out/production/bytecode-viewer/me/konloch/kontainer/io/DiskReader.class differ diff --git a/out/production/bytecode-viewer/me/konloch/kontainer/io/DiskWriter.class b/out/production/bytecode-viewer/me/konloch/kontainer/io/DiskWriter.class new file mode 100644 index 00000000..c87af999 Binary files /dev/null and b/out/production/bytecode-viewer/me/konloch/kontainer/io/DiskWriter.class differ diff --git a/out/production/bytecode-viewer/me/konloch/kontainer/io/HTTPRequest.class b/out/production/bytecode-viewer/me/konloch/kontainer/io/HTTPRequest.class new file mode 100644 index 00000000..4c250d4a Binary files /dev/null and b/out/production/bytecode-viewer/me/konloch/kontainer/io/HTTPRequest.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/AlreadySelectedException.class b/out/production/bytecode-viewer/org/apache/commons/cli/AlreadySelectedException.class new file mode 100644 index 00000000..fa311b2a Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/AlreadySelectedException.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/AmbiguousOptionException.class b/out/production/bytecode-viewer/org/apache/commons/cli/AmbiguousOptionException.class new file mode 100644 index 00000000..b6f9e433 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/AmbiguousOptionException.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/BasicParser.class b/out/production/bytecode-viewer/org/apache/commons/cli/BasicParser.class new file mode 100644 index 00000000..c484b222 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/BasicParser.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/CommandLine.class b/out/production/bytecode-viewer/org/apache/commons/cli/CommandLine.class new file mode 100644 index 00000000..a62bd0f6 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/CommandLine.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/CommandLineParser.class b/out/production/bytecode-viewer/org/apache/commons/cli/CommandLineParser.class new file mode 100644 index 00000000..d27c258c Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/CommandLineParser.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/DefaultParser.class b/out/production/bytecode-viewer/org/apache/commons/cli/DefaultParser.class new file mode 100644 index 00000000..0fc12ce4 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/DefaultParser.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/GnuParser.class b/out/production/bytecode-viewer/org/apache/commons/cli/GnuParser.class new file mode 100644 index 00000000..bd2a8bd5 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/GnuParser.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/HelpFormatter$1.class b/out/production/bytecode-viewer/org/apache/commons/cli/HelpFormatter$1.class new file mode 100644 index 00000000..26d47803 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/HelpFormatter$1.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/HelpFormatter$OptionComparator.class b/out/production/bytecode-viewer/org/apache/commons/cli/HelpFormatter$OptionComparator.class new file mode 100644 index 00000000..7222eaff Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/HelpFormatter$OptionComparator.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/HelpFormatter.class b/out/production/bytecode-viewer/org/apache/commons/cli/HelpFormatter.class new file mode 100644 index 00000000..6e7961e0 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/HelpFormatter.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/MissingArgumentException.class b/out/production/bytecode-viewer/org/apache/commons/cli/MissingArgumentException.class new file mode 100644 index 00000000..67c42d01 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/MissingArgumentException.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/MissingOptionException.class b/out/production/bytecode-viewer/org/apache/commons/cli/MissingOptionException.class new file mode 100644 index 00000000..3dbc750a Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/MissingOptionException.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/Option$1.class b/out/production/bytecode-viewer/org/apache/commons/cli/Option$1.class new file mode 100644 index 00000000..4c705438 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/Option$1.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/Option$Builder.class b/out/production/bytecode-viewer/org/apache/commons/cli/Option$Builder.class new file mode 100644 index 00000000..91420e6f Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/Option$Builder.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/Option.class b/out/production/bytecode-viewer/org/apache/commons/cli/Option.class new file mode 100644 index 00000000..bb2d0103 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/Option.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/OptionBuilder.class b/out/production/bytecode-viewer/org/apache/commons/cli/OptionBuilder.class new file mode 100644 index 00000000..2d93e78d Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/OptionBuilder.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/OptionGroup.class b/out/production/bytecode-viewer/org/apache/commons/cli/OptionGroup.class new file mode 100644 index 00000000..fbc57913 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/OptionGroup.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/OptionValidator.class b/out/production/bytecode-viewer/org/apache/commons/cli/OptionValidator.class new file mode 100644 index 00000000..3110d154 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/OptionValidator.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/Options.class b/out/production/bytecode-viewer/org/apache/commons/cli/Options.class new file mode 100644 index 00000000..3b2a697b Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/Options.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/ParseException.class b/out/production/bytecode-viewer/org/apache/commons/cli/ParseException.class new file mode 100644 index 00000000..80840f3c Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/ParseException.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/Parser.class b/out/production/bytecode-viewer/org/apache/commons/cli/Parser.class new file mode 100644 index 00000000..860e41e3 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/Parser.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/PatternOptionBuilder.class b/out/production/bytecode-viewer/org/apache/commons/cli/PatternOptionBuilder.class new file mode 100644 index 00000000..586591e8 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/PatternOptionBuilder.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/PosixParser.class b/out/production/bytecode-viewer/org/apache/commons/cli/PosixParser.class new file mode 100644 index 00000000..d05dc386 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/PosixParser.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/TypeHandler.class b/out/production/bytecode-viewer/org/apache/commons/cli/TypeHandler.class new file mode 100644 index 00000000..ad560429 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/TypeHandler.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/UnrecognizedOptionException.class b/out/production/bytecode-viewer/org/apache/commons/cli/UnrecognizedOptionException.class new file mode 100644 index 00000000..9b951adc Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/UnrecognizedOptionException.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/cli/Util.class b/out/production/bytecode-viewer/org/apache/commons/cli/Util.class new file mode 100644 index 00000000..f587705b Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/cli/Util.class differ diff --git a/src/main/java/org/apache/commons/cli/overview.html b/out/production/bytecode-viewer/org/apache/commons/cli/overview.html similarity index 100% rename from src/main/java/org/apache/commons/cli/overview.html rename to out/production/bytecode-viewer/org/apache/commons/cli/overview.html diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/BinaryDecoder.class b/out/production/bytecode-viewer/org/apache/commons/codec/BinaryDecoder.class new file mode 100644 index 00000000..82818f28 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/BinaryDecoder.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/BinaryEncoder.class b/out/production/bytecode-viewer/org/apache/commons/codec/BinaryEncoder.class new file mode 100644 index 00000000..c98f830e Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/BinaryEncoder.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/CharEncoding.class b/out/production/bytecode-viewer/org/apache/commons/codec/CharEncoding.class new file mode 100644 index 00000000..28a5e85f Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/CharEncoding.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/Charsets.class b/out/production/bytecode-viewer/org/apache/commons/codec/Charsets.class new file mode 100644 index 00000000..bc26bdc0 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/Charsets.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/Decoder.class b/out/production/bytecode-viewer/org/apache/commons/codec/Decoder.class new file mode 100644 index 00000000..bb6679b3 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/Decoder.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/DecoderException.class b/out/production/bytecode-viewer/org/apache/commons/codec/DecoderException.class new file mode 100644 index 00000000..a54c281c Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/DecoderException.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/Encoder.class b/out/production/bytecode-viewer/org/apache/commons/codec/Encoder.class new file mode 100644 index 00000000..10817f67 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/Encoder.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/EncoderException.class b/out/production/bytecode-viewer/org/apache/commons/codec/EncoderException.class new file mode 100644 index 00000000..d81f0d5d Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/EncoderException.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/StringDecoder.class b/out/production/bytecode-viewer/org/apache/commons/codec/StringDecoder.class new file mode 100644 index 00000000..01fa2e09 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/StringDecoder.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/StringEncoder.class b/out/production/bytecode-viewer/org/apache/commons/codec/StringEncoder.class new file mode 100644 index 00000000..734ede94 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/StringEncoder.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/StringEncoderComparator.class b/out/production/bytecode-viewer/org/apache/commons/codec/StringEncoderComparator.class new file mode 100644 index 00000000..1cf5fc94 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/StringEncoderComparator.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base32.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base32.class new file mode 100644 index 00000000..0ce8efca Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base32.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base32InputStream.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base32InputStream.class new file mode 100644 index 00000000..14bbc7f7 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base32InputStream.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base32OutputStream.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base32OutputStream.class new file mode 100644 index 00000000..fbe578e0 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base32OutputStream.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base64.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base64.class new file mode 100644 index 00000000..1cdafbd1 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base64.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base64InputStream.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base64InputStream.class new file mode 100644 index 00000000..43695732 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base64InputStream.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base64OutputStream.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base64OutputStream.class new file mode 100644 index 00000000..d2b629ff Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Base64OutputStream.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/BaseNCodec$Context.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/BaseNCodec$Context.class new file mode 100644 index 00000000..d32789ed Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/BaseNCodec$Context.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/BaseNCodec.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/BaseNCodec.class new file mode 100644 index 00000000..ac19c1bb Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/BaseNCodec.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/BaseNCodecInputStream.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/BaseNCodecInputStream.class new file mode 100644 index 00000000..ea1007ac Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/BaseNCodecInputStream.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/BaseNCodecOutputStream.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/BaseNCodecOutputStream.class new file mode 100644 index 00000000..b7d65976 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/BaseNCodecOutputStream.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/BinaryCodec.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/BinaryCodec.class new file mode 100644 index 00000000..8ece6d32 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/BinaryCodec.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/CharSequenceUtils.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/CharSequenceUtils.class new file mode 100644 index 00000000..ce6e7d1b Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/CharSequenceUtils.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/Hex.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Hex.class new file mode 100644 index 00000000..e4443fa4 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/Hex.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/binary/StringUtils.class b/out/production/bytecode-viewer/org/apache/commons/codec/binary/StringUtils.class new file mode 100644 index 00000000..f6c82868 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/binary/StringUtils.class differ diff --git a/src/main/java/org/apache/commons/codec/binary/package.html b/out/production/bytecode-viewer/org/apache/commons/codec/binary/package.html similarity index 100% rename from src/main/java/org/apache/commons/codec/binary/package.html rename to out/production/bytecode-viewer/org/apache/commons/codec/binary/package.html diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/digest/B64.class b/out/production/bytecode-viewer/org/apache/commons/codec/digest/B64.class new file mode 100644 index 00000000..c2d5f20c Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/digest/B64.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/digest/Crypt.class b/out/production/bytecode-viewer/org/apache/commons/codec/digest/Crypt.class new file mode 100644 index 00000000..82387dd2 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/digest/Crypt.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/digest/DigestUtils.class b/out/production/bytecode-viewer/org/apache/commons/codec/digest/DigestUtils.class new file mode 100644 index 00000000..5814ee3a Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/digest/DigestUtils.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/digest/HmacAlgorithms.class b/out/production/bytecode-viewer/org/apache/commons/codec/digest/HmacAlgorithms.class new file mode 100644 index 00000000..2807c489 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/digest/HmacAlgorithms.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/digest/HmacUtils.class b/out/production/bytecode-viewer/org/apache/commons/codec/digest/HmacUtils.class new file mode 100644 index 00000000..250ec318 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/digest/HmacUtils.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/digest/Md5Crypt.class b/out/production/bytecode-viewer/org/apache/commons/codec/digest/Md5Crypt.class new file mode 100644 index 00000000..18a575b9 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/digest/Md5Crypt.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/digest/MessageDigestAlgorithms.class b/out/production/bytecode-viewer/org/apache/commons/codec/digest/MessageDigestAlgorithms.class new file mode 100644 index 00000000..deb9705c Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/digest/MessageDigestAlgorithms.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/digest/Sha2Crypt.class b/out/production/bytecode-viewer/org/apache/commons/codec/digest/Sha2Crypt.class new file mode 100644 index 00000000..dd333fd1 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/digest/Sha2Crypt.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/digest/UnixCrypt.class b/out/production/bytecode-viewer/org/apache/commons/codec/digest/UnixCrypt.class new file mode 100644 index 00000000..37283954 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/digest/UnixCrypt.class differ diff --git a/src/main/java/org/apache/commons/codec/digest/package.html b/out/production/bytecode-viewer/org/apache/commons/codec/digest/package.html similarity index 100% rename from src/main/java/org/apache/commons/codec/digest/package.html rename to out/production/bytecode-viewer/org/apache/commons/codec/digest/package.html diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/AbstractCaverphone.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/AbstractCaverphone.class new file mode 100644 index 00000000..2bc38259 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/AbstractCaverphone.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/Caverphone.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/Caverphone.class new file mode 100644 index 00000000..98948664 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/Caverphone.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/Caverphone1.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/Caverphone1.class new file mode 100644 index 00000000..c51d46e8 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/Caverphone1.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/Caverphone2.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/Caverphone2.class new file mode 100644 index 00000000..589e569d Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/Caverphone2.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/ColognePhonetic$CologneBuffer.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/ColognePhonetic$CologneBuffer.class new file mode 100644 index 00000000..123dfe13 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/ColognePhonetic$CologneBuffer.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/ColognePhonetic$CologneInputBuffer.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/ColognePhonetic$CologneInputBuffer.class new file mode 100644 index 00000000..03552809 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/ColognePhonetic$CologneInputBuffer.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/ColognePhonetic$CologneOutputBuffer.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/ColognePhonetic$CologneOutputBuffer.class new file mode 100644 index 00000000..2b35fe4f Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/ColognePhonetic$CologneOutputBuffer.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/ColognePhonetic.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/ColognePhonetic.class new file mode 100644 index 00000000..a3612f05 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/ColognePhonetic.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/DaitchMokotoffSoundex$1.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/DaitchMokotoffSoundex$1.class new file mode 100644 index 00000000..6136b5dc Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/DaitchMokotoffSoundex$1.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/DaitchMokotoffSoundex$Branch.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/DaitchMokotoffSoundex$Branch.class new file mode 100644 index 00000000..b084c6ae Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/DaitchMokotoffSoundex$Branch.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/DaitchMokotoffSoundex$Rule.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/DaitchMokotoffSoundex$Rule.class new file mode 100644 index 00000000..bf7bf636 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/DaitchMokotoffSoundex$Rule.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/DaitchMokotoffSoundex.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/DaitchMokotoffSoundex.class new file mode 100644 index 00000000..c0a70235 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/DaitchMokotoffSoundex.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/DoubleMetaphone$DoubleMetaphoneResult.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/DoubleMetaphone$DoubleMetaphoneResult.class new file mode 100644 index 00000000..aaf665af Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/DoubleMetaphone$DoubleMetaphoneResult.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/DoubleMetaphone.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/DoubleMetaphone.class new file mode 100644 index 00000000..fe567966 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/DoubleMetaphone.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/MatchRatingApproachEncoder.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/MatchRatingApproachEncoder.class new file mode 100644 index 00000000..9a2f0465 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/MatchRatingApproachEncoder.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/Metaphone.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/Metaphone.class new file mode 100644 index 00000000..334fd259 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/Metaphone.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/Nysiis.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/Nysiis.class new file mode 100644 index 00000000..fa90d9b8 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/Nysiis.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/RefinedSoundex.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/RefinedSoundex.class new file mode 100644 index 00000000..bad1d15e Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/RefinedSoundex.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/Soundex.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/Soundex.class new file mode 100644 index 00000000..7e7a16e7 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/Soundex.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/SoundexUtils.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/SoundexUtils.class new file mode 100644 index 00000000..9e2632fb Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/SoundexUtils.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/BeiderMorseEncoder.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/BeiderMorseEncoder.class new file mode 100644 index 00000000..356d3f50 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/BeiderMorseEncoder.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Lang$1.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Lang$1.class new file mode 100644 index 00000000..08d4086c Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Lang$1.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Lang$LangRule.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Lang$LangRule.class new file mode 100644 index 00000000..c9fe6363 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Lang$LangRule.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Lang.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Lang.class new file mode 100644 index 00000000..4cdbc9c1 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Lang.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages$1.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages$1.class new file mode 100644 index 00000000..527f1ae0 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages$1.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages$2.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages$2.class new file mode 100644 index 00000000..5cef3976 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages$2.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages$LanguageSet.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages$LanguageSet.class new file mode 100644 index 00000000..cbdd3420 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages$LanguageSet.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages$SomeLanguages.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages$SomeLanguages.class new file mode 100644 index 00000000..cca87715 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages$SomeLanguages.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages.class new file mode 100644 index 00000000..48225cb4 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Languages.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/NameType.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/NameType.class new file mode 100644 index 00000000..89cdee6c Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/NameType.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/PhoneticEngine$1.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/PhoneticEngine$1.class new file mode 100644 index 00000000..8f525f3c Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/PhoneticEngine$1.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/PhoneticEngine$PhonemeBuilder.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/PhoneticEngine$PhonemeBuilder.class new file mode 100644 index 00000000..6834ca46 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/PhoneticEngine$PhonemeBuilder.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/PhoneticEngine$RulesApplication.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/PhoneticEngine$RulesApplication.class new file mode 100644 index 00000000..293c6f0b Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/PhoneticEngine$RulesApplication.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/PhoneticEngine.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/PhoneticEngine.class new file mode 100644 index 00000000..66a368c4 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/PhoneticEngine.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/ResourceConstants.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/ResourceConstants.class new file mode 100644 index 00000000..2ce40be5 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/ResourceConstants.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$1.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$1.class new file mode 100644 index 00000000..f2af375f Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$1.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$10.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$10.class new file mode 100644 index 00000000..99e3a8fa Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$10.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$2.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$2.class new file mode 100644 index 00000000..9b4b3f6f Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$2.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$3.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$3.class new file mode 100644 index 00000000..ec157e37 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$3.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$4.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$4.class new file mode 100644 index 00000000..2e1270c6 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$4.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$5.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$5.class new file mode 100644 index 00000000..9cdb971d Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$5.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$6.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$6.class new file mode 100644 index 00000000..8cde517c Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$6.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$7.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$7.class new file mode 100644 index 00000000..c8f54b49 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$7.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$8.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$8.class new file mode 100644 index 00000000..569f04c2 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$8.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$9.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$9.class new file mode 100644 index 00000000..b91c5e0f Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$9.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$Phoneme$1.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$Phoneme$1.class new file mode 100644 index 00000000..9a6a1394 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$Phoneme$1.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$Phoneme.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$Phoneme.class new file mode 100644 index 00000000..e5c3b934 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$Phoneme.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$PhonemeExpr.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$PhonemeExpr.class new file mode 100644 index 00000000..88e43fda Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$PhonemeExpr.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$PhonemeList.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$PhonemeList.class new file mode 100644 index 00000000..478faeb4 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$PhonemeList.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$RPattern.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$RPattern.class new file mode 100644 index 00000000..c7b306d6 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule$RPattern.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule.class new file mode 100644 index 00000000..1ab8e920 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/Rule.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/RuleType.class b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/RuleType.class new file mode 100644 index 00000000..be4a7dc2 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/RuleType.class differ diff --git a/src/main/java/org/apache/commons/codec/language/bm/package.html b/out/production/bytecode-viewer/org/apache/commons/codec/language/bm/package.html similarity index 100% rename from src/main/java/org/apache/commons/codec/language/bm/package.html rename to out/production/bytecode-viewer/org/apache/commons/codec/language/bm/package.html diff --git a/src/main/java/org/apache/commons/codec/language/package.html b/out/production/bytecode-viewer/org/apache/commons/codec/language/package.html similarity index 100% rename from src/main/java/org/apache/commons/codec/language/package.html rename to out/production/bytecode-viewer/org/apache/commons/codec/language/package.html diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/net/BCodec.class b/out/production/bytecode-viewer/org/apache/commons/codec/net/BCodec.class new file mode 100644 index 00000000..6dbae79c Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/net/BCodec.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/net/QCodec.class b/out/production/bytecode-viewer/org/apache/commons/codec/net/QCodec.class new file mode 100644 index 00000000..9558dcd4 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/net/QCodec.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/net/QuotedPrintableCodec.class b/out/production/bytecode-viewer/org/apache/commons/codec/net/QuotedPrintableCodec.class new file mode 100644 index 00000000..ab32719f Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/net/QuotedPrintableCodec.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/net/RFC1522Codec.class b/out/production/bytecode-viewer/org/apache/commons/codec/net/RFC1522Codec.class new file mode 100644 index 00000000..48752713 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/net/RFC1522Codec.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/net/URLCodec.class b/out/production/bytecode-viewer/org/apache/commons/codec/net/URLCodec.class new file mode 100644 index 00000000..f47db0ac Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/net/URLCodec.class differ diff --git a/out/production/bytecode-viewer/org/apache/commons/codec/net/Utils.class b/out/production/bytecode-viewer/org/apache/commons/codec/net/Utils.class new file mode 100644 index 00000000..9a8fc054 Binary files /dev/null and b/out/production/bytecode-viewer/org/apache/commons/codec/net/Utils.class differ diff --git a/src/main/java/org/apache/commons/codec/net/package.html b/out/production/bytecode-viewer/org/apache/commons/codec/net/package.html similarity index 100% rename from src/main/java/org/apache/commons/codec/net/package.html rename to out/production/bytecode-viewer/org/apache/commons/codec/net/package.html diff --git a/src/main/java/org/apache/commons/codec/overview.html b/out/production/bytecode-viewer/org/apache/commons/codec/overview.html similarity index 100% rename from src/main/java/org/apache/commons/codec/overview.html rename to out/production/bytecode-viewer/org/apache/commons/codec/overview.html diff --git a/src/main/java/org/apache/commons/codec/package.html b/out/production/bytecode-viewer/org/apache/commons/codec/package.html similarity index 100% rename from src/main/java/org/apache/commons/codec/package.html rename to out/production/bytecode-viewer/org/apache/commons/codec/package.html diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$1.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$1.class new file mode 100644 index 00000000..5bf6cfaa Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$1.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$10.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$10.class new file mode 100644 index 00000000..cf1f0694 Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$10.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$11.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$11.class new file mode 100644 index 00000000..3d9c382a Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$11.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$12.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$12.class new file mode 100644 index 00000000..c1e80095 Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$12.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$13.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$13.class new file mode 100644 index 00000000..20b1e7db Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$13.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$14.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$14.class new file mode 100644 index 00000000..5e26cf2d Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$14.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$2.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$2.class new file mode 100644 index 00000000..d1d8d699 Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$2.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$3.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$3.class new file mode 100644 index 00000000..c6f8eb68 Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$3.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$4.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$4.class new file mode 100644 index 00000000..3d764a4e Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$4.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$5.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$5.class new file mode 100644 index 00000000..deb73fde Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$5.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$6.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$6.class new file mode 100644 index 00000000..7b44545c Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$6.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$7.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$7.class new file mode 100644 index 00000000..39134071 Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$7.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$8.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$8.class new file mode 100644 index 00000000..36c6608c Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$8.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$9.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$9.class new file mode 100644 index 00000000..b53e18df Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$9.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$DefaultThreadFactory.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$DefaultThreadFactory.class new file mode 100644 index 00000000..28ad1cd9 Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$DefaultThreadFactory.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$ServerThreadFactory.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$ServerThreadFactory.class new file mode 100644 index 00000000..00a85e21 Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr$ServerThreadFactory.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/AsyncScalr.class b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr.class new file mode 100644 index 00000000..38740709 Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/AsyncScalr.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/Scalr$1.class b/out/production/bytecode-viewer/org/imgscalr/Scalr$1.class new file mode 100644 index 00000000..e52a7b9a Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/Scalr$1.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/Scalr$Method.class b/out/production/bytecode-viewer/org/imgscalr/Scalr$Method.class new file mode 100644 index 00000000..8360ee59 Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/Scalr$Method.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/Scalr$Mode.class b/out/production/bytecode-viewer/org/imgscalr/Scalr$Mode.class new file mode 100644 index 00000000..df1a53bb Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/Scalr$Mode.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/Scalr$Rotation.class b/out/production/bytecode-viewer/org/imgscalr/Scalr$Rotation.class new file mode 100644 index 00000000..000ffd11 Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/Scalr$Rotation.class differ diff --git a/out/production/bytecode-viewer/org/imgscalr/Scalr.class b/out/production/bytecode-viewer/org/imgscalr/Scalr.class new file mode 100644 index 00000000..7cd283a4 Binary files /dev/null and b/out/production/bytecode-viewer/org/imgscalr/Scalr.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/AnnotationVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/AnnotationVisitor.class new file mode 100644 index 00000000..9f6833d7 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/AnnotationVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/AnnotationWriter.class b/out/production/bytecode-viewer/org/objectweb/asm/AnnotationWriter.class new file mode 100644 index 00000000..0ebd139e Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/AnnotationWriter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/Attribute.class b/out/production/bytecode-viewer/org/objectweb/asm/Attribute.class new file mode 100644 index 00000000..7f14a0af Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/Attribute.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/ByteVector.class b/out/production/bytecode-viewer/org/objectweb/asm/ByteVector.class new file mode 100644 index 00000000..cf7a537a Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/ByteVector.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/ClassReader.class b/out/production/bytecode-viewer/org/objectweb/asm/ClassReader.class new file mode 100644 index 00000000..52e3ab30 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/ClassReader.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/ClassVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/ClassVisitor.class new file mode 100644 index 00000000..8e919734 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/ClassVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/ClassWriter.class b/out/production/bytecode-viewer/org/objectweb/asm/ClassWriter.class new file mode 100644 index 00000000..5376f503 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/ClassWriter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/Context.class b/out/production/bytecode-viewer/org/objectweb/asm/Context.class new file mode 100644 index 00000000..21497e7a Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/Context.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/Edge.class b/out/production/bytecode-viewer/org/objectweb/asm/Edge.class new file mode 100644 index 00000000..b79e669f Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/Edge.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/FieldVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/FieldVisitor.class new file mode 100644 index 00000000..b6f78a9f Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/FieldVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/FieldWriter.class b/out/production/bytecode-viewer/org/objectweb/asm/FieldWriter.class new file mode 100644 index 00000000..3bcc952e Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/FieldWriter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/Frame.class b/out/production/bytecode-viewer/org/objectweb/asm/Frame.class new file mode 100644 index 00000000..8ff9768f Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/Frame.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/Handle.class b/out/production/bytecode-viewer/org/objectweb/asm/Handle.class new file mode 100644 index 00000000..a0152e89 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/Handle.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/Handler.class b/out/production/bytecode-viewer/org/objectweb/asm/Handler.class new file mode 100644 index 00000000..e28edf5c Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/Handler.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/Item.class b/out/production/bytecode-viewer/org/objectweb/asm/Item.class new file mode 100644 index 00000000..c2dc624f Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/Item.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/Label.class b/out/production/bytecode-viewer/org/objectweb/asm/Label.class new file mode 100644 index 00000000..9bfee6bd Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/Label.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/MethodVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/MethodVisitor.class new file mode 100644 index 00000000..920bd2ec Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/MethodVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/MethodWriter.class b/out/production/bytecode-viewer/org/objectweb/asm/MethodWriter.class new file mode 100644 index 00000000..ed74a438 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/MethodWriter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/Opcodes.class b/out/production/bytecode-viewer/org/objectweb/asm/Opcodes.class new file mode 100644 index 00000000..f9757d60 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/Opcodes.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/Type.class b/out/production/bytecode-viewer/org/objectweb/asm/Type.class new file mode 100644 index 00000000..1d2f2fef Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/Type.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/TypePath.class b/out/production/bytecode-viewer/org/objectweb/asm/TypePath.class new file mode 100644 index 00000000..0c1fd9f9 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/TypePath.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/TypeReference.class b/out/production/bytecode-viewer/org/objectweb/asm/TypeReference.class new file mode 100644 index 00000000..4ed59af1 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/TypeReference.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/AdviceAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/AdviceAdapter.class new file mode 100644 index 00000000..775e74ae Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/AdviceAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/AnalyzerAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/AnalyzerAdapter.class new file mode 100644 index 00000000..42329b2d Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/AnalyzerAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/CodeSizeEvaluator.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/CodeSizeEvaluator.class new file mode 100644 index 00000000..f0a81a5e Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/CodeSizeEvaluator.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/GeneratorAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/GeneratorAdapter.class new file mode 100644 index 00000000..c2b20386 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/GeneratorAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/InstructionAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/InstructionAdapter.class new file mode 100644 index 00000000..e840e695 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/InstructionAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/JSRInlinerAdapter$Instantiation.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/JSRInlinerAdapter$Instantiation.class new file mode 100644 index 00000000..bb2d66cb Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/JSRInlinerAdapter$Instantiation.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/JSRInlinerAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/JSRInlinerAdapter.class new file mode 100644 index 00000000..67b846c2 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/JSRInlinerAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/LocalVariablesSorter.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/LocalVariablesSorter.class new file mode 100644 index 00000000..61d52b52 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/LocalVariablesSorter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/Method.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/Method.class new file mode 100644 index 00000000..37587ffb Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/Method.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/Remapper.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/Remapper.class new file mode 100644 index 00000000..c1f550bf Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/Remapper.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingAnnotationAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingAnnotationAdapter.class new file mode 100644 index 00000000..cf498eac Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingAnnotationAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingClassAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingClassAdapter.class new file mode 100644 index 00000000..2ed0efc5 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingClassAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingFieldAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingFieldAdapter.class new file mode 100644 index 00000000..83b6d085 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingFieldAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingMethodAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingMethodAdapter.class new file mode 100644 index 00000000..a447b34e Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingMethodAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingSignatureAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingSignatureAdapter.class new file mode 100644 index 00000000..4b2d9b8e Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/RemappingSignatureAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/SerialVersionUIDAdder$Item.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/SerialVersionUIDAdder$Item.class new file mode 100644 index 00000000..906019e5 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/SerialVersionUIDAdder$Item.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/SerialVersionUIDAdder.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/SerialVersionUIDAdder.class new file mode 100644 index 00000000..db9df393 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/SerialVersionUIDAdder.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/SimpleRemapper.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/SimpleRemapper.class new file mode 100644 index 00000000..988903f5 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/SimpleRemapper.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/StaticInitMerger.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/StaticInitMerger.class new file mode 100644 index 00000000..e4959214 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/StaticInitMerger.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/TableSwitchGenerator.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/TableSwitchGenerator.class new file mode 100644 index 00000000..4c563911 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/TableSwitchGenerator.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/TryCatchBlockSorter$1.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/TryCatchBlockSorter$1.class new file mode 100644 index 00000000..6774ed33 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/TryCatchBlockSorter$1.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/TryCatchBlockSorter.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/TryCatchBlockSorter.class new file mode 100644 index 00000000..9b7c376a Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/TryCatchBlockSorter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/Block.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/Block.class new file mode 100644 index 00000000..7c88a748 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/Block.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/BlockVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/BlockVisitor.class new file mode 100644 index 00000000..c93319b0 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/BlockVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/CallVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/CallVisitor.class new file mode 100644 index 00000000..5b11bf0e Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/CallVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/InsnVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/InsnVisitor.class new file mode 100644 index 00000000..42d357a8 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/InsnVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/graph/CallGraph.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/graph/CallGraph.class new file mode 100644 index 00000000..d197f0b9 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/graph/CallGraph.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/graph/Digraph.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/graph/Digraph.class new file mode 100644 index 00000000..7ecee383 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/graph/Digraph.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/graph/FlowGraph.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/graph/FlowGraph.class new file mode 100644 index 00000000..5dcfdac2 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/graph/FlowGraph.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/query/InsnQuery.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/query/InsnQuery.class new file mode 100644 index 00000000..d9609d46 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/query/InsnQuery.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/query/MemberQuery.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/query/MemberQuery.class new file mode 100644 index 00000000..911ed133 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/query/MemberQuery.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/query/NumberQuery.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/query/NumberQuery.class new file mode 100644 index 00000000..480b1fb4 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/query/NumberQuery.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/NodeTree.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/NodeTree.class new file mode 100644 index 00000000..0f5eaab8 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/NodeTree.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/NodeVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/NodeVisitor.class new file mode 100644 index 00000000..e2f6e9d9 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/NodeVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/Tree.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/Tree.class new file mode 100644 index 00000000..e25a6f57 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/Tree.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/AbstractNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/AbstractNode.class new file mode 100644 index 00000000..26c5a292 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/AbstractNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/ArithmeticNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/ArithmeticNode.class new file mode 100644 index 00000000..587b7d74 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/ArithmeticNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/ConstantNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/ConstantNode.class new file mode 100644 index 00000000..9b605f7b Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/ConstantNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/ConversionNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/ConversionNode.class new file mode 100644 index 00000000..33aef92a Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/ConversionNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/FieldMemberNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/FieldMemberNode.class new file mode 100644 index 00000000..007fb6de Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/FieldMemberNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/IincNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/IincNode.class new file mode 100644 index 00000000..fe1f47df Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/IincNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/JumpNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/JumpNode.class new file mode 100644 index 00000000..794871a7 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/JumpNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/MethodMemberNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/MethodMemberNode.class new file mode 100644 index 00000000..b895a2f4 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/MethodMemberNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/NumberNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/NumberNode.class new file mode 100644 index 00000000..14d05f83 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/NumberNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/ReferenceNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/ReferenceNode.class new file mode 100644 index 00000000..75b6c264 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/ReferenceNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/TargetNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/TargetNode.class new file mode 100644 index 00000000..716ec47f Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/TargetNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/TypeNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/TypeNode.class new file mode 100644 index 00000000..51159922 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/TypeNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/VariableNode.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/VariableNode.class new file mode 100644 index 00000000..97eca453 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/node/VariableNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/util/TreeBuilder.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/util/TreeBuilder.class new file mode 100644 index 00000000..622ed697 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/util/TreeBuilder.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/util/TreeSize.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/util/TreeSize.class new file mode 100644 index 00000000..785d8954 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/cfg/tree/util/TreeSize.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/util/Assembly.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/util/Assembly.class new file mode 100644 index 00000000..34403142 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/util/Assembly.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/commons/util/JarArchive.class b/out/production/bytecode-viewer/org/objectweb/asm/commons/util/JarArchive.class new file mode 100644 index 00000000..ef1941d5 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/commons/util/JarArchive.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/signature/SignatureReader.class b/out/production/bytecode-viewer/org/objectweb/asm/signature/SignatureReader.class new file mode 100644 index 00000000..5005d866 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/signature/SignatureReader.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/signature/SignatureVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/signature/SignatureVisitor.class new file mode 100644 index 00000000..10946b23 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/signature/SignatureVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/signature/SignatureWriter.class b/out/production/bytecode-viewer/org/objectweb/asm/signature/SignatureWriter.class new file mode 100644 index 00000000..ded67622 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/signature/SignatureWriter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/AbstractInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/AbstractInsnNode.class new file mode 100644 index 00000000..4755f1d5 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/AbstractInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/AnnotationNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/AnnotationNode.class new file mode 100644 index 00000000..a7516d70 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/AnnotationNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/ClassNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/ClassNode.class new file mode 100644 index 00000000..9d53dd1a Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/ClassNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/FieldInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/FieldInsnNode.class new file mode 100644 index 00000000..ccabf57b Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/FieldInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/FieldNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/FieldNode.class new file mode 100644 index 00000000..39265fd8 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/FieldNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/FrameNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/FrameNode.class new file mode 100644 index 00000000..37b27a6c Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/FrameNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/IincInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/IincInsnNode.class new file mode 100644 index 00000000..bf20ab0b Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/IincInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/InnerClassNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/InnerClassNode.class new file mode 100644 index 00000000..825c0e46 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/InnerClassNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/InsnList$InsnListIterator.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/InsnList$InsnListIterator.class new file mode 100644 index 00000000..1cf94042 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/InsnList$InsnListIterator.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/InsnList.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/InsnList.class new file mode 100644 index 00000000..5e03bf57 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/InsnList.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/InsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/InsnNode.class new file mode 100644 index 00000000..5a6f086e Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/InsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/IntInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/IntInsnNode.class new file mode 100644 index 00000000..ae31e946 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/IntInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/InvokeDynamicInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/InvokeDynamicInsnNode.class new file mode 100644 index 00000000..b8d45565 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/InvokeDynamicInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/JumpInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/JumpInsnNode.class new file mode 100644 index 00000000..3f21b535 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/JumpInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/LabelNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/LabelNode.class new file mode 100644 index 00000000..3a54901e Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/LabelNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/LdcInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/LdcInsnNode.class new file mode 100644 index 00000000..930e2550 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/LdcInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/LineNumberNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/LineNumberNode.class new file mode 100644 index 00000000..214710d4 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/LineNumberNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/LocalVariableAnnotationNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/LocalVariableAnnotationNode.class new file mode 100644 index 00000000..6d2c09b0 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/LocalVariableAnnotationNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/LocalVariableNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/LocalVariableNode.class new file mode 100644 index 00000000..3c9fb0b5 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/LocalVariableNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/LookupSwitchInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/LookupSwitchInsnNode.class new file mode 100644 index 00000000..c8ce8c20 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/LookupSwitchInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/MethodInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/MethodInsnNode.class new file mode 100644 index 00000000..566dd1b3 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/MethodInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/MethodNode$1.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/MethodNode$1.class new file mode 100644 index 00000000..63c3a772 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/MethodNode$1.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/MethodNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/MethodNode.class new file mode 100644 index 00000000..fd3fffad Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/MethodNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/MultiANewArrayInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/MultiANewArrayInsnNode.class new file mode 100644 index 00000000..40611b5a Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/MultiANewArrayInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/ParameterNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/ParameterNode.class new file mode 100644 index 00000000..1f2184a9 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/ParameterNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/TableSwitchInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/TableSwitchInsnNode.class new file mode 100644 index 00000000..06353311 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/TableSwitchInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/TryCatchBlockNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/TryCatchBlockNode.class new file mode 100644 index 00000000..3b7307a8 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/TryCatchBlockNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/TypeAnnotationNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/TypeAnnotationNode.class new file mode 100644 index 00000000..bac1072a Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/TypeAnnotationNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/TypeInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/TypeInsnNode.class new file mode 100644 index 00000000..69dcb753 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/TypeInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/VarInsnNode.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/VarInsnNode.class new file mode 100644 index 00000000..54dafe34 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/VarInsnNode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Analyzer.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Analyzer.class new file mode 100644 index 00000000..98eeb096 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Analyzer.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/AnalyzerException.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/AnalyzerException.class new file mode 100644 index 00000000..9a3684ae Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/AnalyzerException.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/BasicInterpreter.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/BasicInterpreter.class new file mode 100644 index 00000000..0702d392 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/BasicInterpreter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/BasicValue.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/BasicValue.class new file mode 100644 index 00000000..9fcd56be Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/BasicValue.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/BasicVerifier.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/BasicVerifier.class new file mode 100644 index 00000000..b7e6b343 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/BasicVerifier.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Frame.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Frame.class new file mode 100644 index 00000000..f5ecf91e Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Frame.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Interpreter.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Interpreter.class new file mode 100644 index 00000000..16f1eb36 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Interpreter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/SimpleVerifier.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/SimpleVerifier.class new file mode 100644 index 00000000..1a7dafec Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/SimpleVerifier.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/SmallSet.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/SmallSet.class new file mode 100644 index 00000000..1f7eeaa0 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/SmallSet.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/SourceInterpreter.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/SourceInterpreter.class new file mode 100644 index 00000000..16a23e07 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/SourceInterpreter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/SourceValue.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/SourceValue.class new file mode 100644 index 00000000..b739a7b7 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/SourceValue.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Subroutine.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Subroutine.class new file mode 100644 index 00000000..33bdda0e Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Subroutine.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Value.class b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Value.class new file mode 100644 index 00000000..9ac010e4 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/tree/analysis/Value.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/ASMifiable.class b/out/production/bytecode-viewer/org/objectweb/asm/util/ASMifiable.class new file mode 100644 index 00000000..fac33943 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/ASMifiable.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/ASMifier.class b/out/production/bytecode-viewer/org/objectweb/asm/util/ASMifier.class new file mode 100644 index 00000000..c0ca6beb Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/ASMifier.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/CheckAnnotationAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/util/CheckAnnotationAdapter.class new file mode 100644 index 00000000..ecc498f6 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/CheckAnnotationAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/CheckClassAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/util/CheckClassAdapter.class new file mode 100644 index 00000000..c59c0394 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/CheckClassAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/CheckFieldAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/util/CheckFieldAdapter.class new file mode 100644 index 00000000..6c517092 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/CheckFieldAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/CheckMethodAdapter$1.class b/out/production/bytecode-viewer/org/objectweb/asm/util/CheckMethodAdapter$1.class new file mode 100644 index 00000000..cf68d133 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/CheckMethodAdapter$1.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/CheckMethodAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/util/CheckMethodAdapter.class new file mode 100644 index 00000000..c56f8927 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/CheckMethodAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/CheckSignatureAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/util/CheckSignatureAdapter.class new file mode 100644 index 00000000..05902f75 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/CheckSignatureAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/Printer.class b/out/production/bytecode-viewer/org/objectweb/asm/util/Printer.class new file mode 100644 index 00000000..dc5b23a9 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/Printer.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/Textifiable.class b/out/production/bytecode-viewer/org/objectweb/asm/util/Textifiable.class new file mode 100644 index 00000000..b29cf226 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/Textifiable.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/Textifier.class b/out/production/bytecode-viewer/org/objectweb/asm/util/Textifier.class new file mode 100644 index 00000000..109f2548 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/Textifier.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/TraceAnnotationVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/util/TraceAnnotationVisitor.class new file mode 100644 index 00000000..d52301bf Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/TraceAnnotationVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/TraceClassVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/util/TraceClassVisitor.class new file mode 100644 index 00000000..d36e5a10 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/TraceClassVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/TraceFieldVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/util/TraceFieldVisitor.class new file mode 100644 index 00000000..0baef843 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/TraceFieldVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/TraceMethodVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/util/TraceMethodVisitor.class new file mode 100644 index 00000000..35a2c8c8 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/TraceMethodVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/util/TraceSignatureVisitor.class b/out/production/bytecode-viewer/org/objectweb/asm/util/TraceSignatureVisitor.class new file mode 100644 index 00000000..c9a370d8 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/util/TraceSignatureVisitor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationDefaultRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationDefaultRule.class new file mode 100644 index 00000000..5874c54c Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationDefaultRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationParameterRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationParameterRule.class new file mode 100644 index 00000000..e06f0227 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationParameterRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationRule.class new file mode 100644 index 00000000..f91ed0a2 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationValueAnnotationRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationValueAnnotationRule.class new file mode 100644 index 00000000..3559680c Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationValueAnnotationRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationValueArrayRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationValueArrayRule.class new file mode 100644 index 00000000..13a66d1d Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationValueArrayRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationValueEnumRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationValueEnumRule.class new file mode 100644 index 00000000..a3dfcc65 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationValueEnumRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationValueRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationValueRule.class new file mode 100644 index 00000000..be6d7368 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$AnnotationValueRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$ClassRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$ClassRule.class new file mode 100644 index 00000000..2cb42e26 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$ClassRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$ExceptionRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$ExceptionRule.class new file mode 100644 index 00000000..c4579251 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$ExceptionRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$ExceptionsRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$ExceptionsRule.class new file mode 100644 index 00000000..82e961a2 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$ExceptionsRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$FieldRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$FieldRule.class new file mode 100644 index 00000000..f5e41a18 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$FieldRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$FrameRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$FrameRule.class new file mode 100644 index 00000000..b077b252 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$FrameRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$FrameTypeRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$FrameTypeRule.class new file mode 100644 index 00000000..2137a958 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$FrameTypeRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InnerClassRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InnerClassRule.class new file mode 100644 index 00000000..0e6a9cc8 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InnerClassRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InsnAnnotationRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InsnAnnotationRule.class new file mode 100644 index 00000000..8df4e077 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InsnAnnotationRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InterfaceRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InterfaceRule.class new file mode 100644 index 00000000..553760ec Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InterfaceRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InterfacesRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InterfacesRule.class new file mode 100644 index 00000000..cff3b290 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InterfacesRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InvokeDynamicBsmArgumentsRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InvokeDynamicBsmArgumentsRule.class new file mode 100644 index 00000000..b2428903 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InvokeDynamicBsmArgumentsRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InvokeDynamicRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InvokeDynamicRule.class new file mode 100644 index 00000000..8f1b40cc Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$InvokeDynamicRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LabelRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LabelRule.class new file mode 100644 index 00000000..5ef51f2e Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LabelRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LineNumberRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LineNumberRule.class new file mode 100644 index 00000000..b2cb68ce Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LineNumberRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LocalVarRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LocalVarRule.class new file mode 100644 index 00000000..549db1bf Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LocalVarRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LocalVariableAnnotationRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LocalVariableAnnotationRule.class new file mode 100644 index 00000000..f5457c3f Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LocalVariableAnnotationRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LookupSwitchLabelRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LookupSwitchLabelRule.class new file mode 100644 index 00000000..715742c4 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LookupSwitchLabelRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LookupSwitchRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LookupSwitchRule.class new file mode 100644 index 00000000..e32b2676 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$LookupSwitchRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$MaxRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$MaxRule.class new file mode 100644 index 00000000..76a110b8 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$MaxRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$MethodParameterRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$MethodParameterRule.class new file mode 100644 index 00000000..11c6bdae Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$MethodParameterRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$MethodRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$MethodRule.class new file mode 100644 index 00000000..cde7d4cb Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$MethodRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$Opcode.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$Opcode.class new file mode 100644 index 00000000..4d9022c6 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$Opcode.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$OpcodeGroup.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$OpcodeGroup.class new file mode 100644 index 00000000..b391fab0 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$OpcodeGroup.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$OpcodesRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$OpcodesRule.class new file mode 100644 index 00000000..00321505 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$OpcodesRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$OuterClassRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$OuterClassRule.class new file mode 100644 index 00000000..858c9d32 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$OuterClassRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$Rule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$Rule.class new file mode 100644 index 00000000..e4ef146c Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$Rule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$RuleSet.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$RuleSet.class new file mode 100644 index 00000000..a405be24 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$RuleSet.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$SourceRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$SourceRule.class new file mode 100644 index 00000000..ed440ec1 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$SourceRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TableSwitchLabelRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TableSwitchLabelRule.class new file mode 100644 index 00000000..6ead2802 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TableSwitchLabelRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TableSwitchRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TableSwitchRule.class new file mode 100644 index 00000000..3c94e961 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TableSwitchRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TryCatchAnnotationRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TryCatchAnnotationRule.class new file mode 100644 index 00000000..a84b2da8 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TryCatchAnnotationRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TryCatchRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TryCatchRule.class new file mode 100644 index 00000000..c7373e7f Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TryCatchRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TypeAnnotationRule.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TypeAnnotationRule.class new file mode 100644 index 00000000..76b6347d Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler$TypeAnnotationRule.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler.class new file mode 100644 index 00000000..f4d73023 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/ASMContentHandler.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ASMContentHandlerFactory$1.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ASMContentHandlerFactory$1.class new file mode 100644 index 00000000..e49fe2b3 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ASMContentHandlerFactory$1.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ASMContentHandlerFactory.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ASMContentHandlerFactory.class new file mode 100644 index 00000000..a6b3ac55 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ASMContentHandlerFactory.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ContentHandlerFactory.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ContentHandlerFactory.class new file mode 100644 index 00000000..671ec52d Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ContentHandlerFactory.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$EntryElement.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$EntryElement.class new file mode 100644 index 00000000..3d727b27 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$EntryElement.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$InputSlicingHandler.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$InputSlicingHandler.class new file mode 100644 index 00000000..e3baf0e2 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$InputSlicingHandler.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$OutputSlicingHandler.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$OutputSlicingHandler.class new file mode 100644 index 00000000..35470623 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$OutputSlicingHandler.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ProtectedInputStream.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ProtectedInputStream.class new file mode 100644 index 00000000..bdb0ec96 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ProtectedInputStream.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$SAXWriter.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$SAXWriter.class new file mode 100644 index 00000000..c0e0b7ad Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$SAXWriter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$SAXWriterFactory.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$SAXWriterFactory.class new file mode 100644 index 00000000..da337ff8 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$SAXWriterFactory.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$SingleDocElement.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$SingleDocElement.class new file mode 100644 index 00000000..398195e4 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$SingleDocElement.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$SubdocumentHandlerFactory.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$SubdocumentHandlerFactory.class new file mode 100644 index 00000000..71ecdd84 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$SubdocumentHandlerFactory.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$TransformerHandlerFactory.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$TransformerHandlerFactory.class new file mode 100644 index 00000000..199cf338 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$TransformerHandlerFactory.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ZipEntryElement.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ZipEntryElement.class new file mode 100644 index 00000000..15137690 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor$ZipEntryElement.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor.class new file mode 100644 index 00000000..02c31c2c Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/Processor.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXAdapter.class new file mode 100644 index 00000000..623c30b1 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXAnnotationAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXAnnotationAdapter.class new file mode 100644 index 00000000..a8d6d0a1 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXAnnotationAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXClassAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXClassAdapter.class new file mode 100644 index 00000000..ccd87938 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXClassAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXCodeAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXCodeAdapter.class new file mode 100644 index 00000000..aa66ddb2 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXCodeAdapter.class differ diff --git a/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXFieldAdapter.class b/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXFieldAdapter.class new file mode 100644 index 00000000..ae597547 Binary files /dev/null and b/out/production/bytecode-viewer/org/objectweb/asm/xml/SAXFieldAdapter.class differ diff --git a/src/main/resources/1.gif b/out/production/bytecode-viewer/resources/1.gif similarity index 100% rename from src/main/resources/1.gif rename to out/production/bytecode-viewer/resources/1.gif diff --git a/src/main/resources/android.png b/out/production/bytecode-viewer/resources/android.png similarity index 100% rename from src/main/resources/android.png rename to out/production/bytecode-viewer/resources/android.png diff --git a/src/main/resources/bat.png b/out/production/bytecode-viewer/resources/bat.png similarity index 100% rename from src/main/resources/bat.png rename to out/production/bytecode-viewer/resources/bat.png diff --git a/src/main/resources/c#.png b/out/production/bytecode-viewer/resources/c#.png similarity index 100% rename from src/main/resources/c#.png rename to out/production/bytecode-viewer/resources/c#.png diff --git a/src/main/resources/c++.png b/out/production/bytecode-viewer/resources/c++.png similarity index 100% rename from src/main/resources/c++.png rename to out/production/bytecode-viewer/resources/c++.png diff --git a/src/main/resources/class.png b/out/production/bytecode-viewer/resources/class.png similarity index 100% rename from src/main/resources/class.png rename to out/production/bytecode-viewer/resources/class.png diff --git a/src/main/resources/config.png b/out/production/bytecode-viewer/resources/config.png similarity index 100% rename from src/main/resources/config.png rename to out/production/bytecode-viewer/resources/config.png diff --git a/src/main/resources/decoded.png b/out/production/bytecode-viewer/resources/decoded.png similarity index 100% rename from src/main/resources/decoded.png rename to out/production/bytecode-viewer/resources/decoded.png diff --git a/src/main/resources/file.png b/out/production/bytecode-viewer/resources/file.png similarity index 100% rename from src/main/resources/file.png rename to out/production/bytecode-viewer/resources/file.png diff --git a/src/main/resources/folder.png b/out/production/bytecode-viewer/resources/folder.png similarity index 100% rename from src/main/resources/folder.png rename to out/production/bytecode-viewer/resources/folder.png diff --git a/src/main/resources/image.png b/out/production/bytecode-viewer/resources/image.png similarity index 100% rename from src/main/resources/image.png rename to out/production/bytecode-viewer/resources/image.png diff --git a/src/main/resources/intro.html b/out/production/bytecode-viewer/resources/intro.html similarity index 100% rename from src/main/resources/intro.html rename to out/production/bytecode-viewer/resources/intro.html diff --git a/src/main/resources/jar.png b/out/production/bytecode-viewer/resources/jar.png similarity index 100% rename from src/main/resources/jar.png rename to out/production/bytecode-viewer/resources/jar.png diff --git a/src/main/resources/java.png b/out/production/bytecode-viewer/resources/java.png similarity index 100% rename from src/main/resources/java.png rename to out/production/bytecode-viewer/resources/java.png diff --git a/src/main/resources/package.png b/out/production/bytecode-viewer/resources/package.png similarity index 100% rename from src/main/resources/package.png rename to out/production/bytecode-viewer/resources/package.png diff --git a/src/main/resources/sh.png b/out/production/bytecode-viewer/resources/sh.png similarity index 100% rename from src/main/resources/sh.png rename to out/production/bytecode-viewer/resources/sh.png diff --git a/src/main/resources/text.png b/out/production/bytecode-viewer/resources/text.png similarity index 100% rename from src/main/resources/text.png rename to out/production/bytecode-viewer/resources/text.png diff --git a/src/main/resources/zip.png b/out/production/bytecode-viewer/resources/zip.png similarity index 100% rename from src/main/resources/zip.png rename to out/production/bytecode-viewer/resources/zip.png diff --git a/out/production/bytecode-viewer/skeleton.py b/out/production/bytecode-viewer/skeleton.py new file mode 100644 index 00000000..99c3a3a6 --- /dev/null +++ b/out/production/bytecode-viewer/skeleton.py @@ -0,0 +1,13 @@ +from the.bytecode.club.bytecodeviewer.api import Plugin +from the.bytecode.club.bytecodeviewer.api import PluginConsole +from java.lang import System +from java.lang import Boolean +from java.util import ArrayList +from org.objectweb.asm.tree import ClassNode + +class skeleton(Plugin): + + def execute(classNodeList, poop): #for some reason it requires a second arg + gui = PluginConsole("Skeleton") + gui.setVisible(Boolean.TRUE) + gui.appendText("exceuted skeleton") \ No newline at end of file diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/AbstractLoaderFactory.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/AbstractLoaderFactory.class new file mode 100644 index 00000000..05823014 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/AbstractLoaderFactory.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot$1.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot$1.class new file mode 100644 index 00000000..5b40d419 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot$2.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot$2.class new file mode 100644 index 00000000..a9d10d95 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot$3.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot$3.class new file mode 100644 index 00000000..603a8142 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot$4.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot$4.class new file mode 100644 index 00000000..5c78ae8c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot.class new file mode 100644 index 00000000..499d8c02 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/Boot.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/ClassPathLoader.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/ClassPathLoader.class new file mode 100644 index 00000000..3c4fde6f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/ClassPathLoader.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/ILoader.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/ILoader.class new file mode 100644 index 00000000..21717008 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/ILoader.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/InitialBootScreen.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/InitialBootScreen.class new file mode 100644 index 00000000..298f5399 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/InitialBootScreen.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/LibraryClassLoader$ResolvingClassWriter.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/LibraryClassLoader$ResolvingClassWriter.class new file mode 100644 index 00000000..6c190128 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/LibraryClassLoader$ResolvingClassWriter.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/LibraryClassLoader.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/LibraryClassLoader.class new file mode 100644 index 00000000..06f612e5 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/LibraryClassLoader.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/LoaderFactory.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/LoaderFactory.class new file mode 100644 index 00000000..3b727fe8 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/LoaderFactory.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/DataContainer.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/DataContainer.class new file mode 100644 index 00000000..2b9d3cde Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/DataContainer.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/EmptyExternalResource.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/EmptyExternalResource.class new file mode 100644 index 00000000..bc0db646 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/EmptyExternalResource.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/ExternalLibrary.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/ExternalLibrary.class new file mode 100644 index 00000000..52125f49 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/ExternalLibrary.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/ExternalResource.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/ExternalResource.class new file mode 100644 index 00000000..5d92234a Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/ExternalResource.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarContents$ClassNodeContainer.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarContents$ClassNodeContainer.class new file mode 100644 index 00000000..594a3c07 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarContents$ClassNodeContainer.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarContents$ResourceContainer.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarContents$ResourceContainer.class new file mode 100644 index 00000000..7994521b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarContents$ResourceContainer.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarContents.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarContents.class new file mode 100644 index 00000000..5de68cba Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarContents.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarInfo.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarInfo.class new file mode 100644 index 00000000..e5e3253c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarInfo.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarResource.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarResource.class new file mode 100644 index 00000000..f440f075 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarResource.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarType.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarType.class new file mode 100644 index 00000000..7cb97746 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/JarType.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/LocateableJarContents.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/LocateableJarContents.class new file mode 100644 index 00000000..c9e76d37 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/resource/LocateableJarContents.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/ClassHelper.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/ClassHelper.class new file mode 100644 index 00000000..c0b51382 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/ClassHelper.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/ClassTree.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/ClassTree.class new file mode 100644 index 00000000..a3e25634 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/ClassTree.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/NullCreator.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/NullCreator.class new file mode 100644 index 00000000..69f15f05 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/NullCreator.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/NullPermeableHashMap.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/NullPermeableHashMap.class new file mode 100644 index 00000000..cd8c4043 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/NullPermeableHashMap.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/SetCreator.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/SetCreator.class new file mode 100644 index 00000000..2a1671e3 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/SetCreator.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/ValueCreator.class b/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/ValueCreator.class new file mode 100644 index 00000000..47f4f04d Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bootloader/util/ValueCreator.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/APKTool.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/APKTool.class new file mode 100644 index 00000000..53fe5a7e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/APKTool.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$1$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$1$1.class new file mode 100644 index 00000000..e76692fa Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$1$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$1$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$1$2.class new file mode 100644 index 00000000..d6761e2d Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$1$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$1.class new file mode 100644 index 00000000..684b0367 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$10.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$10.class new file mode 100644 index 00000000..0c80ba24 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$10.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$11$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$11$1.class new file mode 100644 index 00000000..80635b58 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$11$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$11$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$11$2.class new file mode 100644 index 00000000..78bfa261 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$11$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$11.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$11.class new file mode 100644 index 00000000..468a2d7e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$11.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$2.class new file mode 100644 index 00000000..d7955487 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$3.class new file mode 100644 index 00000000..c1a94eb1 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$4.class new file mode 100644 index 00000000..2ccc3ee3 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$5.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$5.class new file mode 100644 index 00000000..4e9fe9bb Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$5.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$6.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$6.class new file mode 100644 index 00000000..efda1b5f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$6.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$7.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$7.class new file mode 100644 index 00000000..07174aab Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$7.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$8.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$8.class new file mode 100644 index 00000000..3696b8b4 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$8.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$9.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$9.class new file mode 100644 index 00000000..f2753d54 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer$9.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer.class new file mode 100644 index 00000000..c4875b3e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/BytecodeViewer.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/CommandLineInput.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/CommandLineInput.class new file mode 100644 index 00000000..1c939daa Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/CommandLineInput.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/Dex2Jar.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/Dex2Jar.class new file mode 100644 index 00000000..e7402677 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/Dex2Jar.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/Enjarify.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/Enjarify.class new file mode 100644 index 00000000..1bbb5b5b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/Enjarify.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileChangeNotifier.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileChangeNotifier.class new file mode 100644 index 00000000..1ec27bbc Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileChangeNotifier.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileContainer.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileContainer.class new file mode 100644 index 00000000..f3f87e2c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileContainer.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$1.class new file mode 100644 index 00000000..9f6cfeaa Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$2.class new file mode 100644 index 00000000..dedf6e25 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$Event.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$Event.class new file mode 100644 index 00000000..ccd8ab7e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$Event.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$Listener.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$Listener.class new file mode 100644 index 00000000..60cb8c15 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$Listener.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$TransferableObject$Fetcher.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$TransferableObject$Fetcher.class new file mode 100644 index 00000000..4f922ab9 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$TransferableObject$Fetcher.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$TransferableObject.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$TransferableObject.class new file mode 100644 index 00000000..9884572d Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop$TransferableObject.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop.class new file mode 100644 index 00000000..81b7bbd8 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/FileDrop.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/JarUtils.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/JarUtils.class new file mode 100644 index 00000000..e9e20a9f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/JarUtils.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/MiscUtils.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/MiscUtils.class new file mode 100644 index 00000000..038e2186 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/MiscUtils.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/NewlineOutputStream.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/NewlineOutputStream.class new file mode 100644 index 00000000..bc3139e5 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/NewlineOutputStream.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/Resources.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/Resources.class new file mode 100644 index 00000000..af88804f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/Resources.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/SecurityMan.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/SecurityMan.class new file mode 100644 index 00000000..4466958c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/SecurityMan.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/Settings.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/Settings.class new file mode 100644 index 00000000..b6caee07 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/Settings.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/ZipUtils.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/ZipUtils.class new file mode 100644 index 00000000..f9d36562 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/ZipUtils.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/ASMUtil_OLD.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/ASMUtil_OLD.class new file mode 100644 index 00000000..dc9dd80f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/ASMUtil_OLD.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/BytecodeHook.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/BytecodeHook.class new file mode 100644 index 00000000..0aa2dad3 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/BytecodeHook.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/BytecodeViewer.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/BytecodeViewer.class new file mode 100644 index 00000000..5d870b04 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/BytecodeViewer.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.class new file mode 100644 index 00000000..55dba494 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/ExceptionUI.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/ExceptionUI.class new file mode 100644 index 00000000..5fb36558 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/ExceptionUI.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/Plugin.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/Plugin.class new file mode 100644 index 00000000..ecb941f0 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/Plugin.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole$1.class new file mode 100644 index 00000000..52de465c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole$2.class new file mode 100644 index 00000000..c0a2b8c4 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole$3.class new file mode 100644 index 00000000..47f9f600 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole$4.class new file mode 100644 index 00000000..5be8f61e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole.class new file mode 100644 index 00000000..23f8592a Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/api/PluginConsole.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/compilers/Compiler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/compilers/Compiler.class new file mode 100644 index 00000000..99d53199 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/compilers/Compiler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.class new file mode 100644 index 00000000..daf30c42 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/compilers/KrakatauAssembler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/compilers/KrakatauAssembler.class new file mode 100644 index 00000000..d7840bbc Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/compilers/KrakatauAssembler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/compilers/SmaliAssembler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/compilers/SmaliAssembler.class new file mode 100644 index 00000000..9d12f6ea Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/compilers/SmaliAssembler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/CFRDecompiler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/CFRDecompiler.class new file mode 100644 index 00000000..871d13fa Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/CFRDecompiler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/Decompiler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/Decompiler.class new file mode 100644 index 00000000..956f6f24 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/Decompiler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.class new file mode 100644 index 00000000..1e712719 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler$1.class new file mode 100644 index 00000000..bf6f0513 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.class new file mode 100644 index 00000000..5ce9cf80 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.class new file mode 100644 index 00000000..fe6d8d51 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.class new file mode 100644 index 00000000..c1811127 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/ProcyonDecompiler$LuytenTypeLoader.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/ProcyonDecompiler$LuytenTypeLoader.class new file mode 100644 index 00000000..9797ef02 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/ProcyonDecompiler$LuytenTypeLoader.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/ProcyonDecompiler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/ProcyonDecompiler.class new file mode 100644 index 00000000..c7e42326 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/ProcyonDecompiler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/SmaliDisassembler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/SmaliDisassembler.class new file mode 100644 index 00000000..2a26e23d Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/SmaliDisassembler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.class new file mode 100644 index 00000000..851e64c4 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/FieldNodeDecompiler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/FieldNodeDecompiler.class new file mode 100644 index 00000000..2579237e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/FieldNodeDecompiler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPattern.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPattern.class new file mode 100644 index 00000000..93019ef3 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPattern.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.class new file mode 100644 index 00000000..b27ecb79 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionSearcher.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionSearcher.class new file mode 100644 index 00000000..46808131 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionSearcher.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/MethodNodeDecompiler.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/MethodNodeDecompiler.class new file mode 100644 index 00000000..322e604b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/MethodNodeDecompiler.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/PrefixedStringBuilder.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/PrefixedStringBuilder.class new file mode 100644 index 00000000..4b2560ac Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/PrefixedStringBuilder.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/TypeAndName.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/TypeAndName.class new file mode 100644 index 00000000..a4088383 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/decompilers/bytecode/TypeAndName.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/AboutWindow.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/AboutWindow.class new file mode 100644 index 00000000..42c0e215 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/AboutWindow.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$1.class new file mode 100644 index 00000000..3500eff5 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$10.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$10.class new file mode 100644 index 00000000..6c42d23b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$10.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$11.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$11.class new file mode 100644 index 00000000..1cf05cc7 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$11.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$12.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$12.class new file mode 100644 index 00000000..6fa64ab9 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$12.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$1.class new file mode 100644 index 00000000..38799c90 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$10.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$10.class new file mode 100644 index 00000000..39cc40e8 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$10.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$11.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$11.class new file mode 100644 index 00000000..b56c92c1 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$11.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$12.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$12.class new file mode 100644 index 00000000..4abbf4c4 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$12.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$13.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$13.class new file mode 100644 index 00000000..99015d75 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$13.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$14.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$14.class new file mode 100644 index 00000000..a27802b4 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$14.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$15.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$15.class new file mode 100644 index 00000000..35e0d28a Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$15.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$16.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$16.class new file mode 100644 index 00000000..49c76691 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$16.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$17.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$17.class new file mode 100644 index 00000000..1d82833b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$17.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$2.class new file mode 100644 index 00000000..438f2eae Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$3.class new file mode 100644 index 00000000..8f879340 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$4.class new file mode 100644 index 00000000..b804e8ce Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$5.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$5.class new file mode 100644 index 00000000..52899e02 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$5.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$6.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$6.class new file mode 100644 index 00000000..e7012e30 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$6.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$7.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$7.class new file mode 100644 index 00000000..3de638a3 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$7.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$8.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$8.class new file mode 100644 index 00000000..bb05647f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$8.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$9.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$9.class new file mode 100644 index 00000000..33626515 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13$9.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13.class new file mode 100644 index 00000000..c6d3808e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$13.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$1.class new file mode 100644 index 00000000..bde61b5a Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$10.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$10.class new file mode 100644 index 00000000..5de742a4 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$10.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$11.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$11.class new file mode 100644 index 00000000..0ca63848 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$11.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$12.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$12.class new file mode 100644 index 00000000..fcff21f5 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$12.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$13.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$13.class new file mode 100644 index 00000000..55ab91a8 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$13.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$14.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$14.class new file mode 100644 index 00000000..379def90 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$14.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$15.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$15.class new file mode 100644 index 00000000..f9504f4e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$15.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$16.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$16.class new file mode 100644 index 00000000..97b6c0fe Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$16.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$17.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$17.class new file mode 100644 index 00000000..2ca299cc Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$17.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$2.class new file mode 100644 index 00000000..81f1cf4c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$3.class new file mode 100644 index 00000000..6df649bd Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$4.class new file mode 100644 index 00000000..1fd63f86 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$5.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$5.class new file mode 100644 index 00000000..8119bc32 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$5.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$6.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$6.class new file mode 100644 index 00000000..fea52417 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$6.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$7.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$7.class new file mode 100644 index 00000000..115bfce8 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$7.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$8.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$8.class new file mode 100644 index 00000000..9c02c7aa Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$8.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$9.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$9.class new file mode 100644 index 00000000..d893f55b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14$9.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14.class new file mode 100644 index 00000000..058ff643 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$14.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$1.class new file mode 100644 index 00000000..23fe5857 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$10.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$10.class new file mode 100644 index 00000000..c16a4061 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$10.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$11.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$11.class new file mode 100644 index 00000000..ce814899 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$11.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$12.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$12.class new file mode 100644 index 00000000..00e315c7 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$12.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$13.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$13.class new file mode 100644 index 00000000..732c3832 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$13.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$14.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$14.class new file mode 100644 index 00000000..522dd789 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$14.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$15.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$15.class new file mode 100644 index 00000000..0226c15d Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$15.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$16.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$16.class new file mode 100644 index 00000000..4431ae27 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$16.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$17.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$17.class new file mode 100644 index 00000000..01744958 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$17.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$2.class new file mode 100644 index 00000000..cb68dd08 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$3.class new file mode 100644 index 00000000..3b043b3e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$4.class new file mode 100644 index 00000000..533326e7 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$5.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$5.class new file mode 100644 index 00000000..e4cf0a1e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$5.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$6.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$6.class new file mode 100644 index 00000000..7637a84d Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$6.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$7.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$7.class new file mode 100644 index 00000000..4c326ef8 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$7.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$8.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$8.class new file mode 100644 index 00000000..49a3da50 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$8.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$9.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$9.class new file mode 100644 index 00000000..4f0f7a37 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15$9.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15.class new file mode 100644 index 00000000..af6f64d9 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$15.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$2.class new file mode 100644 index 00000000..7704f81e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$3.class new file mode 100644 index 00000000..460e2de5 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$4.class new file mode 100644 index 00000000..24e41e7d Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$5.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$5.class new file mode 100644 index 00000000..eb317ab6 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$5.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$6.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$6.class new file mode 100644 index 00000000..f6b69593 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$6.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$7.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$7.class new file mode 100644 index 00000000..b5280973 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$7.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$8.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$8.class new file mode 100644 index 00000000..c939a55e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$8.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$9.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$9.class new file mode 100644 index 00000000..f321fc3a Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$9.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$MethodData.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$MethodData.class new file mode 100644 index 00000000..ef1c0fd6 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$MethodData.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$NoWrapParagraphView.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$NoWrapParagraphView.class new file mode 100644 index 00000000..113a1ca9 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$NoWrapParagraphView.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$WrapColumnFactory.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$WrapColumnFactory.class new file mode 100644 index 00000000..bfd2e3d8 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$WrapColumnFactory.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$WrapEditorKit.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$WrapEditorKit.class new file mode 100644 index 00000000..d6e4f05b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer$WrapEditorKit.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer.class new file mode 100644 index 00000000..6939cb3e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ClassViewer.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ExportJar$1$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ExportJar$1$1.class new file mode 100644 index 00000000..e5f0d862 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ExportJar$1$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ExportJar$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ExportJar$1.class new file mode 100644 index 00000000..bcb088f6 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ExportJar$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ExportJar.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ExportJar.class new file mode 100644 index 00000000..81e7a9bd Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ExportJar.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$1.class new file mode 100644 index 00000000..6ec758fa Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$2.class new file mode 100644 index 00000000..a01020a2 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$3.class new file mode 100644 index 00000000..557ed93e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$4.class new file mode 100644 index 00000000..17423e36 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$5.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$5.class new file mode 100644 index 00000000..1fc5d715 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$5.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$6.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$6.class new file mode 100644 index 00000000..d62df0cc Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$6.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$7.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$7.class new file mode 100644 index 00000000..dc68c139 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$7.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$ImageRenderer.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$ImageRenderer.class new file mode 100644 index 00000000..597c76b9 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$ImageRenderer.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$MyTree.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$MyTree.class new file mode 100644 index 00000000..db504884 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$MyTree.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$MyTreeNode$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$MyTreeNode$1.class new file mode 100644 index 00000000..98640153 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$MyTreeNode$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$MyTreeNode.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$MyTreeNode.class new file mode 100644 index 00000000..ae2112f0 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$MyTreeNode.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$StringMetrics.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$StringMetrics.class new file mode 100644 index 00000000..dcb97f5b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane$StringMetrics.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.class new file mode 100644 index 00000000..29107c7f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$1.class new file mode 100644 index 00000000..9d4ba28b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$2.class new file mode 100644 index 00000000..54ef73e9 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$3.class new file mode 100644 index 00000000..b24c6be7 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$4.class new file mode 100644 index 00000000..0b8eae58 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$5.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$5.class new file mode 100644 index 00000000..4318b77e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer$5.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer.class new file mode 100644 index 00000000..854d9b06 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/FileViewer.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/GraphicialReflectionKit.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/GraphicialReflectionKit.class new file mode 100644 index 00000000..1072b3df Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/GraphicialReflectionKit.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$1.class new file mode 100644 index 00000000..67b32803 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$10.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$10.class new file mode 100644 index 00000000..0aae9717 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$10.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$11$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$11$1.class new file mode 100644 index 00000000..7d41d40b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$11$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$11.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$11.class new file mode 100644 index 00000000..f1de22d1 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$11.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$12$1$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$12$1$1.class new file mode 100644 index 00000000..2b357250 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$12$1$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$12$1$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$12$1$2.class new file mode 100644 index 00000000..0a855835 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$12$1$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$12$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$12$1.class new file mode 100644 index 00000000..6a216311 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$12$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$12.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$12.class new file mode 100644 index 00000000..e58b4fa8 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$12.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$13.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$13.class new file mode 100644 index 00000000..e650e2c4 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$13.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$14$1$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$14$1$1.class new file mode 100644 index 00000000..bfda8b99 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$14$1$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$14$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$14$1.class new file mode 100644 index 00000000..8698bbb0 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$14$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$14.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$14.class new file mode 100644 index 00000000..0c41ca62 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$14.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$15$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$15$1.class new file mode 100644 index 00000000..94b4c045 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$15$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$15.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$15.class new file mode 100644 index 00000000..f1be8175 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$15.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$16.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$16.class new file mode 100644 index 00000000..8ebe2366 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$16.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17$1$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17$1$1.class new file mode 100644 index 00000000..245b7db6 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17$1$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17$1$2$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17$1$2$1.class new file mode 100644 index 00000000..8dcb82b3 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17$1$2$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17$1$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17$1$2.class new file mode 100644 index 00000000..26623087 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17$1$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17$1.class new file mode 100644 index 00000000..7d8a9f39 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17.class new file mode 100644 index 00000000..1a1a72cf Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$17.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$1.class new file mode 100644 index 00000000..f2aeee6b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$2.class new file mode 100644 index 00000000..4c750a42 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$3.class new file mode 100644 index 00000000..3c322a5f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$4.class new file mode 100644 index 00000000..57971fb5 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$5.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$5.class new file mode 100644 index 00000000..4d007ec9 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1$5.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1.class new file mode 100644 index 00000000..538b0fdc Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18.class new file mode 100644 index 00000000..424463ac Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$18.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$1.class new file mode 100644 index 00000000..ee3be577 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$2.class new file mode 100644 index 00000000..bd1cde67 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$3.class new file mode 100644 index 00000000..adc02ade Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$4.class new file mode 100644 index 00000000..00dd5cd6 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$5.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$5.class new file mode 100644 index 00000000..cead1da5 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1$5.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1.class new file mode 100644 index 00000000..a62cd246 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19.class new file mode 100644 index 00000000..e6df9e47 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$19.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$2.class new file mode 100644 index 00000000..10b4cb94 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$20.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$20.class new file mode 100644 index 00000000..d7a6533b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$20.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$21.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$21.class new file mode 100644 index 00000000..0b025080 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$21.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$22.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$22.class new file mode 100644 index 00000000..7beaf490 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$22.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$23.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$23.class new file mode 100644 index 00000000..0fb05068 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$23.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$24.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$24.class new file mode 100644 index 00000000..fb2d0a46 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$24.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$25.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$25.class new file mode 100644 index 00000000..25d9835b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$25.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$26.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$26.class new file mode 100644 index 00000000..624ec946 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$26.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$27.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$27.class new file mode 100644 index 00000000..93b5fc05 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$27.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$28.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$28.class new file mode 100644 index 00000000..37bbc8a6 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$28.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$29.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$29.class new file mode 100644 index 00000000..b9832782 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$29.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$3.class new file mode 100644 index 00000000..4d038202 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$30.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$30.class new file mode 100644 index 00000000..9947256a Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$30.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$31.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$31.class new file mode 100644 index 00000000..1d78ed1b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$31.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$32.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$32.class new file mode 100644 index 00000000..62892e19 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$32.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$33.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$33.class new file mode 100644 index 00000000..8024f0a4 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$33.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$34.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$34.class new file mode 100644 index 00000000..7368c52f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$34.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$35.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$35.class new file mode 100644 index 00000000..16e0c952 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$35.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$36.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$36.class new file mode 100644 index 00000000..6b47194e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$36.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$37.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$37.class new file mode 100644 index 00000000..b11167d7 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$37.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$38.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$38.class new file mode 100644 index 00000000..f80b17e8 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$38.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$39.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$39.class new file mode 100644 index 00000000..a91159b5 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$39.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$4.class new file mode 100644 index 00000000..e16227c2 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$40.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$40.class new file mode 100644 index 00000000..2a867736 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$40.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$5.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$5.class new file mode 100644 index 00000000..3783d58c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$5.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$6.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$6.class new file mode 100644 index 00000000..91e2ae65 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$6.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$7.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$7.class new file mode 100644 index 00000000..fb65cd86 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$7.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$8.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$8.class new file mode 100644 index 00000000..7dae4a43 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$8.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$9.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$9.class new file mode 100644 index 00000000..714f4394 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$9.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$Test.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$Test.class new file mode 100644 index 00000000..97c0f623 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI$Test.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.class new file mode 100644 index 00000000..483819fd Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MaliciousCodeScannerOptions$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MaliciousCodeScannerOptions$1.class new file mode 100644 index 00000000..807fc342 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MaliciousCodeScannerOptions$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MaliciousCodeScannerOptions.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MaliciousCodeScannerOptions.class new file mode 100644 index 00000000..5e1e139b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/MaliciousCodeScannerOptions.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/PaneUpdaterThread.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/PaneUpdaterThread.class new file mode 100644 index 00000000..866751a1 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/PaneUpdaterThread.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ReplaceStringsOptions$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ReplaceStringsOptions$1.class new file mode 100644 index 00000000..bace733c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ReplaceStringsOptions$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ReplaceStringsOptions.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ReplaceStringsOptions.class new file mode 100644 index 00000000..b89d75ff Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/ReplaceStringsOptions.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/RunOptions$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/RunOptions$1.class new file mode 100644 index 00000000..2ace1b84 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/RunOptions$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/RunOptions.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/RunOptions.class new file mode 100644 index 00000000..cfbd58b5 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/RunOptions.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$1.class new file mode 100644 index 00000000..81b54875 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$2.class new file mode 100644 index 00000000..14390398 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$3$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$3$1.class new file mode 100644 index 00000000..809292ad Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$3$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$3$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$3$2.class new file mode 100644 index 00000000..1f9aa34f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$3$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$3.class new file mode 100644 index 00000000..abb7a30c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$4.class new file mode 100644 index 00000000..31c1a040 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$SearchRadius.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$SearchRadius.class new file mode 100644 index 00000000..53b7a977 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$SearchRadius.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$SearchType.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$SearchType.class new file mode 100644 index 00000000..4596aeb7 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane$SearchType.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane.class new file mode 100644 index 00000000..279cbcca Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SearchingPane.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$1.class new file mode 100644 index 00000000..13dd6c53 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$2.class new file mode 100644 index 00000000..1bfead9c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$3.class new file mode 100644 index 00000000..e4f22a3c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$4.class new file mode 100644 index 00000000..5611ae2e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$CustomOutputStream.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$CustomOutputStream.class new file mode 100644 index 00000000..3ca89d6d Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole$CustomOutputStream.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole.class new file mode 100644 index 00000000..0a049058 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$1.class new file mode 100644 index 00000000..a7173ca2 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$2.class new file mode 100644 index 00000000..3810a03c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$3.class new file mode 100644 index 00000000..17457794 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$4.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$4.class new file mode 100644 index 00000000..b4f596c1 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$4.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$5.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$5.class new file mode 100644 index 00000000..3e1a6e97 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$5.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$TabButton.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$TabButton.class new file mode 100644 index 00000000..b34a7d14 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane$TabButton.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane.class new file mode 100644 index 00000000..233c9167 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/TabbedPane.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/Viewer.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/Viewer.class new file mode 100644 index 00000000..21542468 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/Viewer.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/VisibleComponent.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/VisibleComponent.class new file mode 100644 index 00000000..1ee6e68e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/VisibleComponent.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/WorkPane$1.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/WorkPane$1.class new file mode 100644 index 00000000..4489694f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/WorkPane$1.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/WorkPane$2.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/WorkPane$2.class new file mode 100644 index 00000000..9bab9159 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/WorkPane$2.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/WorkPane$3.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/WorkPane$3.class new file mode 100644 index 00000000..65b2bdd0 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/WorkPane$3.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/WorkPane.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/WorkPane.class new file mode 100644 index 00000000..75714607 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/gui/WorkPane.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.class new file mode 100644 index 00000000..48644529 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/RenameClasses.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/RenameClasses.class new file mode 100644 index 00000000..b7481ed1 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/RenameClasses.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/RenameFields.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/RenameFields.class new file mode 100644 index 00000000..5ac4a743 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/RenameFields.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/RenameMethods.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/RenameMethods.class new file mode 100644 index 00000000..fb92960a Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/RenameMethods.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/HookMap.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/HookMap.class new file mode 100644 index 00000000..d38af976 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/HookMap.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RefactorMapper.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RefactorMapper.class new file mode 100644 index 00000000..547f90b7 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RefactorMapper.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/Refactorer.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/Refactorer.class new file mode 100644 index 00000000..b24539bd Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/Refactorer.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/FieldMappingData.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/FieldMappingData.class new file mode 100644 index 00000000..21dca155 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/FieldMappingData.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MappingData.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MappingData.class new file mode 100644 index 00000000..a93514b8 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MappingData.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MethodMappingData.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MethodMappingData.class new file mode 100644 index 00000000..8e127525 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MethodMappingData.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameClasses.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameClasses.class new file mode 100644 index 00000000..289063e7 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameClasses.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameFields.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameFields.class new file mode 100644 index 00000000..6f80b6ec Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameFields.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameMethods.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameMethods.class new file mode 100644 index 00000000..3c1bdd88 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameMethods.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/PluginLaunchStrategy.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/PluginLaunchStrategy.class new file mode 100644 index 00000000..c360706c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/PluginLaunchStrategy.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/PluginManager$PluginFileFilter.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/PluginManager$PluginFileFilter.class new file mode 100644 index 00000000..8ab2a4bb Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/PluginManager$PluginFileFilter.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/PluginManager.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/PluginManager.class new file mode 100644 index 00000000..642103ce Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/PluginManager.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.class new file mode 100644 index 00000000..533e5a9f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.class new file mode 100644 index 00000000..f52d5b56 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.class new file mode 100644 index 00000000..325356d5 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.class new file mode 100644 index 00000000..8794dcb6 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.class new file mode 100644 index 00000000..ba547409 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.class new file mode 100644 index 00000000..5c45879b Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.class new file mode 100644 index 00000000..13dd786e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.class new file mode 100644 index 00000000..f823739c Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.class new file mode 100644 index 00000000..50157f74 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy$LoadedNodeData.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy$LoadedNodeData.class new file mode 100644 index 00000000..31ad902e Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy$LoadedNodeData.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy$LoadedPluginData.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy$LoadedPluginData.class new file mode 100644 index 00000000..a7448af4 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy$LoadedPluginData.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy$LoadingClassLoader.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy$LoadingClassLoader.class new file mode 100644 index 00000000..964efac6 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy$LoadingClassLoader.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.class new file mode 100644 index 00000000..a3b086b2 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.class new file mode 100644 index 00000000..cd1fe0a4 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.class new file mode 100644 index 00000000..b5891186 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.class new file mode 100644 index 00000000..d3818ebc Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.class new file mode 100644 index 00000000..6f2c66af Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/BackgroundSearchThread.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/BackgroundSearchThread.class new file mode 100644 index 00000000..ddcec179 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/BackgroundSearchThread.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.class new file mode 100644 index 00000000..217e10fd Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/LDCSearch.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/LDCSearch.class new file mode 100644 index 00000000..33dc5891 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/LDCSearch.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.class new file mode 100644 index 00000000..185b8d00 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.class new file mode 100644 index 00000000..a869993f Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/RegexSearch.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/RegexSearch.class new file mode 100644 index 00000000..b747bced Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/RegexSearch.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/SearchResultNotifier.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/SearchResultNotifier.class new file mode 100644 index 00000000..6dcd67cf Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/SearchResultNotifier.class differ diff --git a/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/SearchTypeDetails.class b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/SearchTypeDetails.class new file mode 100644 index 00000000..2f516a55 Binary files /dev/null and b/out/production/bytecode-viewer/the/bytecode/club/bytecodeviewer/searching/SearchTypeDetails.class differ diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 0e44e44f..00000000 --- a/pom.xml +++ /dev/null @@ -1,243 +0,0 @@ - - - 4.0.0 - - - - - the.bytecode.club - bytecode-viewer - 3.0.0 - - UTF-8 - - - - - maven-compiler-plugin - 3.3 - - 1.7 - 1.7 - true - - - - org.apache.maven.plugins - maven-jar-plugin - 2.6 - - - maven-shade-plugin - 2.4.3 - - - package - - shade - - - - - the.bytecode.club.bytecodeviewer.BytecodeViewer - - - - - *:* - - META-INF/* - - - - ca.benow:jd - - org/fife/** - - - - org.jf:baksmali - - org/apache/commons/cli/** - - - - dex2jar:dex2jar - - org/objectweb/asm/xml/Processor.class - org/objectweb/asm/util/TraceClassVisitor.class - org/objectweb/asm/util/CheckClassAdapter.class - - - - com.fifesoft:rsyntaxtextarea - - ** - - - - true - - - - - - - - - - - bytecode-viewer - Bytecode Viewer Repository - file:///libs/ - - - - - - org.imgscalr - imgscalr-lib - 4.2 - - - commons-cli - commons-cli - 1.3.1 - - - commons-codec - commons-codec - 1.10 - - - org.codehaus.janino - janino - RELEASE - - - org.apache.commons - commons-lang3 - RELEASE - - - commons-io - commons-io - 2.4 - - - com.fifesoft - rsyntaxtextarea - 2.5.8 - - - org.tinyjee.jgraphx - jgraphx - 2.3.0.5 - - - com.googlecode.mp4parser - isoparser - 1.1.9 - - - org.ow2.asm - asm-all - 5.0.4 - - - org.zeroturnaround - zt-zip - 1.8 - - - - - - org.bitbucket.mstrobel - procyon-compilertools - 0.5.29 - - - org.bitbucket.mstrobel - procyon-core - 0.5.29 - - - - - - - com.strobel - decompiler - RELEASE - system - ${project.basedir}/libs/procyon-decompiler-0.5.30.jar - - - org.jf - smali - 2.0.3 - system - ${project.basedir}/libs/smali-2.0.3-obf-patched.jar - - - org.smali - baksmali - RELEASE - system - ${project.basedir}/libs/baksmali-2.0.3_obf.jar - - - org.benf - cfr - RELEASE - system - ${project.basedir}/libs/cfr_0_115.jar - - - ca.benow - jd - RELEASE - system - ${project.basedir}/libs/jd-gui-1.0.0-RC4.jar - - - eu.bibl - byteanalysis - RELEASE - system - ${project.basedir}/libs/byteanalysis-1.0.jar - - - brut - apktool - RELEASE - system - ${project.basedir}/libs/apktool_2.0.1_obf-2.jar - - - dex2jar - dex2jar - RELEASE - system - ${project.basedir}/libs/dex_obf.jar - - - org.jetbrains.java - decompiler - RELEASE - system - ${project.basedir}/libs/fernflower-2016.jar - - - - - - - - - - \ No newline at end of file diff --git a/publish_libs_to_repository.sh b/publish_libs_to_repository.sh deleted file mode 100755 index b3671faa..00000000 --- a/publish_libs_to_repository.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# the script will install the dependencies from ./libs/ diretory into the local Maven repository - -install() { - if [ ! -z "$5" ]; then - classifier=-Dclassifier=$5 - else - unset classifier - fi - mvn install:install-file -Dfile=libs/$1 -DgroupId=$2 -DartifactId=$3 -Dversion=$4 ${classifier} -Dpackaging=jar -} - -install procyon-decompiler-0.5.30.jar com.strobel procyon 0.5.30 -install cfr_0_115.jar org.benf cfr 0.115 -install jd-gui-1.0.0-RC4.jar ca.benow jd 1.4.0 -install byteanalysis-1.0.jar eu.bibl byteanalysis 1.0 -install apktool_2.0.1_obf-2.jar brut apktool 2.0.1 -install fernflower-2016.jar org.jetbrains.java decompiler 2015-1 -install dex_obf.jar dex2jar dex2jar 0.0.1 -install smali-2.0.3-obf-patched.jar org.jf smali 2.0.3 patched -install baksmali-2.0.3_obf.jar org.jf baksmali 2.0.3 diff --git a/src/META-INF/MANIFEST.MF b/src/META-INF/MANIFEST.MF new file mode 100644 index 00000000..429686e7 --- /dev/null +++ b/src/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Class-Path: . BytecodeViewer 2.9.9-preview2_lib/byteanalysis-1.0.jar B + ytecodeViewer 2.9.9-preview2_lib/commons-codec-1.9.jar BytecodeViewer + 2.9.9-preview2_lib/commons-io-2.4.jar BytecodeViewer 2.9.9-preview2_ + lib/commons-lang3-3.3.2.jar BytecodeViewer 2.9.9-preview2_lib/imgscal + r-lib-4.2.jar BytecodeViewer 2.9.9-preview2_lib/jar-rename-1.6.jar By + tecodeViewer 2.9.9-preview2_lib/jasmin-p2.5.jar BytecodeViewer 2.9.9- + preview2_lib/jgraphx.jar BytecodeViewer 2.9.9-preview2_lib/rsyntaxtex + tarea.jar BytecodeViewer 2.9.9-preview2_lib/smali-2.0.3-obf-patched.j + ar BytecodeViewer 2.9.9-preview2_lib/baksmali-2.0.3.jar BytecodeViewe + r 2.9.9-preview2_lib/fernflower2015.jar BytecodeViewer 2.9.9-preview2 + _lib/commons-compiler.jar BytecodeViewer 2.9.9-preview2_lib/apktool_2 + .0.0rc4_obf.jar BytecodeViewer 2.9.9-preview2_lib/dex2jar_2.0_obf.jar + BytecodeViewer 2.9.9-preview2_lib/jd-gui-1.0.0-RC4.jar BytecodeViewe + r 2.9.9-preview2_lib/procyon-decompiler-0.5.29.jar BytecodeViewer 2.9 + .9-preview2_lib/cfr_0_101.jar BytecodeViewer 2.9.9-preview2_lib/commo + ns-net-3.1.jar BytecodeViewer 2.9.9-preview2_lib/janino.jar +Main-Class: the.bytecode.club.bytecodeviewer.BytecodeViewer + diff --git a/src/com/jhe/hexed/JHexEditor.java b/src/com/jhe/hexed/JHexEditor.java new file mode 100644 index 00000000..23ac5273 --- /dev/null +++ b/src/com/jhe/hexed/JHexEditor.java @@ -0,0 +1,257 @@ +package com.jhe.hexed; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +/** + * Created by IntelliJ IDEA. User: laullon Date: 08-abr-2003 Time: 13:21:09 + */ +public class JHexEditor extends JPanel implements FocusListener, + AdjustmentListener, MouseWheelListener { + private static final long serialVersionUID = 2289328616534802372L; + byte[] buff; + public int cursor; + protected static Font font = new Font("Monospaced", 0, 12); + protected int border = 2; + public boolean DEBUG = false; + private JPanel panel; + private JScrollBar sb; + private int inicio = 0; + private int lineas = 10; + + public JHexEditor(byte[] buff) { + super(); + this.buff = buff; + + this.addMouseWheelListener(this); + + sb = new JScrollBar(JScrollBar.VERTICAL); + sb.addAdjustmentListener(this); + sb.setMinimum(0); + sb.setMaximum(buff.length / getLineas()); + + JPanel p1, p2, p3; + // centro + p1 = new JPanel(new BorderLayout(1, 1)); + p1.add(new JHexEditorHEX(this), BorderLayout.CENTER); + p1.add(new Columnas(), BorderLayout.NORTH); + + // izq. + p2 = new JPanel(new BorderLayout(1, 1)); + p2.add(new Filas(), BorderLayout.CENTER); + p2.add(new Caja(), BorderLayout.NORTH); + + // der + p3 = new JPanel(new BorderLayout(1, 1)); + p3.add(sb, BorderLayout.EAST); + p3.add(new JHexEditorASCII(this), BorderLayout.CENTER); + p3.add(new Caja(), BorderLayout.NORTH); + + panel = new JPanel(); + panel.setLayout(new BorderLayout(1, 1)); + panel.add(p1, BorderLayout.CENTER); + panel.add(p2, BorderLayout.WEST); + panel.add(p3, BorderLayout.EAST); + + this.setLayout(new BorderLayout(1, 1)); + this.add(panel, BorderLayout.CENTER); + } + + public void paint(Graphics g) { + FontMetrics fn = getFontMetrics(font); + Rectangle rec = this.getBounds(); + lineas = (rec.height / fn.getHeight()) - 1; + int n = (buff.length / 16) - 1; + if (lineas > n) { + lineas = n; + inicio = 0; + } + + sb.setValues(getInicio(), +getLineas(), 0, buff.length / 16); + sb.setValueIsAdjusting(true); + super.paint(g); + } + + protected void actualizaCursor() { + int n = (cursor / 16); + + System.out.print("- " + inicio + "<" + n + "<" + (lineas + inicio) + + "(" + lineas + ")"); + + if (n < inicio) + inicio = n; + else if (n >= inicio + lineas) + inicio = n - (lineas - 1); + + System.out.println(" - " + inicio + "<" + n + "<" + (lineas + inicio) + + "(" + lineas + ")"); + + repaint(); + } + + protected int getInicio() { + return inicio; + } + + protected int getLineas() { + return lineas; + } + + protected void fondo(Graphics g, int x, int y, int s) { + FontMetrics fn = getFontMetrics(font); + g.fillRect(((fn.stringWidth(" ") + 1) * x) + border, + (fn.getHeight() * y) + border, ((fn.stringWidth(" ") + 1) * s), + fn.getHeight() + 1); + } + + protected void cuadro(Graphics g, int x, int y, int s) { + FontMetrics fn = getFontMetrics(font); + g.drawRect(((fn.stringWidth(" ") + 1) * x) + border, + (fn.getHeight() * y) + border, ((fn.stringWidth(" ") + 1) * s), + fn.getHeight() + 1); + } + + protected void printString(Graphics g, String s, int x, int y) { + FontMetrics fn = getFontMetrics(font); + g.drawString(s, ((fn.stringWidth(" ") + 1) * x) + border, + ((fn.getHeight() * (y + 1)) - fn.getMaxDescent()) + border); + } + + public void focusGained(FocusEvent e) { + this.repaint(); + } + + public void focusLost(FocusEvent e) { + this.repaint(); + } + + public void adjustmentValueChanged(AdjustmentEvent e) { + inicio = e.getValue(); + if (inicio < 0) + inicio = 0; + repaint(); + } + + public void mouseWheelMoved(MouseWheelEvent e) { + inicio += (e.getUnitsToScroll()); + if ((inicio + lineas) >= buff.length / 16) + inicio = (buff.length / 16) - lineas; + if (inicio < 0) + inicio = 0; + repaint(); + } + + public void keyPressed(KeyEvent e) { + /* + * switch(e.getKeyCode()) { case 33: // rep if(cursor>=(16*lineas)) + * cursor-=(16*lineas); actualizaCursor(); break; case 34: // fin + * if(cursor<(buff.length-(16*lineas))) cursor+=(16*lineas); + * actualizaCursor(); break; case 35: // fin cursor=buff.length-1; + * actualizaCursor(); break; case 36: // ini cursor=0; + * actualizaCursor(); break; case 37: // <-- if(cursor!=0) cursor--; + * actualizaCursor(); break; case 38: // <-- if(cursor>15) cursor-=16; + * actualizaCursor(); break; case 39: // --> if(cursor!=(buff.length-1)) + * cursor++; actualizaCursor(); break; case 40: // --> + * if(cursor<(buff.length-16)) cursor+=16; actualizaCursor(); break; } + */ + } + + private class Columnas extends JPanel { + private static final long serialVersionUID = -1734199617526339842L; + + public Columnas() { + this.setLayout(new BorderLayout(1, 1)); + } + + public Dimension getPreferredSize() { + return getMinimumSize(); + } + + public Dimension getMinimumSize() { + Dimension d = new Dimension(); + FontMetrics fn = getFontMetrics(font); + int h = fn.getHeight(); + int nl = 1; + d.setSize(((fn.stringWidth(" ") + 1) * +((16 * 3) - 1)) + + (border * 2) + 1, h * nl + (border * 2) + 1); + return d; + } + + public void paint(Graphics g) { + Dimension d = getMinimumSize(); + g.setColor(Color.white); + g.fillRect(0, 0, d.width, d.height); + g.setColor(Color.black); + g.setFont(font); + + for (int n = 0; n < 16; n++) { + if (n == (cursor % 16)) + cuadro(g, n * 3, 0, 2); + String s = "00" + Integer.toHexString(n); + s = s.substring(s.length() - 2); + printString(g, s, n * 3, 0); + } + } + } + + private class Caja extends JPanel { + private static final long serialVersionUID = -6124062720565016834L; + + public Dimension getPreferredSize() { + return getMinimumSize(); + } + + public Dimension getMinimumSize() { + Dimension d = new Dimension(); + FontMetrics fn = getFontMetrics(font); + int h = fn.getHeight(); + d.setSize((fn.stringWidth(" ") + 1) + (border * 2) + 1, h + + (border * 2) + 1); + return d; + } + + } + + private class Filas extends JPanel { + private static final long serialVersionUID = 8797347523486018051L; + + public Filas() { + this.setLayout(new BorderLayout(1, 1)); + } + + public Dimension getPreferredSize() { + return getMinimumSize(); + } + + public Dimension getMinimumSize() { + Dimension d = new Dimension(); + FontMetrics fn = getFontMetrics(font); + int h = fn.getHeight(); + int nl = getLineas(); + d.setSize((fn.stringWidth(" ") + 1) * (8) + (border * 2) + 1, h + * nl + (border * 2) + 1); + return d; + } + + public void paint(Graphics g) { + Dimension d = getMinimumSize(); + g.setColor(Color.white); + g.fillRect(0, 0, d.width, d.height); + g.setColor(Color.black); + g.setFont(font); + + int ini = getInicio(); + int fin = ini + getLineas(); + int y = 0; + for (int n = ini; n < fin; n++) { + if (n == (cursor / 16)) + cuadro(g, 0, y, 8); + String s = "0000000000000" + Integer.toHexString(n); + s = s.substring(s.length() - 8); + printString(g, s, 0, y++); + } + } + } + +} diff --git a/src/com/jhe/hexed/JHexEditorASCII.java b/src/com/jhe/hexed/JHexEditorASCII.java new file mode 100644 index 00000000..314b79a3 --- /dev/null +++ b/src/com/jhe/hexed/JHexEditorASCII.java @@ -0,0 +1,141 @@ +package com.jhe.hexed; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +/** + * Created by IntelliJ IDEA. User: laullon Date: 09-abr-2003 Time: 12:47:18 + */ +public class JHexEditorASCII extends JComponent implements MouseListener, + KeyListener { + private static final long serialVersionUID = 5505374841731053461L; + private JHexEditor he; + + public JHexEditorASCII(JHexEditor he) { + this.he = he; + addMouseListener(this); + addKeyListener(this); + addFocusListener(he); + } + + public Dimension getPreferredSize() { + debug("getPreferredSize()"); + return getMinimumSize(); + } + + public Dimension getMinimumSize() { + debug("getMinimumSize()"); + + Dimension d = new Dimension(); + FontMetrics fn = getFontMetrics(JHexEditor.font); + int h = fn.getHeight(); + int nl = he.getLineas(); + d.setSize((fn.stringWidth(" ") + 1) * (16) + (he.border * 2) + 1, h + * nl + (he.border * 2) + 1); + return d; + } + + public void paint(Graphics g) { + debug("paint(" + g + ")"); + debug("cursor=" + he.cursor + " buff.length=" + he.buff.length); + Dimension d = getMinimumSize(); + g.setColor(Color.white); + g.fillRect(0, 0, d.width, d.height); + g.setColor(Color.black); + + g.setFont(JHexEditor.font); + + // datos ascii + int ini = he.getInicio() * 16; + int fin = ini + (he.getLineas() * 16); + if (fin > he.buff.length) + fin = he.buff.length; + + int x = 0; + int y = 0; + for (int n = ini; n < fin; n++) { + if (n == he.cursor) { + g.setColor(Color.blue); + if (hasFocus()) + he.fondo(g, x, y, 1); + else + he.cuadro(g, x, y, 1); + if (hasFocus()) + g.setColor(Color.white); + else + g.setColor(Color.black); + } else { + g.setColor(Color.black); + } + + String s = "" + new Character((char) he.buff[n]); + if ((he.buff[n] < 20) || (he.buff[n] > 126)) + s = "" + (char) 16; + he.printString(g, s, (x++), y); + if (x == 16) { + x = 0; + y++; + } + } + + } + + private void debug(String s) { + if (he.DEBUG) + System.out.println("JHexEditorASCII ==> " + s); + } + + // calcular la posicion del raton + public int calcularPosicionRaton(int x, int y) { + FontMetrics fn = getFontMetrics(JHexEditor.font); + x = x / (fn.stringWidth(" ") + 1); + y = y / fn.getHeight(); + debug("x=" + x + " ,y=" + y); + return x + ((y + he.getInicio()) * 16); + } + + // mouselistener + public void mouseClicked(MouseEvent e) { + debug("mouseClicked(" + e + ")"); + he.cursor = calcularPosicionRaton(e.getX(), e.getY()); + this.requestFocus(); + he.repaint(); + } + + public void mousePressed(MouseEvent e) { + } + + public void mouseReleased(MouseEvent e) { + } + + public void mouseEntered(MouseEvent e) { + } + + public void mouseExited(MouseEvent e) { + } + + // KeyListener + public void keyTyped(KeyEvent e) { + /* + * debug("keyTyped("+e+")"); + * + * he.buff[he.cursor]=(byte)e.getKeyChar(); + * + * if(he.cursor!=(he.buff.length-1)) he.cursor++; he.repaint(); + */ + } + + public void keyPressed(KeyEvent e) { + debug("keyPressed(" + e + ")"); + he.keyPressed(e); + } + + public void keyReleased(KeyEvent e) { + debug("keyReleased(" + e + ")"); + } + + public boolean isFocusTraversable() { + return true; + } +} diff --git a/src/com/jhe/hexed/JHexEditorHEX.java b/src/com/jhe/hexed/JHexEditorHEX.java new file mode 100644 index 00000000..bfa9e352 --- /dev/null +++ b/src/com/jhe/hexed/JHexEditorHEX.java @@ -0,0 +1,154 @@ +package com.jhe.hexed; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +/** + * Created by IntelliJ IDEA. User: laullon Date: 09-abr-2003 Time: 12:47:32 + */ +public class JHexEditorHEX extends JComponent implements MouseListener, + KeyListener { + private static final long serialVersionUID = 1481995655372014571L; + private JHexEditor he; + private int cursor = 0; + + public JHexEditorHEX(JHexEditor he) { + this.he = he; + addMouseListener(this); + addKeyListener(this); + addFocusListener(he); + } + + /* + * public Dimension getPreferredSize() { debug("getPreferredSize()"); return + * getMinimumSize(); } + */ + + public Dimension getMaximumSize() { + debug("getMaximumSize()"); + return getMinimumSize(); + } + + /* + * public Dimension getMinimumSize() { debug("getMinimumSize()"); + * + * Dimension d=new Dimension(); FontMetrics fn=getFontMetrics(he.font); int + * h=fn.getHeight(); int nl=he.getLineas(); + * d.setSize(((fn.stringWidth(" ")+1 + * )*+((16*3)-1))+(he.border*2)+1,h*nl+(he.border*2)+1); return d; } + */ + + public void paint(Graphics g) { + debug("paint(" + g + ")"); + debug("cursor=" + he.cursor + " buff.length=" + he.buff.length); + Dimension d = getMinimumSize(); + g.setColor(Color.white); + g.fillRect(0, 0, d.width, d.height); + g.setColor(Color.black); + + g.setFont(JHexEditor.font); + + int ini = he.getInicio() * 16; + int fin = ini + (he.getLineas() * 16); + if (fin > he.buff.length) + fin = he.buff.length; + + // datos hex + int x = 0; + int y = 0; + for (int n = ini; n < fin; n++) { + if (n == he.cursor) { + if (hasFocus()) { + g.setColor(Color.black); + he.fondo(g, (x * 3), y, 2); + g.setColor(Color.blue); + he.fondo(g, (x * 3) + cursor, y, 1); + } else { + g.setColor(Color.blue); + he.cuadro(g, (x * 3), y, 2); + } + + if (hasFocus()) + g.setColor(Color.white); + else + g.setColor(Color.black); + } else { + g.setColor(Color.black); + } + + String s = ("0" + Integer.toHexString(he.buff[n])); + s = s.substring(s.length() - 2); + he.printString(g, s, ((x++) * 3), y); + if (x == 16) { + x = 0; + y++; + } + } + } + + private void debug(String s) { + if (he.DEBUG) + System.out.println("JHexEditorHEX ==> " + s); + } + + // calcular la posicion del raton + public int calcularPosicionRaton(int x, int y) { + FontMetrics fn = getFontMetrics(JHexEditor.font); + x = x / ((fn.stringWidth(" ") + 1) * 3); + y = y / fn.getHeight(); + debug("x=" + x + " ,y=" + y); + return x + ((y + he.getInicio()) * 16); + } + + // mouselistener + public void mouseClicked(MouseEvent e) { + debug("mouseClicked(" + e + ")"); + he.cursor = calcularPosicionRaton(e.getX(), e.getY()); + this.requestFocus(); + he.repaint(); + } + + public void mousePressed(MouseEvent e) { + } + + public void mouseReleased(MouseEvent e) { + } + + public void mouseEntered(MouseEvent e) { + } + + public void mouseExited(MouseEvent e) { + } + + // KeyListener + public void keyTyped(KeyEvent e) { + debug("keyTyped(" + e + ")"); + + /* + * char c=e.getKeyChar(); + * if(((c>='0')&&(c<='9'))||((c>='A')&&(c<='F'))||((c>='a')&&(c<='f'))) + * { char[] str=new char[2]; String + * n="00"+Integer.toHexString((int)he.buff[he.cursor]); if(n.length()>2) + * n=n.substring(n.length()-2); str[1-cursor]=n.charAt(1-cursor); + * str[cursor]=e.getKeyChar(); + * he.buff[he.cursor]=(byte)Integer.parseInt(new String(str),16); + * + * if(cursor!=1) cursor=1; else if(he.cursor!=(he.buff.length-1)){ + * he.cursor++; cursor=0;} he.actualizaCursor(); } + */ + } + + public void keyPressed(KeyEvent e) { + debug("keyPressed(" + e + ")"); + he.keyPressed(e); + } + + public void keyReleased(KeyEvent e) { + debug("keyReleased(" + e + ")"); + } + + public boolean isFocusTraversable() { + return true; + } +} diff --git a/src/main/java/jd/cli/Main.java b/src/jd/cli/Main.java similarity index 100% rename from src/main/java/jd/cli/Main.java rename to src/jd/cli/Main.java index d9afbfbc..11004a4f 100644 --- a/src/main/java/jd/cli/Main.java +++ b/src/jd/cli/Main.java @@ -1,5 +1,8 @@ package jd.cli; +import java.io.File; +import java.io.PrintStream; + import jd.cli.loader.DirectoryLoader; import jd.cli.preferences.CommonPreferences; import jd.cli.printer.text.PlainTextPrinter; @@ -7,9 +10,6 @@ import jd.cli.util.ClassFileUtil; import jd.core.Decompiler; import jd.core.process.DecompilerImpl; -import java.io.File; -import java.io.PrintStream; - public class Main { diff --git a/src/main/java/jd/cli/loader/BaseLoader.java b/src/jd/cli/loader/BaseLoader.java similarity index 100% rename from src/main/java/jd/cli/loader/BaseLoader.java rename to src/jd/cli/loader/BaseLoader.java index 9faceca1..67f6979a 100644 --- a/src/main/java/jd/cli/loader/BaseLoader.java +++ b/src/jd/cli/loader/BaseLoader.java @@ -1,9 +1,9 @@ package jd.cli.loader; -import jd.core.loader.Loader; - import java.io.File; +import jd.core.loader.Loader; + public abstract class BaseLoader implements Loader { protected String codebase; diff --git a/src/main/java/jd/cli/loader/DirectoryLoader.java b/src/jd/cli/loader/DirectoryLoader.java similarity index 83% rename from src/main/java/jd/cli/loader/DirectoryLoader.java rename to src/jd/cli/loader/DirectoryLoader.java index ad905f97..1a85fcaf 100644 --- a/src/main/java/jd/cli/loader/DirectoryLoader.java +++ b/src/jd/cli/loader/DirectoryLoader.java @@ -1,8 +1,12 @@ package jd.cli.loader; -import jd.core.loader.LoaderException; +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; -import java.io.*; +import jd.core.loader.LoaderException; public class DirectoryLoader extends BaseLoader diff --git a/src/main/java/jd/cli/loader/JarLoader.java b/src/jd/cli/loader/JarLoader.java similarity index 100% rename from src/main/java/jd/cli/loader/JarLoader.java rename to src/jd/cli/loader/JarLoader.java index d74a3b40..695d4780 100644 --- a/src/main/java/jd/cli/loader/JarLoader.java +++ b/src/jd/cli/loader/JarLoader.java @@ -1,13 +1,13 @@ package jd.cli.loader; -import jd.core.loader.LoaderException; - import java.io.DataInputStream; import java.io.File; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; +import jd.core.loader.LoaderException; + public class JarLoader extends BaseLoader { diff --git a/src/main/java/jd/cli/loader/LoaderManager.java b/src/jd/cli/loader/LoaderManager.java similarity index 100% rename from src/main/java/jd/cli/loader/LoaderManager.java rename to src/jd/cli/loader/LoaderManager.java index 9c8d31a7..6a9e949d 100644 --- a/src/main/java/jd/cli/loader/LoaderManager.java +++ b/src/jd/cli/loader/LoaderManager.java @@ -1,11 +1,11 @@ package jd.cli.loader; -import jd.core.loader.LoaderException; - import java.io.File; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import jd.core.loader.LoaderException; + public class LoaderManager { protected final static String JAR_SUFFIX = ".jar"; diff --git a/src/main/java/jd/cli/preferences/CommonPreferences.java b/src/jd/cli/preferences/CommonPreferences.java similarity index 100% rename from src/main/java/jd/cli/preferences/CommonPreferences.java rename to src/jd/cli/preferences/CommonPreferences.java diff --git a/src/main/java/jd/cli/printer/html/HtmlPrinter.java b/src/jd/cli/printer/html/HtmlPrinter.java similarity index 100% rename from src/main/java/jd/cli/printer/html/HtmlPrinter.java rename to src/jd/cli/printer/html/HtmlPrinter.java index bd007d0b..0a1b7393 100644 --- a/src/main/java/jd/cli/printer/html/HtmlPrinter.java +++ b/src/jd/cli/printer/html/HtmlPrinter.java @@ -1,11 +1,11 @@ package jd.cli.printer.html; +import java.io.PrintStream; + import jd.cli.util.VersionUtil; import jd.core.CoreConstants; import jd.core.printer.Printer; -import java.io.PrintStream; - /* * CSS * .javacode{font-size:11px} diff --git a/src/main/java/jd/cli/printer/text/PlainTextPrinter.java b/src/jd/cli/printer/text/PlainTextPrinter.java similarity index 100% rename from src/main/java/jd/cli/printer/text/PlainTextPrinter.java rename to src/jd/cli/printer/text/PlainTextPrinter.java index 91c834f6..ae9f6da7 100644 --- a/src/main/java/jd/cli/printer/text/PlainTextPrinter.java +++ b/src/jd/cli/printer/text/PlainTextPrinter.java @@ -1,11 +1,11 @@ package jd.cli.printer.text; +import java.io.PrintStream; + import jd.cli.preferences.CommonPreferences; import jd.core.model.instruction.bytecode.instruction.Instruction; import jd.core.printer.Printer; -import java.io.PrintStream; - public class PlainTextPrinter implements Printer { protected static final String TAB = " "; diff --git a/src/jd/cli/util/ClassFileUtil.java b/src/jd/cli/util/ClassFileUtil.java new file mode 100644 index 00000000..1a1914cc --- /dev/null +++ b/src/jd/cli/util/ClassFileUtil.java @@ -0,0 +1,147 @@ +package jd.cli.util; + +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; + +import jd.core.CoreConstants; +import jd.core.model.classfile.constant.Constant; +import jd.core.model.classfile.constant.ConstantClass; +import jd.core.model.classfile.constant.ConstantConstant; +import jd.core.model.classfile.constant.ConstantUtf8; +import jd.core.process.deserializer.ClassFormatException; +import jd.core.util.StringConstants; + + +public class ClassFileUtil +{ + /* + * Lecture rapide de la structure de la classe et extraction du nom du + * repoertoire de base. + */ + public static String ExtractDirectoryPath(String pathToClass) + { + DataInputStream dis = null; + String directoryPath = null; + + try + { + dis = new DataInputStream( + new BufferedInputStream( + new FileInputStream(pathToClass))); + + int magic = dis.readInt(); + if(magic != CoreConstants.JAVA_MAGIC_NUMBER) + throw new ClassFormatException("Invalid Java .class file"); + + /* int minor_version = */ dis.readUnsignedShort(); + /* int major_version = */ dis.readUnsignedShort(); + + Constant[] constants = DeserializeConstants(dis); + + /* int access_flags = */ dis.readUnsignedShort(); + int this_class = dis.readUnsignedShort(); + + Constant c = constants[this_class]; + if ((c == null) || (c.tag != ConstantConstant.CONSTANT_Class)) + throw new ClassFormatException("Invalid contant pool"); + + c = constants[((ConstantClass)c).name_index]; + if ((c == null) || (c.tag != ConstantConstant.CONSTANT_Utf8)) + throw new ClassFormatException("Invalid contant pool"); + + String internalClassName = ((ConstantUtf8)c).bytes; + String pathSuffix = internalClassName.replace( + StringConstants.INTERNAL_PACKAGE_SEPARATOR, File.separatorChar) + + StringConstants.CLASS_FILE_SUFFIX; + + int index = pathToClass.indexOf(pathSuffix); + + if (index < 0) + throw new ClassFormatException("Invalid internal class name"); + + directoryPath = pathToClass.substring(0, index); + } + catch (FileNotFoundException e) + { + directoryPath = null; + e.printStackTrace(); + } + catch (IOException e) + { + directoryPath = null; + e.printStackTrace(); + } + finally + { + if (dis != null) + try { dis.close(); } catch (IOException e) { } + } + + return directoryPath; + } + + public static String ExtractInternalPath( + String directoryPath, String pathToClass) + { + if ((directoryPath == null) || (pathToClass == null) || + !pathToClass.startsWith(directoryPath)) + return null; + + String s = pathToClass.substring(directoryPath.length()); + + return s.replace(File.separatorChar, StringConstants.INTERNAL_PACKAGE_SEPARATOR); + } + + private static Constant[] DeserializeConstants(DataInputStream dis) + throws IOException + { + int count = dis.readUnsignedShort(); + if (count == 0) + return null; + + Constant[] constants = new Constant[count]; + + for (int i=1; i - * To parse a given JSON input, use the parse() methods like in this - * example: - *

- *
- * JsonObject object = Json.parse(string).asObject();
- * 
- *

- * To create a JSON data structure to be serialized, use the methods - * value(), array(), and object(). For example, the following - * snippet will produce the JSON string {"foo": 23, "bar": true}: - *

- *
- * String string = Json.object().add("foo", 23).add("bar", true).toString();
- * 
- *

- * To create a JSON array from a given Java array, you can use one of the array() - * methods with varargs parameters: - *

- *
- * String[] names = ...
- * JsonArray array = Json.array(names);
- * 
- */ -public final class Json { - - private Json() { - // not meant to be instantiated - } - - /** - * Represents the JSON literal null. - */ - public static final JsonValue NULL = new JsonLiteral("null"); - - /** - * Represents the JSON literal true. - */ - public static final JsonValue TRUE = new JsonLiteral("true"); - - /** - * Represents the JSON literal false. - */ - public static final JsonValue FALSE = new JsonLiteral("false"); - - /** - * Returns a JsonValue instance that represents the given int value. - * - * @param value - * the value to get a JSON representation for - * @return a JSON value that represents the given value - */ - public static JsonValue value(int value) { - return new JsonNumber(Integer.toString(value, 10)); - } - - /** - * Returns a JsonValue instance that represents the given long value. - * - * @param value - * the value to get a JSON representation for - * @return a JSON value that represents the given value - */ - public static JsonValue value(long value) { - return new JsonNumber(Long.toString(value, 10)); - } - - /** - * Returns a JsonValue instance that represents the given float value. - * - * @param value - * the value to get a JSON representation for - * @return a JSON value that represents the given value - */ - public static JsonValue value(float value) { - if (Float.isInfinite(value) || Float.isNaN(value)) { - throw new IllegalArgumentException("Infinite and NaN values not permitted in JSON"); - } - return new JsonNumber(cutOffPointZero(Float.toString(value))); - } - - /** - * Returns a JsonValue instance that represents the given double value. - * - * @param value - * the value to get a JSON representation for - * @return a JSON value that represents the given value - */ - public static JsonValue value(double value) { - if (Double.isInfinite(value) || Double.isNaN(value)) { - throw new IllegalArgumentException("Infinite and NaN values not permitted in JSON"); - } - return new JsonNumber(cutOffPointZero(Double.toString(value))); - } - - /** - * Returns a JsonValue instance that represents the given string. - * - * @param string - * the string to get a JSON representation for - * @return a JSON value that represents the given string - */ - public static JsonValue value(String string) { - return string == null ? NULL : new JsonString(string); - } - - /** - * Returns a JsonValue instance that represents the given boolean value. - * - * @param value - * the value to get a JSON representation for - * @return a JSON value that represents the given value - */ - public static JsonValue value(boolean value) { - return value ? TRUE : FALSE; - } - - /** - * Creates a new empty JsonArray. This is equivalent to creating a new JsonArray using the - * constructor. - * - * @return a new empty JSON array - */ - public static JsonValue array() { - return new JsonArray(); - } - - /** - * Creates a new JsonArray that contains the JSON representations of the given int - * values. - * - * @param values - * the values to be included in the new JSON array - * @return a new JSON array that contains the given values - */ - public static JsonArray array(int... values) { - if (values == null) { - throw new NullPointerException("values is null"); - } - JsonArray array = new JsonArray(); - for (int value : values) { - array.add(value); - } - return array; - } - - /** - * Creates a new JsonArray that contains the JSON representations of the given long - * values. - * - * @param values - * the values to be included in the new JSON array - * @return a new JSON array that contains the given values - */ - public static JsonArray array(long... values) { - if (values == null) { - throw new NullPointerException("values is null"); - } - JsonArray array = new JsonArray(); - for (long value : values) { - array.add(value); - } - return array; - } - - /** - * Creates a new JsonArray that contains the JSON representations of the given float - * values. - * - * @param values - * the values to be included in the new JSON array - * @return a new JSON array that contains the given values - */ - public static JsonArray array(float... values) { - if (values == null) { - throw new NullPointerException("values is null"); - } - JsonArray array = new JsonArray(); - for (float value : values) { - array.add(value); - } - return array; - } - - /** - * Creates a new JsonArray that contains the JSON representations of the given double - * values. - * - * @param values - * the values to be included in the new JSON array - * @return a new JSON array that contains the given values - */ - public static JsonArray array(double... values) { - if (values == null) { - throw new NullPointerException("values is null"); - } - JsonArray array = new JsonArray(); - for (double value : values) { - array.add(value); - } - return array; - } - - /** - * Creates a new JsonArray that contains the JSON representations of the given - * boolean values. - * - * @param values - * the values to be included in the new JSON array - * @return a new JSON array that contains the given values - */ - public static JsonArray array(boolean... values) { - if (values == null) { - throw new NullPointerException("values is null"); - } - JsonArray array = new JsonArray(); - for (boolean value : values) { - array.add(value); - } - return array; - } - - /** - * Creates a new JsonArray that contains the JSON representations of the given strings. - * - * @param strings - * the strings to be included in the new JSON array - * @return a new JSON array that contains the given strings - */ - public static JsonArray array(String... strings) { - if (strings == null) { - throw new NullPointerException("values is null"); - } - JsonArray array = new JsonArray(); - for (String value : strings) { - array.add(value); - } - return array; - } - - /** - * Creates a new empty JsonObject. This is equivalent to creating a new JsonObject using the - * constructor. - * - * @return a new empty JSON object - */ - public static JsonObject object() { - return new JsonObject(); - } - - /** - * Parses the given input string as JSON. The input must contain a valid JSON value, optionally - * padded with whitespace. - * - * @param string - * the input string, must be valid JSON - * @return a value that represents the parsed JSON - * @throws ParseException - * if the input is not valid JSON - */ - public static JsonValue parse(String string) { - if (string == null) { - throw new NullPointerException("string is null"); - } - try { - return new JsonParser(string).parse(); - } catch (IOException exception) { - // JsonParser does not throw IOException for String - throw new RuntimeException(exception); - } - } - - /** - * Reads the entire input stream from the given reader and parses it as JSON. The input must - * contain a valid JSON value, optionally padded with whitespace. - *

- * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in - * an additional BufferedReader does not improve reading - * performance. - *

- * - * @param reader - * the reader to read the JSON value from - * @return a value that represents the parsed JSON - * @throws IOException - * if an I/O error occurs in the reader - * @throws ParseException - * if the input is not valid JSON - */ - public static JsonValue parse(Reader reader) throws IOException { - if (reader == null) { - throw new NullPointerException("reader is null"); - } - return new JsonParser( reader ).parse(); - } - - private static String cutOffPointZero(String string) { - if (string.endsWith(".0")) { - return string.substring(0, string.length() - 2); - } - return string; - } - -} diff --git a/src/main/java/com/eclipsesource/json/JsonArray.java b/src/main/java/com/eclipsesource/json/JsonArray.java deleted file mode 100644 index c4b30cf2..00000000 --- a/src/main/java/com/eclipsesource/json/JsonArray.java +++ /dev/null @@ -1,499 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 EclipseSource. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package com.eclipsesource.json; - -import java.io.IOException; -import java.io.Reader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - - -/** - * Represents a JSON array, an ordered collection of JSON values. - *

- * Elements can be added using the add(...) methods which accept instances of - * {@link JsonValue}, strings, primitive numbers, and boolean values. To replace an element of an - * array, use the set(int, ...) methods. - *

- *

- * Elements can be accessed by their index using {@link #get(int)}. This class also supports - * iterating over the elements in document order using an {@link #iterator()} or an enhanced for - * loop: - *

- *
- * for (JsonValue value : jsonArray) {
- *   ...
- * }
- * 
- *

- * An equivalent {@link List} can be obtained from the method {@link #values()}. - *

- *

- * Note that this class is not thread-safe. If multiple threads access a - * JsonArray instance concurrently, while at least one of these threads modifies the - * contents of this array, access to the instance must be synchronized externally. Failure to do so - * may lead to an inconsistent state. - *

- *

- * This class is not supposed to be extended by clients. - *

- */ -@SuppressWarnings("serial") // use default serial UID -public class JsonArray extends JsonValue implements Iterable { - - private final List values; - - /** - * Creates a new empty JsonArray. - */ - public JsonArray() { - values = new ArrayList(); - } - - /** - * Creates a new JsonArray with the contents of the specified JSON array. - * - * @param array - * the JsonArray to get the initial contents from, must not be null - */ - public JsonArray(JsonArray array) { - this(array, false); - } - - private JsonArray(JsonArray array, boolean unmodifiable) { - if (array == null) { - throw new NullPointerException("array is null"); - } - if (unmodifiable) { - values = Collections.unmodifiableList(array.values); - } else { - values = new ArrayList(array.values); - } - } - - /** - * Reads a JSON array from the given reader. - *

- * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in - * an additional BufferedReader does not improve reading - * performance. - *

- * - * @param reader - * the reader to read the JSON array from - * @return the JSON array that has been read - * @throws IOException - * if an I/O error occurs in the reader - * @throws ParseException - * if the input is not valid JSON - * @throws UnsupportedOperationException - * if the input does not contain a JSON array - * @deprecated Use {@link Json#parse(Reader)}{@link JsonValue#asArray() .asArray()} instead - */ - @Deprecated - public static JsonArray readFrom(Reader reader) throws IOException { - return JsonValue.readFrom(reader).asArray(); - } - - /** - * Reads a JSON array from the given string. - * - * @param string - * the string that contains the JSON array - * @return the JSON array that has been read - * @throws ParseException - * if the input is not valid JSON - * @throws UnsupportedOperationException - * if the input does not contain a JSON array - * @deprecated Use {@link Json#parse(String)}{@link JsonValue#asArray() .asArray()} instead - */ - @Deprecated - public static JsonArray readFrom(String string) { - return JsonValue.readFrom(string).asArray(); - } - - /** - * Returns an unmodifiable wrapper for the specified JsonArray. This method allows to provide - * read-only access to a JsonArray. - *

- * The returned JsonArray is backed by the given array and reflects subsequent changes. Attempts - * to modify the returned JsonArray result in an UnsupportedOperationException. - *

- * - * @param array - * the JsonArray for which an unmodifiable JsonArray is to be returned - * @return an unmodifiable view of the specified JsonArray - */ - public static JsonArray unmodifiableArray(JsonArray array) { - return new JsonArray(array, true); - } - - /** - * Appends the JSON representation of the specified int value to the end of this - * array. - * - * @param value - * the value to add to the array - * @return the array itself, to enable method chaining - */ - public JsonArray add(int value) { - values.add(Json.value(value)); - return this; - } - - /** - * Appends the JSON representation of the specified long value to the end of this - * array. - * - * @param value - * the value to add to the array - * @return the array itself, to enable method chaining - */ - public JsonArray add(long value) { - values.add(Json.value(value)); - return this; - } - - /** - * Appends the JSON representation of the specified float value to the end of this - * array. - * - * @param value - * the value to add to the array - * @return the array itself, to enable method chaining - */ - public JsonArray add(float value) { - values.add(Json.value(value)); - return this; - } - - /** - * Appends the JSON representation of the specified double value to the end of this - * array. - * - * @param value - * the value to add to the array - * @return the array itself, to enable method chaining - */ - public JsonArray add(double value) { - values.add(Json.value(value)); - return this; - } - - /** - * Appends the JSON representation of the specified boolean value to the end of this - * array. - * - * @param value - * the value to add to the array - * @return the array itself, to enable method chaining - */ - public JsonArray add(boolean value) { - values.add(Json.value(value)); - return this; - } - - /** - * Appends the JSON representation of the specified string to the end of this array. - * - * @param value - * the string to add to the array - * @return the array itself, to enable method chaining - */ - public JsonArray add(String value) { - values.add(Json.value(value)); - return this; - } - - /** - * Appends the specified JSON value to the end of this array. - * - * @param value - * the JsonValue to add to the array, must not be null - * @return the array itself, to enable method chaining - */ - public JsonArray add(JsonValue value) { - if (value == null) { - throw new NullPointerException("value is null"); - } - values.add(value); - return this; - } - - /** - * Replaces the element at the specified position in this array with the JSON representation of - * the specified int value. - * - * @param index - * the index of the array element to replace - * @param value - * the value to be stored at the specified array position - * @return the array itself, to enable method chaining - * @throws IndexOutOfBoundsException - * if the index is out of range, i.e. index < 0 or - * index >= size - */ - public JsonArray set(int index, int value) { - values.set(index, Json.value(value)); - return this; - } - - /** - * Replaces the element at the specified position in this array with the JSON representation of - * the specified long value. - * - * @param index - * the index of the array element to replace - * @param value - * the value to be stored at the specified array position - * @return the array itself, to enable method chaining - * @throws IndexOutOfBoundsException - * if the index is out of range, i.e. index < 0 or - * index >= size - */ - public JsonArray set(int index, long value) { - values.set(index, Json.value(value)); - return this; - } - - /** - * Replaces the element at the specified position in this array with the JSON representation of - * the specified float value. - * - * @param index - * the index of the array element to replace - * @param value - * the value to be stored at the specified array position - * @return the array itself, to enable method chaining - * @throws IndexOutOfBoundsException - * if the index is out of range, i.e. index < 0 or - * index >= size - */ - public JsonArray set(int index, float value) { - values.set(index, Json.value(value)); - return this; - } - - /** - * Replaces the element at the specified position in this array with the JSON representation of - * the specified double value. - * - * @param index - * the index of the array element to replace - * @param value - * the value to be stored at the specified array position - * @return the array itself, to enable method chaining - * @throws IndexOutOfBoundsException - * if the index is out of range, i.e. index < 0 or - * index >= size - */ - public JsonArray set(int index, double value) { - values.set(index, Json.value(value)); - return this; - } - - /** - * Replaces the element at the specified position in this array with the JSON representation of - * the specified boolean value. - * - * @param index - * the index of the array element to replace - * @param value - * the value to be stored at the specified array position - * @return the array itself, to enable method chaining - * @throws IndexOutOfBoundsException - * if the index is out of range, i.e. index < 0 or - * index >= size - */ - public JsonArray set(int index, boolean value) { - values.set(index, Json.value(value)); - return this; - } - - /** - * Replaces the element at the specified position in this array with the JSON representation of - * the specified string. - * - * @param index - * the index of the array element to replace - * @param value - * the string to be stored at the specified array position - * @return the array itself, to enable method chaining - * @throws IndexOutOfBoundsException - * if the index is out of range, i.e. index < 0 or - * index >= size - */ - public JsonArray set(int index, String value) { - values.set(index, Json.value(value)); - return this; - } - - /** - * Replaces the element at the specified position in this array with the specified JSON value. - * - * @param index - * the index of the array element to replace - * @param value - * the value to be stored at the specified array position, must not be null - * @return the array itself, to enable method chaining - * @throws IndexOutOfBoundsException - * if the index is out of range, i.e. index < 0 or - * index >= size - */ - public JsonArray set(int index, JsonValue value) { - if (value == null) { - throw new NullPointerException("value is null"); - } - values.set(index, value); - return this; - } - - /** - * Removes the element at the specified index from this array. - * - * @param index - * the index of the element to remove - * @return the array itself, to enable method chaining - * @throws IndexOutOfBoundsException - * if the index is out of range, i.e. index < 0 or - * index >= size - */ - public JsonArray remove(int index) { - values.remove(index); - return this; - } - - /** - * Returns the number of elements in this array. - * - * @return the number of elements in this array - */ - public int size() { - return values.size(); - } - - /** - * Returns true if this array contains no elements. - * - * @return true if this array contains no elements - */ - public boolean isEmpty() { - return values.isEmpty(); - } - - /** - * Returns the value of the element at the specified position in this array. - * - * @param index - * the index of the array element to return - * @return the value of the element at the specified position - * @throws IndexOutOfBoundsException - * if the index is out of range, i.e. index < 0 or - * index >= size - */ - public JsonValue get(int index) { - return values.get(index); - } - - /** - * Returns a list of the values in this array in document order. The returned list is backed by - * this array and will reflect subsequent changes. It cannot be used to modify this array. - * Attempts to modify the returned list will result in an exception. - * - * @return a list of the values in this array - */ - public List values() { - return Collections.unmodifiableList(values); - } - - /** - * Returns an iterator over the values of this array in document order. The returned iterator - * cannot be used to modify this array. - * - * @return an iterator over the values of this array - */ - public Iterator iterator() { - final Iterator iterator = values.iterator(); - return new Iterator() { - - public boolean hasNext() { - return iterator.hasNext(); - } - - public JsonValue next() { - return iterator.next(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - }; - } - - @Override - void write(JsonWriter writer) throws IOException { - writer.writeArrayOpen(); - Iterator iterator = iterator(); - boolean first = true; - while (iterator.hasNext()) { - if (!first) { - writer.writeArraySeparator(); - } - iterator.next().write(writer); - first = false; - } - writer.writeArrayClose(); - } - - @Override - public boolean isArray() { - return true; - } - - @Override - public JsonArray asArray() { - return this; - } - - @Override - public int hashCode() { - return values.hashCode(); - } - - @Override - public boolean equals(Object object) { - if (this == object) { - return true; - } - if (object == null) { - return false; - } - if (getClass() != object.getClass()) { - return false; - } - JsonArray other = (JsonArray)object; - return values.equals(other.values); - } - -} diff --git a/src/main/java/com/eclipsesource/json/JsonLiteral.java b/src/main/java/com/eclipsesource/json/JsonLiteral.java deleted file mode 100644 index 7762689e..00000000 --- a/src/main/java/com/eclipsesource/json/JsonLiteral.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 EclipseSource. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package com.eclipsesource.json; - -import java.io.IOException; - - -@SuppressWarnings("serial") // use default serial UID -class JsonLiteral extends JsonValue { - - private final String value; - private final boolean isNull; - private final boolean isTrue; - private final boolean isFalse; - - JsonLiteral(String value) { - this.value = value; - isNull = "null".equals(value); - isTrue = "true".equals(value); - isFalse = "false".equals(value); - } - - @Override - void write(JsonWriter writer) throws IOException { - writer.writeLiteral(value); - } - - @Override - public String toString() { - return value; - } - - @Override - public int hashCode() { - return value.hashCode(); - } - - @Override - public boolean isNull() { - return isNull; - } - - @Override - public boolean isTrue() { - return isTrue; - } - - @Override - public boolean isFalse() { - return isFalse; - } - - @Override - public boolean isBoolean() { - return isTrue || isFalse; - } - - @Override - public boolean asBoolean() { - return isNull ? super.asBoolean() : isTrue; - } - - @Override - public boolean equals(Object object) { - if (this == object) { - return true; - } - if (object == null) { - return false; - } - if (getClass() != object.getClass()) { - return false; - } - JsonLiteral other = (JsonLiteral)object; - return value.equals(other.value); - } - -} diff --git a/src/main/java/com/eclipsesource/json/JsonNumber.java b/src/main/java/com/eclipsesource/json/JsonNumber.java deleted file mode 100644 index 74ba958d..00000000 --- a/src/main/java/com/eclipsesource/json/JsonNumber.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 EclipseSource. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package com.eclipsesource.json; - -import java.io.IOException; - - -@SuppressWarnings("serial") // use default serial UID -class JsonNumber extends JsonValue { - - private final String string; - - JsonNumber(String string) { - if (string == null) { - throw new NullPointerException("string is null"); - } - this.string = string; - } - - @Override - public String toString() { - return string; - } - - @Override - void write(JsonWriter writer) throws IOException { - writer.writeNumber(string); - } - - @Override - public boolean isNumber() { - return true; - } - - @Override - public int asInt() { - return Integer.parseInt(string, 10); - } - - @Override - public long asLong() { - return Long.parseLong(string, 10); - } - - @Override - public float asFloat() { - return Float.parseFloat(string); - } - - @Override - public double asDouble() { - return Double.parseDouble(string); - } - - @Override - public int hashCode() { - return string.hashCode(); - } - - @Override - public boolean equals(Object object) { - if (this == object) { - return true; - } - if (object == null) { - return false; - } - if (getClass() != object.getClass()) { - return false; - } - JsonNumber other = (JsonNumber)object; - return string.equals(other.string); - } - -} diff --git a/src/main/java/com/eclipsesource/json/JsonObject.java b/src/main/java/com/eclipsesource/json/JsonObject.java deleted file mode 100644 index 83799fb5..00000000 --- a/src/main/java/com/eclipsesource/json/JsonObject.java +++ /dev/null @@ -1,907 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 EclipseSource. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package com.eclipsesource.json; - -import com.eclipsesource.json.JsonObject.Member; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Reader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - - -/** - * Represents a JSON object, a set of name/value pairs, where the names are strings and the values - * are JSON values. - *

- * Members can be added using the add(String, ...) methods which accept instances of - * {@link JsonValue}, strings, primitive numbers, and boolean values. To modify certain values of an - * object, use the set(String, ...) methods. Please note that the add - * methods are faster than set as they do not search for existing members. On the other - * hand, the add methods do not prevent adding multiple members with the same name. - * Duplicate names are discouraged but not prohibited by JSON. - *

- *

- * Members can be accessed by their name using {@link #get(String)}. A list of all names can be - * obtained from the method {@link #names()}. This class also supports iterating over the members in - * document order using an {@link #iterator()} or an enhanced for loop: - *

- *
- * for (Member member : jsonObject) {
- *   String name = member.getName();
- *   JsonValue value = member.getValue();
- *   ...
- * }
- * 
- *

- * Even though JSON objects are unordered by definition, instances of this class preserve the order - * of members to allow processing in document order and to guarantee a predictable output. - *

- *

- * Note that this class is not thread-safe. If multiple threads access a - * JsonObject instance concurrently, while at least one of these threads modifies the - * contents of this object, access to the instance must be synchronized externally. Failure to do so - * may lead to an inconsistent state. - *

- *

- * This class is not supposed to be extended by clients. - *

- */ -@SuppressWarnings("serial") // use default serial UID -public class JsonObject extends JsonValue implements Iterable { - - private final List names; - private final List values; - private transient HashIndexTable table; - - /** - * Creates a new empty JsonObject. - */ - public JsonObject() { - names = new ArrayList(); - values = new ArrayList(); - table = new HashIndexTable(); - } - - /** - * Creates a new JsonObject, initialized with the contents of the specified JSON object. - * - * @param object - * the JSON object to get the initial contents from, must not be null - */ - public JsonObject(JsonObject object) { - this(object, false); - } - - private JsonObject(JsonObject object, boolean unmodifiable) { - if (object == null) { - throw new NullPointerException("object is null"); - } - if (unmodifiable) { - names = Collections.unmodifiableList(object.names); - values = Collections.unmodifiableList(object.values); - } else { - names = new ArrayList(object.names); - values = new ArrayList(object.values); - } - table = new HashIndexTable(); - updateHashIndex(); - } - - /** - * Reads a JSON object from the given reader. - *

- * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in - * an additional BufferedReader does not improve reading - * performance. - *

- * - * @param reader - * the reader to read the JSON object from - * @return the JSON object that has been read - * @throws IOException - * if an I/O error occurs in the reader - * @throws ParseException - * if the input is not valid JSON - * @throws UnsupportedOperationException - * if the input does not contain a JSON object - * @deprecated Use {@link Json#parse(Reader)}{@link JsonValue#asObject() .asObject()} instead - */ - @Deprecated - public static JsonObject readFrom(Reader reader) throws IOException { - return JsonValue.readFrom(reader).asObject(); - } - - /** - * Reads a JSON object from the given string. - * - * @param string - * the string that contains the JSON object - * @return the JSON object that has been read - * @throws ParseException - * if the input is not valid JSON - * @throws UnsupportedOperationException - * if the input does not contain a JSON object - * @deprecated Use {@link Json#parse(String)}{@link JsonValue#asObject() .asObject()} instead - */ - @Deprecated - public static JsonObject readFrom(String string) { - return JsonValue.readFrom(string).asObject(); - } - - /** - * Returns an unmodifiable JsonObject for the specified one. This method allows to provide - * read-only access to a JsonObject. - *

- * The returned JsonObject is backed by the given object and reflect changes that happen to it. - * Attempts to modify the returned JsonObject result in an - * UnsupportedOperationException. - *

- * - * @param object - * the JsonObject for which an unmodifiable JsonObject is to be returned - * @return an unmodifiable view of the specified JsonObject - */ - public static JsonObject unmodifiableObject(JsonObject object) { - return new JsonObject(object, true); - } - - /** - * Appends a new member to the end of this object, with the specified name and the JSON - * representation of the specified int value. - *

- * This method does not prevent duplicate names. Calling this method with a name - * that already exists in the object will append another member with the same name. In order to - * replace existing members, use the method set(name, value) instead. However, - * add is much faster than set (because it does not need to - * search for existing members). Therefore add should be preferred when constructing new - * objects. - *

- * - * @param name - * the name of the member to add - * @param value - * the value of the member to add - * @return the object itself, to enable method chaining - */ - public JsonObject add(String name, int value) { - add(name, Json.value(value)); - return this; - } - - /** - * Appends a new member to the end of this object, with the specified name and the JSON - * representation of the specified long value. - *

- * This method does not prevent duplicate names. Calling this method with a name - * that already exists in the object will append another member with the same name. In order to - * replace existing members, use the method set(name, value) instead. However, - * add is much faster than set (because it does not need to - * search for existing members). Therefore add should be preferred when constructing new - * objects. - *

- * - * @param name - * the name of the member to add - * @param value - * the value of the member to add - * @return the object itself, to enable method chaining - */ - public JsonObject add(String name, long value) { - add(name, Json.value(value)); - return this; - } - - /** - * Appends a new member to the end of this object, with the specified name and the JSON - * representation of the specified float value. - *

- * This method does not prevent duplicate names. Calling this method with a name - * that already exists in the object will append another member with the same name. In order to - * replace existing members, use the method set(name, value) instead. However, - * add is much faster than set (because it does not need to - * search for existing members). Therefore add should be preferred when constructing new - * objects. - *

- * - * @param name - * the name of the member to add - * @param value - * the value of the member to add - * @return the object itself, to enable method chaining - */ - public JsonObject add(String name, float value) { - add(name, Json.value(value)); - return this; - } - - /** - * Appends a new member to the end of this object, with the specified name and the JSON - * representation of the specified double value. - *

- * This method does not prevent duplicate names. Calling this method with a name - * that already exists in the object will append another member with the same name. In order to - * replace existing members, use the method set(name, value) instead. However, - * add is much faster than set (because it does not need to - * search for existing members). Therefore add should be preferred when constructing new - * objects. - *

- * - * @param name - * the name of the member to add - * @param value - * the value of the member to add - * @return the object itself, to enable method chaining - */ - public JsonObject add(String name, double value) { - add(name, Json.value(value)); - return this; - } - - /** - * Appends a new member to the end of this object, with the specified name and the JSON - * representation of the specified boolean value. - *

- * This method does not prevent duplicate names. Calling this method with a name - * that already exists in the object will append another member with the same name. In order to - * replace existing members, use the method set(name, value) instead. However, - * add is much faster than set (because it does not need to - * search for existing members). Therefore add should be preferred when constructing new - * objects. - *

- * - * @param name - * the name of the member to add - * @param value - * the value of the member to add - * @return the object itself, to enable method chaining - */ - public JsonObject add(String name, boolean value) { - add(name, Json.value(value)); - return this; - } - - /** - * Appends a new member to the end of this object, with the specified name and the JSON - * representation of the specified string. - *

- * This method does not prevent duplicate names. Calling this method with a name - * that already exists in the object will append another member with the same name. In order to - * replace existing members, use the method set(name, value) instead. However, - * add is much faster than set (because it does not need to - * search for existing members). Therefore add should be preferred when constructing new - * objects. - *

- * - * @param name - * the name of the member to add - * @param value - * the value of the member to add - * @return the object itself, to enable method chaining - */ - public JsonObject add(String name, String value) { - add(name, Json.value(value)); - return this; - } - - /** - * Appends a new member to the end of this object, with the specified name and the specified JSON - * value. - *

- * This method does not prevent duplicate names. Calling this method with a name - * that already exists in the object will append another member with the same name. In order to - * replace existing members, use the method set(name, value) instead. However, - * add is much faster than set (because it does not need to - * search for existing members). Therefore add should be preferred when constructing new - * objects. - *

- * - * @param name - * the name of the member to add - * @param value - * the value of the member to add, must not be null - * @return the object itself, to enable method chaining - */ - public JsonObject add(String name, JsonValue value) { - if (name == null) { - throw new NullPointerException("name is null"); - } - if (value == null) { - throw new NullPointerException("value is null"); - } - table.add(name, names.size()); - names.add(name); - values.add(value); - return this; - } - - /** - * Sets the value of the member with the specified name to the JSON representation of the - * specified int value. If this object does not contain a member with this name, a - * new member is added at the end of the object. If this object contains multiple members with - * this name, only the last one is changed. - *

- * This method should only be used to modify existing objects. To fill a new - * object with members, the method add(name, value) should be preferred which is much - * faster (as it does not need to search for existing members). - *

- * - * @param name - * the name of the member to replace - * @param value - * the value to set to the member - * @return the object itself, to enable method chaining - */ - public JsonObject set(String name, int value) { - set(name, Json.value(value)); - return this; - } - - /** - * Sets the value of the member with the specified name to the JSON representation of the - * specified long value. If this object does not contain a member with this name, a - * new member is added at the end of the object. If this object contains multiple members with - * this name, only the last one is changed. - *

- * This method should only be used to modify existing objects. To fill a new - * object with members, the method add(name, value) should be preferred which is much - * faster (as it does not need to search for existing members). - *

- * - * @param name - * the name of the member to replace - * @param value - * the value to set to the member - * @return the object itself, to enable method chaining - */ - public JsonObject set(String name, long value) { - set(name, Json.value(value)); - return this; - } - - /** - * Sets the value of the member with the specified name to the JSON representation of the - * specified float value. If this object does not contain a member with this name, a - * new member is added at the end of the object. If this object contains multiple members with - * this name, only the last one is changed. - *

- * This method should only be used to modify existing objects. To fill a new - * object with members, the method add(name, value) should be preferred which is much - * faster (as it does not need to search for existing members). - *

- * - * @param name - * the name of the member to add - * @param value - * the value of the member to add - * @return the object itself, to enable method chaining - */ - public JsonObject set(String name, float value) { - set(name, Json.value(value)); - return this; - } - - /** - * Sets the value of the member with the specified name to the JSON representation of the - * specified double value. If this object does not contain a member with this name, a - * new member is added at the end of the object. If this object contains multiple members with - * this name, only the last one is changed. - *

- * This method should only be used to modify existing objects. To fill a new - * object with members, the method add(name, value) should be preferred which is much - * faster (as it does not need to search for existing members). - *

- * - * @param name - * the name of the member to add - * @param value - * the value of the member to add - * @return the object itself, to enable method chaining - */ - public JsonObject set(String name, double value) { - set(name, Json.value(value)); - return this; - } - - /** - * Sets the value of the member with the specified name to the JSON representation of the - * specified boolean value. If this object does not contain a member with this name, - * a new member is added at the end of the object. If this object contains multiple members with - * this name, only the last one is changed. - *

- * This method should only be used to modify existing objects. To fill a new - * object with members, the method add(name, value) should be preferred which is much - * faster (as it does not need to search for existing members). - *

- * - * @param name - * the name of the member to add - * @param value - * the value of the member to add - * @return the object itself, to enable method chaining - */ - public JsonObject set(String name, boolean value) { - set(name, Json.value(value)); - return this; - } - - /** - * Sets the value of the member with the specified name to the JSON representation of the - * specified string. If this object does not contain a member with this name, a new member is - * added at the end of the object. If this object contains multiple members with this name, only - * the last one is changed. - *

- * This method should only be used to modify existing objects. To fill a new - * object with members, the method add(name, value) should be preferred which is much - * faster (as it does not need to search for existing members). - *

- * - * @param name - * the name of the member to add - * @param value - * the value of the member to add - * @return the object itself, to enable method chaining - */ - public JsonObject set(String name, String value) { - set(name, Json.value(value)); - return this; - } - - /** - * Sets the value of the member with the specified name to the specified JSON value. If this - * object does not contain a member with this name, a new member is added at the end of the - * object. If this object contains multiple members with this name, only the last one is changed. - *

- * This method should only be used to modify existing objects. To fill a new - * object with members, the method add(name, value) should be preferred which is much - * faster (as it does not need to search for existing members). - *

- * - * @param name - * the name of the member to add - * @param value - * the value of the member to add, must not be null - * @return the object itself, to enable method chaining - */ - public JsonObject set(String name, JsonValue value) { - if (name == null) { - throw new NullPointerException("name is null"); - } - if (value == null) { - throw new NullPointerException("value is null"); - } - int index = indexOf(name); - if (index != -1) { - values.set(index, value); - } else { - table.add(name, names.size()); - names.add(name); - values.add(value); - } - return this; - } - - /** - * Removes a member with the specified name from this object. If this object contains multiple - * members with the given name, only the last one is removed. If this object does not contain a - * member with the specified name, the object is not modified. - * - * @param name - * the name of the member to remove - * @return the object itself, to enable method chaining - */ - public JsonObject remove(String name) { - if (name == null) { - throw new NullPointerException("name is null"); - } - int index = indexOf(name); - if (index != -1) { - table.remove(index); - names.remove(index); - values.remove(index); - } - return this; - } - - /** - * Copies all members of the specified object into this object. When the specified object contains - * members with names that also exist in this object, the existing values in this object will be - * replaced by the corresponding values in the specified object. - * - * @param object - * the object to merge - * @return the object itself, to enable method chaining - */ - public JsonObject merge(JsonObject object) { - if (object == null) { - throw new NullPointerException("object is null"); - } - for (Member member : object) { - this.set(member.name, member.value); - } - return this; - } - - /** - * Returns the value of the member with the specified name in this object. If this object contains - * multiple members with the given name, this method will return the last one. - * - * @param name - * the name of the member whose value is to be returned - * @return the value of the last member with the specified name, or null if this - * object does not contain a member with that name - */ - public JsonValue get(String name) { - if (name == null) { - throw new NullPointerException("name is null"); - } - int index = indexOf(name); - return index != -1 ? values.get(index) : null; - } - - /** - * Returns the int value of the member with the specified name in this object. If - * this object does not contain a member with this name, the given default value is returned. If - * this object contains multiple members with the given name, the last one will be picked. If this - * member's value does not represent a JSON number or if it cannot be interpreted as Java - * int, an exception is thrown. - * - * @param name - * the name of the member whose value is to be returned - * @param defaultValue - * the value to be returned if the requested member is missing - * @return the value of the last member with the specified name, or the given default value if - * this object does not contain a member with that name - */ - public int getInt(String name, int defaultValue) { - JsonValue value = get(name); - return value != null ? value.asInt() : defaultValue; - } - - /** - * Returns the long value of the member with the specified name in this object. If - * this object does not contain a member with this name, the given default value is returned. If - * this object contains multiple members with the given name, the last one will be picked. If this - * member's value does not represent a JSON number or if it cannot be interpreted as Java - * long, an exception is thrown. - * - * @param name - * the name of the member whose value is to be returned - * @param defaultValue - * the value to be returned if the requested member is missing - * @return the value of the last member with the specified name, or the given default value if - * this object does not contain a member with that name - */ - public long getLong(String name, long defaultValue) { - JsonValue value = get(name); - return value != null ? value.asLong() : defaultValue; - } - - /** - * Returns the float value of the member with the specified name in this object. If - * this object does not contain a member with this name, the given default value is returned. If - * this object contains multiple members with the given name, the last one will be picked. If this - * member's value does not represent a JSON number or if it cannot be interpreted as Java - * float, an exception is thrown. - * - * @param name - * the name of the member whose value is to be returned - * @param defaultValue - * the value to be returned if the requested member is missing - * @return the value of the last member with the specified name, or the given default value if - * this object does not contain a member with that name - */ - public float getFloat(String name, float defaultValue) { - JsonValue value = get(name); - return value != null ? value.asFloat() : defaultValue; - } - - /** - * Returns the double value of the member with the specified name in this object. If - * this object does not contain a member with this name, the given default value is returned. If - * this object contains multiple members with the given name, the last one will be picked. If this - * member's value does not represent a JSON number or if it cannot be interpreted as Java - * double, an exception is thrown. - * - * @param name - * the name of the member whose value is to be returned - * @param defaultValue - * the value to be returned if the requested member is missing - * @return the value of the last member with the specified name, or the given default value if - * this object does not contain a member with that name - */ - public double getDouble(String name, double defaultValue) { - JsonValue value = get(name); - return value != null ? value.asDouble() : defaultValue; - } - - /** - * Returns the boolean value of the member with the specified name in this object. If - * this object does not contain a member with this name, the given default value is returned. If - * this object contains multiple members with the given name, the last one will be picked. If this - * member's value does not represent a JSON true or false value, an - * exception is thrown. - * - * @param name - * the name of the member whose value is to be returned - * @param defaultValue - * the value to be returned if the requested member is missing - * @return the value of the last member with the specified name, or the given default value if - * this object does not contain a member with that name - */ - public boolean getBoolean(String name, boolean defaultValue) { - JsonValue value = get(name); - return value != null ? value.asBoolean() : defaultValue; - } - - /** - * Returns the String value of the member with the specified name in this object. If - * this object does not contain a member with this name, the given default value is returned. If - * this object contains multiple members with the given name, the last one is picked. If this - * member's value does not represent a JSON string, an exception is thrown. - * - * @param name - * the name of the member whose value is to be returned - * @param defaultValue - * the value to be returned if the requested member is missing - * @return the value of the last member with the specified name, or the given default value if - * this object does not contain a member with that name - */ - public String getString(String name, String defaultValue) { - JsonValue value = get(name); - return value != null ? value.asString() : defaultValue; - } - - /** - * Returns the number of members (name/value pairs) in this object. - * - * @return the number of members in this object - */ - public int size() { - return names.size(); - } - - /** - * Returns true if this object contains no members. - * - * @return true if this object contains no members - */ - public boolean isEmpty() { - return names.isEmpty(); - } - - /** - * Returns a list of the names in this object in document order. The returned list is backed by - * this object and will reflect subsequent changes. It cannot be used to modify this object. - * Attempts to modify the returned list will result in an exception. - * - * @return a list of the names in this object - */ - public List names() { - return Collections.unmodifiableList(names); - } - - /** - * Returns an iterator over the members of this object in document order. The returned iterator - * cannot be used to modify this object. - * - * @return an iterator over the members of this object - */ - public Iterator iterator() { - final Iterator namesIterator = names.iterator(); - final Iterator valuesIterator = values.iterator(); - return new Iterator() { - - public boolean hasNext() { - return namesIterator.hasNext(); - } - - public Member next() { - String name = namesIterator.next(); - JsonValue value = valuesIterator.next(); - return new Member(name, value); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - }; - } - - @Override - void write(JsonWriter writer) throws IOException { - writer.writeObjectOpen(); - Iterator namesIterator = names.iterator(); - Iterator valuesIterator = values.iterator(); - boolean first = true; - while (namesIterator.hasNext()) { - if (!first) { - writer.writeObjectSeparator(); - } - writer.writeMemberName(namesIterator.next()); - writer.writeMemberSeparator(); - valuesIterator.next().write(writer); - first = false; - } - writer.writeObjectClose(); - } - - @Override - public boolean isObject() { - return true; - } - - @Override - public JsonObject asObject() { - return this; - } - - @Override - public int hashCode() { - int result = 1; - result = 31 * result + names.hashCode(); - result = 31 * result + values.hashCode(); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - JsonObject other = (JsonObject)obj; - return names.equals(other.names) && values.equals(other.values); - } - - int indexOf(String name) { - int index = table.get(name); - if (index != -1 && name.equals(names.get(index))) { - return index; - } - return names.lastIndexOf(name); - } - - private synchronized void readObject(ObjectInputStream inputStream) - throws IOException, ClassNotFoundException - { - inputStream.defaultReadObject(); - table = new HashIndexTable(); - updateHashIndex(); - } - - private void updateHashIndex() { - int size = names.size(); - for (int i = 0; i < size; i++) { - table.add(names.get(i), i); - } - } - - /** - * Represents a member of a JSON object, a pair of a name and a value. - */ - public static class Member { - - private final String name; - private final JsonValue value; - - Member(String name, JsonValue value) { - this.name = name; - this.value = value; - } - - /** - * Returns the name of this member. - * - * @return the name of this member, never null - */ - public String getName() { - return name; - } - - /** - * Returns the value of this member. - * - * @return the value of this member, never null - */ - public JsonValue getValue() { - return value; - } - - @Override - public int hashCode() { - int result = 1; - result = 31 * result + name.hashCode(); - result = 31 * result + value.hashCode(); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Member other = (Member)obj; - return name.equals(other.name) && value.equals(other.value); - } - - } - - static class HashIndexTable { - - private final byte[] hashTable = new byte[32]; // must be a power of two - - public HashIndexTable() { - } - - public HashIndexTable(HashIndexTable original) { - System.arraycopy(original.hashTable, 0, hashTable, 0, hashTable.length); - } - - void add(String name, int index) { - int slot = hashSlotFor(name); - if (index < 0xff) { - // increment by 1, 0 stands for empty - hashTable[slot] = (byte)(index + 1); - } else { - hashTable[slot] = 0; - } - } - - void remove(int index) { - for (int i = 0; i < hashTable.length; i++) { - if (hashTable[i] == index + 1) { - hashTable[i] = 0; - } else if (hashTable[i] > index + 1) { - hashTable[i]--; - } - } - } - - int get(Object name) { - int slot = hashSlotFor(name); - // subtract 1, 0 stands for empty - return (hashTable[slot] & 0xff) - 1; - } - - private int hashSlotFor(Object element) { - return element.hashCode() & hashTable.length - 1; - } - - } - -} diff --git a/src/main/java/com/eclipsesource/json/JsonParser.java b/src/main/java/com/eclipsesource/json/JsonParser.java deleted file mode 100644 index 64afeb43..00000000 --- a/src/main/java/com/eclipsesource/json/JsonParser.java +++ /dev/null @@ -1,400 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 EclipseSource. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package com.eclipsesource.json; - -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; - - -class JsonParser { - - private static final int MIN_BUFFER_SIZE = 10; - private static final int DEFAULT_BUFFER_SIZE = 1024; - - private final Reader reader; - private final char[] buffer; - private int bufferOffset; - private int index; - private int fill; - private int line; - private int lineOffset; - private int current; - private StringBuilder captureBuffer; - private int captureStart; - - /* - * | bufferOffset - * v - * [a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t] < input - * [l|m|n|o|p|q|r|s|t|?|?] < buffer - * ^ ^ - * | index fill - */ - - JsonParser(String string) { - this(new StringReader(string), - Math.max(MIN_BUFFER_SIZE, Math.min(DEFAULT_BUFFER_SIZE, string.length()))); - } - - JsonParser(Reader reader) { - this(reader, DEFAULT_BUFFER_SIZE); - } - - JsonParser(Reader reader, int buffersize) { - this.reader = reader; - buffer = new char[buffersize]; - line = 1; - captureStart = -1; - } - - JsonValue parse() throws IOException { - read(); - skipWhiteSpace(); - JsonValue result = readValue(); - skipWhiteSpace(); - if (!isEndOfText()) { - throw error("Unexpected character"); - } - return result; - } - - private JsonValue readValue() throws IOException { - switch (current) { - case 'n': - return readNull(); - case 't': - return readTrue(); - case 'f': - return readFalse(); - case '"': - return readString(); - case '[': - return readArray(); - case '{': - return readObject(); - case '-': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - return readNumber(); - default: - throw expected("value"); - } - } - - private JsonArray readArray() throws IOException { - read(); - JsonArray array = new JsonArray(); - skipWhiteSpace(); - if (readChar(']')) { - return array; - } - do { - skipWhiteSpace(); - array.add(readValue()); - skipWhiteSpace(); - } while (readChar(',')); - if (!readChar(']')) { - throw expected("',' or ']'"); - } - return array; - } - - private JsonObject readObject() throws IOException { - read(); - JsonObject object = new JsonObject(); - skipWhiteSpace(); - if (readChar('}')) { - return object; - } - do { - skipWhiteSpace(); - String name = readName(); - skipWhiteSpace(); - if (!readChar(':')) { - throw expected("':'"); - } - skipWhiteSpace(); - object.add(name, readValue()); - skipWhiteSpace(); - } while (readChar(',')); - if (!readChar('}')) { - throw expected("',' or '}'"); - } - return object; - } - - private String readName() throws IOException { - if (current != '"') { - throw expected("name"); - } - return readStringInternal(); - } - - private JsonValue readNull() throws IOException { - read(); - readRequiredChar('u'); - readRequiredChar('l'); - readRequiredChar('l'); - return Json.NULL; - } - - private JsonValue readTrue() throws IOException { - read(); - readRequiredChar('r'); - readRequiredChar('u'); - readRequiredChar('e'); - return Json.TRUE; - } - - private JsonValue readFalse() throws IOException { - read(); - readRequiredChar('a'); - readRequiredChar('l'); - readRequiredChar('s'); - readRequiredChar('e'); - return Json.FALSE; - } - - private void readRequiredChar(char ch) throws IOException { - if (!readChar(ch)) { - throw expected("'" + ch + "'"); - } - } - - private JsonValue readString() throws IOException { - return new JsonString(readStringInternal()); - } - - private String readStringInternal() throws IOException { - read(); - startCapture(); - while (current != '"') { - if (current == '\\') { - pauseCapture(); - readEscape(); - startCapture(); - } else if (current < 0x20) { - throw expected("valid string character"); - } else { - read(); - } - } - String string = endCapture(); - read(); - return string; - } - - private void readEscape() throws IOException { - read(); - switch (current) { - case '"': - case '/': - case '\\': - captureBuffer.append((char)current); - break; - case 'b': - captureBuffer.append('\b'); - break; - case 'f': - captureBuffer.append('\f'); - break; - case 'n': - captureBuffer.append('\n'); - break; - case 'r': - captureBuffer.append('\r'); - break; - case 't': - captureBuffer.append('\t'); - break; - case 'u': - char[] hexChars = new char[4]; - for (int i = 0; i < 4; i++) { - read(); - if (!isHexDigit()) { - throw expected("hexadecimal digit"); - } - hexChars[i] = (char)current; - } - captureBuffer.append((char)Integer.parseInt(new String(hexChars), 16)); - break; - default: - throw expected("valid escape sequence"); - } - read(); - } - - private JsonValue readNumber() throws IOException { - startCapture(); - readChar('-'); - int firstDigit = current; - if (!readDigit()) { - throw expected("digit"); - } - if (firstDigit != '0') { - while (readDigit()) { - } - } - readFraction(); - readExponent(); - return new JsonNumber(endCapture()); - } - - private boolean readFraction() throws IOException { - if (!readChar('.')) { - return false; - } - if (!readDigit()) { - throw expected("digit"); - } - while (readDigit()) { - } - return true; - } - - private boolean readExponent() throws IOException { - if (!readChar('e') && !readChar('E')) { - return false; - } - if (!readChar('+')) { - readChar('-'); - } - if (!readDigit()) { - throw expected("digit"); - } - while (readDigit()) { - } - return true; - } - - private boolean readChar(char ch) throws IOException { - if (current != ch) { - return false; - } - read(); - return true; - } - - private boolean readDigit() throws IOException { - if (!isDigit()) { - return false; - } - read(); - return true; - } - - private void skipWhiteSpace() throws IOException { - while (isWhiteSpace()) { - read(); - } - } - - private void read() throws IOException { - if (index == fill) { - if (captureStart != -1) { - captureBuffer.append(buffer, captureStart, fill - captureStart); - captureStart = 0; - } - bufferOffset += fill; - fill = reader.read(buffer, 0, buffer.length); - index = 0; - if (fill == -1) { - current = -1; - return; - } - } - if (current == '\n') { - line++; - lineOffset = bufferOffset + index; - } - current = buffer[index++]; - } - - private void startCapture() { - if (captureBuffer == null) { - captureBuffer = new StringBuilder(); - } - captureStart = index - 1; - } - - private void pauseCapture() { - int end = current == -1 ? index : index - 1; - captureBuffer.append(buffer, captureStart, end - captureStart); - captureStart = -1; - } - - private String endCapture() { - int end = current == -1 ? index : index - 1; - String captured; - if (captureBuffer.length() > 0) { - captureBuffer.append(buffer, captureStart, end - captureStart); - captured = captureBuffer.toString(); - captureBuffer.setLength(0); - } else { - captured = new String(buffer, captureStart, end - captureStart); - } - captureStart = -1; - return captured; - } - - private ParseException expected(String expected) { - if (isEndOfText()) { - return error("Unexpected end of input"); - } - return error("Expected " + expected); - } - - private ParseException error(String message) { - int absIndex = bufferOffset + index; - int column = absIndex - lineOffset; - int offset = isEndOfText() ? absIndex : absIndex - 1; - return new ParseException(message, offset, line, column - 1); - } - - private boolean isWhiteSpace() { - return current == ' ' || current == '\t' || current == '\n' || current == '\r'; - } - - private boolean isDigit() { - return current >= '0' && current <= '9'; - } - - private boolean isHexDigit() { - return current >= '0' && current <= '9' - || current >= 'a' && current <= 'f' - || current >= 'A' && current <= 'F'; - } - - private boolean isEndOfText() { - return current == -1; - } - -} diff --git a/src/main/java/com/eclipsesource/json/JsonString.java b/src/main/java/com/eclipsesource/json/JsonString.java deleted file mode 100644 index bd76bfc7..00000000 --- a/src/main/java/com/eclipsesource/json/JsonString.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 EclipseSource. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package com.eclipsesource.json; - -import java.io.IOException; - - -@SuppressWarnings("serial") // use default serial UID -class JsonString extends JsonValue { - - private final String string; - - JsonString(String string) { - if (string == null) { - throw new NullPointerException("string is null"); - } - this.string = string; - } - - @Override - void write(JsonWriter writer) throws IOException { - writer.writeString(string); - } - - @Override - public boolean isString() { - return true; - } - - @Override - public String asString() { - return string; - } - - @Override - public int hashCode() { - return string.hashCode(); - } - - @Override - public boolean equals(Object object) { - if (this == object) { - return true; - } - if (object == null) { - return false; - } - if (getClass() != object.getClass()) { - return false; - } - JsonString other = (JsonString)object; - return string.equals(other.string); - } - -} diff --git a/src/main/java/com/eclipsesource/json/JsonValue.java b/src/main/java/com/eclipsesource/json/JsonValue.java deleted file mode 100644 index 4c7c6737..00000000 --- a/src/main/java/com/eclipsesource/json/JsonValue.java +++ /dev/null @@ -1,496 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 EclipseSource. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package com.eclipsesource.json; - -import java.io.*; - - -/** - * Represents a JSON value. This can be a JSON object, an array, - * a number, a string, or one of the literals - * true, false, and null. - *

- * The literals true, false, and null are - * represented by the constants {@link #TRUE}, {@link #FALSE}, and {@link #NULL}. - *

- *

- * JSON objects and arrays are represented by the subtypes - * {@link JsonObject} and {@link JsonArray}. Instances of these types can be created using the - * public constructors of these classes. - *

- *

- * Instances that represent JSON numbers, strings and - * boolean values can be created using the static factory methods - * {@link #valueOf(String)}, {@link #valueOf(long)}, {@link #valueOf(double)}, etc. - *

- *

- * In order to find out whether an instance of this class is of a certain type, the methods - * {@link #isObject()}, {@link #isArray()}, {@link #isString()}, {@link #isNumber()} etc. can be - * used. - *

- *

- * If the type of a JSON value is known, the methods {@link #asObject()}, {@link #asArray()}, - * {@link #asString()}, {@link #asInt()}, etc. can be used to get this value directly in the - * appropriate target type. - *

- *

- * This class is not supposed to be extended by clients. - *

- */ -@SuppressWarnings("serial") // use default serial UID -public abstract class JsonValue implements Serializable { - - /** - * Represents the JSON literal true. - * @deprecated Use Json.TRUE instead - */ - @Deprecated - public static final JsonValue TRUE = Json.TRUE; - - /** - * Represents the JSON literal false. - * @deprecated Use Json.FALSE instead - */ - @Deprecated - public static final JsonValue FALSE = Json.FALSE; - - /** - * Represents the JSON literal null. - * @deprecated Use Json.NULL instead - */ - @Deprecated - public static final JsonValue NULL = Json.NULL; - - JsonValue() { - // prevent subclasses outside of this package - } - - /** - * Reads a JSON value from the given reader. - *

- * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in - * an additional BufferedReader does not improve reading - * performance. - *

- * - * @param reader - * the reader to read the JSON value from - * @return the JSON value that has been read - * @throws IOException - * if an I/O error occurs in the reader - * @throws ParseException - * if the input is not valid JSON - * @deprecated Use {@link Json#parse(Reader)} instead - */ - @Deprecated - public static JsonValue readFrom(Reader reader) throws IOException { - return new JsonParser(reader).parse(); - } - - /** - * Reads a JSON value from the given string. - * - * @param text - * the string that contains the JSON value - * @return the JSON value that has been read - * @throws ParseException - * if the input is not valid JSON - * @deprecated Use {@link Json#parse(String)} instead - */ - @Deprecated - public static JsonValue readFrom(String text) { - try { - return new JsonParser(text).parse(); - } catch (IOException exception) { - // JsonParser does not throw IOException for String - throw new RuntimeException(exception); - } - } - - /** - * Returns a JsonValue instance that represents the given int value. - * - * @param value - * the value to get a JSON representation for - * @return a JSON value that represents the given value - * @deprecated Use Json.value() instead - */ - @Deprecated - public static JsonValue valueOf(int value) { - return Json.value(value); - } - - /** - * Returns a JsonValue instance that represents the given long value. - * - * @param value - * the value to get a JSON representation for - * @return a JSON value that represents the given value - * @deprecated Use Json.value() instead - */ - @Deprecated - public static JsonValue valueOf(long value) { - return Json.value(value); - } - - /** - * Returns a JsonValue instance that represents the given float value. - * - * @param value - * the value to get a JSON representation for - * @return a JSON value that represents the given value - * @deprecated Use Json.value() instead - */ - @Deprecated - public static JsonValue valueOf(float value) { - return Json.value(value); - } - - /** - * Returns a JsonValue instance that represents the given double value. - * - * @param value - * the value to get a JSON representation for - * @return a JSON value that represents the given value - * @deprecated Use Json.value() instead - */ - @Deprecated - public static JsonValue valueOf(double value) { - return Json.value(value); - } - - /** - * Returns a JsonValue instance that represents the given string. - * - * @param string - * the string to get a JSON representation for - * @return a JSON value that represents the given string - * @deprecated Use Json.value() instead - */ - @Deprecated - public static JsonValue valueOf(String string) { - return Json.value(string); - } - - /** - * Returns a JsonValue instance that represents the given boolean value. - * - * @param value - * the value to get a JSON representation for - * @return a JSON value that represents the given value - * @deprecated Use Json.value() instead - */ - @Deprecated - public static JsonValue valueOf(boolean value) { - return Json.value(value); - } - - /** - * Detects whether this value represents a JSON object. If this is the case, this value is an - * instance of {@link JsonObject}. - * - * @return true if this value is an instance of JsonObject - */ - public boolean isObject() { - return false; - } - - /** - * Detects whether this value represents a JSON array. If this is the case, this value is an - * instance of {@link JsonArray}. - * - * @return true if this value is an instance of JsonArray - */ - public boolean isArray() { - return false; - } - - /** - * Detects whether this value represents a JSON number. - * - * @return true if this value represents a JSON number - */ - public boolean isNumber() { - return false; - } - - /** - * Detects whether this value represents a JSON string. - * - * @return true if this value represents a JSON string - */ - public boolean isString() { - return false; - } - - /** - * Detects whether this value represents a boolean value. - * - * @return true if this value represents either the JSON literal true or - * false - */ - public boolean isBoolean() { - return false; - } - - /** - * Detects whether this value represents the JSON literal true. - * - * @return true if this value represents the JSON literal true - */ - public boolean isTrue() { - return false; - } - - /** - * Detects whether this value represents the JSON literal false. - * - * @return true if this value represents the JSON literal false - */ - public boolean isFalse() { - return false; - } - - /** - * Detects whether this value represents the JSON literal null. - * - * @return true if this value represents the JSON literal null - */ - public boolean isNull() { - return false; - } - - /** - * Returns this JSON value as {@link JsonObject}, assuming that this value represents a JSON - * object. If this is not the case, an exception is thrown. - * - * @return a JSONObject for this value - * @throws UnsupportedOperationException - * if this value is not a JSON object - */ - public JsonObject asObject() { - throw new UnsupportedOperationException("Not an object: " + toString()); - } - - /** - * Returns this JSON value as {@link JsonArray}, assuming that this value represents a JSON array. - * If this is not the case, an exception is thrown. - * - * @return a JSONArray for this value - * @throws UnsupportedOperationException - * if this value is not a JSON array - */ - public JsonArray asArray() { - throw new UnsupportedOperationException("Not an array: " + toString()); - } - - /** - * Returns this JSON value as an int value, assuming that this value represents a - * JSON number that can be interpreted as Java int. If this is not the case, an - * exception is thrown. - *

- * To be interpreted as Java int, the JSON number must neither contain an exponent - * nor a fraction part. Moreover, the number must be in the Integer range. - *

- * - * @return this value as int - * @throws UnsupportedOperationException - * if this value is not a JSON number - * @throws NumberFormatException - * if this JSON number can not be interpreted as int value - */ - public int asInt() { - throw new UnsupportedOperationException("Not a number: " + toString()); - } - - /** - * Returns this JSON value as a long value, assuming that this value represents a - * JSON number that can be interpreted as Java long. If this is not the case, an - * exception is thrown. - *

- * To be interpreted as Java long, the JSON number must neither contain an exponent - * nor a fraction part. Moreover, the number must be in the Long range. - *

- * - * @return this value as long - * @throws UnsupportedOperationException - * if this value is not a JSON number - * @throws NumberFormatException - * if this JSON number can not be interpreted as long value - */ - public long asLong() { - throw new UnsupportedOperationException("Not a number: " + toString()); - } - - /** - * Returns this JSON value as a float value, assuming that this value represents a - * JSON number. If this is not the case, an exception is thrown. - *

- * If the JSON number is out of the Float range, {@link Float#POSITIVE_INFINITY} or - * {@link Float#NEGATIVE_INFINITY} is returned. - *

- * - * @return this value as float - * @throws UnsupportedOperationException - * if this value is not a JSON number - */ - public float asFloat() { - throw new UnsupportedOperationException("Not a number: " + toString()); - } - - /** - * Returns this JSON value as a double value, assuming that this value represents a - * JSON number. If this is not the case, an exception is thrown. - *

- * If the JSON number is out of the Double range, {@link Double#POSITIVE_INFINITY} or - * {@link Double#NEGATIVE_INFINITY} is returned. - *

- * - * @return this value as double - * @throws UnsupportedOperationException - * if this value is not a JSON number - */ - public double asDouble() { - throw new UnsupportedOperationException("Not a number: " + toString()); - } - - /** - * Returns this JSON value as String, assuming that this value represents a JSON string. If this - * is not the case, an exception is thrown. - * - * @return the string represented by this value - * @throws UnsupportedOperationException - * if this value is not a JSON string - */ - public String asString() { - throw new UnsupportedOperationException("Not a string: " + toString()); - } - - /** - * Returns this JSON value as a boolean value, assuming that this value is either - * true or false. If this is not the case, an exception is thrown. - * - * @return this value as boolean - * @throws UnsupportedOperationException - * if this value is neither true or false - */ - public boolean asBoolean() { - throw new UnsupportedOperationException("Not a boolean: " + toString()); - } - - /** - * Writes the JSON representation of this value to the given writer in its minimal form, without - * any additional whitespace. - *

- * Writing performance can be improved by using a {@link java.io.BufferedWriter BufferedWriter}. - *

- * - * @param writer - * the writer to write this value to - * @throws IOException - * if an I/O error occurs in the writer - */ - public void writeTo(Writer writer) throws IOException { - writeTo(writer, WriterConfig.MINIMAL); - } - - /** - * Writes the JSON representation of this value to the given writer using the given formatting. - *

- * Writing performance can be improved by using a {@link java.io.BufferedWriter BufferedWriter}. - *

- * - * @param writer - * the writer to write this value to - * @param config - * a configuration that controls the formatting or null for the minimal form - * @throws IOException - * if an I/O error occurs in the writer - */ - public void writeTo(Writer writer, WriterConfig config) throws IOException { - if (writer == null) { - throw new NullPointerException("writer is null"); - } - if (config == null) { - throw new NullPointerException("config is null"); - } - WritingBuffer buffer = new WritingBuffer(writer, 128); - write(config.createWriter(buffer)); - buffer.flush(); - } - - /** - * Returns the JSON string for this value in its minimal form, without any additional whitespace. - * The result is guaranteed to be a valid input for the method {@link #readFrom(String)} and to - * create a value that is equal to this object. - * - * @return a JSON string that represents this value - */ - @Override - public String toString() { - return toString(WriterConfig.MINIMAL); - } - - /** - * Returns the JSON string for this value using the given formatting. - * - * @param config - * a configuration that controls the formatting or null for the minimal form - * @return a JSON string that represents this value - */ - public String toString(WriterConfig config) { - StringWriter writer = new StringWriter(); - try { - writeTo(writer, config); - } catch (IOException exception) { - // StringWriter does not throw IOExceptions - throw new RuntimeException(exception); - } - return writer.toString(); - } - - /** - * Indicates whether some other object is "equal to" this one according to the contract specified - * in {@link Object#equals(Object)}. - *

- * Two JsonValues are considered equal if and only if they represent the same JSON text. As a - * consequence, two given JsonObjects may be different even though they contain the same set of - * names with the same values, but in a different order. - *

- * - * @param object - * the reference object with which to compare - * @return true if this object is the same as the object argument; false otherwise - */ - @Override - public boolean equals(Object object) { - return super.equals(object); - } - - @Override - public int hashCode() { - return super.hashCode(); - } - - abstract void write(JsonWriter writer) throws IOException; - -} diff --git a/src/main/java/com/eclipsesource/json/JsonWriter.java b/src/main/java/com/eclipsesource/json/JsonWriter.java deleted file mode 100644 index 6d06e1a3..00000000 --- a/src/main/java/com/eclipsesource/json/JsonWriter.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 EclipseSource. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package com.eclipsesource.json; - -import java.io.IOException; -import java.io.Writer; - - -class JsonWriter { - - private static final int CONTROL_CHARACTERS_END = 0x001f; - - private static final char[] QUOT_CHARS = {'\\', '"'}; - private static final char[] BS_CHARS = {'\\', '\\'}; - private static final char[] LF_CHARS = {'\\', 'n'}; - private static final char[] CR_CHARS = {'\\', 'r'}; - private static final char[] TAB_CHARS = {'\\', 't'}; - // In JavaScript, U+2028 and U+2029 characters count as line endings and must be encoded. - // http://stackoverflow.com/questions/2965293/javascript-parse-error-on-u2028-unicode-character - private static final char[] UNICODE_2028_CHARS = {'\\', 'u', '2', '0', '2', '8'}; - private static final char[] UNICODE_2029_CHARS = {'\\', 'u', '2', '0', '2', '9'}; - private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'a', 'b', 'c', 'd', 'e', 'f'}; - - protected final Writer writer; - - JsonWriter(Writer writer) { - this.writer = writer; - } - - protected void writeLiteral(String value) throws IOException { - writer.write(value); - } - - protected void writeNumber(String string) throws IOException { - writer.write(string); - } - - protected void writeString(String string) throws IOException { - writer.write('"'); - writeJsonString(string); - writer.write('"'); - } - - protected void writeArrayOpen() throws IOException { - writer.write('['); - } - - protected void writeArrayClose() throws IOException { - writer.write(']'); - } - - protected void writeArraySeparator() throws IOException { - writer.write(','); - } - - protected void writeObjectOpen() throws IOException { - writer.write('{'); - } - - protected void writeObjectClose() throws IOException { - writer.write('}'); - } - - protected void writeMemberName(String name) throws IOException { - writer.write('"'); - writeJsonString(name); - writer.write('"'); - } - - protected void writeMemberSeparator() throws IOException { - writer.write(':'); - } - - protected void writeObjectSeparator() throws IOException { - writer.write(','); - } - - protected void writeJsonString(String string) throws IOException { - int length = string.length(); - int start = 0; - for (int index = 0; index < length; index++) { - char[] replacement = getReplacementChars(string.charAt(index)); - if (replacement != null) { - writer.write(string, start, index - start); - writer.write(replacement); - start = index + 1; - } - } - writer.write(string, start, length - start); - } - - private static char[] getReplacementChars(char ch) { - if (ch > '\\') { - if (ch < '\u2028' || ch > '\u2029') { - // The lower range contains 'a' .. 'z'. Only 2 checks required. - return null; - } - return ch == '\u2028' ? UNICODE_2028_CHARS : UNICODE_2029_CHARS; - } - if (ch == '\\') { - return BS_CHARS; - } - if (ch > '"') { - // This range contains '0' .. '9' and 'A' .. 'Z'. Need 3 checks to get here. - return null; - } - if (ch == '"') { - return QUOT_CHARS; - } - if (ch > CONTROL_CHARACTERS_END) { - return null; - } - if (ch == '\n') { - return LF_CHARS; - } - if (ch == '\r') { - return CR_CHARS; - } - if (ch == '\t') { - return TAB_CHARS; - } - return new char[] {'\\', 'u', '0', '0', HEX_DIGITS[ch >> 4 & 0x000f], HEX_DIGITS[ch & 0x000f]}; - } - -} diff --git a/src/main/java/com/eclipsesource/json/ParseException.java b/src/main/java/com/eclipsesource/json/ParseException.java deleted file mode 100644 index 40aae2f7..00000000 --- a/src/main/java/com/eclipsesource/json/ParseException.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 EclipseSource. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package com.eclipsesource.json; - -/** - * An unchecked exception to indicate that an input does not qualify as valid JSON. - */ -@SuppressWarnings("serial") // use default serial UID -public class ParseException extends RuntimeException { - - private final int offset; - private final int line; - private final int column; - - ParseException(String message, int offset, int line, int column) { - super(message + " at " + line + ":" + column); - this.offset = offset; - this.line = line; - this.column = column; - } - - /** - * Returns the absolute index of the character at which the error occurred. The index of the first - * character of a document is 0. - * - * @return the character offset at which the error occurred, will be >= 0 - */ - public int getOffset() { - return offset; - } - - /** - * Returns the number of the line in which the error occurred. The first line counts as 1. - * - * @return the line in which the error occurred, will be >= 1 - */ - public int getLine() { - return line; - } - - /** - * Returns the index of the character at which the error occurred, relative to the line. The index - * of the first character of a line is 0. - * - * @return the column in which the error occurred, will be >= 0 - */ - public int getColumn() { - return column; - } - -} diff --git a/src/main/java/com/eclipsesource/json/PrettyPrint.java b/src/main/java/com/eclipsesource/json/PrettyPrint.java deleted file mode 100644 index 9e60e890..00000000 --- a/src/main/java/com/eclipsesource/json/PrettyPrint.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 EclipseSource. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package com.eclipsesource.json; - -import java.io.IOException; -import java.io.Writer; -import java.util.Arrays; - - -/** - * Enables human readable JSON output by inserting whitespace between values.after commas and - * colons. Example: - * - *
- * jsonValue.writeTo(writer, PrettyPrint.singleLine());
- * 
- */ -public class PrettyPrint extends WriterConfig { - - private final char[] indentChars; - - protected PrettyPrint(char[] indentChars) { - this.indentChars = indentChars; - } - - /** - * Print every value on a separate line. Use tabs (\t) for indentation. - * - * @return A PrettyPrint instance for wrapped mode with tab indentation - */ - public static PrettyPrint singleLine() { - return new PrettyPrint(null); - } - - /** - * Print every value on a separate line. Use the given number of spaces for indentation. - * - * @param number - * the number of spaces to use - * @return A PrettyPrint instance for wrapped mode with spaces indentation - */ - public static PrettyPrint indentWithSpaces(int number) { - if (number < 0) { - throw new IllegalArgumentException("number is negative"); - } - char[] chars = new char[number]; - Arrays.fill(chars, ' '); - return new PrettyPrint(chars); - } - - /** - * Do not break lines, but still insert whitespace between values. - * - * @return A PrettyPrint instance for single-line mode - */ - public static PrettyPrint indentWithTabs() { - return new PrettyPrint(new char[] {'\t'}); - } - - @Override - protected JsonWriter createWriter(Writer writer) { - return new PrettyPrintWriter(writer, indentChars); - } - - private static class PrettyPrintWriter extends JsonWriter { - - private final char[] indentChars; - private int indent; - - private PrettyPrintWriter(Writer writer, char[] indentChars) { - super(writer); - this.indentChars = indentChars; - } - - @Override - protected void writeArrayOpen() throws IOException { - indent++; - writer.write('['); - writeNewLine(); - } - - @Override - protected void writeArrayClose() throws IOException { - indent--; - writeNewLine(); - writer.write(']'); - } - - @Override - protected void writeArraySeparator() throws IOException { - writer.write(','); - if (!writeNewLine()) { - writer.write(' '); - } - } - - @Override - protected void writeObjectOpen() throws IOException { - indent++; - writer.write('{'); - writeNewLine(); - } - - @Override - protected void writeObjectClose() throws IOException { - indent--; - writeNewLine(); - writer.write('}'); - } - - @Override - protected void writeMemberSeparator() throws IOException { - writer.write(':'); - writer.write(' '); - } - - @Override - protected void writeObjectSeparator() throws IOException { - writer.write(','); - if (!writeNewLine()) { - writer.write(' '); - } - } - - private boolean writeNewLine() throws IOException { - if (indentChars == null) { - return false; - } - writer.write('\n'); - for (int i = 0; i < indent; i++) { - writer.write(indentChars); - } - return true; - } - - } - -} diff --git a/src/main/java/com/eclipsesource/json/WriterConfig.java b/src/main/java/com/eclipsesource/json/WriterConfig.java deleted file mode 100644 index 14c76292..00000000 --- a/src/main/java/com/eclipsesource/json/WriterConfig.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 EclipseSource. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package com.eclipsesource.json; - -import java.io.Writer; - - -/** - * Controls the formatting of the JSON output. Use one of the available constants. - */ -public abstract class WriterConfig { - - /** - * Write JSON in its minimal form, without any additional whitespace. This is the default. - */ - public static WriterConfig MINIMAL = new WriterConfig() { - @Override - JsonWriter createWriter(Writer writer) { - return new JsonWriter(writer); - } - }; - - /** - * Write JSON in pretty-print, with each value on a separate line and an indentation of two - * spaces. - */ - public static WriterConfig PRETTY_PRINT = PrettyPrint.indentWithSpaces(2); - - abstract JsonWriter createWriter(Writer writer); - -} diff --git a/src/main/java/com/eclipsesource/json/WritingBuffer.java b/src/main/java/com/eclipsesource/json/WritingBuffer.java deleted file mode 100644 index 0132c3af..00000000 --- a/src/main/java/com/eclipsesource/json/WritingBuffer.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 EclipseSource. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package com.eclipsesource.json; - -import java.io.IOException; -import java.io.Writer; - - -/** - * A lightweight writing buffer to reduce the amount of write operations to be performed on the - * underlying writer. This implementation is not thread-safe. It deliberately deviates from the - * contract of Writer. In particular, it does not flush or close the wrapped writer nor does it - * ensure that the wrapped writer is open. - */ -class WritingBuffer extends Writer { - - private final Writer writer; - private final char[] buffer; - private int fill = 0; - - WritingBuffer(Writer writer) { - this(writer, 16); - } - - WritingBuffer(Writer writer, int bufferSize) { - this.writer = writer; - buffer = new char[bufferSize]; - } - - @Override - public void write(int c) throws IOException { - if (fill > buffer.length - 1) { - flush(); - } - buffer[fill++] = (char)c; - } - - @Override - public void write(char[] cbuf, int off, int len) throws IOException { - if (fill > buffer.length - len) { - flush(); - if (len > buffer.length) { - writer.write(cbuf, off, len); - return; - } - } - System.arraycopy(cbuf, off, buffer, fill, len); - fill += len; - } - - @Override - public void write(String str, int off, int len) throws IOException { - if (fill > buffer.length - len) { - flush(); - if (len > buffer.length) { - writer.write(str, off, len); - return; - } - } - str.getChars(off, off + len, buffer, fill); - fill += len; - } - - /** - * Flushes the internal buffer but does not flush the wrapped writer. - */ - @Override - public void flush() throws IOException { - writer.write(buffer, 0, fill); - fill = 0; - } - - /** - * Does not close or flush the wrapped writer. - */ - @Override - public void close() throws IOException { - } - -} diff --git a/src/main/java/com/jhe/hexed/JHexEditor.java b/src/main/java/com/jhe/hexed/JHexEditor.java deleted file mode 100644 index af2cc4bb..00000000 --- a/src/main/java/com/jhe/hexed/JHexEditor.java +++ /dev/null @@ -1,257 +0,0 @@ -package com.jhe.hexed; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; - -/** - * Created by IntelliJ IDEA. User: laullon Date: 08-abr-2003 Time: 13:21:09 - */ -public class JHexEditor extends JPanel implements FocusListener, - AdjustmentListener, MouseWheelListener { - private static final long serialVersionUID = 2289328616534802372L; - byte[] buff; - public int cursor; - protected static Font font = new Font("Monospaced", 0, 12); - protected int border = 2; - public boolean DEBUG = false; - private JPanel panel; - private JScrollBar sb; - private int inicio = 0; - private int lineas = 10; - - public JHexEditor(byte[] buff) { - super(); - this.buff = buff; - - this.addMouseWheelListener(this); - - sb = new JScrollBar(JScrollBar.VERTICAL); - sb.addAdjustmentListener(this); - sb.setMinimum(0); - sb.setMaximum(buff.length / getLineas()); - - JPanel p1, p2, p3; - // centro - p1 = new JPanel(new BorderLayout(1, 1)); - p1.add(new JHexEditorHEX(this), BorderLayout.CENTER); - p1.add(new Columnas(), BorderLayout.NORTH); - - // izq. - p2 = new JPanel(new BorderLayout(1, 1)); - p2.add(new Filas(), BorderLayout.CENTER); - p2.add(new Caja(), BorderLayout.NORTH); - - // der - p3 = new JPanel(new BorderLayout(1, 1)); - p3.add(sb, BorderLayout.EAST); - p3.add(new JHexEditorASCII(this), BorderLayout.CENTER); - p3.add(new Caja(), BorderLayout.NORTH); - - panel = new JPanel(); - panel.setLayout(new BorderLayout(1, 1)); - panel.add(p1, BorderLayout.CENTER); - panel.add(p2, BorderLayout.WEST); - panel.add(p3, BorderLayout.EAST); - - this.setLayout(new BorderLayout(1, 1)); - this.add(panel, BorderLayout.CENTER); - } - - public void paint(Graphics g) { - FontMetrics fn = getFontMetrics(font); - Rectangle rec = this.getBounds(); - lineas = (rec.height / fn.getHeight()) - 1; - int n = (buff.length / 16) - 1; - if (lineas > n) { - lineas = n; - inicio = 0; - } - - sb.setValues(getInicio(), +getLineas(), 0, buff.length / 16); - sb.setValueIsAdjusting(true); - super.paint(g); - } - - protected void actualizaCursor() { - int n = (cursor / 16); - - System.out.print("- " + inicio + "<" + n + "<" + (lineas + inicio) - + "(" + lineas + ")"); - - if (n < inicio) - inicio = n; - else if (n >= inicio + lineas) - inicio = n - (lineas - 1); - - System.out.println(" - " + inicio + "<" + n + "<" + (lineas + inicio) - + "(" + lineas + ")"); - - repaint(); - } - - protected int getInicio() { - return inicio; - } - - protected int getLineas() { - return lineas; - } - - protected void fondo(Graphics g, int x, int y, int s) { - FontMetrics fn = getFontMetrics(font); - g.fillRect(((fn.stringWidth(" ") + 1) * x) + border, - (fn.getHeight() * y) + border, ((fn.stringWidth(" ") + 1) * s), - fn.getHeight() + 1); - } - - protected void cuadro(Graphics g, int x, int y, int s) { - FontMetrics fn = getFontMetrics(font); - g.drawRect(((fn.stringWidth(" ") + 1) * x) + border, - (fn.getHeight() * y) + border, ((fn.stringWidth(" ") + 1) * s), - fn.getHeight() + 1); - } - - protected void printString(Graphics g, String s, int x, int y) { - FontMetrics fn = getFontMetrics(font); - g.drawString(s, ((fn.stringWidth(" ") + 1) * x) + border, - ((fn.getHeight() * (y + 1)) - fn.getMaxDescent()) + border); - } - - public void focusGained(FocusEvent e) { - this.repaint(); - } - - public void focusLost(FocusEvent e) { - this.repaint(); - } - - public void adjustmentValueChanged(AdjustmentEvent e) { - inicio = e.getValue(); - if (inicio < 0) - inicio = 0; - repaint(); - } - - public void mouseWheelMoved(MouseWheelEvent e) { - inicio += (e.getUnitsToScroll()); - if ((inicio + lineas) >= buff.length / 16) - inicio = (buff.length / 16) - lineas; - if (inicio < 0) - inicio = 0; - repaint(); - } - - public void keyPressed(KeyEvent e) { - /* - * switch(e.getKeyCode()) { case 33: // rep if(cursor>=(16*lineas)) - * cursor-=(16*lineas); actualizaCursor(); break; case 34: // fin - * if(cursor<(buff.length-(16*lineas))) cursor+=(16*lineas); - * actualizaCursor(); break; case 35: // fin cursor=buff.length-1; - * actualizaCursor(); break; case 36: // ini cursor=0; - * actualizaCursor(); break; case 37: // <-- if(cursor!=0) cursor--; - * actualizaCursor(); break; case 38: // <-- if(cursor>15) cursor-=16; - * actualizaCursor(); break; case 39: // --> if(cursor!=(buff.length-1)) - * cursor++; actualizaCursor(); break; case 40: // --> - * if(cursor<(buff.length-16)) cursor+=16; actualizaCursor(); break; } - */ - } - - private class Columnas extends JPanel { - private static final long serialVersionUID = -1734199617526339842L; - - public Columnas() { - this.setLayout(new BorderLayout(1, 1)); - } - - public Dimension getPreferredSize() { - return getMinimumSize(); - } - - public Dimension getMinimumSize() { - Dimension d = new Dimension(); - FontMetrics fn = getFontMetrics(font); - int h = fn.getHeight(); - int nl = 1; - d.setSize(((fn.stringWidth(" ") + 1) * +((16 * 3) - 1)) - + (border * 2) + 1, h * nl + (border * 2) + 1); - return d; - } - - public void paint(Graphics g) { - Dimension d = getMinimumSize(); - g.setColor(Color.white); - g.fillRect(0, 0, d.width, d.height); - g.setColor(Color.black); - g.setFont(font); - - for (int n = 0; n < 16; n++) { - if (n == (cursor % 16)) - cuadro(g, n * 3, 0, 2); - String s = "00" + Integer.toHexString(n); - s = s.substring(s.length() - 2); - printString(g, s, n * 3, 0); - } - } - } - - private class Caja extends JPanel { - private static final long serialVersionUID = -6124062720565016834L; - - public Dimension getPreferredSize() { - return getMinimumSize(); - } - - public Dimension getMinimumSize() { - Dimension d = new Dimension(); - FontMetrics fn = getFontMetrics(font); - int h = fn.getHeight(); - d.setSize((fn.stringWidth(" ") + 1) + (border * 2) + 1, h - + (border * 2) + 1); - return d; - } - - } - - private class Filas extends JPanel { - private static final long serialVersionUID = 8797347523486018051L; - - public Filas() { - this.setLayout(new BorderLayout(1, 1)); - } - - public Dimension getPreferredSize() { - return getMinimumSize(); - } - - public Dimension getMinimumSize() { - Dimension d = new Dimension(); - FontMetrics fn = getFontMetrics(font); - int h = fn.getHeight(); - int nl = getLineas(); - d.setSize((fn.stringWidth(" ") + 1) * (8) + (border * 2) + 1, h - * nl + (border * 2) + 1); - return d; - } - - public void paint(Graphics g) { - Dimension d = getMinimumSize(); - g.setColor(Color.white); - g.fillRect(0, 0, d.width, d.height); - g.setColor(Color.black); - g.setFont(font); - - int ini = getInicio(); - int fin = ini + getLineas(); - int y = 0; - for (int n = ini; n < fin; n++) { - if (n == (cursor / 16)) - cuadro(g, 0, y, 8); - String s = "0000000000000" + Integer.toHexString(n); - s = s.substring(s.length() - 8); - printString(g, s, 0, y++); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/com/jhe/hexed/JHexEditorASCII.java b/src/main/java/com/jhe/hexed/JHexEditorASCII.java deleted file mode 100644 index 84971e5f..00000000 --- a/src/main/java/com/jhe/hexed/JHexEditorASCII.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.jhe.hexed; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; - -/** - * Created by IntelliJ IDEA. User: laullon Date: 09-abr-2003 Time: 12:47:18 - */ -public class JHexEditorASCII extends JComponent implements MouseListener, - KeyListener { - private static final long serialVersionUID = 5505374841731053461L; - private JHexEditor he; - - public JHexEditorASCII(JHexEditor he) { - this.he = he; - addMouseListener(this); - addKeyListener(this); - addFocusListener(he); - } - - public Dimension getPreferredSize() { - debug("getPreferredSize()"); - return getMinimumSize(); - } - - public Dimension getMinimumSize() { - debug("getMinimumSize()"); - - Dimension d = new Dimension(); - FontMetrics fn = getFontMetrics(JHexEditor.font); - int h = fn.getHeight(); - int nl = he.getLineas(); - d.setSize((fn.stringWidth(" ") + 1) * (16) + (he.border * 2) + 1, h - * nl + (he.border * 2) + 1); - return d; - } - - public void paint(Graphics g) { - debug("paint(" + g + ")"); - debug("cursor=" + he.cursor + " buff.length=" + he.buff.length); - Dimension d = getMinimumSize(); - g.setColor(Color.white); - g.fillRect(0, 0, d.width, d.height); - g.setColor(Color.black); - - g.setFont(JHexEditor.font); - - // datos ascii - int ini = he.getInicio() * 16; - int fin = ini + (he.getLineas() * 16); - if (fin > he.buff.length) - fin = he.buff.length; - - int x = 0; - int y = 0; - for (int n = ini; n < fin; n++) { - if (n == he.cursor) { - g.setColor(Color.blue); - if (hasFocus()) - he.fondo(g, x, y, 1); - else - he.cuadro(g, x, y, 1); - if (hasFocus()) - g.setColor(Color.white); - else - g.setColor(Color.black); - } else { - g.setColor(Color.black); - } - - String s = String.valueOf(he.buff[n]); - if ((he.buff[n] < 20) || (he.buff[n] > 126)) - s = "" + (char) 16; - he.printString(g, s, (x++), y); - if (x == 16) { - x = 0; - y++; - } - } - - } - - private void debug(String s) { - if (he.DEBUG) - System.out.println("JHexEditorASCII ==> " + s); - } - - // calcular la posicion del raton - public int calcularPosicionRaton(int x, int y) { - FontMetrics fn = getFontMetrics(JHexEditor.font); - x = x / (fn.stringWidth(" ") + 1); - y = y / fn.getHeight(); - debug("x=" + x + " ,y=" + y); - return x + ((y + he.getInicio()) * 16); - } - - // mouselistener - public void mouseClicked(MouseEvent e) { - debug("mouseClicked(" + e + ")"); - he.cursor = calcularPosicionRaton(e.getX(), e.getY()); - this.requestFocus(); - he.repaint(); - } - - public void mousePressed(MouseEvent e) { - } - - public void mouseReleased(MouseEvent e) { - } - - public void mouseEntered(MouseEvent e) { - } - - public void mouseExited(MouseEvent e) { - } - - // KeyListener - public void keyTyped(KeyEvent e) { - /* - * debug("keyTyped("+e+")"); - * - * he.buff[he.cursor]=(byte)e.getKeyChar(); - * - * if(he.cursor!=(he.buff.length-1)) he.cursor++; he.repaint(); - */ - } - - public void keyPressed(KeyEvent e) { - debug("keyPressed(" + e + ")"); - he.keyPressed(e); - } - - public void keyReleased(KeyEvent e) { - debug("keyReleased(" + e + ")"); - } - - public boolean isFocusTraversable() { - return true; - } -} \ No newline at end of file diff --git a/src/main/java/com/jhe/hexed/JHexEditorHEX.java b/src/main/java/com/jhe/hexed/JHexEditorHEX.java deleted file mode 100644 index ab76d8a4..00000000 --- a/src/main/java/com/jhe/hexed/JHexEditorHEX.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.jhe.hexed; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; - -/** - * Created by IntelliJ IDEA. User: laullon Date: 09-abr-2003 Time: 12:47:32 - */ -public class JHexEditorHEX extends JComponent implements MouseListener, - KeyListener { - private static final long serialVersionUID = 1481995655372014571L; - private JHexEditor he; - private int cursor = 0; - - public JHexEditorHEX(JHexEditor he) { - this.he = he; - addMouseListener(this); - addKeyListener(this); - addFocusListener(he); - } - - /* - * public Dimension getPreferredSize() { debug("getPreferredSize()"); return - * getMinimumSize(); } - */ - - public Dimension getMaximumSize() { - debug("getMaximumSize()"); - return getMinimumSize(); - } - - /* - * public Dimension getMinimumSize() { debug("getMinimumSize()"); - * - * Dimension d=new Dimension(); FontMetrics fn=getFontMetrics(he.font); int - * h=fn.getHeight(); int nl=he.getLineas(); - * d.setSize(((fn.stringWidth(" ")+1 - * )*+((16*3)-1))+(he.border*2)+1,h*nl+(he.border*2)+1); return d; } - */ - - public void paint(Graphics g) { - debug("paint(" + g + ")"); - debug("cursor=" + he.cursor + " buff.length=" + he.buff.length); - Dimension d = getMinimumSize(); - g.setColor(Color.white); - g.fillRect(0, 0, d.width, d.height); - g.setColor(Color.black); - - g.setFont(JHexEditor.font); - - int ini = he.getInicio() * 16; - int fin = ini + (he.getLineas() * 16); - if (fin > he.buff.length) - fin = he.buff.length; - - // datos hex - int x = 0; - int y = 0; - for (int n = ini; n < fin; n++) { - if (n == he.cursor) { - if (hasFocus()) { - g.setColor(Color.black); - he.fondo(g, (x * 3), y, 2); - g.setColor(Color.blue); - he.fondo(g, (x * 3) + cursor, y, 1); - } else { - g.setColor(Color.blue); - he.cuadro(g, (x * 3), y, 2); - } - - if (hasFocus()) - g.setColor(Color.white); - else - g.setColor(Color.black); - } else { - g.setColor(Color.black); - } - - String s = ("0" + Integer.toHexString(he.buff[n])); - s = s.substring(s.length() - 2); - he.printString(g, s, ((x++) * 3), y); - if (x == 16) { - x = 0; - y++; - } - } - } - - private void debug(String s) { - if (he.DEBUG) - System.out.println("JHexEditorHEX ==> " + s); - } - - // calcular la posicion del raton - public int calcularPosicionRaton(int x, int y) { - FontMetrics fn = getFontMetrics(JHexEditor.font); - x = x / ((fn.stringWidth(" ") + 1) * 3); - y = y / fn.getHeight(); - debug("x=" + x + " ,y=" + y); - return x + ((y + he.getInicio()) * 16); - } - - // mouselistener - public void mouseClicked(MouseEvent e) { - debug("mouseClicked(" + e + ")"); - he.cursor = calcularPosicionRaton(e.getX(), e.getY()); - this.requestFocus(); - he.repaint(); - } - - public void mousePressed(MouseEvent e) { - } - - public void mouseReleased(MouseEvent e) { - } - - public void mouseEntered(MouseEvent e) { - } - - public void mouseExited(MouseEvent e) { - } - - // KeyListener - public void keyTyped(KeyEvent e) { - debug("keyTyped(" + e + ")"); - - /* - * char c=e.getKeyChar(); - * if(((c>='0')&&(c<='9'))||((c>='A')&&(c<='F'))||((c>='a')&&(c<='f'))) - * { char[] str=new char[2]; String - * n="00"+Integer.toHexString((int)he.buff[he.cursor]); if(n.length()>2) - * n=n.substring(n.length()-2); str[1-cursor]=n.charAt(1-cursor); - * str[cursor]=e.getKeyChar(); - * he.buff[he.cursor]=(byte)Integer.parseInt(new String(str),16); - * - * if(cursor!=1) cursor=1; else if(he.cursor!=(he.buff.length-1)){ - * he.cursor++; cursor=0;} he.actualizaCursor(); } - */ - } - - public void keyPressed(KeyEvent e) { - debug("keyPressed(" + e + ")"); - he.keyPressed(e); - } - - public void keyReleased(KeyEvent e) { - debug("keyReleased(" + e + ")"); - } - - public boolean isFocusTraversable() { - return true; - } -} \ No newline at end of file diff --git a/src/main/java/jd/cli/util/ClassFileUtil.java b/src/main/java/jd/cli/util/ClassFileUtil.java deleted file mode 100644 index 396795ea..00000000 --- a/src/main/java/jd/cli/util/ClassFileUtil.java +++ /dev/null @@ -1,135 +0,0 @@ -package jd.cli.util; - -import jd.core.CoreConstants; -import jd.core.model.classfile.constant.Constant; -import jd.core.model.classfile.constant.ConstantClass; -import jd.core.model.classfile.constant.ConstantConstant; -import jd.core.model.classfile.constant.ConstantUtf8; -import jd.core.process.deserializer.ClassFormatException; -import jd.core.util.StringConstants; - -import java.io.*; - - -public class ClassFileUtil { - private ClassFileUtil() { - } - - /* - * Lecture rapide de la structure de la classe et extraction du nom du - * repoertoire de base. - */ - public static String ExtractDirectoryPath(String pathToClass) throws Exception { - DataInputStream dis = null; - String directoryPath = null; - - try { - dis = new DataInputStream( - new BufferedInputStream( - new FileInputStream(pathToClass))); - int magic = dis.readInt(); - if (magic != CoreConstants.JAVA_MAGIC_NUMBER) - throw new ClassFormatException("Invalid Java .class file"); - - /* int minor_version = */ - dis.readUnsignedShort(); - /* int major_version = */ - dis.readUnsignedShort(); - - Constant[] constants = DeserializeConstants(dis); - - /* int access_flags = */ - dis.readUnsignedShort(); - int this_class = dis.readUnsignedShort(); - - Constant c = constants[this_class]; - if ((c == null) || (c.tag != ConstantConstant.CONSTANT_Class)) - throw new ClassFormatException("Invalid contant pool"); - - c = constants[((ConstantClass) c).name_index]; - if ((c == null) || (c.tag != ConstantConstant.CONSTANT_Utf8)) - throw new ClassFormatException("Invalid contant pool"); - - String internalClassName = ((ConstantUtf8) c).bytes; - String pathSuffix = internalClassName.replace( - StringConstants.INTERNAL_PACKAGE_SEPARATOR, File.separatorChar) + - StringConstants.CLASS_FILE_SUFFIX; - - int index = pathToClass.indexOf(pathSuffix); - - if (index < 0) - throw new ClassFormatException("Invalid internal class name"); - - directoryPath = pathToClass.substring(0, index); - } finally { - if (dis != null) - try { - dis.close(); - } catch (IOException e) { - } - } - - return directoryPath; - } - - public static String ExtractInternalPath( - String directoryPath, String pathToClass) { - if ((directoryPath == null) || (pathToClass == null) || - !pathToClass.startsWith(directoryPath)) - return null; - - String s = pathToClass.substring(directoryPath.length()); - - return s.replace(File.separatorChar, StringConstants.INTERNAL_PACKAGE_SEPARATOR); - } - - private static Constant[] DeserializeConstants(DataInputStream dis) - throws IOException { - int count = dis.readUnsignedShort(); - if (count == 0) - return null; - - Constant[] constants = new Constant[count]; - - for (int i = 1; i < count; i++) { - byte tag = dis.readByte(); - - switch (tag) { - case ConstantConstant.CONSTANT_Class: - constants[i] = new ConstantClass(tag, dis.readUnsignedShort()); - break; - case ConstantConstant.CONSTANT_Utf8: - constants[i] = new ConstantUtf8(tag, dis.readUTF()); - break; - case ConstantConstant.CONSTANT_Long: - case ConstantConstant.CONSTANT_Double: - dis.readInt(); - dis.readInt(); - i++; - break; - case ConstantConstant.CONSTANT_Fieldref: - case ConstantConstant.CONSTANT_Methodref: - case ConstantConstant.CONSTANT_InterfaceMethodref: - case ConstantConstant.CONSTANT_NameAndType: - dis.readUnsignedShort(); - dis.readUnsignedShort(); - break; - case ConstantConstant.CONSTANT_Integer: - case ConstantConstant.CONSTANT_Float: - dis.readInt(); - break; - case ConstantConstant.CONSTANT_String: - dis.readUnsignedShort(); - break; - case 15: - case 16: - case 18: - throw new IllegalArgumentException("JD-GUI does not support Java 8 as of yet"); - default: - throw new ClassFormatException("Invalid constant pool entry"); - } - } - - return constants; - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/APKTool.java b/src/main/java/the/bytecode/club/bytecodeviewer/APKTool.java deleted file mode 100644 index 3b8490cf..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/APKTool.java +++ /dev/null @@ -1,47 +0,0 @@ -package the.bytecode.club.bytecodeviewer; - -import org.apache.commons.io.FileUtils; -import org.zeroturnaround.zip.ZipUtil; - -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Path; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -public class APKTool { - public static synchronized void decodeResources(File input, File output) { - try { - Path temporaryDirectory = Files.createTempDirectory("apkresources"); - Files.delete(temporaryDirectory); - brut.apktool.Main.main(new String[]{"-s", "-f", "-o", temporaryDirectory.toAbsolutePath().toString(), "decode", input.getAbsolutePath()}); - File directory = temporaryDirectory.toFile(); - File original = new File(directory, "original"); - FileUtils.deleteDirectory(original); - File classes = new File(directory, "classes.dex"); - classes.delete(); - File apktool = new File(directory, "apktool.yml"); - apktool.delete(); - ZipUtil.pack(directory, output); - FileUtils.deleteDirectory(directory); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/Boot.java b/src/main/java/the/bytecode/club/bytecodeviewer/Boot.java deleted file mode 100644 index 195bfefe..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/Boot.java +++ /dev/null @@ -1,163 +0,0 @@ -package the.bytecode.club.bytecodeviewer; - -import org.apache.commons.io.FileUtils; -import org.zeroturnaround.zip.ZipUtil; -import the.bytecode.club.bytecodeviewer.api.ExceptionUI; - -import javax.swing.*; -import java.io.File; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * @author Konloch - * @author Bibl (don't ban me pls) - * @created 19 Jul 2015 03:22:37 - */ -public class Boot { - private static InitialBootScreen screen; - - static { - try { - screen = new InitialBootScreen(); - } catch (Exception e) { - new ExceptionUI(e); - } - } - - public static void boot() throws Exception { - File enjarifyDirectory = new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "enjarify_" + BytecodeViewer.enjarifyVersion); - File krakatauDirectory = new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "krakatau_" + BytecodeViewer.krakatauVersion); - if (!enjarifyDirectory.exists() || !krakatauDirectory.exists()) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - screen.setVisible(true); - } - }); - } - screen.getProgressBar().setMaximum(BootSequence.values().length); - setState(BootSequence.CHECKING_LIBRARIES); - - checkEnjarify(); - checkKrakatau(); - - setState(BootSequence.BOOTING); - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - screen.setVisible(false); - } - }); - } - - public static void setState(BootSequence s) { - screen.setTitle("Initialzing Bytecode Viewer - " + s.getMessage()); - screen.getProgressBar().setValue(s.ordinal()); - System.out.println(s.getMessage()); - } - - public static void checkEnjarify() { - setState(BootSequence.CHECKING_ENJARIFY); - - for (File f : new File(BytecodeViewer.getBCVDirectory()).listFiles()) { - if (f.getName().toLowerCase().startsWith("enjarify_") && !f.getName().split("_")[1].split("\\.")[0].equals(BytecodeViewer.enjarifyVersion)) { - setState(BootSequence.CLEANING_ENJARIFY); - try { - FileUtils.deleteDirectory(f); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - File enjarifyDirectory = new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "enjarify_" + BytecodeViewer.enjarifyVersion); - if (!enjarifyDirectory.exists()) { - try { - setState(BootSequence.MOVING_ENJARIFY); - Path temporaryEnjarifyZip = Files.createTempFile("enjarify", ".zip"); - Files.delete(temporaryEnjarifyZip); - InputStream inputStream = Boot.class.getResourceAsStream("/enjarify-2.zip"); - Files.copy(inputStream, temporaryEnjarifyZip); - ZipUtil.unpack(temporaryEnjarifyZip.toFile(), enjarifyDirectory); - Files.delete(temporaryEnjarifyZip); - } catch (Exception e) { - BytecodeViewer.showMessage("ERROR: There was an issue unzipping enjarify (possibly corrupt). Restart BCV." + BytecodeViewer.nl + - "If the error persists contact @Konloch."); - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - - } - - public static void checkKrakatau() { - setState(BootSequence.CHECKING_KRAKATAU); - - for (File f : new File(BytecodeViewer.getBCVDirectory()).listFiles()) { - if (f.getName().toLowerCase().startsWith("krakatau_") && !f.getName().split("_")[1].split("\\.")[0].equals(BytecodeViewer.krakatauVersion)) { - setState(BootSequence.CLEANING_KRAKATAU); - try { - FileUtils.deleteDirectory(f); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - File krakatauDirectory = new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "krakatau_" + BytecodeViewer.krakatauVersion); - if (!krakatauDirectory.exists()) { - try { - setState(BootSequence.MOVING_KRAKATAU); - Path temporaryKrakatauZip = Files.createTempFile("krakatau", ".zip"); - Files.delete(temporaryKrakatauZip); - InputStream inputStream = Boot.class.getResourceAsStream("/Krakatau-8.zip"); - Files.copy(inputStream, temporaryKrakatauZip); - ZipUtil.unpack(temporaryKrakatauZip.toFile(), krakatauDirectory); - Files.delete(temporaryKrakatauZip); - } catch (Exception e) { - BytecodeViewer.showMessage("ERROR: There was an issue unzipping Krakatau decompiler (possibly corrupt). Restart BCV." + BytecodeViewer.nl + - "If the error persists contact @Konloch."); - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - } - - enum BootSequence { - CHECKING_LIBRARIES("Checking libraries"), - CHECKING_ENJARIFY("Checking Enjarify"), - CLEANING_ENJARIFY("Cleaning Enjarify"), - MOVING_ENJARIFY("Moving Enjarify"), - CHECKING_KRAKATAU("Checking Krakatau"), - CLEANING_KRAKATAU("Cleaning Krakatau"), - MOVING_KRAKATAU("Moving Krakatau"), - BOOTING("Booting"); - - private String message; - - BootSequence(String message) { - this.message = message; - } - - public String getMessage() { - return this.message; - } - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java deleted file mode 100644 index aff22a65..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ /dev/null @@ -1,1135 +0,0 @@ -package the.bytecode.club.bytecodeviewer; - -import me.konloch.kontainer.io.HTTPRequest; -import org.apache.commons.io.FileUtils; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.api.ClassNodeLoader; -import the.bytecode.club.bytecodeviewer.api.ExceptionUI; -import the.bytecode.club.bytecodeviewer.gui.*; -import the.bytecode.club.bytecodeviewer.obfuscators.mapping.Refactorer; -import the.bytecode.club.bytecodeviewer.plugin.PluginManager; - -import javax.swing.*; -import javax.swing.filechooser.FileFilter; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.io.*; -import java.net.URI; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * A lightweight Java Reverse Engineering suite, developed by Konloch - http://konloch.me - *

- * Are you a Java Reverse Engineer? Or maybe you want to learn Java Reverse Engineering? - * Join The Bytecode Club, we're noob friendly, and censorship free. - *

- * http://the.bytecode.club - *

- * All you have to do is add a jar or class file into the workspace, select the - * file you want then it will start decompiling the class in the background, - * when it's done it will show the Source code, Bytecode and Hexcode of the - * class file you chose. - *

- * There is also a plugin system that will allow you to interact with the loaded - * classfiles, for example you can write a String deobfuscator, a malicious code - * searcher, or something else you can think of. You can either use one of the - * pre-written plugins, or write your own. It supports groovy - * scripting. Once a plugin is activated, it will send a ClassNode ArrayList of - * every single class loaded in the file system to the execute function, this - * allows the user to handle it completely using ASM. - *

- * TODO: - *

- * 3.0.0: (RETIREMENT PARTY, WOHOOO) - * Add obfuscation: - * - Add integer boxing and other obfuscation methods contra implemented - * - Insert unadded/debug opcodes to try to fuck up decompilers - * - ClassAnylyzterAdapter - * Add the jump/save mark system Ida Pro has. - * Add class annotations to bytecode decompiler. - * EVERYTHING BUG FREE, CHECK 100% - * bytecode editor that works by editing per method instead of entire class, methods are in a pane like the file navigator - * Make the tabs menu and middle mouse button click work on the tab itself not just the close button. - *

- * before 3.0.0: - * EVERYTHING ON THE FUCKING GITHUB ISSUES LOL - * make it use that global last used inside of export as jar - * Spiffy up the plugin console with hilighted lines - * Take https://github.com/ptnkjke/Java-Bytecode-Editor visualize - * make zipfile not include the decode shit - * add stackmapframes to bytecode decompiler - * add stackmapframes remover? - * make ez-injection plugin console show all sys.out calls - * add JEB decompiler optionally, requires them to add jeb library jar externally and disable update check ? - * add decompile as zip for krakatau-bytecode, jd-gui and smali for CLI - * fix hook inject for EZ-Injection - * fix classfile searcher - * make the decompilers launch in a separate process? - *

- * -----2.9.9-----: - * 08/01/2015 - Fixed a pingback concurrency exception issue. - * 08/03/2015 - Fixed a typo for FernFlower decompiler. - * 08/03/2015 - Fixed an issue with Krakatau Decompiler as zip. - * 08/07/2015 - "Fixed" an issue with Enjarify and latest PyPy3 bin. - * 08/07/2015 - FernFlower & CFR Decompiler now launch in their own process with the 'slimjar' version. - * 08/07/2015 - Switched the ClassViewer up slightly so it utilizes the event dispatch thread. - * 08/07/2015 - Fixed? CFIDE's Bytecode Decompiler on TableSwitchs - * 01/04/2015 - Afffsdd fixed the same filename from 2 containers. - * 01/04/2015 - Afffsdd fixed a typo. - * 01/04/2015 - Afffsdd Added an option to show the containing file name. - * - * @author Konloch - */ - -public class BytecodeViewer { - - /*per version*/ - public static final String version = "3.0.0"; - public static final String krakatauVersion = "8"; - public static final String enjarifyVersion = "2"; - public static final boolean previewCopy = false; - /* Constants */ - public static final String fs = System.getProperty("file.separator"); - public static final String nl = System.getProperty("line.separator"); - public static final File dataDir = new File(System.getProperty("user.home") + fs + ".Bytecode-Viewer"); - public static final File filesFile = new File(dataDir, "recentfiles.bcv"); - public static final File pluginsFile = new File(dataDir, "recentplugins.bcv"); - public static final File settingsFile = new File(dataDir, "settings.bcv"); - public static final File krakatauDirectory = new File(dataDir + fs + "krakatau_" + krakatauVersion + fs + "Krakatau-master"); - public static final File enjarifyDirectory = new File(dataDir + fs + "enjarify_" + enjarifyVersion + fs + "enjarify-master"); - @Deprecated - public static final File tempDir = new File(dataDir, "bcv_temp"); - private static final long start = System.currentTimeMillis(); - /*the rest*/ - public static MainViewerGUI viewer = null; - public static ClassNodeLoader loader = new ClassNodeLoader(); // TODO MAKE SECURE BECAUSE THIS IS INSECURE - public static SecurityMan sm = new SecurityMan(); // TODO MAKE SECURE BECAUSE THIS IS INSECURE - public static ArrayList files = new ArrayList(); //all of BCV's loaded files/classes/etc - private static int maxRecentFiles = 25; - private static List recentFiles = new ArrayList<>(); - private static List recentPlugins = new ArrayList<>(); - public static boolean runningObfuscation = false; - public static String lastDirectory = ""; - public static ArrayList createdProcesses = new ArrayList(); - public static Refactorer refactorer = new Refactorer(); - public static boolean pingback = false; - public static boolean deleteForiegnLibraries = true; - - private BytecodeViewer() { - } - - /** - * Main startup - * - * @param args files you want to open or CLI - */ - public static void main(String[] args) { - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (Exception e) { - new ExceptionUI(e); - } - try { - System.setSecurityManager(sm); - System.out.println("https://the.bytecode.club - Created by @Konloch and @samczsun - Bytecode Viewer " + version); - CommandLineInput input = new CommandLineInput(args); - if (previewCopy && !input.containsCommand()) - showMessage("WARNING: This is a preview/dev copy, you WON'T be alerted when " + version + " is actually out if you use this." + nl + - "Make sure to watch the repo: https://github.com/Konloch/bytecode-viewer for " + version + "'s release"); - if (!filesFile.exists() && !filesFile.createNewFile()) { - throw new RuntimeException("Could not create recent files file"); - } - if (!pluginsFile.exists() && !pluginsFile.createNewFile()) { - throw new RuntimeException("Could not create recent plugins file"); - } - recentFiles.addAll(FileUtils.readLines(filesFile, "UTF-8")); - recentPlugins.addAll(FileUtils.readLines(pluginsFile, "UTF-8")); - int CLI = input.parseCommandLine(); - if (CLI == CommandLineInput.STOP) return; - if (CLI == CommandLineInput.OPEN_FILE) { - viewer = new MainViewerGUI(); - Settings.loadGUI(); - Boot.boot(); - BytecodeViewer.BOOT(args, false); - } else { - BytecodeViewer.BOOT(args, true); - input.executeCommandLine(); - } - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - - /** - * The version checker thread - */ - private static final Thread versionChecker = new Thread() { - @Override - public void run() { - try { - HTTPRequest r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/VERSION")); - final String version = r.readSingle(); - try { - int simplemaths = Integer.parseInt(version.replace(".", "")); - int simplemaths2 = Integer.parseInt(BytecodeViewer.version.replace(".", "")); - if (simplemaths2 > simplemaths) return; //developer version - } catch (Exception e) { - - } - - if (!BytecodeViewer.version.equals(version)) { - r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/README.txt")); - String[] readme = r.read(); - - String changelog = "Unable to load change log, please try again later." + nl; - boolean trigger = false; - boolean finalTrigger = false; - for (String st : readme) { - if (st.equals("--- " + BytecodeViewer.version + " ---:")) { - changelog = ""; - trigger = true; - } else if (trigger) { - if (st.startsWith("--- ")) finalTrigger = true; - - if (finalTrigger) changelog += st + nl; - } - } - - JOptionPane pane = new JOptionPane("Your version: " + BytecodeViewer.version + ", latest version: " + version + nl + nl + "Changes since your version:" + nl + changelog + nl + "What would you like to do?"); - Object[] options = new String[]{"Open The Download Page", "Download The Updated Jar", "Do Nothing"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Outdated Version"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result == 0) { - if (Desktop.isDesktopSupported()) { - Desktop.getDesktop().browse(new URI("https://github.com/Konloch/bytecode-viewer/releases")); - } else { - showMessage("Cannot open the page, please manually type it." + nl + "https://github.com/Konloch/bytecode-viewer/releases"); - } - } - if (result == 1) { - JFileChooser fc = new JFileChooser(); - try { - fc.setCurrentDirectory(new File(".").getAbsoluteFile()); //set the current working directory - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - fc.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("zip"); - } - - @Override - public String getDescription() { - return "Zip Archives"; - } - }); - fc.setFileHidingEnabled(false); - fc.setAcceptAllFileFilterUsed(false); - int returnVal = fc.showSaveDialog(viewer); - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - if (!file.getAbsolutePath().endsWith(".zip")) - file = new File(file.getAbsolutePath() + ".zip"); - - if (file.exists()) { - pane = new JOptionPane("The file " + file + " exists, would you like to overwrite it?"); - options = new String[]{"Yes", "No"}; - pane.setOptions(options); - dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Overwrite File"); - dialog.setVisible(true); - obj = pane.getValue(); - result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result != 0) return; - - file.delete(); - } - - final File finalFile = file; - Thread downloadThread = new Thread() { - @Override - public void run() { - try { - InputStream is = new URL("https://github.com/Konloch/bytecode-viewer/releases/download/v" + version + "/BytecodeViewer." + version + ".zip").openConnection().getInputStream(); - FileOutputStream fos = new FileOutputStream(finalFile); - try { - System.out.println("Downloading from https://github.com/Konloch/bytecode-viewer/releases/download/v" + version + "/BytecodeViewer." + version + ".zip"); - byte[] buffer = new byte[8192]; - int len; - int downloaded = 0; - boolean flag = false; - showMessage("Downloading the jar in the background, when it's finished you will be alerted with another message box." + nl + nl + "Expect this to take several minutes."); - while ((len = is.read(buffer)) > 0) { - fos.write(buffer, 0, len); - fos.flush(); - downloaded += 8192; - int mbs = downloaded / 1048576; - if (mbs % 5 == 0 && mbs != 0) { - if (!flag) System.out.println("Downloaded " + mbs + "MBs so far"); - flag = true; - } else flag = false; - } - } finally { - try { - if (is != null) { - is.close(); - } - } finally { - if (fos != null) { - fos.flush(); - fos.close(); - } - } - } - System.out.println("Download finished!"); - showMessage("Download successful! You can find the updated program at " + finalFile.getAbsolutePath()); - } catch (FileNotFoundException e) { - showMessage("Unable to download, the zip file has not been uploaded yet, please try again in about 10 minutes."); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - - } - }; - downloadThread.start(); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - }; - - /** - * Pings back to bytecodeviewer.com to be added into the total running statistics - */ - private static final Thread PingBack = new Thread() { - @Override - public void run() { - try { - new HTTPRequest(new URL("https://bytecodeviewer.com/add.php")).read(); - } catch (Exception e) { - pingback = false; - } - } - }; - - public static void pingback() { - JOptionPane pane = new JOptionPane("Would you like to 'pingback' to https://bytecodeviewer.com to be counted in the global users for BCV?"); - Object[] options = new String[]{"Yes", "No"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Optional Pingback"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result == 0) { - try { - if (!PingBack.isAlive()) PingBack.start(); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - } - - /** - * Boot after all of the libraries have been loaded - * - * @param cli is it running CLI mode or not - */ - public static void BOOT(String[] args, boolean cli) { - cleanup(); - Runtime.getRuntime().addShutdownHook(new Thread() { - @Override - public void run() { - for (Process proc : createdProcesses) - proc.destroy(); - try { - FileUtils.writeLines(filesFile, recentFiles); - FileUtils.writeLines(pluginsFile, recentPlugins); - } catch (IOException e) { - new ExceptionUI(e); - } - Settings.saveGUI(); - cleanup(); - } - }); - - viewer.calledAfterLoad(); - resetRecentFilesMenu(); - - if (!pingback) { - PingBack.start(); - pingback = true; - } - - if (viewer.chckbxmntmNewCheckItem_12.isSelected()) versionChecker.start(); - - if (!cli) viewer.setVisible(true); - - System.out.println("Start up took " + ((System.currentTimeMillis() - start) / 1000) + " seconds"); - - if (!cli) if (args.length >= 1) for (String s : args) { - openFiles(new File[]{new File(s)}, true); - } - } - - /** - * because Smali and Baksmali System.exit if it failed - * - * @param i - */ - public static void exit(int i) { - - } - - /** - * Returns the currently opened ClassNode - * - * @return the currently opened ClassNode - */ - public static ClassNode getCurrentlyOpenedClassNode() { - return viewer.workPane.getCurrentViewer().cn; - } - - /** - * Returns the ClassNode by the specified name - * - * @param containerName name of the FileContainer that this class is in - * @param name the class name - * @return the ClassNode instance - */ - public static ClassNode getClassNode(String containerName, String name) { - for (FileContainer container : files) { - if (container.name.equals(containerName) && container.getData().containsKey(name + ".class")) { - return container.getClassNode(name); - } - } - return null; - } - - public static byte[] getClassBytes(String containerName, String name) { - for (FileContainer container : files) { - if (container.name.equals(containerName) && container.getData().containsKey(name)) { - return container.getData().get(name); - } - } - return null; - } - - /** - * Grabs the file contents of the loaded resources. - * - * @param name the file name - * @return the file contents as a byte[] - */ - public static byte[] getFileContents(String name) { - for (FileContainer container : files) { - HashMap files = container.files; - if (files.containsKey(name)) return files.get(name); - } - - return null; - } - - /** - * Replaces an old node with a new instance - * - * @param oldNode the old instance - * @param newNode the new instance - */ - public static void updateNode(ClassNode oldNode, ClassNode newNode) { - for (FileContainer container : files) { - if (container.remove(oldNode)) container.add(newNode); - } - } - - /** - * Gets all of the loaded classes as an array list - * - * @return the loaded classes as an array list - */ - public static ArrayList getLoadedClasses() { - ArrayList a = new ArrayList(); - - for (FileContainer container : files) - for (ClassNode c : container.values()) - if (!a.contains(c)) a.add(c); - - return a; - } - - public static ArrayList loadAllClasses() { - ArrayList a = new ArrayList(); - for (FileContainer container : files) { - for (String s : container.files.keySet()) { - ClassNode loaded = container.getClassNode(s.substring(0, s.length() - 6)); - if (loaded != null) { - a.add(loaded); - } - } - } - - return a; - } - - public static Map getLoadedBytes() { - Map data = new HashMap<>(); - for (FileContainer container : files) { - data.putAll(container.getData()); - } - return data; - } - - /** - * Compile all of the compilable panes that're opened. - * - * @param message if it should send a message saying it's compiled sucessfully. - * @return true if no errors, false if it failed to compile. - */ - public static boolean compile(boolean message) { - BytecodeViewer.viewer.setIcon(true); - boolean actuallyTried = false; - - for (java.awt.Component c : BytecodeViewer.viewer.workPane.getLoadedViewers()) { - if (c instanceof ClassViewer) { - ClassViewer cv = (ClassViewer) c; - boolean valid = false; - for (int i = 0; i < cv.panels.size(); i++) { - if (cv.smalis.get(i) != null && cv.smalis.get(i).isEditable()) { - valid = true; - } - } - if (valid) { - actuallyTried = true; - Object smali[] = cv.getSmali(); - if (smali != null) { - ClassNode origNode = (ClassNode) smali[0]; - String smaliText = (String) smali[1]; - byte[] smaliCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.smali.compile(smaliText, origNode.name); - if (smaliCompiled != null) { - ClassNode newNode = JarUtils.getNode(smaliCompiled); - BytecodeViewer.updateNode(origNode, newNode); - } else { - BytecodeViewer.showMessage("There has been an error with assembling your Smali code, please check this. Class: " + origNode.name); - BytecodeViewer.viewer.setIcon(false); - return false; - } - } - } - valid = false; - for (int i = 0; i < cv.panels.size(); i++) { - if (cv.krakataus.get(i) != null && cv.krakataus.get(i).isEditable()) { - valid = true; - } - } - if (valid) { - actuallyTried = true; - Object krakatau[] = cv.getKrakatau(); - if (krakatau != null) { - ClassNode origNode = (ClassNode) krakatau[0]; - String krakatauText = (String) krakatau[1]; - byte[] krakatauCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.krakatau.compile(krakatauText, origNode.name); - if (krakatauCompiled != null) { - ClassNode newNode = JarUtils.getNode(krakatauCompiled); - BytecodeViewer.updateNode(origNode, newNode); - } else { - BytecodeViewer.showMessage("There has been an error with assembling your Krakatau Bytecode, please check this. Class: " + origNode.name); - BytecodeViewer.viewer.setIcon(false); - return false; - } - } - } - valid = false; - for (int i = 0; i < cv.panels.size(); i++) { - if (cv.javas.get(i) != null && cv.javas.get(i).isEditable()) { - valid = true; - } - } - if (valid) { - actuallyTried = true; - Object java[] = cv.getJava(); - if (java != null) { - ClassNode origNode = (ClassNode) java[0]; - String javaText = (String) java[1]; - - SystemErrConsole errConsole = new SystemErrConsole("Java Compile Issues"); - errConsole.setText("Error compiling class: " + origNode.name + nl + "Keep in mind most decompilers cannot produce compilable classes" + nl + nl); - - byte[] javaCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.java.compile(javaText, origNode.name); - if (javaCompiled != null) { - ClassNode newNode = JarUtils.getNode(javaCompiled); - BytecodeViewer.updateNode(origNode, newNode); - errConsole.finished(); - } else { - errConsole.pretty(); - errConsole.setVisible(true); - errConsole.finished(); - BytecodeViewer.viewer.setIcon(false); - return false; - } - } - } - } - } - - if (message) if (actuallyTried) BytecodeViewer.showMessage("Compiled Successfully."); - else BytecodeViewer.showMessage("You have no editable panes opened, make one editable and try again."); - - BytecodeViewer.viewer.setIcon(false); - return true; - } - - private static boolean update = true; - - /** - * Opens a file, optional if it should append to the recent files menu - * - * @param files the file(s) you wish to open - * @param recentFiles if it should append to the recent files menu - */ - public static void openFiles(final File[] files, boolean recentFiles) { - if (recentFiles) for (File f : files) - if (f.exists()) BytecodeViewer.addRecentFile(f); - - BytecodeViewer.viewer.setIcon(true); - update = true; - - Thread t = new Thread() { - @Override - public void run() { - try { - for (final File f : files) { - final String fn = f.getName(); - if (!f.exists()) { - update = false; - showMessage("The file " + f.getAbsolutePath() + " could not be found."); - } else { - if (f.isDirectory()) { - FileContainer container = new FileContainer(f); - HashMap files = new HashMap(); - boolean finished = false; - ArrayList totalFiles = new ArrayList(); - totalFiles.add(f); - String dir = f.getAbsolutePath();//f.getAbsolutePath().substring(0, f.getAbsolutePath().length()-f.getName().length()); - - while (!finished) { - boolean added = false; - for (int i = 0; i < totalFiles.size(); i++) { - File child = totalFiles.get(i); - if (child.listFiles() != null) for (File rocket : child.listFiles()) - if (!totalFiles.contains(rocket)) { - totalFiles.add(rocket); - added = true; - } - } - - if (!added) { - for (File child : totalFiles) - if (child.isFile()) { - String fileName = child.getAbsolutePath().substring(dir.length() + 1, child.getAbsolutePath().length()).replaceAll("\\\\", "\\/"); - - - files.put(fileName, Files.readAllBytes(Paths.get(child.getAbsolutePath()))); - } - finished = true; - } - } - container.files = files; - BytecodeViewer.files.add(container); - } else { - if (fn.endsWith(".jar") || fn.endsWith(".zip")) { - try { - JarUtils.put(f); - } catch (final Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - update = false; - } - - } else if (fn.endsWith(".class")) { - try { - byte[] bytes = JarUtils.getBytes(new FileInputStream(f)); - String cafebabe = String.format("%02X%02X%02X%02X", bytes[0], bytes[1], bytes[2], bytes[3]); - if (cafebabe.toLowerCase().equals("cafebabe")) { - final ClassNode cn = JarUtils.getNode(bytes); - - FileContainer container = new FileContainer(f); - container.files.put(cn.name + ".class", bytes); - container.add(cn); - BytecodeViewer.files.add(container); - } else { - showMessage(fn + ": Header does not start with CAFEBABE, ignoring."); - update = false; - } - } catch (final Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - update = false; - } - } else if (fn.endsWith(".apk")) { - try { - BytecodeViewer.viewer.setIcon(true); - FileContainer container = new FileContainer(f); - - if (viewer.decodeAPKResources.isSelected()) { - File decodedResources = new File(tempDir, MiscUtils.randomString(32) + ".apk"); - APKTool.decodeResources(f, decodedResources); - container.files = JarUtils.loadResources(decodedResources); - } - - container.files.putAll(JarUtils.loadResources(f)); - - String name = getRandomizedName() + ".jar"; - File output = new File(tempDir, name); - - if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionDex.getModel())) - Dex2Jar.dex2Jar(f, output); - else if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel())) - Enjarify.apk2Jar(f, output); - - for (ClassNode classNode : JarUtils.loadClasses(output)) { - container.add(classNode); - } - - BytecodeViewer.viewer.setIcon(false); - BytecodeViewer.files.add(container); - } catch (final Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - return; - } else if (fn.endsWith(".dex")) { - try { - BytecodeViewer.viewer.setIcon(true); - FileContainer container = new FileContainer(f); - - String name = getRandomizedName() + ".jar"; - File output = new File(tempDir, name); - - if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionDex.getModel())) - Dex2Jar.dex2Jar(f, output); - else if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel())) - Enjarify.apk2Jar(f, output); - - for (ClassNode classNode : JarUtils.loadClasses(output)) { - container.add(classNode); - } - - BytecodeViewer.viewer.setIcon(false); - BytecodeViewer.files.add(container); - } catch (final Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - return; - } else { - HashMap files = new HashMap(); - byte[] bytes = JarUtils.getBytes(new FileInputStream(f)); - files.put(f.getName(), bytes); - - - FileContainer container = new FileContainer(f); - container.files = files; - BytecodeViewer.files.add(container); - } - } - } - } - } catch (final Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } finally { - BytecodeViewer.viewer.setIcon(false); - if (update) try { - MainViewerGUI.getComponent(FileNavigationPane.class).updateTree(); - } catch (java.lang.NullPointerException e) { - } - } - } - }; - t.start(); - } - - /** - * Starts the specified plugin - * - * @param file the file of the plugin - */ - public static void startPlugin(File file) { - if (!file.exists()) return; - - try { - PluginManager.runPlugin(file); - } catch (Throwable e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - addRecentPlugin(file); - } - - /** - * Send a message to alert the user - * - * @param message the message you need to send - */ - public static void showMessage(String message) { - JOptionPane.showMessageDialog(viewer, message); - } - - /** - * Resets the workspace with optional user input required - * - * @param ask if should require user input or not - */ - public static void resetWorkSpace(boolean ask) { - if (!ask) { - files.clear(); - MainViewerGUI.getComponent(FileNavigationPane.class).resetWorkspace(); - MainViewerGUI.getComponent(WorkPane.class).resetWorkspace(); - MainViewerGUI.getComponent(SearchingPane.class).resetWorkspace(); - the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().clear(); - } else { - JOptionPane pane = new JOptionPane("Are you sure you want to reset the workspace?\n\rIt will also reset your file navigator and search."); - Object[] options = new String[]{"Yes", "No"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(viewer, "Bytecode Viewer - Reset Workspace"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result == 0) { - files.clear(); - MainViewerGUI.getComponent(FileNavigationPane.class).resetWorkspace(); - MainViewerGUI.getComponent(WorkPane.class).resetWorkspace(); - MainViewerGUI.getComponent(SearchingPane.class).resetWorkspace(); - the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().clear(); - } - } - } - - private static ArrayList killList = new ArrayList(); - - /** - * Add the recent file - * - * @param f the recent file - */ - public static void addRecentFile(File f) { - for (int i = 0; i < recentFiles.size(); i++) { // remove dead strings - String s = recentFiles.get(i); - if (s.isEmpty() || i > maxRecentFiles) killList.add(s); - } - if (!killList.isEmpty()) { - for (String s : killList) - recentFiles.remove(s); - killList.clear(); - } - - if (recentFiles.contains(f.getAbsolutePath())) // already added on the list - recentFiles.remove(f.getAbsolutePath()); - if (recentFiles.size() >= maxRecentFiles) recentFiles.remove(maxRecentFiles - 1); // zero indexing - - recentFiles.add(0, f.getAbsolutePath()); - resetRecentFilesMenu(); - } - - private static ArrayList killList2 = new ArrayList(); - - /** - * Add to the recent plugin list - * - * @param f the plugin file - */ - public static void addRecentPlugin(File f) { - for (int i = 0; i < recentPlugins.size(); i++) { // remove dead strings - String s = recentPlugins.get(i); - if (s.isEmpty() || i > maxRecentFiles) killList2.add(s); - } - if (!killList2.isEmpty()) { - for (String s : killList2) - recentPlugins.remove(s); - killList2.clear(); - } - - if (recentPlugins.contains(f.getAbsolutePath())) // already added on the list - recentPlugins.remove(f.getAbsolutePath()); - if (recentPlugins.size() >= maxRecentFiles) recentPlugins.remove(maxRecentFiles - 1); // zero indexing - - recentPlugins.add(0, f.getAbsolutePath()); - resetRecentFilesMenu(); - } - - /** - * resets the recent files menu - */ - public static void resetRecentFilesMenu() { - viewer.mnRecentFiles.removeAll(); - for (String s : recentFiles) - if (!s.isEmpty()) { - JMenuItem m = new JMenuItem(s); - m.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JMenuItem m = (JMenuItem) e.getSource(); - openFiles(new File[]{new File(m.getText())}, true); - } - }); - viewer.mnRecentFiles.add(m); - } - viewer.mnRecentPlugins.removeAll(); - for (String s : recentPlugins) - if (!s.isEmpty()) { - JMenuItem m = new JMenuItem(s); - m.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JMenuItem m = (JMenuItem) e.getSource(); - startPlugin(new File(m.getText())); - } - }); - viewer.mnRecentPlugins.add(m); - } - } - - /** - * Clears the temp directory - */ - public static void cleanup() { - try { - FileUtils.cleanDirectory(tempDir); - } catch (Exception e) { - } - } - - public static ArrayList createdRandomizedNames = new ArrayList(); - - /** - * Ensures it will only return a uniquely generated names, contains a dupe checker to be sure - * - * @return the unique randomized name of 25 characters. - */ - public static String getRandomizedName() { - boolean generated = false; - String name = ""; - while (!generated) { - String randomizedName = MiscUtils.randomString(25); - if (!createdRandomizedNames.contains(randomizedName)) { - createdRandomizedNames.add(randomizedName); - name = randomizedName; - generated = true; - } - } - return name; - } - - /** - * Returns the BCV directory - * - * @return the static BCV directory - */ - public static String getBCVDirectory() { - while (!dataDir.exists()) dataDir.mkdirs(); - - if (!dataDir.isHidden() && isWindows()) hideFile(dataDir); - - return dataDir.getAbsolutePath(); - } - - /** - * Checks if the OS contains 'win' - * - * @return true if the os.name property contains 'win' - */ - private static boolean isWindows() { - return System.getProperty("os.name").toLowerCase().contains("win"); - } - - /** - * Runs the windows command to hide files - * - * @param f file you want hidden - */ - private static void hideFile(File f) { - sm.stopBlocking(); - try { - // Hide file by running attrib system command (on Windows) - Runtime.getRuntime().exec("attrib +H " + f.getAbsolutePath()); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - sm.setBlocking(); - } - - private static long last = System.currentTimeMillis(); - - /** - * Checks the hotkeys - * - * @param e - */ - public static void checkHotKey(KeyEvent e) { - if (System.currentTimeMillis() - last <= (4000)) return; - - if ((e.getKeyCode() == KeyEvent.VK_O) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { - last = System.currentTimeMillis(); - JFileChooser fc = new JFileChooser(); - try { - fc.setSelectedFile(new File(BytecodeViewer.lastDirectory)); - } catch (Exception e2) { - - } - fc.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - if (f.isDirectory()) return true; - - String extension = MiscUtils.extension(f.getAbsolutePath()); - if (extension != null) - if (extension.equals("jar") || extension.equals("zip") || extension.equals("class") || extension.equals("apk") || extension.equals("dex")) - return true; - - return false; - } - - @Override - public String getDescription() { - return "APKs, DEX, Class Files or Zip/Jar Archives"; - } - }); - fc.setFileHidingEnabled(false); - fc.setAcceptAllFileFilterUsed(false); - int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - BytecodeViewer.lastDirectory = fc.getSelectedFile().getAbsolutePath(); - try { - BytecodeViewer.viewer.setIcon(true); - BytecodeViewer.openFiles(new File[]{fc.getSelectedFile()}, true); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e1) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); - } - } - } else if ((e.getKeyCode() == KeyEvent.VK_N) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { - last = System.currentTimeMillis(); - BytecodeViewer.resetWorkSpace(true); - } else if ((e.getKeyCode() == KeyEvent.VK_T) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { - last = System.currentTimeMillis(); - Thread t = new Thread() { - public void run() { - BytecodeViewer.compile(true); - } - }; - t.start(); - } else if ((e.getKeyCode() == KeyEvent.VK_R) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { - last = System.currentTimeMillis(); - if (BytecodeViewer.getLoadedClasses().isEmpty()) { - BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); - return; - } - new RunOptions().setVisible(true); - } else if ((e.getKeyCode() == KeyEvent.VK_S) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { - last = System.currentTimeMillis(); - - if (BytecodeViewer.getLoadedClasses().isEmpty()) { - BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); - return; - } - - Thread t = new Thread() { - public void run() { - if (viewer.autoCompileSmali.isSelected() && !BytecodeViewer.compile(false)) return; - JFileChooser fc = new JFileChooser(); - fc.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("zip"); - } - - @Override - public String getDescription() { - return "Zip Archives"; - } - }); - fc.setFileHidingEnabled(false); - fc.setAcceptAllFileFilterUsed(false); - int returnVal = fc.showSaveDialog(viewer); - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - if (!file.getAbsolutePath().endsWith(".zip")) file = new File(file.getAbsolutePath() + ".zip"); - - if (file.exists()) { - JOptionPane pane = new JOptionPane("Are you sure you wish to overwrite this existing file?"); - Object[] options = new String[]{"Yes", "No"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Overwrite File"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result == 0) { - file.delete(); - } else { - return; - } - } - - final File file2 = file; - - BytecodeViewer.viewer.setIcon(true); - Thread t = new Thread() { - @Override - public void run() { - JarUtils.saveAsJar(BytecodeViewer.getLoadedBytes(), file2.getAbsolutePath()); - BytecodeViewer.viewer.setIcon(false); - } - }; - t.start(); - } - } - }; - t.start(); - } else if ((e.getKeyCode() == KeyEvent.VK_W) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { - last = System.currentTimeMillis(); - if (viewer.workPane.getCurrentViewer() != null) - viewer.workPane.tabs.remove(viewer.workPane.getCurrentViewer()); - } - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/CommandLineInput.java b/src/main/java/the/bytecode/club/bytecodeviewer/CommandLineInput.java deleted file mode 100644 index 57288ea1..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/CommandLineInput.java +++ /dev/null @@ -1,184 +0,0 @@ -package the.bytecode.club.bytecodeviewer; - -import org.apache.commons.cli.*; -import org.apache.commons.io.FileUtils; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.api.ExceptionUI; -import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; - -import java.io.File; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * Used to allow BCV to be integrated as CLI instead of GUI. - * - * @author Konloch - */ - -public class CommandLineInput { - private static final Options options = new Options(); - private static final CommandLineParser parser = new DefaultParser(); - - /*BECAUSE WHO DOESN'T LOVE MAGIC NUMBERS*/ - public static int STOP = -1; - public static int OPEN_FILE = 0; - public static int CLI = 1; - - private CommandLine parsed; - - public CommandLineInput(String[] args) throws ParseException { - parsed = parser.parse(options, args); - } - - static { - options.addOption(new Option("help", null, false, "prints the help menu.")); - options.addOption(new Option("list", null, false, "lists all the available decompilers for BCV " + BytecodeViewer.version + ".")); - options.addOption(new Option("decompiler", null, true, "sets the decompiler, procyon by default.")); - options.addOption(new Option("i", null, true, "sets the input.")); - options.addOption(new Option("o", null, true, "sets the output.")); - options.addOption(new Option("t", null, true, "sets the target class to decompile, append all to decomp all as zip.")); - options.addOption(new Option("nowait", null, true, "won't wait the 5 seconds to allow the user to read the CLI.")); - } - - public boolean containsCommand() { - if (parsed.hasOption("help") || - parsed.hasOption("list") || - parsed.hasOption("decompiler") || - parsed.hasOption("i") || - parsed.hasOption("o") || - parsed.hasOption("t") || - parsed.hasOption("nowait")) { - return true; - } - return false; - } - - public int parseCommandLine() { - if (!containsCommand()) { - return OPEN_FILE; - } - try { - if (parsed.hasOption("list")) { - System.out.println("Procyon"); - System.out.println("CFR"); - System.out.println("FernFlower"); - System.out.println("Krakatau"); - System.out.println("Krakatau-Bytecode"); - System.out.println("JD-GUI"); - System.out.println("Smali"); - return STOP; - } else if (parsed.hasOption("help")) { - for (String s : new String[]{"-help Displays the help menu", "-list Displays the available decompilers", "-decompiler Selects the decompiler, procyon by default", "-i Selects the input file", "-o Selects the output file", "-t Must either be the fully qualified classname or \"all\" to decompile all as zip", "-nowait Doesn't wait for the user to read the CLI messages"}) - System.out.println(s); - return STOP; - } else { - if (parsed.getOptionValue("i") == null) { - System.err.println("Set the input with -i"); - return STOP; - } - if (parsed.getOptionValue("o") == null) { - System.err.println("Set the output with -o"); - return STOP; - } - if (parsed.getOptionValue("t") == null) { - System.err.println("Set the target with -t"); - return STOP; - } - - File input = new File(parsed.getOptionValue("i")); - File output = new File(parsed.getOptionValue("o")); - String decompiler = parsed.getOptionValue("decompiler"); - - if (!input.exists()) { - System.err.println(input.getAbsolutePath() + " does not exist."); - return STOP; - } - - if (output.exists()) { - System.err.println("WARNING: Deleted old " + output.getAbsolutePath() + "."); - output.delete(); - } - - //check if zip, jar, apk, dex, or class - //if its zip/jar/apk/dex attempt unzip as whole zip - //if its just class allow any - - if (decompiler != null && - !decompiler.equalsIgnoreCase("procyon") && - !decompiler.equalsIgnoreCase("cfr") && - !decompiler.equalsIgnoreCase("fernflower") && - !decompiler.equalsIgnoreCase("krakatau") && - !decompiler.equalsIgnoreCase("krakatau-bytecode") && - !decompiler.equalsIgnoreCase("jd-gui") && - !decompiler.equalsIgnoreCase("smali")) { - System.out.println("Error, no decompiler called '" + decompiler + "' found. Type -decompiler-list for the list"); - } - - - if (!parsed.hasOption("nowait")) Thread.sleep(5 * 1000); - - return CLI; - } - } catch (Exception e) { - new ExceptionUI(e); - } - - return OPEN_FILE; - } - - public void executeCommandLine() { - try { - File input = new File(parsed.getOptionValue("i")); - File output = new File(parsed.getOptionValue("o")); - String target = parsed.getOptionValue("t"); - - Decompiler use = null; - if (parsed.getOptionValue("decompiler") == null) { - System.out.println("You can define another decompiler by appending -decompiler \"name\", by default procyon has been set."); - use = Decompiler.PROCYON; - } else if ((use = Decompiler.getByName(parsed.getOptionValue("decompiler"))) == null) { - System.out.println("Decompiler not found. By default Procyon has been set."); - use = Decompiler.PROCYON; - } - - System.out.println("Decompiling " + input.getAbsolutePath() + " with " + use.getName()); - BytecodeViewer.openFiles(new File[]{input}, false); - String containerName = BytecodeViewer.files.get(0).name; - Thread.sleep(5 * 1000); - if (target.equalsIgnoreCase("all")) { - use.decompileToZip(output.getAbsolutePath()); - } else { - try { - ClassNode cn = BytecodeViewer.getClassNode(containerName, target); - byte[] bytes = BytecodeViewer.getClassBytes(containerName, target); - String contents = use.decompileClassNode(cn, bytes); - FileUtils.write(output, contents, "UTF-8", false); - } catch (Exception e) { - new ExceptionUI(e); - } - } - System.out.println("Finished."); - System.out.println("Bytecode Viewer CLI v" + BytecodeViewer.version + " by @Konloch - http://bytecodeviewer.com"); - System.exit(0); - } catch (Exception e) { - new ExceptionUI(e); - } - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/DecompilerSettings.java b/src/main/java/the/bytecode/club/bytecodeviewer/DecompilerSettings.java deleted file mode 100644 index 88ac590b..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/DecompilerSettings.java +++ /dev/null @@ -1,80 +0,0 @@ -package the.bytecode.club.bytecodeviewer; - -import com.eclipsesource.json.JsonObject; -import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; - -import javax.swing.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class DecompilerSettings { - private Decompiler decompiler; - - public DecompilerSettings(Decompiler decompiler) { - this.decompiler = decompiler; - } - - private Map menuItems = new HashMap<>(); - private List registrationOrder = new ArrayList<>(); - - public void registerSetting(Setting setting) { - if (!menuItems.containsKey(setting)) { - registrationOrder.add(setting); - JCheckBoxMenuItem item = new JCheckBoxMenuItem(setting.getText()); - if (setting.isDefaultOn()) { - item.setSelected(true); - } - menuItems.put(setting, item); - } - } - - public boolean isSelected(Setting setting) { - return menuItems.get(setting).isSelected(); - } - - public JCheckBoxMenuItem getMenuItem(Setting setting) { - return menuItems.get(setting); - } - - public int size() { - return registrationOrder.size(); - } - - public void loadFrom(JsonObject rootSettings) { - if (rootSettings.get("decompilers") != null) { - JsonObject decompilerSection = rootSettings.get("decompilers").asObject(); - if (decompilerSection.get(decompiler.getName()) != null) { - JsonObject thisDecompiler = decompilerSection.get(decompiler.getName()).asObject(); - for (Map.Entry entry : menuItems.entrySet()) { - if (thisDecompiler.get(entry.getKey().getParam()) != null) { - entry.getValue().setSelected(thisDecompiler.get(entry.getKey().getParam()).asBoolean()); - } - } - } - } - } - - public void saveTo(JsonObject rootSettings) { - if (rootSettings.get("decompilers") == null) { - rootSettings.add("decompilers", new JsonObject()); - } - JsonObject decompilerSection = rootSettings.get("decompilers").asObject(); - if (decompilerSection.get(decompiler.getName()) == null) { - decompilerSection.add(decompiler.getName(), new JsonObject()); - } - JsonObject thisDecompiler = decompilerSection.get(decompiler.getName()).asObject(); - for (Map.Entry entry : menuItems.entrySet()) { - thisDecompiler.add(entry.getKey().getParam(), entry.getValue().isSelected()); - } - } - - public interface Setting { - String getText(); - - String getParam(); - - boolean isDefaultOn(); - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/InitialBootScreen.java b/src/main/java/the/bytecode/club/bytecodeviewer/InitialBootScreen.java deleted file mode 100644 index 5f56349b..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/InitialBootScreen.java +++ /dev/null @@ -1,94 +0,0 @@ -package the.bytecode.club.bytecodeviewer; - -import javax.swing.*; -import javax.swing.text.html.HTMLEditorKit; -import java.awt.*; -import java.io.IOException; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * @author Konloch - * @author Bibl (don't ban me pls) - * @created 19 Jul 2015 04:12:21 - */ -public class InitialBootScreen extends JFrame { - private static final long serialVersionUID = -1098467609722393444L; - - private JProgressBar progressBar = new JProgressBar(); - - public InitialBootScreen() throws IOException { - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - this.setIconImages(Resources.iconList); - - int i = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight(); - if (i >= 840) - setSize(new Dimension(600, 800)); - else if (i >= 640) - setSize(new Dimension(500, 600)); - else if (i >= 440) - setSize(new Dimension(400, 400)); - else - setSize(Toolkit.getDefaultToolkit().getScreenSize()); - - setTitle("Bytecode Viewer Boot Screen - Starting Up"); - GridBagLayout gridBagLayout = new GridBagLayout(); - gridBagLayout.columnWidths = new int[]{0, 0}; - gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - gridBagLayout.columnWeights = new double[]{1.0, Double.MIN_VALUE}; - gridBagLayout.rowWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; - getContentPane().setLayout(gridBagLayout); - - JScrollPane scrollPane = new JScrollPane(); - GridBagConstraints gbc_scrollPane = new GridBagConstraints(); - gbc_scrollPane.gridheight = 24; - gbc_scrollPane.insets = new Insets(0, 0, 5, 0); - gbc_scrollPane.fill = GridBagConstraints.BOTH; - gbc_scrollPane.gridx = 0; - gbc_scrollPane.gridy = 0; - getContentPane().add(scrollPane, gbc_scrollPane); - - JEditorPane editorPane = new JEditorPane(); - editorPane.setEditorKit(new HTMLEditorKit()); - - editorPane.setText(convertStreamToString(InitialBootScreen.class.getResourceAsStream("/intro.html"))); - - scrollPane.setViewportView(editorPane); - - GridBagConstraints gbc_progressBar = new GridBagConstraints(); - gbc_progressBar.fill = GridBagConstraints.HORIZONTAL; - gbc_progressBar.gridx = 0; - gbc_progressBar.gridy = 24; - getContentPane().add(progressBar, gbc_progressBar); - this.setLocationRelativeTo(null); - } - - static String convertStreamToString(java.io.InputStream is) throws IOException { - @SuppressWarnings("resource") - java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); - String string = s.hasNext() ? s.next() : ""; - is.close(); - s.close(); - return string; - } - - public JProgressBar getProgressBar() { - return progressBar; - } -} \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/Settings.java b/src/main/java/the/bytecode/club/bytecodeviewer/Settings.java deleted file mode 100644 index 9fca8b68..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/Settings.java +++ /dev/null @@ -1,112 +0,0 @@ -package the.bytecode.club.bytecodeviewer; - -import com.eclipsesource.json.JsonObject; -import com.eclipsesource.json.ParseException; -import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; - -import java.io.FileOutputStream; -import java.io.FileReader; -import java.util.HashMap; -import java.util.Map; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * Used to handle loading/saving the GUI (options). - * - * @author Konloch - */ -public class Settings { - private static final Map ALL_SETTINGS = new HashMap<>(); - - public static final Settings PYTHON2_LOCATION = new Settings<>("python2location"); - public static final Settings PYTHON3_LOCATION = new Settings<>("python3location"); - public static final Settings JAVAC_LOCATION = new Settings<>("javaclocation"); - public static final Settings JAVA_LOCATION = new Settings<>("javalocation"); - public static final Settings RT_LOCATION = new Settings<>("rtlocation"); - public static final Settings PATH = new Settings<>("path"); - - private String key; - private T value; - - public Settings(String key) { - this.key = key; - ALL_SETTINGS.put(this.key, this); - } - - public T get() { - return this.value; - } - - public void set(T value) { - this.value = value; - } - - public boolean isEmpty() { - return this.value == null || (this.value instanceof String && ((String) this.value).isEmpty()); - } - - public static void saveGUI() { - try { - JsonObject settings = new JsonObject(); - Decompiler.CFR.getSettings().saveTo(settings); - Decompiler.FERNFLOWER.getSettings().saveTo(settings); - Decompiler.PROCYON.getSettings().saveTo(settings); - Decompiler.BYTECODE.getSettings().saveTo(settings); - if (settings.get("settings") == null) { - settings.add("settings", new JsonObject()); - } - JsonObject rootSettings = settings.get("settings").asObject(); - for (Map.Entry setting : Settings.ALL_SETTINGS.entrySet()) { - if (setting.getValue().get() != null) { - rootSettings.add(setting.getKey(), setting.getValue().get().toString()); - } - } - FileOutputStream out = new FileOutputStream(BytecodeViewer.settingsFile); - out.write(settings.toString().getBytes("UTF-8")); - out.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void loadGUI() { - try { - JsonObject settings = new JsonObject(); - try { - settings = JsonObject.readFrom(new FileReader(BytecodeViewer.settingsFile)); - } catch (ParseException | UnsupportedOperationException e) { - } - Decompiler.CFR.getSettings().loadFrom(settings); - Decompiler.FERNFLOWER.getSettings().loadFrom(settings); - Decompiler.PROCYON.getSettings().loadFrom(settings); - Decompiler.BYTECODE.getSettings().loadFrom(settings); - if (settings.get("settings") != null) { - JsonObject rootSettings = settings.get("settings").asObject(); - for (Map.Entry setting : Settings.ALL_SETTINGS.entrySet()) { - if (rootSettings.get(setting.getKey()) != null) { - setting.getValue().set(rootSettings.get(setting.getKey()).asString()); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/BytecodeViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/api/BytecodeViewer.java deleted file mode 100644 index 48c123a8..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/BytecodeViewer.java +++ /dev/null @@ -1,277 +0,0 @@ -package the.bytecode.club.bytecodeviewer.api; - -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.JarUtils; -import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; -import the.bytecode.club.bytecodeviewer.plugin.preinstalled.EZInjection; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.List; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * The official API for BCV, this was designed for plugin authors and - * people utilizing EZ-Injection. - * - * @author Konloch - * - */ - -public class BytecodeViewer { - - private static URLClassLoader cl; - - private BytecodeViewer() { - } - - /** - * Grab the loader instance - * - * @return - */ - public static ClassNodeLoader getClassNodeLoader() { - return the.bytecode.club.bytecodeviewer.BytecodeViewer.loader; - } - - /** - * Returns the URLClassLoader instance - * @return the URLClassLoader instance - */ - public static URLClassLoader getClassLoaderInstance() { - return cl; - } - - - /** - * Re-instances the URLClassLoader and loads a jar to it. - * - * @param nodeList - * The list of ClassNodes to be loaded - * @return The loaded classes into the new URLClassLoader instance - * @author Cafebabe - * @throws IOException - * @throws ClassNotFoundException - */ - @SuppressWarnings("deprecation") - public static List> loadClassesIntoClassLoader(ArrayList nodeList) throws IOException, ClassNotFoundException { - File f = new File(the.bytecode.club.bytecodeviewer.BytecodeViewer.tempDir, "loaded_temp.jar"); - JarUtils.saveAsJarClassesOnly(nodeList, f.getAbsolutePath()); - - JarFile jarFile = new JarFile("" + f.getAbsolutePath()); - Enumeration e = jarFile.entries(); - cl = URLClassLoader.newInstance(new URL[]{f.toURL()}); - List> ret = new ArrayList>(); - - while (e.hasMoreElements()) { - JarEntry je = (JarEntry) e.nextElement(); - if (je.isDirectory() || !je.getName().endsWith(".class")) continue; - String className = je.getName().replace("/", ".").replace(".class", ""); - className = className.replace('/', '.'); - ret.add(cl.loadClass(className)); - - } - jarFile.close(); - - return ret; - - } - - - /** - * Re-instances the URLClassLoader and loads a jar to it. - * @return The loaded classes into the new URLClassLoader instance - * @author Cafebabe - * @throws IOException - * @throws ClassNotFoundException - */ - public static List> loadAllClassesIntoClassLoader() throws ClassNotFoundException, IOException { - return loadClassesIntoClassLoader(getLoadedClasses()); - } - - /** - * Creates a new instance of the ClassNode loader. - */ - public static void createNewClassNodeLoaderInstance() { - the.bytecode.club.bytecodeviewer.BytecodeViewer.loader.clear(); - the.bytecode.club.bytecodeviewer.BytecodeViewer.loader = new ClassNodeLoader(); - } - - /** - * Used to start a plugin from file. - * - * @param plugin - * the file of the plugin - */ - public static void startPlugin(File plugin) { - the.bytecode.club.bytecodeviewer.BytecodeViewer.startPlugin(plugin); - } - - /** - * Used to load classes/jars into BCV. - * - * @param files - * an array of the files you want loaded. - * @param recentFiles - * if it should save to the recent files menu. - */ - public static void openFiles(File[] files, boolean recentFiles) { - the.bytecode.club.bytecodeviewer.BytecodeViewer.openFiles(files, recentFiles); - } - - /** - * Returns the currently opened class node, if nothing is opened it'll return null. - * @return The opened class node or a null if nothing is opened - */ - public static ClassNode getCurrentlyOpenedClassNode() { - return the.bytecode.club.bytecodeviewer.BytecodeViewer.getCurrentlyOpenedClassNode(); - } - - /** - * Used to load a ClassNode. - * - * @param name - * the full name of the ClassNode - * @return the ClassNode - */ - public static ClassNode getClassNode(String containerName, String name) { - return the.bytecode.club.bytecodeviewer.BytecodeViewer.getClassNode(containerName, name); - } - - /** - * Used to grab the loaded ClassNodes. - * - * @return the loaded classes - */ - public static ArrayList getLoadedClasses() { - return the.bytecode.club.bytecodeviewer.BytecodeViewer.getLoadedClasses(); - } - - /** - * Used to insert a Bytecode Hook using EZ-Injection. - * - * @param hook - */ - public static void insertHook(BytecodeHook hook) { - EZInjection.hookArray.add(hook); - } - - /** - * This will ask the user if they really want to reset the workspace, then - * it'll reset the work space. - * - * @param ask - * if it should ask the user about resetting the workspace - */ - public static void resetWorkSpace(boolean ask) { - the.bytecode.club.bytecodeviewer.BytecodeViewer.resetWorkSpace(ask); - } - - /** - * If true, it will display the busy icon, if false it will remove it if - * it's displayed. - * - * @param busy - * if it should display the busy icon or not - */ - public static void setBusy(boolean busy) { - the.bytecode.club.bytecodeviewer.BytecodeViewer.viewer.setIcon(busy); - } - - /** - * Sends a small window popup with the defined message. - * - * @param message - * the message you want to display - */ - public static void showMessage(String message) { - the.bytecode.club.bytecodeviewer.BytecodeViewer.showMessage(message); - } - - /** - * Returns the wrapped Krakatau Decompiler instance. - * @return The wrapped Krakatau Decompiler instance - */ - public static Decompiler getKrakatauDecompiler() { - return Decompiler.KRAKATAU; - } - - /** - * Returns the wrapped Procyon Decompiler instance. - * @return The wrapped Procyon Decompiler instance - */ - public static Decompiler getProcyonDecompiler() { - return Decompiler.PROCYON; - } - - /** - * Returns the wrapped CFR Decompiler instance. - * @return The wrapped CFR Decompiler instance - */ - public static Decompiler getCFRDecompiler() { - return Decompiler.CFR; - } - - /** - * Returns the wrapped FernFlower Decompiler instance. - * @return The wrapped FernFlower Decompiler instance - */ - public static Decompiler getFernFlowerDecompiler() { - return Decompiler.FERNFLOWER; - } - - /** - * Returns the wrapped Krakatau Disassembler instance. - * @return The wrapped Krakatau Disassembler instance - */ - public static Decompiler getKrakatauDisassembler() { - return Decompiler.KRAKATAU_DA; - } - - /** - * Returns the wrapped Krakatau Assembler instance. - * @return The wrapped Krakatau Assembler instance - */ - public static the.bytecode.club.bytecodeviewer.compilers.Compiler getKrakatauCompiler() { - return the.bytecode.club.bytecodeviewer.compilers.Compiler.krakatau; - } - - /** - * Returns the wrapped Smali Assembler instance. - * @return The wrapped Smali Assembler instance - */ - public static the.bytecode.club.bytecodeviewer.compilers.Compiler getSmaliCompiler() { - return the.bytecode.club.bytecodeviewer.compilers.Compiler.smali; - } - - /** - * Returns the wrapped JD-GUI Decompiler instance. - * @return The wrapped JD-GUI Decompiler instance - */ - public static the.bytecode.club.bytecodeviewer.decompilers.Decompiler getDJGUIDecompiler() { - return the.bytecode.club.bytecodeviewer.decompilers.Decompiler.JDGUI; - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/CFRDecompiler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/CFRDecompiler.java deleted file mode 100644 index 04709ec0..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/CFRDecompiler.java +++ /dev/null @@ -1,286 +0,0 @@ -package the.bytecode.club.bytecodeviewer.decompilers; - -import org.apache.commons.io.FileUtils; -import org.benf.cfr.reader.bytecode.analysis.types.JavaTypeInstance; -import org.benf.cfr.reader.entities.ClassFile; -import org.benf.cfr.reader.entities.Method; -import org.benf.cfr.reader.relationship.MemberNameResolver; -import org.benf.cfr.reader.state.ClassFileSourceImpl; -import org.benf.cfr.reader.state.DCCommonState; -import org.benf.cfr.reader.state.TypeUsageCollector; -import org.benf.cfr.reader.util.CannotLoadClassException; -import org.benf.cfr.reader.util.Functional; -import org.benf.cfr.reader.util.ListFactory; -import org.benf.cfr.reader.util.Predicate; -import org.benf.cfr.reader.util.bytestream.BaseByteData; -import org.benf.cfr.reader.util.getopt.GetOptParser; -import org.benf.cfr.reader.util.getopt.Options; -import org.benf.cfr.reader.util.getopt.OptionsImpl; -import org.benf.cfr.reader.util.output.*; -import org.objectweb.asm.tree.ClassNode; -import org.zeroturnaround.zip.ZipUtil; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.DecompilerSettings; -import the.bytecode.club.bytecodeviewer.JarUtils; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.List; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * CFR Java Wrapper - * - * @author Konloch - */ -public class CFRDecompiler extends Decompiler { - - public CFRDecompiler() { - for (Settings setting : Settings.values()) { - settings.registerSetting(setting); - } - } - - @Override - public DecompilerSettings getSettings() { - return settings; - } - - @Override - public String getName() { - return "CFR"; - } - - @Override - public String decompileClassNode(ClassNode cn, byte[] b) { - try { - Options options = new GetOptParser().parse(generateMainMethod(), OptionsImpl.getFactory()); - ClassFileSourceImpl classFileSource = new ClassFileSourceImpl(options); - DCCommonState dcCommonState = new DCCommonState(options, classFileSource); - return doClass(dcCommonState, b); - } catch (Exception e) { - return parseException(e); - } - } - - @Override - public void decompileToZip(String zipName) { - try { - Path outputDir = Files.createTempDirectory("cfr_output"); - Path tempJar = Files.createTempFile("cfr_input", ".jar"); - File output = new File(zipName); - try { - JarUtils.saveAsJar(BytecodeViewer.getLoadedBytes(), tempJar.toAbsolutePath().toString()); - Options options = new GetOptParser().parse(generateMainMethod(), OptionsImpl.getFactory()); - ClassFileSourceImpl classFileSource = new ClassFileSourceImpl(options); - DCCommonState dcCommonState = new DCCommonState(options, classFileSource); - doJar(dcCommonState, tempJar.toAbsolutePath(), outputDir.toAbsolutePath()); - ZipUtil.pack(outputDir.toFile(), output); - } catch (Exception e) { - handleException(e); - } finally { - try { - FileUtils.deleteDirectory(outputDir.toFile()); - } catch (IOException e) { - handleException(e); - } - try { - Files.delete(tempJar); - } catch (IOException e) { - handleException(e); - } - } - } catch (Exception e) { - handleException(e); - } - } - - public String[] generateMainMethod() { - String[] result = new String[getSettings().size() * 2 + 1]; - result[0] = "bytecodeviewer"; - int index = 1; - for (Settings setting : Settings.values()) { - result[index++] = "--" + setting.getParam(); - result[index++] = String.valueOf(getSettings().isSelected(setting)); - } - return result; - } - - public static String doClass(DCCommonState dcCommonState, byte[] content1) throws Exception { - Options options = dcCommonState.getOptions(); - Dumper d = new ToStringDumper(); - BaseByteData data = new BaseByteData(content1); - ClassFile var24 = new ClassFile(data, "", dcCommonState); - dcCommonState.configureWith(var24); - - try { - var24 = dcCommonState.getClassFile(var24.getClassType()); - } catch (CannotLoadClassException var18) { - } - - if (options.getOption(OptionsImpl.DECOMPILE_INNER_CLASSES)) { - var24.loadInnerClasses(dcCommonState); - } - - if (options.getOption(OptionsImpl.RENAME_MEMBERS)) { - MemberNameResolver.resolveNames(dcCommonState, ListFactory.newList(dcCommonState.getClassCache().getLoadedTypes())); - } - - var24.analyseTop(dcCommonState); - TypeUsageCollector var25 = new TypeUsageCollector(var24); - var24.collectTypeUsages(var25); - String var26 = options.getOption(OptionsImpl.METHODNAME); - if (var26 == null) { - var24.dump(d); - } else { - try { - for (Method method : var24.getMethodByName(var26)) { - method.dump(d, true); - } - } catch (NoSuchMethodException var19) { - throw new IllegalArgumentException("No such method \'" + var26 + "\'."); - } - } - d.print(""); - return d.toString(); - } - - public static void doJar(DCCommonState dcCommonState, Path input, Path output) throws Exception { - SummaryDumper summaryDumper = new NopSummaryDumper(); - Dumper d = new ToStringDumper(); - Options options = dcCommonState.getOptions(); - IllegalIdentifierDump illegalIdentifierDump = IllegalIdentifierDump.Factory.get(options); - - final Predicate e = org.benf.cfr.reader.util.MiscUtils.mkRegexFilter(options.getOption(OptionsImpl.JAR_FILTER), true); - - List err1 = dcCommonState.explicitlyLoadJar(input.toAbsolutePath().toString()); - err1 = Functional.filter(err1, new Predicate() { - public boolean test(JavaTypeInstance in) { - return e.test(in.getRawName()); - } - }); - if (options.getOption(OptionsImpl.RENAME_MEMBERS)) { - MemberNameResolver.resolveNames(dcCommonState, err1); - } - - for (JavaTypeInstance type : err1) { - try { - ClassFile e1 = dcCommonState.getClassFile(type); - if (e1.isInnerClass()) { - d = null; - } else { - if (options.getOption(OptionsImpl.DECOMPILE_INNER_CLASSES).booleanValue()) { - e1.loadInnerClasses(dcCommonState); - } - - e1.analyseTop(dcCommonState); - TypeUsageCollector collectingDumper = new TypeUsageCollector(e1); - e1.collectTypeUsages(collectingDumper); - d = new FileDumper(output.toAbsolutePath().toString(), true, e1.getClassType(), summaryDumper, collectingDumper.getTypeUsageInformation(), options, illegalIdentifierDump); - e1.dump(d); - d.print("\n"); - d.print("\n"); - } - } catch (Dumper.CannotCreate var25) { - throw var25; - } catch (RuntimeException var26) { - d.print(var26.toString()).print("\n").print("\n").print("\n"); - } finally { - if (d != null) { - d.close(); - } - } - } - } - - public enum Settings implements DecompilerSettings.Setting { - DECODE_ENUM_SWITCH("decodeenumswitch", "Decode Enum Switch", true), - SUGAR_ENUMS("sugarenums", "SugarEnums", true), - DECODE_STRING_SWITCH("decodestringswitch", "Decode String Switch", true), - ARRAYITER("arrayiter", "Arrayiter", true), - COLLECTIONITER("collectioniter", "Collectioniter", true), - INNER_CLASSES("innerclasses", "Inner Classes", true), - REMOVE_BOILER_PLATE("removeboilerplate", "Remove Boiler Plate", true), - REMOVE_INNER_CLASS_SYNTHETICS("removeinnerclasssynthetics", "Remove Inner Class Synthetics", true), - DECODE_LAMBDAS("decodelambdas", "Decode Lambdas", true), - HIDE_BRIDGE_METHODS("hidebridgemethods", "Hide Bridge Methods", true), - LIFT_CONSTRUCTOR_INIT("liftconstructorinit", "Lift Constructor Init", true), - REMOVE_DEAD_METHODS("removedeadmethods", "Remove Dead Methods", true), - REMOVE_BAD_GENERICS("removebadgenerics", "Remove Bad Generics", true), - SUGAR_ASSERTS("sugarasserts", "Sugar Asserts", true), - SUGAR_BOXING("sugarboxing", "Sugar Boxing", true), - SHOW_VERSION("showversion", "Show Version", true), - DECODE_FINALLY("decodefinally", "Decode Finally", true), - TIDY_MONITORS("tidymonitors", "Tidy Monitors", true), - LENIENT("lenient", "Lenient"), - DUMP_CLASS_PATH("dumpclasspath", "Dump Classpath"), - COMMENTS("comments", "Comments", true), - FORCE_TOP_SORT("forcetopsort", "Force Top Sort", true), - FORCE_TOP_SORT_AGGRESSIVE("forcetopsortaggress", "Force Top Sort Aggressive", true), - STRINGBUFFER("stringbuffer", "StringBuffer"), - STRINGBUILDER("stringbuilder", "StringBuilder", true), - SILENT("silent", "Silent", true), - RECOVER("recover", "Recover", true), - ECLIPSE("eclipse", "Eclipse", true), - OVERRIDE("override", "Override", true), - SHOW_INFERRABLE("showinferrable", "Show Inferrable", true), - FORCE_AGGRESSIVE_EXCEPTION_AGG("aexagg", "Force Aggressive Exception Aggregation", true), - FORCE_COND_PROPAGATE("forcecondpropagate", "Force Conditional Propogation", true), - HIDE_UTF("hideutf", "Hide UTF", true), - HIDE_LONG_STRINGS("hidelongstrings", "Hide Long Strings"), - COMMENT_MONITORS("commentmonitors", "Comment Monitors"), - ALLOW_CORRECTING("allowcorrecting", "Allow Correcting", true), - LABELLED_BLOCKS("labelledblocks", "Labelled Blocks", true), - J14_CLASS_OBJ("j14classobj", "Java 1.4 Class Objects"), - HIDE_LANG_IMPORTS("hidelangimports", "Hide Lang Imports", true), - RECOVER_TYPE_CLASH("recovertypeclash", "Recover Type Clash", true), - RECOVER_TYPE_HINTS("recovertypehints", "Recover Type Hints", true), - FORCE_RETURNING_IFS("forcereturningifs", "Force Returning Ifs", true), - FOR_LOOP_AGG_CAPTURE("forloopaggcapture", "For Loop Aggressive Capture", true); - - private String name; - private String param; - private boolean on; - - Settings(String param, String name) { - this(param, name, false); - } - - Settings(String param, String name, boolean on) { - this.name = name; - this.param = param; - this.on = on; - } - - public String getText() { - return name; - } - - public boolean isDefaultOn() { - return on; - } - - public String getParam() { - return param; - } - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/Decompiler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/Decompiler.java deleted file mode 100644 index a2030290..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/Decompiler.java +++ /dev/null @@ -1,128 +0,0 @@ -package the.bytecode.club.bytecodeviewer.decompilers; - -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.DecompilerSettings; -import the.bytecode.club.bytecodeviewer.api.ExceptionUI; -import the.bytecode.club.bytecodeviewer.decompilers.bytecode.ClassNodeDecompiler; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * Used to represent all of the decompilers/disassemblers BCV contains. - * - * @author Konloch - * - */ - -public abstract class Decompiler { - private static final Map BY_NAME = new HashMap<>(); - - public final static Decompiler BYTECODE = new ClassNodeDecompiler(); - public final static Decompiler FERNFLOWER = new FernFlowerDecompiler(); - public final static Decompiler PROCYON = new ProcyonDecompiler(); - public final static Decompiler CFR = new CFRDecompiler(); - public final static Decompiler KRAKATAU = new KrakatauDecompiler(); - public final static Decompiler JDGUI = new JDGUIDecompiler(); - public final static Decompiler KRAKATAU_DA = new KrakatauDisassembler(); - public final static Decompiler SMALI = new SmaliDisassembler(); - public final static Decompiler HEXCODE = new Decompiler() { - @Override - public String decompileClassNode(ClassNode cn, byte[] b) { - throw new IllegalArgumentException(); - } - - @Override - public void decompileToZip(String zipName) { - throw new IllegalArgumentException(); - } - - @Override - public String getName() { - return "Hexcode"; - } - - @Override - public DecompilerSettings getSettings() { - throw new IllegalArgumentException(); - } - }; - - public Decompiler() { - BY_NAME.put(getName().toLowerCase().replace(' ', '-'), this); - } - - protected DecompilerSettings settings = new DecompilerSettings(this); - - public abstract String decompileClassNode(ClassNode cn, byte[] b); - - public abstract void decompileToZip(String zipName); - - public abstract String getName(); - - public DecompilerSettings getSettings() { - return settings; - } - - protected String parseException(Throwable e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - e.printStackTrace(); - String exception = "Bytecode Viewer Version: " + BytecodeViewer.version + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString(); - return getName() + " encountered a problem! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com" + BytecodeViewer.nl + - BytecodeViewer.nl + - "Suggested Fix: Click refresh class, if it fails again try another decompiler." + BytecodeViewer.nl + - BytecodeViewer.nl + - exception; - } - - protected void handleException(Exception e) { - new ExceptionUI(e); - } - - protected byte[] fixBytes(byte[] in) { - ClassReader reader = new ClassReader(in); - ClassNode node = new ClassNode(); - reader.accept(node, ClassReader.EXPAND_FRAMES); - ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); - node.accept(writer); - return writer.toByteArray(); - } - - public static void ensureInitted() { - // Just to make sure the classes is loaded so all decompilers are loaded - } - - public static Decompiler getByName(String name) { - return BY_NAME.get(name.toLowerCase().replace(' ', '-')); - } - - public static Collection getAllDecompilers() { - return Collections.unmodifiableCollection(BY_NAME.values()); - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.java deleted file mode 100644 index 4d20e861..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.java +++ /dev/null @@ -1,235 +0,0 @@ -package the.bytecode.club.bytecodeviewer.decompilers; - -import org.apache.commons.io.FileUtils; -import org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler; -import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler; -import org.jetbrains.java.decompiler.main.decompiler.PrintStreamLogger; -import org.jetbrains.java.decompiler.main.extern.IBytecodeProvider; -import org.jetbrains.java.decompiler.main.extern.IResultSaver; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.DecompilerSettings; -import the.bytecode.club.bytecodeviewer.JarUtils; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicReference; -import java.util.jar.Manifest; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * A FernFlower wrapper with all the options (except 2) - * - * @author Konloch - * @author WaterWolf - */ - -public class FernFlowerDecompiler extends Decompiler { - - public FernFlowerDecompiler() { - for (Settings setting : Settings.values()) { - settings.registerSetting(setting); - } - } - - @Override - public String getName() { - return "FernFlower"; - } - - @Override - public String decompileClassNode(final ClassNode cn, byte[] b) { - try { - if (cn.version < 49) { - b = fixBytes(b); - } - final byte[] bytesToUse = b; - - Map options = main(generateMainMethod()); - - final AtomicReference result = new AtomicReference(); - result.set(null); - - BaseDecompiler baseDecompiler = new BaseDecompiler(new IBytecodeProvider() { - @Override - public byte[] getBytecode(String s, String s1) throws IOException { - byte[] clone = new byte[bytesToUse.length]; - System.arraycopy(bytesToUse, 0, clone, 0, bytesToUse.length); - return clone; - } - }, new IResultSaver() { - @Override - public void saveFolder(String s) { - - } - - @Override - public void copyFile(String s, String s1, String s2) { - - } - - @Override - public void saveClassFile(String s, String s1, String s2, String s3, int[] ints) { - result.set(s3); - } - - @Override - public void createArchive(String s, String s1, Manifest manifest) { - - } - - @Override - public void saveDirEntry(String s, String s1, String s2) { - - } - - @Override - public void copyEntry(String s, String s1, String s2, String s3) { - - } - - @Override - public void saveClassEntry(String s, String s1, String s2, String s3, String s4) { - } - - @Override - public void closeArchive(String s, String s1) { - - } - }, options, new PrintStreamLogger(System.out)); - - baseDecompiler.addSpace(new File(cn.name + ".class"), true); - baseDecompiler.decompileContext(); - while (true) { - if (result.get() != null) { - break; - } - } - return result.get(); - } catch (Exception e) { - return parseException(e); - } - } - - @Override - public void decompileToZip(String zipName) { - try { - Path outputDir = Files.createTempDirectory("fernflower_output"); - Path tempJar = Files.createTempFile("fernflower_input", ".jar"); - File output = new File(zipName); - JarUtils.saveAsJar(BytecodeViewer.getLoadedBytes(), tempJar.toAbsolutePath().toString()); - ConsoleDecompiler decompiler = new ConsoleDecompiler(outputDir.toFile(), main(generateMainMethod())); - decompiler.addSpace(tempJar.toFile(), true); - decompiler.decompileContext(); - Files.move(outputDir.toFile().listFiles()[0].toPath(), output.toPath()); - Files.delete(tempJar); - FileUtils.deleteDirectory(outputDir.toFile()); - } catch (Exception e) { - handleException(e); - } - } - - public Map main(String[] args) { - HashMap mapOptions = new HashMap(); - boolean isOption = true; - - for (int destination = 0; destination < args.length - 1; ++destination) { - String logger = args[destination]; - if (isOption && logger.length() > 5 && logger.charAt(0) == 45 && logger.charAt(4) == 61) { - String decompiler = logger.substring(5); - if ("true".equalsIgnoreCase(decompiler)) { - decompiler = "1"; - } else if ("false".equalsIgnoreCase(decompiler)) { - decompiler = "0"; - } - - mapOptions.put(logger.substring(1, 4), decompiler); - } else { - isOption = false; - } - } - - return mapOptions; - } - - private String[] generateMainMethod() { - String[] result = new String[getSettings().size()]; - int index = 0; - for (Settings setting : Settings.values()) { - result[index++] = String.format("-%s=%s", setting.getParam(), getSettings().isSelected(setting) ? "1" : "0"); - } - return result; - } - - public enum Settings implements DecompilerSettings.Setting { - HIDE_BRIDGE_METHODS("rbr", "Hide Bridge Methods", true), - HIDE_SYNTHETIC_CLASS_MEMBERS("rsy", "Hide Synthetic Class Members"), - DECOMPILE_INNER_CLASSES("din", "Decompile Inner Classes", true), - COLLAPSE_14_CLASS_REFERENCES("dc4", "Collapse 1.4 Class References", true), - DECOMPILE_ASSERTIONS("das", "Decompile Assertions", true), - HIDE_EMPTY_SUPER_INVOCATION("hes", "Hide Empty Super Invocation", true), - HIDE_EMPTY_DEFAULT_CONSTRUCTOR("hec", "Hide Empty Default Constructor", true), - DECOMPILE_GENERIC_SIGNATURES("dgs", "Decompile Generic Signatures"), - ASSUME_RETURN_NOT_THROWING_EXCEPTIONS("ner", "Assume return not throwing exceptions", true), - DECOMPILE_ENUMS("den", "Decompile enumerations", true), - REMOVE_GETCLASS("rgn", "Remove getClass()", true), - OUTPUT_NUMBERIC_LITERALS("lit", "Output numeric literals 'as-is'"), - ENCODE_UNICODE("asc", "Encode non-ASCII as unicode escapes"), - INT_1_AS_BOOLEAN_TRUE("bto", "Assume int 1 is boolean true", true), - ALLOW_NOT_SET_SYNTHETIC("nns", "Allow not set synthetic attribute", true), - NAMELESS_TYPES_AS_OBJECT("uto", "Consider nameless types as java.lang.Object", true), - RECOVER_VARIABLE_NAMES("udv", "Recover variable names", true), - REMOVE_EMPTY_EXCEPTIONS("rer", "Remove empty exceptions", true), - DEINLINE_FINALLY("fdi", "De-inline finally", true), - RENAME_AMBIGIOUS_MEMBERS("ren", "Rename ambigious members"), - REMOVE_INTELLIJ_NOTNULL("inn", "Remove IntelliJ @NotNull", true), - DECOMPILE_LAMBDA_TO_ANONYMOUS("lac", "Decompile lambdas to anonymous classes"); - - private String name; - private String param; - private boolean on; - - Settings(String param, String name) { - this(param, name, false); - } - - Settings(String param, String name, boolean on) { - this.name = name; - this.param = param; - this.on = on; - } - - public String getText() { - return name; - } - - public boolean isDefaultOn() { - return on; - } - - public String getParam() { - return param; - } - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.java deleted file mode 100644 index 4fa13e51..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.java +++ /dev/null @@ -1,116 +0,0 @@ -package the.bytecode.club.bytecodeviewer.decompilers; - -import jd.cli.preferences.CommonPreferences; -import jd.cli.printer.text.PlainTextPrinter; -import jd.core.loader.Loader; -import jd.core.loader.LoaderException; -import jd.core.process.DecompilerImpl; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; - -import java.io.*; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * JD-Core Decompiler Wrapper - * - * @author Konloch - * @author JD-Core developers - */ - -public class JDGUIDecompiler extends Decompiler { - @Override - public String getName() { - return "JDGUI"; - } - - @Override - public String decompileClassNode(ClassNode cn, byte[] b) { - try { - if (cn.version < 49) { - b = fixBytes(b); - } - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - decompile(b, outputStream); - return outputStream.toString("UTF-8"); - } catch (Exception e) { - return parseException(e); - } - } - - @Override - public void decompileToZip(String zipName) { - File output = new File(zipName); - try (ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(output))) { - - for (Map.Entry entry : BytecodeViewer.getLoadedBytes().entrySet()) { - String name = entry.getKey(); - if (name.endsWith(".class")) { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - try { - decompile(entry.getValue(), out); - zipOutputStream.putNextEntry(new ZipEntry(name.substring(0, name.length() - 6) + ".java")); - zipOutputStream.write(out.toByteArray()); - } catch (Exception e) { - e.printStackTrace(); - zipOutputStream.putNextEntry(new ZipEntry(name)); - zipOutputStream.write(entry.getValue()); - } - } else { - zipOutputStream.putNextEntry(new ZipEntry(name)); - zipOutputStream.write(entry.getValue()); - } - zipOutputStream.closeEntry(); - } - } catch (Exception e) { - handleException(e); - } - } - - private void decompile(final byte[] data, OutputStream to) throws LoaderException, UnsupportedEncodingException { - CommonPreferences preferences = new CommonPreferences() { - @Override - public boolean isShowLineNumbers() { - return true; - } - - @Override - public boolean isMergeEmptyLines() { - return true; - } - }; - Loader customLoader = new Loader() { - @Override - public DataInputStream load(String s) throws LoaderException { - return new DataInputStream(new ByteArrayInputStream(data)); - } - - @Override - public boolean canLoad(String s) { - return true; - } - }; - - new DecompilerImpl().decompile(preferences, customLoader, new PlainTextPrinter(preferences, new PrintStream(to, false, "UTF-8")), "BytecodeViewer.class"); - } -} \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.java deleted file mode 100644 index 123dd760..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.java +++ /dev/null @@ -1,174 +0,0 @@ -package the.bytecode.club.bytecodeviewer.decompilers; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.objectweb.asm.tree.ClassNode; -import org.zeroturnaround.zip.ZipUtil; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.JarUtils; -import the.bytecode.club.bytecodeviewer.MiscUtils; -import the.bytecode.club.bytecodeviewer.Settings; - -import java.io.*; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * Krakatau Java Decompiler Wrapper, requires Python 2.7 - * - * @author Konloch - */ - -public class KrakatauDecompiler extends Decompiler { - @Override - public String getName() { - return "Krakatau"; - } - - public String quick() { - if (Settings.PATH.isEmpty()) return ""; - else return ";" + Settings.PATH.get(); - } - - public String decompileClassNode(ClassNode cn, byte[] b) { - if (Settings.PYTHON2_LOCATION.isEmpty()) { - BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path."); - BytecodeViewer.viewer.pythonC(); - } - if (Settings.RT_LOCATION.isEmpty()) { - BytecodeViewer.showMessage("You need to set your JRE RT Library.\r\n(C:\\Program Files (x86)\\Java\\jre7\\lib\\rt.jar)"); - BytecodeViewer.viewer.rtC(); - } - - if (Settings.PYTHON2_LOCATION.isEmpty()) { - BytecodeViewer.showMessage("You need to set Python!"); - return "Set your paths"; - } - - if (Settings.RT_LOCATION.isEmpty()) { - BytecodeViewer.showMessage("You need to set RT.jar!"); - return "Set your paths"; - } - - String s = "Bytecode Viewer Version: " + BytecodeViewer.version + BytecodeViewer.nl + BytecodeViewer.nl + "Please send this to konloch@gmail.com. " + BytecodeViewer.nl + BytecodeViewer.nl; - - - try { - final Path outputJar = Files.createTempFile("kdeout", ".zip"); - final Path inputJar = Files.createTempFile("kdein", ".jar"); - JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedBytes(), inputJar.toAbsolutePath().toString()); - - BytecodeViewer.sm.stopBlocking(); - ProcessBuilder pb = new ProcessBuilder(Settings.PYTHON2_LOCATION.get(), "-O", //love you storyyeller <3 - BytecodeViewer.krakatauDirectory.getAbsolutePath() + BytecodeViewer.fs + "decompile.py", "-skip", //love you storyyeller <3 - "-nauto", "-path", Settings.RT_LOCATION.get() + ";" + inputJar.toAbsolutePath().toString() + quick(), "-out", outputJar.toAbsolutePath().toString(), cn.name + ".class"); - - Process process = pb.start(); - BytecodeViewer.createdProcesses.add(process); - - //Read out dir output - InputStream is = process.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - BufferedReader br = new BufferedReader(isr); - String log = "Process:" + BytecodeViewer.nl + BytecodeViewer.nl; - String line; - while ((line = br.readLine()) != null) { - log += BytecodeViewer.nl + line; - } - br.close(); - - log += BytecodeViewer.nl + BytecodeViewer.nl + "Error:" + BytecodeViewer.nl + BytecodeViewer.nl; - is = process.getErrorStream(); - isr = new InputStreamReader(is); - br = new BufferedReader(isr); - while ((line = br.readLine()) != null) { - log += BytecodeViewer.nl + line; - } - br.close(); - - int exitValue = process.waitFor(); - log += BytecodeViewer.nl + BytecodeViewer.nl + "Exit Value is " + exitValue; - s = log; - - ZipFile zipFile= new ZipFile(outputJar.toFile()); - Enumeration entries = zipFile.entries(); - byte[] data = null; - while (entries.hasMoreElements()) { - ZipEntry next = entries.nextElement(); - if (next.getName().equals(cn.name + ".java")) { - data = IOUtils.toByteArray(zipFile.getInputStream(next)); - } - } - zipFile.close(); - Files.delete(inputJar); - Files.delete(outputJar); - return new String(data, "UTF-8"); - } catch (Exception e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - e.printStackTrace(); - s += BytecodeViewer.nl + "Bytecode Viewer Version: " + BytecodeViewer.version + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString(); - } finally { - BytecodeViewer.sm.setBlocking(); - } - - return s; - } - - public void decompileToZip(String zipName) { - if (Settings.PYTHON2_LOCATION.isEmpty()) { - BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path."); - BytecodeViewer.viewer.pythonC(); - } - if (Settings.RT_LOCATION.isEmpty()) { - BytecodeViewer.showMessage("You need to set your JRE RT Library.\r\n(C:\\Program Files (x86)\\Java\\jre7\\lib\\rt.jar)"); - BytecodeViewer.viewer.rtC(); - } - - - try { - File tempDir = Files.createTempDirectory("krakatauoutput").toFile(); - File tempJar = new File(tempDir, "temp.jar"); - JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedBytes(), tempJar.getAbsolutePath()); - - BytecodeViewer.sm.stopBlocking(); - ProcessBuilder pb = new ProcessBuilder(Settings.PYTHON2_LOCATION.get(), "-O", //love you storyyeller <3 - BytecodeViewer.krakatauDirectory.getAbsolutePath() + BytecodeViewer.fs + "decompile.py", "-skip", //love you storyyeller <3 - "-nauto", "-path", Settings.RT_LOCATION.get() + ";" + tempJar.getAbsolutePath(), "-out", tempDir.getAbsolutePath(), tempJar.getAbsolutePath()); - - Process process = pb.start(); - BytecodeViewer.createdProcesses.add(process); - MiscUtils.printProcess(process); - process.waitFor(); - - tempJar.delete(); - ZipUtil.pack(tempDir, new File(zipName)); - FileUtils.deleteDirectory(tempDir); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } finally { - BytecodeViewer.sm.setBlocking(); - } - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/ProcyonDecompiler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/ProcyonDecompiler.java deleted file mode 100644 index fceef88d..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/ProcyonDecompiler.java +++ /dev/null @@ -1,270 +0,0 @@ -package the.bytecode.club.bytecodeviewer.decompilers; - -import com.beust.jcommander.JCommander; -import com.strobel.assembler.InputTypeLoader; -import com.strobel.assembler.metadata.*; -import com.strobel.core.StringUtilities; -import com.strobel.decompiler.CommandLineOptions; -import com.strobel.decompiler.DecompilationOptions; -import com.strobel.decompiler.DecompilerSettings; -import com.strobel.decompiler.PlainTextOutput; -import com.strobel.decompiler.languages.Languages; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.JarUtils; - -import java.io.*; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.zip.ZipException; -import java.util.zip.ZipOutputStream; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * Procyon Java Decompiler Wrapper - * - * @author Konloch - * @author DeathMarine - */ - -public class ProcyonDecompiler extends Decompiler { - - public ProcyonDecompiler() { - for (Settings setting : Settings.values()) { - settings.registerSetting(setting); - } - } - - @Override - public String getName() { - return "Procyon"; - } - - public DecompilerSettings getDecompilerSettings() { - CommandLineOptions options = new CommandLineOptions(); - JCommander jCommander = new JCommander(options); - String[] args = new String[Settings.values().length * 2]; - int index = 0; - for (the.bytecode.club.bytecodeviewer.DecompilerSettings.Setting setting : Settings.values()) { - args[index++] = "--" + setting.getParam(); - args[index++] = String.valueOf(getSettings().isSelected(setting)); - } - jCommander.parse(args); - DecompilerSettings settings = new DecompilerSettings(); - settings.setFlattenSwitchBlocks(options.getFlattenSwitchBlocks()); - settings.setForceExplicitImports(!options.getCollapseImports()); - settings.setForceExplicitTypeArguments(options.getForceExplicitTypeArguments()); - settings.setRetainRedundantCasts(options.getRetainRedundantCasts()); - settings.setShowSyntheticMembers(options.getShowSyntheticMembers()); - settings.setExcludeNestedTypes(options.getExcludeNestedTypes()); - settings.setOutputDirectory(options.getOutputDirectory()); - settings.setIncludeLineNumbersInBytecode(options.getIncludeLineNumbers()); - settings.setRetainPointlessSwitches(options.getRetainPointlessSwitches()); - settings.setUnicodeOutputEnabled(options.isUnicodeOutputEnabled()); - settings.setMergeVariables(options.getMergeVariables()); - settings.setShowDebugLineNumbers(options.getShowDebugLineNumbers()); - settings.setSimplifyMemberReferences(options.getSimplifyMemberReferences()); - settings.setDisableForEachTransforms(options.getDisableForEachTransforms()); - settings.setTypeLoader(new InputTypeLoader()); - if (options.isRawBytecode()) { - settings.setLanguage(Languages.bytecode()); - } else if (options.isBytecodeAst()) { - settings.setLanguage(options.isUnoptimized() ? Languages.bytecodeAstUnoptimized() : Languages.bytecodeAst()); - } - return settings; - } - - @Override - public String decompileClassNode(final ClassNode cn, byte[] b) { - try { - if (cn.version < 49) { - b = fixBytes(b); - } - final byte[] bytesToUse = b; - final Map loadedClasses = BytecodeViewer.getLoadedBytes(); - DecompilerSettings settings = getDecompilerSettings(); - MetadataSystem metadataSystem = new MetadataSystem(new ITypeLoader() { - private InputTypeLoader backLoader = new InputTypeLoader(); - - @Override - public boolean tryLoadType(String s, Buffer buffer) { - if (s.equals(cn.name)) { - buffer.putByteArray(bytesToUse, 0, bytesToUse.length); - buffer.position(0); - return true; - } else { - byte[] toUse = loadedClasses.get(s + ".class"); - if (toUse != null) { - buffer.putByteArray(toUse, 0, toUse.length); - buffer.position(0); - return true; - } else { - return backLoader.tryLoadType(s, buffer); - } - } - } - }); - TypeReference type = metadataSystem.lookupType(cn.name); - DecompilationOptions decompilationOptions = new DecompilationOptions(); - decompilationOptions.setSettings(DecompilerSettings.javaDefaults()); - decompilationOptions.setFullDecompilation(true); - TypeDefinition resolvedType = null; - if (type == null || ((resolvedType = type.resolve()) == null)) { - throw new Exception("Unable to resolve type."); - } - StringWriter stringwriter = new StringWriter(); - settings.getLanguage().decompileType(resolvedType, new PlainTextOutput(stringwriter), decompilationOptions); - String decompiledSource = stringwriter.toString(); - return decompiledSource; - } catch (Throwable e) { - return parseException(e); - } - } - - @Override - public void decompileToZip(String zipName) { - File tempZip = new File(BytecodeViewer.tempDir, "temp.jar"); - if (tempZip.exists()) tempZip.delete(); - - JarUtils.saveAsJar(BytecodeViewer.getLoadedBytes(), tempZip.getAbsolutePath()); - - try { - doSaveJarDecompiled(tempZip, new File(zipName)); - } catch (Exception e) { - handleException(e); - } - } - - /** - * @author DeathMarine - */ - private void doSaveJarDecompiled(File inFile, File outFile) throws Exception { - try (JarFile jfile = new JarFile(inFile); - FileOutputStream dest = new FileOutputStream(outFile); - BufferedOutputStream buffDest = new BufferedOutputStream(dest); - ZipOutputStream out = new ZipOutputStream(buffDest);) { - byte data[] = new byte[1024]; - DecompilerSettings settings = getDecompilerSettings(); - MetadataSystem metadataSystem = new MetadataSystem(new JarTypeLoader(jfile)); - - DecompilationOptions decompilationOptions = new DecompilationOptions(); - decompilationOptions.setSettings(settings); - decompilationOptions.setFullDecompilation(true); - - Enumeration ent = jfile.entries(); - Set history = new HashSet(); - while (ent.hasMoreElements()) { - JarEntry entry = ent.nextElement(); - if (entry.getName().endsWith(".class")) { - JarEntry etn = new JarEntry(entry.getName().replace(".class", ".java")); - if (history.add(etn)) { - out.putNextEntry(etn); - try { - String internalName = StringUtilities.removeRight(entry.getName(), ".class"); - TypeReference type = metadataSystem.lookupType(internalName); - TypeDefinition resolvedType = null; - if ((type == null) || ((resolvedType = type.resolve()) == null)) { - throw new Exception("Unable to resolve type."); - } - Writer writer = new OutputStreamWriter(out); - settings.getLanguage().decompileType(resolvedType, new PlainTextOutput(writer), decompilationOptions); - writer.flush(); - } finally { - out.closeEntry(); - } - } - } else { - try { - JarEntry etn = new JarEntry(entry.getName()); - if (history.add(etn)) continue; - history.add(etn); - out.putNextEntry(etn); - try { - InputStream in = jfile.getInputStream(entry); - if (in != null) { - try { - int count; - while ((count = in.read(data, 0, 1024)) != -1) { - out.write(data, 0, count); - } - } finally { - in.close(); - } - } - } finally { - out.closeEntry(); - } - } catch (ZipException ze) { - // some jar-s contain duplicate pom.xml entries: ignore - // it - if (!ze.getMessage().contains("duplicate")) { - throw ze; - } - } - } - } - } - } - - public enum Settings implements the.bytecode.club.bytecodeviewer.DecompilerSettings.Setting { - SHOW_DEBUG_LINE_NUMBERS("debug-line-numbers", "Show Debug Line Numbers"), - SIMPLIFY_MEMBER_REFERENCES("simplify-member-references", "Simplify Member References"), - MERGE_VARIABLES("merge-variables", "Merge Variables"), - UNICODE_OUTPUT("unicode", "Allow Unicode Output"), - RETAIN_POINTLESS_SWITCHES("retain-pointless-switches", "Retain pointless switches"), - INCLUDE_LINE_NUMBERS_IN_BYTECODE("with-line-numbers", "Include line numbers in bytecode"), - RETAIN_REDUNDANT_CASTS("retain-explicit-casts", "Retain redundant casts"), - SHOW_SYNTHETIC_MEMBERS("show-synthetic", "Show synthetic members"), - FORCE_EXPLICIT_TYPE_ARGS("explicit-type-arguments", "Force explicit type arguments"), - FORCE_EXPLICIT_IMPORTS("explicit-imports", "Force explicit imports"), - FLATTEN_SWITCH_BLOCKS("flatten-switch-blocks", "Flatten switch blocks"), - EXCLUDE_NESTED_TYPES("exclude-nested", "Exclude nested types"); - - private String name; - private String param; - private boolean on; - - Settings(String param, String name) { - this(param, name, false); - } - - Settings(String param, String name, boolean on) { - this.name = name; - this.param = param; - this.on = on; - } - - public String getText() { - return name; - } - - public boolean isDefaultOn() { - return on; - } - - public String getParam() { - return param; - } - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/SmaliDisassembler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/SmaliDisassembler.java deleted file mode 100644 index 1230d42f..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/SmaliDisassembler.java +++ /dev/null @@ -1,103 +0,0 @@ -package the.bytecode.club.bytecodeviewer.decompilers; - -import org.apache.commons.io.FileUtils; -import org.objectweb.asm.tree.ClassNode; -import org.zeroturnaround.zip.ZipUtil; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.Dex2Jar; -import the.bytecode.club.bytecodeviewer.MiscUtils; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * Smali Disassembler Wrapper - * - * @author Konloch - * - */ - -public class SmaliDisassembler extends Decompiler { - @Override - public String getName() { - return "Smali"; - } - - public String decompileClassNode(ClassNode cn, byte[] b) { - String fileStart = BytecodeViewer.tempDir.getAbsolutePath()+ BytecodeViewer.fs - + "temp"; - - String start = MiscUtils.getUniqueName(fileStart, ".class"); - - final File tempClass = new File(start + ".class"); - final File tempZip = new File(start + ".jar"); - final File tempDex = new File(start + ".dex"); - final File tempSmali = new File(start + "-smali"); //output directory - - try { - final FileOutputStream fos = new FileOutputStream(tempClass); - - fos.write(b); - - fos.close(); - } catch (final IOException e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - - ZipUtil.packEntry(tempClass, tempZip); - - Dex2Jar.saveAsDex(tempZip, tempDex); - - try { - org.jf.baksmali.main.main(new String[]{"-o", tempSmali.getAbsolutePath(), "-x", tempDex.getAbsolutePath()}); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - - File outputSmali = null; - - boolean found = false; - File current = tempSmali; - while (!found) { - File f = current.listFiles()[0]; - if (f.isDirectory()) - current = f; - else { - outputSmali = f; - found = true; - } - - } - try { - return FileUtils.readFileToString(outputSmali, "UTF-8"); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - - return null; - } - - @Override - public void decompileToZip(String zipName) { - - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java deleted file mode 100644 index a44aae63..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java +++ /dev/null @@ -1,199 +0,0 @@ -package the.bytecode.club.bytecodeviewer.decompilers.bytecode; - -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.FieldNode; -import org.objectweb.asm.tree.InnerClassNode; -import org.objectweb.asm.tree.MethodNode; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.DecompilerSettings; -import the.bytecode.club.bytecodeviewer.FileContainer; -import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; - -import java.util.ArrayList; -import java.util.List; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * - * @author Konloch - * @author Bibl - * - */ - -public class ClassNodeDecompiler extends Decompiler { - - public ClassNodeDecompiler() { - for (Settings setting : Settings.values()) { - settings.registerSetting(setting); - } - } - - @Override - public String getName() { - return "Bytecode"; - } - - public String decompileClassNode(ClassNode cn, byte[] b) { - String containerName = null; - for (FileContainer container : BytecodeViewer.files) { - String name = cn.name + ".class"; - if (container.getData().containsKey(name)) { - if (container.getClassNode(name) == cn) - containerName = container.name; - } - } - System.out.println(containerName); - - return decompile(new PrefixedStringBuilder(), new ArrayList(), containerName, cn).toString(); - } - - protected static PrefixedStringBuilder decompile(PrefixedStringBuilder sb, ArrayList decompiledClasses, String containerName, ClassNode cn) { - ArrayList unableToDecompile = new ArrayList(); - decompiledClasses.add(cn.name); - sb.append(getAccessString(cn.access)); - sb.append(" "); - sb.append(cn.name); - if (cn.superName != null && !cn.superName.equals("java/lang/Object")) { - sb.append(" extends "); - sb.append(cn.superName); - } - - int amountOfInterfaces = cn.interfaces.size(); - if (amountOfInterfaces > 0) { - sb.append(" implements "); - sb.append(cn.interfaces.get(0)); - if (amountOfInterfaces > 1) { - // sb.append(","); - } - for (int i = 1; i < amountOfInterfaces; i++) { - sb.append(", "); - sb.append(cn.interfaces.get(i)); - } - } - sb.append(" {"); - sb.append(BytecodeViewer.nl); - for (FieldNode fn : (List) cn.fields) { - sb.append(BytecodeViewer.nl); - sb.append(" "); - FieldNodeDecompiler.decompile(sb, fn); - } - if (cn.fields.size() > 0) { - sb.append(BytecodeViewer.nl); - } - for (MethodNode mn : (List) cn.methods) { - sb.append(BytecodeViewer.nl); - MethodNodeDecompiler.decompile(sb, mn, cn); - } - - for (Object o : cn.innerClasses) { - InnerClassNode innerClassNode = (InnerClassNode) o; - String innerClassName = innerClassNode.name; - if ((innerClassName != null) && !decompiledClasses.contains(innerClassName)) { - decompiledClasses.add(innerClassName); - ClassNode cn1 = BytecodeViewer.getClassNode(containerName, innerClassName); - if (cn1 != null) { - sb.appendPrefix(" "); - sb.append(BytecodeViewer.nl + BytecodeViewer.nl); - sb = decompile(sb, decompiledClasses, containerName,cn1); - sb.trimPrefix(5); - sb.append(BytecodeViewer.nl); - } else { - unableToDecompile.add(innerClassName); - } - } - } - - if (!unableToDecompile.isEmpty()) { - sb.append("//the following inner classes couldn't be decompiled: "); - for (String s : unableToDecompile) { - sb.append(s); - sb.append(" "); - } - sb.append(BytecodeViewer.nl); - } - - sb.append("}"); - // System.out.println("Wrote end for " + cn.name + - // " with prefix length: " + sb.prefix.length()); - return sb; - } - - public static String getAccessString(int access) { - List tokens = new ArrayList(); - if ((access & Opcodes.ACC_PUBLIC) != 0) tokens.add("public"); - if ((access & Opcodes.ACC_PRIVATE) != 0) tokens.add("private"); - if ((access & Opcodes.ACC_PROTECTED) != 0) tokens.add("protected"); - if ((access & Opcodes.ACC_FINAL) != 0) tokens.add("final"); - if ((access & Opcodes.ACC_SYNTHETIC) != 0) tokens.add("synthetic"); - // if ((access & Opcodes.ACC_SUPER) != 0) - // tokens.add("super"); implied by invokespecial insn - if ((access & Opcodes.ACC_ABSTRACT) != 0) tokens.add("abstract"); - if ((access & Opcodes.ACC_INTERFACE) != 0) tokens.add("interface"); - if ((access & Opcodes.ACC_ENUM) != 0) tokens.add("enum"); - if ((access & Opcodes.ACC_ANNOTATION) != 0) tokens.add("annotation"); - if (!tokens.contains("interface") && !tokens.contains("enum") && !tokens.contains("annotation")) - tokens.add("class"); - if (tokens.size() == 0) return "[Error parsing]"; - - // hackery delimeters - StringBuilder sb = new StringBuilder(tokens.get(0)); - for (int i = 1; i < tokens.size(); i++) { - sb.append(" "); - sb.append(tokens.get(i)); - } - return sb.toString(); - } - - @Override - public void decompileToZip(String zipName) { - } - - public enum Settings implements DecompilerSettings.Setting { - DEBUG_HELPERS("debug-helpers", "Debug Helpers", true), - APPEND_BRACKETS_TO_LABELS("append-brackets-to-labels", "Append Brackets to Labels", true); - - private String name; - private String param; - private boolean on; - - Settings(String param, String name) { - this(param, name, false); - } - - Settings(String param, String name, boolean on) { - this.name = name; - this.param = param; - this.on = on; - } - - public String getText() { - return name; - } - - public boolean isDefaultOn() { - return on; - } - - public String getParam() { - return param; - } - } -} \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.java deleted file mode 100644 index d82dfe77..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.java +++ /dev/null @@ -1,303 +0,0 @@ -package the.bytecode.club.bytecodeviewer.decompilers.bytecode; - -import eu.bibl.banalysis.asm.desc.OpcodeInfo; -import org.apache.commons.lang3.StringEscapeUtils; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.*; -import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.lang.reflect.Modifier; -import java.util.*; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * - * @author Konloch - * @author Bibl - * - */ -public class InstructionPrinter { - - /** The MethodNode to print **/ - protected MethodNode mNode; - private TypeAndName[] args; - - protected int[] pattern; - protected boolean match; - protected InstructionSearcher searcher; - - protected List matchedInsns; - protected Map labels; - - public InstructionPrinter(MethodNode m, TypeAndName[] args) { - this.args = args; - mNode = m; - labels = new HashMap(); - // matchedInsns = new ArrayList(); // ingnored because - // match = false - match = false; - } - - public InstructionPrinter(MethodNode m, InstructionPattern pattern, TypeAndName[] args) { - this.args = args; - mNode = m; - labels = new HashMap(); - searcher = new InstructionSearcher(m.instructions, pattern); - match = searcher.search(); - if (match) { - for (AbstractInsnNode[] ains : searcher.getMatches()) { - for (AbstractInsnNode ain : ains) { - matchedInsns.add(ain); - } - } - } - } - - /** - * Creates the print - * - * @return The print as an ArrayList - */ - public ArrayList createPrint() { - ArrayList info = new ArrayList(); - ListIterator it = mNode.instructions.iterator(); - boolean firstLabel = false; - while (it.hasNext()) { - AbstractInsnNode ain = (AbstractInsnNode) it.next(); - String line = ""; - if (ain instanceof VarInsnNode) { - line = printVarInsnNode((VarInsnNode) ain, it); - } else if (ain instanceof IntInsnNode) { - line = printIntInsnNode((IntInsnNode) ain, it); - } else if (ain instanceof FieldInsnNode) { - line = printFieldInsnNode((FieldInsnNode) ain, it); - } else if (ain instanceof MethodInsnNode) { - line = printMethodInsnNode((MethodInsnNode) ain, it); - } else if (ain instanceof LdcInsnNode) { - line = printLdcInsnNode((LdcInsnNode) ain, it); - } else if (ain instanceof InsnNode) { - line = printInsnNode((InsnNode) ain, it); - } else if (ain instanceof JumpInsnNode) { - line = printJumpInsnNode((JumpInsnNode) ain, it); - } else if (ain instanceof LineNumberNode) { - line = printLineNumberNode((LineNumberNode) ain, it); - } else if (ain instanceof LabelNode) { - if (firstLabel && Decompiler.BYTECODE.getSettings().isSelected(ClassNodeDecompiler.Settings.APPEND_BRACKETS_TO_LABELS)) - info.add("}"); - - line = printLabelnode((LabelNode) ain); - - if (Decompiler.BYTECODE.getSettings().isSelected(ClassNodeDecompiler.Settings.APPEND_BRACKETS_TO_LABELS)) { - if (!firstLabel) firstLabel = true; - line += " {"; - } - } else if (ain instanceof TypeInsnNode) { - line = printTypeInsnNode((TypeInsnNode) ain); - } else if (ain instanceof FrameNode) { - line = ""; - } else if (ain instanceof IincInsnNode) { - line = printIincInsnNode((IincInsnNode) ain); - } else if (ain instanceof TableSwitchInsnNode) { - line = printTableSwitchInsnNode((TableSwitchInsnNode) ain); - } else if (ain instanceof LookupSwitchInsnNode) { - line = printLookupSwitchInsnNode((LookupSwitchInsnNode) ain); - } else if (ain instanceof InvokeDynamicInsnNode) { - line = printInvokeDynamicInsNode((InvokeDynamicInsnNode) ain); - } else { - line += "UNADDED OPCODE: " + nameOpcode(ain.opcode()) + " " + ain.toString(); - } - if (!line.equals("")) { - if (match) if (matchedInsns.contains(ain)) line = " -> " + line; - - info.add(line); - } - } - if (firstLabel && Decompiler.BYTECODE.getSettings().isSelected(ClassNodeDecompiler.Settings.APPEND_BRACKETS_TO_LABELS)) info.add("}"); - return info; - } - - protected String printVarInsnNode(VarInsnNode vin, ListIterator it) { - StringBuilder sb = new StringBuilder(); - sb.append(nameOpcode(vin.opcode())); - sb.append(vin.var); - if (Decompiler.BYTECODE.getSettings().isSelected(ClassNodeDecompiler.Settings.DEBUG_HELPERS)) { - if (vin.var == 0 && !Modifier.isStatic(mNode.access)) { - sb.append(" // reference to self"); - } else { - final int refIndex = vin.var - (Modifier.isStatic(mNode.access) ? 0 : 1); - if (refIndex >= 0 && refIndex < args.length - 1) { - sb.append(" // reference to " + args[refIndex].name); - } - } - } - - return sb.toString(); - } - - protected String printIntInsnNode(IntInsnNode iin, ListIterator it) { - return nameOpcode(iin.opcode()) + " " + iin.operand; - } - - protected String printFieldInsnNode(FieldInsnNode fin, ListIterator it) { - String desc = Type.getType(fin.desc).getClassName(); - if (desc == null || desc.equals("null")) desc = fin.desc; - return nameOpcode(fin.opcode()) + " " + fin.owner + "." + fin.name + ":" + desc; - } - - protected String printMethodInsnNode(MethodInsnNode min, ListIterator it) { - StringBuilder sb = new StringBuilder(); - sb.append(nameOpcode(min.opcode()) + " " + min.owner + " " + min.name + "("); - - String desc = min.desc; - try { - if (Type.getType(min.desc) != null) desc = Type.getType(min.desc).getClassName(); - - if (desc == null || desc.equals("null")) desc = min.desc; - } catch (java.lang.ArrayIndexOutOfBoundsException e) { - - } - - sb.append(desc); - - sb.append(");"); - - return sb.toString(); - } - - protected String printLdcInsnNode(LdcInsnNode ldc, ListIterator it) { - if (ldc.cst instanceof String) - return nameOpcode(ldc.opcode()) + " \"" + StringEscapeUtils.escapeJava(ldc.cst.toString()) + "\" (" + ldc.cst.getClass().getCanonicalName() + ")"; - - return nameOpcode(ldc.opcode()) + " " + StringEscapeUtils.escapeJava(ldc.cst.toString()) + " (" + ldc.cst.getClass().getCanonicalName() + ")"; - } - - protected String printInsnNode(InsnNode in, ListIterator it) { - return nameOpcode(in.opcode()); - } - - protected String printJumpInsnNode(JumpInsnNode jin, ListIterator it) { - String line = nameOpcode(jin.opcode()) + " L" + resolveLabel(jin.label); - return line; - } - - protected String printLineNumberNode(LineNumberNode lin, ListIterator it) { - return ""; - } - - protected String printLabelnode(LabelNode label) { - return "L" + resolveLabel(label); - } - - protected String printTypeInsnNode(TypeInsnNode tin) { - try { - String desc = tin.desc; - try { - if (Type.getType(tin.desc) != null) desc = Type.getType(tin.desc).getClassName(); - - if (desc == null || desc.equals("null")) desc = tin.desc; - } catch (java.lang.ArrayIndexOutOfBoundsException e) { - - } - return nameOpcode(tin.opcode()) + " " + desc; - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - return "//error"; - } - - protected String printIincInsnNode(IincInsnNode iin) { - return nameOpcode(iin.opcode()) + " " + iin.var + " " + iin.incr; - } - - protected String printTableSwitchInsnNode(TableSwitchInsnNode tin) { - String line = nameOpcode(tin.opcode()) + " \n"; - List labels = tin.labels; - int count = 0; - for (int i = tin.min; i < tin.max + 1; i++) { - line += " val: " + i + " -> " + "L" + resolveLabel((LabelNode) labels.get(count++)) + "\n"; - } - line += " default" + " -> L" + resolveLabel(tin.dflt) + ""; - return line; - } - - protected String printLookupSwitchInsnNode(LookupSwitchInsnNode lin) { - String line = nameOpcode(lin.opcode()) + ": \n"; - List keys = lin.keys; - List labels = lin.labels; - - for (int i = 0; i < keys.size(); i++) { - int key = (Integer) keys.get(i); - LabelNode label = (LabelNode) labels.get(i); - line += " val: " + key + " -> " + "L" + resolveLabel(label) + "\n"; - } - line += " default" + " -> L" + resolveLabel(lin.dflt) + ""; - return line; - } - - protected String printInvokeDynamicInsNode(InvokeDynamicInsnNode idin) { - StringBuilder sb = new StringBuilder(); - sb.append(nameOpcode(idin.opcode()) + " " + idin.bsm.getName() + "("); - - String desc = idin.desc; - String partedDesc = idin.desc.substring(2); - try { - if (Type.getType(partedDesc) != null) desc = Type.getType(partedDesc).getClassName(); - - if (desc == null || desc.equals("null")) desc = idin.desc; - } catch (java.lang.ArrayIndexOutOfBoundsException e) { - - } - - sb.append(desc); - - sb.append(");"); - - return sb.toString(); - } - - protected String nameOpcode(int opcode) { - return " " + OpcodeInfo.OPCODES.get(opcode).toLowerCase(); - } - - protected int resolveLabel(LabelNode label) { - if (labels.containsKey(label)) { - return labels.get(label); - } else { - int newLabelIndex = labels.size() + 1; - labels.put(label, newLabelIndex); - return newLabelIndex; - } - } - - public static void saveTo(File file, InstructionPrinter printer) { - try (BufferedWriter bw = new BufferedWriter(new FileWriter(file))) { - for (String s : printer.createPrint()) { - bw.write(s); - bw.newLine(); - } - } catch (IOException e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } -} \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java deleted file mode 100644 index 9b6e29ca..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java +++ /dev/null @@ -1,106 +0,0 @@ -package the.bytecode.club.bytecodeviewer.gui; - -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.Resources; -import the.bytecode.club.bytecodeviewer.Settings; - -import javax.swing.*; -import java.awt.*; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * The about frame. - * - * @author Konloch - */ -public class AboutWindow extends JFrame { - private static final long serialVersionUID = -8230501978224923296L; - private JTextArea textArea = new JTextArea(); - - public AboutWindow() { - this.setIconImages(Resources.iconList); - setSize(Toolkit.getDefaultToolkit().getScreenSize()); - setType(Type.UTILITY); - setTitle("Bytecode Viewer - About - https://bytecodeviewer.com | https://the.bytecode.club"); - getContentPane().setLayout(new CardLayout(0, 0)); - JScrollPane scrollPane = new JScrollPane(); - getContentPane().add(scrollPane, "name_322439757638784"); - textArea.setWrapStyleWord(true); - textArea.setEnabled(false); - textArea.setDisabledTextColor(Color.BLACK); - scrollPane.setViewportView(textArea); - this.setResizable(false); - this.setLocationRelativeTo(null); - } - - @Override - public void setVisible(boolean b) { - super.setVisible(b); - textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int) BytecodeViewer.viewer.fontSpinner.getValue())); - textArea.setText("Bytecode Viewer " + BytecodeViewer.version + " is an open source program developed and maintained by Konloch (konloch@gmail.com) and samczsun 100% free and open sourced licensed under GPL v3 CopyLeft" + BytecodeViewer.nl + - BytecodeViewer.nl + - "Settings:" + BytecodeViewer.nl + - " Preview Copy: " + BytecodeViewer.previewCopy + BytecodeViewer.nl + - " Java: " + Settings.JAVA_LOCATION.get() + BytecodeViewer.nl + - " Javac: " + Settings.JAVAC_LOCATION.get() + BytecodeViewer.nl + - " BCV Dir: " + BytecodeViewer.getBCVDirectory() + BytecodeViewer.nl + - " Python 2.7 (or PyPy): " + Settings.PYTHON2_LOCATION.get() + BytecodeViewer.nl + - " Python 3.X (or PyPy): " + Settings.PYTHON3_LOCATION.get() + BytecodeViewer.nl + - " RT.jar:" + Settings.RT_LOCATION.get() + BytecodeViewer.nl + - " Optional Lib: " + Settings.PATH.get() + BytecodeViewer.nl + - " BCV Krakatau: v" + BytecodeViewer.krakatauVersion + BytecodeViewer.nl + - " Krakatau Dir: " + BytecodeViewer.krakatauDirectory.getAbsolutePath() + BytecodeViewer.nl + - " BCV Enjarify: v" + BytecodeViewer.enjarifyVersion + BytecodeViewer.nl + - " Enjarify Dir: " + BytecodeViewer.enjarifyDirectory.getAbsolutePath()+ BytecodeViewer.nl + BytecodeViewer.nl + - "Command Line Input:" + BytecodeViewer.nl + - " -help Displays the help menu" + BytecodeViewer.nl + - " -list Displays the available decompilers" + BytecodeViewer.nl + - " -decompiler Selects the decompiler, procyon by default" + BytecodeViewer.nl + - " -i Selects the input file (Jar, Class, APK, ZIP, DEX all work automatically)" + BytecodeViewer.nl + - " -o Selects the output file (Java or Java-Bytecode)" + BytecodeViewer.nl + - " -t Must either be the fully qualified classname or \"all\" to decompile all as zip" + BytecodeViewer.nl + - " -nowait Doesn't wait for the user to read the CLI messages" + BytecodeViewer.nl + BytecodeViewer.nl + - "Keybinds:" + BytecodeViewer.nl + - " CTRL + O: Open/add new jar/class/apk" + BytecodeViewer.nl + - " CTLR + N: Reset the workspace" + BytecodeViewer.nl + - " CTRL + W: Closes the currently opened tab" + BytecodeViewer.nl + - " CTRL + T: Compile" + BytecodeViewer.nl + - " CTRL + S: Save classes as zip" + BytecodeViewer.nl + - " CTRL + R: Run (EZ-Inject) - dynamically load the classes and invoke a main class" + BytecodeViewer.nl + - BytecodeViewer.nl + - "Code from various projects has been used, including but not limited to:" + BytecodeViewer.nl + - " J-RET by WaterWolf" + BytecodeViewer.nl + - " JHexPane by Sam Koivu" + BytecodeViewer.nl + - " RSynaxPane by Robert Futrell" + BytecodeViewer.nl + - " Commons IO by Apache" + BytecodeViewer.nl + - " ASM by OW2" + BytecodeViewer.nl + - " FernFlower by Stiver" + BytecodeViewer.nl + - " Procyon by Mstrobel" + BytecodeViewer.nl + - " CFR by Lee Benfield" + BytecodeViewer.nl + - " CFIDE by Bibl" + BytecodeViewer.nl + - " Smali by JesusFreke" + BytecodeViewer.nl + - " Dex2Jar by pxb1..?" + BytecodeViewer.nl + - " Krakatau by Storyyeller" + BytecodeViewer.nl + - " JD-GUI + JD-Core by The Java-Decompiler Team" + BytecodeViewer.nl + - " Enjarify by Storyyeller" + BytecodeViewer.nl + - BytecodeViewer.nl + - "If you're interested in Java Reverse Engineering, join The Bytecode Club - https://the.bytecode.club"); - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/AllatoriStringDecrypterOptions.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/AllatoriStringDecrypterOptions.java deleted file mode 100644 index 03e12ef4..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/AllatoriStringDecrypterOptions.java +++ /dev/null @@ -1,73 +0,0 @@ -package the.bytecode.club.bytecodeviewer.gui; - -import the.bytecode.club.bytecodeviewer.Resources; -import the.bytecode.club.bytecodeviewer.plugin.PluginManager; -import the.bytecode.club.bytecodeviewer.plugin.preinstalled.AllatoriStringDecrypter; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * The UI for replace strings plugin. - * - * @author Konloch - * - */ - -public class AllatoriStringDecrypterOptions extends JFrame { - public AllatoriStringDecrypterOptions() { - this.setIconImages(Resources.iconList); - setSize(new Dimension(250, 120)); - setResizable(false); - setTitle("Allatori decrypter"); - getContentPane().setLayout(null); - - JButton btnNewButton = new JButton("Decrypt"); - btnNewButton.setBounds(6, 56, 232, 23); - getContentPane().add(btnNewButton); - - - JLabel lblNewLabel = new JLabel("Class:"); - lblNewLabel.setBounds(6, 20, 67, 14); - getContentPane().add(lblNewLabel); - - textField = new JTextField(); - textField.setToolTipText("* will search all classes"); - textField.setText("*"); - textField.setBounds(80, 17, 158, 20); - getContentPane().add(textField); - textField.setColumns(10); - - - btnNewButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - PluginManager.runPlugin(new AllatoriStringDecrypter(textField.getText())); - dispose(); - } - }); - this.setLocationRelativeTo(null); - } - - private static final long serialVersionUID = -2662514582647810868L; - private JTextField textField; -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java deleted file mode 100644 index 5dd0f090..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java +++ /dev/null @@ -1,435 +0,0 @@ -package the.bytecode.club.bytecodeviewer.gui; - -import com.jhe.hexed.JHexEditor; -import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; -import org.fife.ui.rtextarea.RTextScrollPane; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.Resources; -import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; - -import javax.swing.*; -import javax.swing.text.DefaultHighlighter; -import javax.swing.text.Highlighter; -import javax.swing.text.JTextComponent; -import java.awt.*; -import java.awt.event.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * This represents the opened classfile. - * - * @author Konloch - * @author WaterWolf - */ - -public class ClassViewer extends Viewer { - private static final long serialVersionUID = -8650495368920680024L; - private List decompileThreads = new ArrayList<>(); - - public void setPanes() { - for (int i = 0; i < BytecodeViewer.viewer.allPanes.size(); i++) { - ButtonGroup group = BytecodeViewer.viewer.allPanes.get(i); - for (Map.Entry entry : BytecodeViewer.viewer.allDecompilers.get(group).entrySet()) { - if (group.isSelected(entry.getKey().getModel())) { - decompilers.set(i, entry.getValue()); - } - } - } - } - - public boolean isPaneEditable(int pane) { - setPanes(); - ButtonGroup buttonGroup = BytecodeViewer.viewer.allPanes.get(pane); - Decompiler selected = decompilers.get(pane); - if (buttonGroup != null && BytecodeViewer.viewer.editButtons.get(buttonGroup) != null && BytecodeViewer.viewer.editButtons.get(buttonGroup).get(selected)!= null && BytecodeViewer.viewer.editButtons.get(buttonGroup).get(selected).isSelected()) { - return true; - } - return false; - } - - public void requestFocus(int pane) { - this.fields.get(pane).requestFocus(); - } - - public void updatePane(int pane, RSyntaxTextArea text, Decompiler decompiler) { - if (decompiler == Decompiler.KRAKATAU_DA) { - krakataus.set(pane, text); - } else if (decompiler == Decompiler.SMALI) { - smalis.set(pane, text); - } else { - javas.set(pane, text); - } - } - - /** - * Whoever wrote this function, THANK YOU! - * - * @param splitter - * @param proportion - * @return - */ - public static JSplitPane setDividerLocation(final JSplitPane splitter, - final double proportion) { - if (splitter.isShowing()) { - if (splitter.getWidth() > 0 && splitter.getHeight() > 0) { - splitter.setDividerLocation(proportion); - } else { - splitter.addComponentListener(new ComponentAdapter() { - @Override - public void componentResized(ComponentEvent ce) { - splitter.removeComponentListener(this); - setDividerLocation(splitter, proportion); - } - }); - } - } else { - splitter.addHierarchyListener(new HierarchyListener() { - @Override - public void hierarchyChanged(HierarchyEvent e) { - if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 - && splitter.isShowing()) { - splitter.removeHierarchyListener(this); - setDividerLocation(splitter, proportion); - } - } - }); - } - return splitter; - } - - JSplitPane sp; - JSplitPane sp2; - public List decompilers = Arrays.asList(null, null, null); - public List panels = Arrays.asList(new JPanel(new BorderLayout()), new JPanel(new BorderLayout()), new JPanel(new BorderLayout())); - public List searches = Arrays.asList(new JPanel(new BorderLayout()), new JPanel(new BorderLayout()), new JPanel(new BorderLayout())); - public List exacts = Arrays.asList(new JCheckBox("Exact"), new JCheckBox("Exact"), new JCheckBox("Exact")); - public List fields = Arrays.asList(new JTextField(), new JTextField(), new JTextField()); - public List javas = Arrays.asList(null, null, null); - public List smalis = Arrays.asList(null, null, null); - public List krakataus = Arrays.asList(null, null, null); - - /** - * This was really interesting to write. - * - * @author Konloch - */ - public void search(int pane, String search, boolean next) { - try { - Component[] com = panels.get(pane).getComponents(); - for (Component c : com) { - if (c instanceof RTextScrollPane) { - RSyntaxTextArea area = (RSyntaxTextArea) ((RTextScrollPane) c) - .getViewport().getComponent(0); - - if (search.isEmpty()) { - highlight(pane, area, ""); - return; - } - - int startLine = area.getDocument().getDefaultRootElement() - .getElementIndex(area.getCaretPosition()) + 1; - int currentLine = 1; - boolean canSearch = false; - String[] test = null; - if (area.getText().split("\n").length >= 2) - test = area.getText().split("\n"); - else - test = area.getText().split("\r"); - int lastGoodLine = -1; - int firstPos = -1; - boolean found = false; - - if (next) { - for (String s : test) { - if (pane == 0 && !exacts.get(0).isSelected() || pane == 1 - && !exacts.get(1).isSelected()) { - s = s.toLowerCase(); - search = search.toLowerCase(); - } - - if (currentLine == startLine) { - canSearch = true; - } else if (s.contains(search)) { - if (canSearch) { - area.setCaretPosition(area.getDocument() - .getDefaultRootElement() - .getElement(currentLine - 1) - .getStartOffset()); - canSearch = false; - found = true; - } - - if (firstPos == -1) - firstPos = currentLine; - } - - currentLine++; - } - - if (!found && firstPos != -1) { - area.setCaretPosition(area.getDocument() - .getDefaultRootElement() - .getElement(firstPos - 1).getStartOffset()); - } - } else { - canSearch = true; - for (String s : test) { - if (pane == 0 && !exacts.get(0).isSelected() || pane == 1 - && !exacts.get(1).isSelected() || pane == 2 - && !exacts.get(2).isSelected()) { - s = s.toLowerCase(); - search = search.toLowerCase(); - } - - if (s.contains(search)) { - if (lastGoodLine != -1 && canSearch) - area.setCaretPosition(area.getDocument() - .getDefaultRootElement() - .getElement(lastGoodLine - 1) - .getStartOffset()); - - lastGoodLine = currentLine; - - if (currentLine >= startLine) - canSearch = false; - } - currentLine++; - } - - if (lastGoodLine != -1 - && area.getDocument() - .getDefaultRootElement() - .getElementIndex( - area.getCaretPosition()) + 1 == startLine) { - area.setCaretPosition(area.getDocument() - .getDefaultRootElement() - .getElement(lastGoodLine - 1) - .getStartOffset()); - } - } - highlight(pane, area, search); - } - } - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - - private DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter( - new Color(255, 62, 150)); - - public void highlight(int pane, JTextComponent textComp, String pattern) { - if (pattern.isEmpty()) { - textComp.getHighlighter().removeAllHighlights(); - return; - } - - try { - Highlighter hilite = textComp.getHighlighter(); - hilite.removeAllHighlights(); - javax.swing.text.Document doc = textComp.getDocument(); - String text = doc.getText(0, doc.getLength()); - int pos = 0; - - if ((pane == 0 && !exacts.get(0).isSelected()) || pane == 1 - && !exacts.get(1).isSelected() || pane == 2 - && !exacts.get(2).isSelected()) { - pattern = pattern.toLowerCase(); - text = text.toLowerCase(); - } - - // Search for pattern - while ((pos = text.indexOf(pattern, pos)) >= 0) { - // Create highlighter using private painter and apply around - // pattern - hilite.addHighlight(pos, pos + pattern.length(), painter); - pos += pattern.length(); - } - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - - public ClassViewer(final String name, final String container, final ClassNode cn) { - for (int i = 0; i < panels.size(); i++) { - final JTextField textField = fields.get(i); - JPanel searchPanel = searches.get(i); - JCheckBox checkBox = exacts.get(i); - JButton byteSearchNext = new JButton(); - JButton byteSearchPrev = new JButton(); - JPanel byteButtonPane = new JPanel(new BorderLayout()); - byteButtonPane.add(byteSearchNext, BorderLayout.WEST); - byteButtonPane.add(byteSearchPrev, BorderLayout.EAST); - byteSearchNext.setIcon(Resources.nextIcon); - byteSearchPrev.setIcon(Resources.prevIcon); - searchPanel.add(byteButtonPane, BorderLayout.WEST); - searchPanel.add(textField, BorderLayout.CENTER); - searchPanel.add(checkBox, BorderLayout.EAST); - byteSearchNext.addActionListener(new ActionListener() { - @Override - public void actionPerformed(final ActionEvent arg0) { - search(0, textField.getText(), true); - } - }); - byteSearchPrev.addActionListener(new ActionListener() { - @Override - public void actionPerformed(final ActionEvent arg0) { - search(0, textField.getText(), false); - } - }); - textField.addKeyListener(new KeyListener() { - @Override - public void keyReleased(KeyEvent arg0) { - if (arg0.getKeyCode() == KeyEvent.VK_ENTER) - search(0, textField.getText(), true); - } - - @Override - public void keyPressed(KeyEvent arg0) { - } - - @Override - public void keyTyped(KeyEvent arg0) { - } - }); - } - - this.name = name; - this.container = container; - this.cn = cn; - updateName(); - this.setLayout(new BorderLayout()); - - this.sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panels.get(0), panels.get(1)); - JHexEditor hex = new JHexEditor(BytecodeViewer.getClassBytes(container, cn.name + ".class")); - this.sp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, panels.get(2)); - this.add(sp2, BorderLayout.CENTER); - - hex.setMaximumSize(new Dimension(0, Integer.MAX_VALUE)); - hex.setSize(0, Integer.MAX_VALUE); - - BytecodeViewer.viewer.setIcon(true); - startPaneUpdater(null); - this.addComponentListener(new ComponentAdapter() { - public void componentResized(ComponentEvent e) { - resetDivider(); - } - }); - } - - public void resetDivider() { - sp.setResizeWeight(0.5); - if (decompilers.get(1) != null && decompilers.get(0) != null) - sp = setDividerLocation(sp, 0.5); - else if (decompilers.get(0) != null) - sp = setDividerLocation(sp, 1); - else if (decompilers.get(1) != null) { - sp.setResizeWeight(1); - sp = setDividerLocation(sp, 0); - } else - sp = setDividerLocation(sp, 0); - if (decompilers.get(2) != null) { - sp2.setResizeWeight(0.7); - sp2 = setDividerLocation(sp2, 0.7); - if ((decompilers.get(1) == null && decompilers.get(0) != null) || (decompilers.get(0) == null && decompilers.get(1) != null)) - sp2 = setDividerLocation(sp2, 0.5); - else if (decompilers.get(0) == null && decompilers.get(1) == null) - sp2 = setDividerLocation(sp2, 0); - } else { - sp.setResizeWeight(1); - sp2.setResizeWeight(0); - sp2 = setDividerLocation(sp2, 1); - } - } - - public void startPaneUpdater(final JButton button) { - this.cn = BytecodeViewer.getClassNode(container, cn.name); //update the classnode - setPanes(); - - for (JPanel jpanel : panels) { - jpanel.removeAll(); - } - for (int i = 0; i < javas.size(); i++) { - javas.set(i, null); - } - for (int i = 0; i < smalis.size(); i++) { - smalis.set(i, null); - } - - if (this.cn == null) { - for (JPanel jpanel : panels) { - jpanel.add(new JLabel("This file has been removed from the reload.")); - } - return; - } - - for (int i = 0; i < decompilers.size(); i++) { - if (decompilers.get(i) != null) { - if (decompilers.get(i) != Decompiler.HEXCODE) { - panels.get(i).add(searches.get(i), BorderLayout.NORTH); - } - PaneUpdaterThread t = new PaneUpdaterThread(this, decompilers.get(i), i, panels.get(i), button); - decompileThreads.add(t); - t.start(); - } - } - } - - public Object[] getSmali() { - for (int i = 0; i < smalis.size(); i++) { - RSyntaxTextArea text = smalis.get(i); - if (text != null) { - return new Object[]{cn, text.getText()}; - } - } - return null; - } - - public Object[] getKrakatau() { - for (int i = 0; i < krakataus.size(); i++) { - RSyntaxTextArea text = krakataus.get(i); - if (text != null) { - return new Object[]{cn, text.getText()}; - } - } - return null; - } - - public Object[] getJava() { - for (int i = 0; i < javas.size(); i++) { - RSyntaxTextArea text = javas.get(i); - if (text != null) { - return new Object[]{cn, text.getText()}; - } - } - return null; - } - - public void reset() { - for (Thread t : decompileThreads) { - t.stop(); - } - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/FileChooser.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/FileChooser.java deleted file mode 100644 index 6ec960fd..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/FileChooser.java +++ /dev/null @@ -1,50 +0,0 @@ -package the.bytecode.club.bytecodeviewer.gui; - -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.Settings; - -import javax.swing.*; -import javax.swing.filechooser.FileFilter; -import java.io.File; - -public class FileChooser { - private Settings target; - private String message; - - public FileChooser(Settings target, String message) { - this.target = target; - this.message = message; - } - - public void run() { - File currentFile = new File(target.get() == null || target.get().isEmpty() ? System.getProperty("user.home") : target.get()); - JFileChooser fc = new JFileChooser(); - fc.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - return true; - } - - @Override - public String getDescription() { - return message; - } - }); - if (currentFile.isDirectory()) { - fc.setCurrentDirectory(currentFile); - } else { - fc.setSelectedFile(currentFile); - } - fc.setFileHidingEnabled(false); - fc.setAcceptAllFileFilterUsed(false); - - int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); - if (returnVal == JFileChooser.APPROVE_OPTION) { - try { - target.set(fc.getSelectedFile().getAbsolutePath()); - } catch (Exception e1) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); - } - } - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.java deleted file mode 100644 index 151d5c89..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.java +++ /dev/null @@ -1,565 +0,0 @@ -package the.bytecode.club.bytecodeviewer.gui; - -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.*; - -import javax.swing.*; -import javax.swing.tree.*; -import java.awt.*; -import java.awt.event.*; -import java.awt.font.FontRenderContext; -import java.awt.geom.Rectangle2D; -import java.io.File; -import java.util.*; -import java.util.Map.Entry; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * The file navigation pane. - * - * @author Konloch - * @author WaterWolf - * @author afffsdd - */ - -@SuppressWarnings("serial") -public class FileNavigationPane extends VisibleComponent implements FileDrop.Listener { - private static final String quickSearchText = "Quick file search (no file extension)"; - - FileChangeNotifier fcn; - JCheckBox exact = new JCheckBox("Exact"); - JButton open = new JButton("+"); - JButton close = new JButton("-"); - - MyTreeNode treeRoot = new MyTreeNode("Loaded Files:"); - MyTree tree = new MyTree(treeRoot); - final JTextField quickSearch = new JTextField(quickSearchText); - public transient KeyAdapter search = new KeyAdapter() { - @Override - public void keyPressed(final KeyEvent ke) { - if (ke.getKeyCode() == KeyEvent.VK_ENTER) { - - final String qt = quickSearch.getText(); - quickSearch.setText(""); - - - String[] path = null; - - if (qt.contains(".")) { - path = qt.split("\\."); - String[] path2 = new String[path.length]; - for (int i = 0; i < path.length; i++) { - path2[i] = path[i]; - if (i + 2 == path.length) { - path2[i + 1] = "." + path[i + 1]; - } - } - } else { - path = new String[]{qt}; - } - - MyTreeNode curNode = treeRoot; - if (exact.isSelected()) { - pathLoop: - for (int i = 0; i < path.length; i++) { - final String pathName = path[i]; - final boolean isLast = i == path.length - 1; - - for (int c = 0; c < curNode.getChildCount(); c++) { - final MyTreeNode child = (MyTreeNode) curNode.getChildAt(c); - System.out.println(pathName + ":" + ((String) child.getUserObject())); - - if (((String) child.getUserObject()).equals(pathName)) { - curNode = child; - if (isLast) { - final TreePath pathn = new TreePath(curNode.getPath()); - tree.setSelectionPath(pathn); - tree.makeVisible(pathn); - tree.scrollPathToVisible(pathn); - openPath(pathn); //auto open - System.out.println("Found! " + curNode); - break pathLoop; - } - continue pathLoop; - } - } - - System.out.println("Could not find " + pathName); - break; - } - } else { - { - @SuppressWarnings("unchecked") - Enumeration enums = curNode.depthFirstEnumeration(); - while (enums != null && enums.hasMoreElements()) { - - MyTreeNode node = enums.nextElement(); - if (node.isLeaf()) { - if (((String) (node.getUserObject())).contains(path[path.length - 1])) { - TreeNode pathArray[] = node.getPath(); - int k = 0; - StringBuffer fullPath = new StringBuffer(); - while (pathArray != null - && k < pathArray.length) { - MyTreeNode n = (MyTreeNode) pathArray[k]; - String s = (String) (n.getUserObject()); - fullPath.append(s); - if (k++ != pathArray.length - 1) { - fullPath.append("."); - } - } - String fullPathString = fullPath.toString(); - if (fullPathString != null && fullPathString.contains(qt)) { - System.out.println("Found! " + node); - final TreePath pathn = new TreePath(node.getPath()); - tree.setSelectionPath(pathn.getParentPath()); - tree.setSelectionPath(pathn); - tree.makeVisible(pathn); - tree.scrollPathToVisible(pathn); - } - } - } - } - } - } - } else if (ke.getKeyCode() == KeyEvent.VK_ESCAPE) { - tree.grabFocus(); - } - } - }; - - public FileNavigationPane(final FileChangeNotifier fcn) { - super("ClassNavigation"); - this.fcn = fcn; - tree.setRootVisible(false); - tree.setShowsRootHandles(true); - quickSearch.setForeground(Color.gray); - setTitle("Files"); - - this.open.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - final TreeNode root = (TreeNode) tree.getModel().getRoot(); - expandAll(tree, new TreePath(root), true); - } - }); - - this.close.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - final TreeNode root = (TreeNode) tree.getModel().getRoot(); - expandAll(tree, new TreePath(root), false); - tree.expandPath(new TreePath(root)); - } - }); - - this.tree.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent e) { - openPath(tree.getPathForLocation(e.getX(), e.getY())); - } - }); - - this.tree.addKeyListener(new KeyListener() { - public void keyTyped(KeyEvent e) { - } - public void keyPressed(KeyEvent e) { - } - @Override - public void keyReleased(KeyEvent arg0) { - if (arg0.getKeyCode() == KeyEvent.VK_ENTER) { - if (arg0.getSource() instanceof MyTree) { - MyTree tree = (MyTree) arg0.getSource(); - openPath(tree.getSelectionPath()); - } - } else if (arg0.getKeyCode() == KeyEvent.VK_F && arg0.isControlDown()) { - quickSearch.grabFocus(); - } - } - }); - - quickSearch.addKeyListener(search); - quickSearch.addFocusListener(new FocusListener() { - @Override - public void focusGained(final FocusEvent arg0) { - if (quickSearch.getText().equals(quickSearchText)) { - quickSearch.setText(null); - quickSearch.setForeground(Color.black); - } - } - - @Override - public void focusLost(final FocusEvent arg0) { - if (quickSearch.getText().isEmpty()) { - quickSearch.setText(quickSearchText); - quickSearch.setForeground(Color.gray); - } - } - }); - - getContentPane().setLayout(new BorderLayout()); - getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER); - - JPanel p2 = new JPanel(); - p2.setLayout(new BorderLayout()); - p2.add(quickSearch, BorderLayout.NORTH); - JPanel p3 = new JPanel(new BorderLayout()); - p3.add(exact, BorderLayout.WEST); - JPanel p4 = new JPanel(new BorderLayout()); - p4.add(open, BorderLayout.EAST); - p4.add(close, BorderLayout.WEST); - p3.add(p4, BorderLayout.EAST); - p2.add(p3, BorderLayout.SOUTH); - - getContentPane().add(p2, BorderLayout.SOUTH); - - this.setVisible(true); - new FileDrop(this, this); - } - - public void openClassFileToWorkSpace(final String name, final String container, final ClassNode node) { - fcn.openClassFile(name, container, node); - } - - public void openFileToWorkSpace(String name, final String container, byte[] contents) { - fcn.openFile(name, container, contents); - } - - @Override - public void filesDropped(final File[] files) { - if (files.length < 1) - return; - BytecodeViewer.openFiles(files, true); - } - - public void updateTree() { - try { - treeRoot.removeAllChildren(); - for (FileContainer container : BytecodeViewer.files) { - MyTreeNode root = new MyTreeNode(container.name); - treeRoot.add(root); - ImageRenderer renderer = new ImageRenderer(); - tree.setCellRenderer(renderer); - - - if (!container.files.isEmpty()) { - for (final Entry entry : container.files.entrySet()) { - String name = entry.getKey(); - final String[] spl = name.split("/"); - if (spl.length < 2) { - root.add(new MyTreeNode(name)); - } else { - MyTreeNode parent = root; - for (final String s : spl) { - MyTreeNode child = null; - for (int i = 0; i < parent.getChildCount(); i++) { - if (((MyTreeNode) parent.getChildAt(i)).getUserObject() - .equals(s)) { - child = (MyTreeNode) parent.getChildAt(i); - break; - } - } - if (child == null) { - child = new MyTreeNode(s); - parent.add(child); - } - parent = child; - } - } - } - } - - } - - treeRoot.sort(); - tree.expandPath(new TreePath(tree.getModel().getRoot())); - tree.updateUI(); - } catch (java.util.ConcurrentModificationException e) { - //ignore, the last file will reset everything - } - // expandAll(tree, true); - } - - @SuppressWarnings("rawtypes") - private void expandAll(final JTree tree, final TreePath parent, - final boolean expand) { - // Traverse children - final TreeNode node = (TreeNode) parent.getLastPathComponent(); - if (node.getChildCount() >= 0) { - for (final Enumeration e = node.children(); e.hasMoreElements(); ) { - final TreeNode n = (TreeNode) e.nextElement(); - final TreePath path = parent.pathByAddingChild(n); - expandAll(tree, path, expand); - } - } - - // Expansion or collapse must be done bottom-up - if (expand) { - tree.expandPath(parent); - } else { - tree.collapsePath(parent); - } - } - - public class MyTree extends JTree { - private static final long serialVersionUID = -2355167326094772096L; - DefaultMutableTreeNode treeRoot; - - public MyTree(final DefaultMutableTreeNode treeRoot) { - super(treeRoot); - this.treeRoot = treeRoot; - } - - StringMetrics m = null; - - @Override - public void paint(final Graphics g) { - try { - super.paint(g); - if (m == null) { - m = new StringMetrics((Graphics2D) g); - } - if (treeRoot.getChildCount() < 1) { - g.setColor(new Color(0, 0, 0, 100)); - g.fillRect(0, 0, getWidth(), getHeight()); - g.setColor(Color.white); - String s = "Drag class/jar/zip/APK/DEX here"; - g.drawString(s, - ((int) ((getWidth() / 2) - (m.getWidth(s) / 2))), - getHeight() / 2); - } - } catch (java.lang.InternalError | java.lang.NullPointerException e) { - - } - } - } - - public class MyTreeNode extends DefaultMutableTreeNode { - - private static final long serialVersionUID = -8817777566176729571L; - - public MyTreeNode(final Object o) { - super(o); - } - - @Override - public void insert(final MutableTreeNode newChild, final int childIndex) { - super.insert(newChild, childIndex); - } - - public void sort() { - recursiveSort(this); - } - - @SuppressWarnings("unchecked") - private void recursiveSort(final MyTreeNode node) { - Collections.sort(node.children, nodeComparator); - final Iterator it = node.children.iterator(); - while (it.hasNext()) { - final MyTreeNode nextNode = it.next(); - if (nextNode.getChildCount() > 0) { - recursiveSort(nextNode); - } - } - } - - protected Comparator nodeComparator = new Comparator() { - @Override - public int compare(final MyTreeNode o1, final MyTreeNode o2) { - // To make sure nodes with children are always on top - final int firstOffset = o1.getChildCount() > 0 ? -1000 : 0; - final int secondOffset = o2.getChildCount() > 0 ? 1000 : 0; - return o1.toString().compareToIgnoreCase(o2.toString()) - + firstOffset + secondOffset; - } - - @Override - public boolean equals(final Object obj) { - return false; - } - - @Override - public int hashCode() { - final int hash = 7; - return hash; - } - }; - } - - /** - * @author http://stackoverflow.com/a/18450804 - */ - class StringMetrics { - - Font font; - FontRenderContext context; - - public StringMetrics(Graphics2D g2) { - - font = g2.getFont(); - context = g2.getFontRenderContext(); - } - - Rectangle2D getBounds(String message) { - - return font.getStringBounds(message, context); - } - - double getWidth(String message) { - - Rectangle2D bounds = getBounds(message); - return bounds.getWidth(); - } - - double getHeight(String message) { - - Rectangle2D bounds = getBounds(message); - return bounds.getHeight(); - } - - } - - public void resetWorkspace() { - treeRoot.removeAllChildren(); - tree.repaint(); - tree.updateUI(); - } - - public void openPath(TreePath path) { - if (path == null) - return; - final StringBuffer nameBuffer = new StringBuffer(); - for (int i = 2; i < path.getPathCount(); i++) { - nameBuffer.append(path.getPathComponent(i)); - if (i < path.getPathCount() - 1) { - nameBuffer.append("/"); - } - } - - String name = nameBuffer.toString(); - String containerName = path.getPathComponent(1).toString(); - if (name.endsWith(".class")) { - final ClassNode cn = BytecodeViewer.getClassNode(containerName, name.substring(0, name.length() - ".class".length())); - if (cn != null) { - openClassFileToWorkSpace(nameBuffer.toString(), containerName, cn); - } - } else { - openFileToWorkSpace(nameBuffer.toString(), containerName, BytecodeViewer.getFileContents(nameBuffer.toString())); - } - } - - /** - * @author http://stackoverflow.com/questions/14968005 - * @author Konloch - */ - public class ImageRenderer extends DefaultTreeCellRenderer { - - public Component getTreeCellRendererComponent( - JTree tree, - Object value, - boolean sel, - boolean expanded, - boolean leaf, - int row, - boolean hasFocus) { //called every time there is a pane update, I.E. whenever you expand a folder - - Component ret = super.getTreeCellRendererComponent(tree, value, - selected, expanded, leaf, row, hasFocus); - - if (value != null && value instanceof the.bytecode.club.bytecodeviewer.gui.FileNavigationPane.MyTreeNode) { - the.bytecode.club.bytecodeviewer.gui.FileNavigationPane.MyTreeNode node = (the.bytecode.club.bytecodeviewer.gui.FileNavigationPane.MyTreeNode) value; - String name = node.toString(); - - if (name.endsWith(".jar")) { - setIcon(Resources.jarIcon); - } else if (name.endsWith(".zip")) { - setIcon(Resources.zipIcon); - } else if (name.endsWith(".bat")) { - setIcon(Resources.batIcon); - } else if (name.endsWith(".sh")) { - setIcon(Resources.shIcon); - } else if (name.endsWith(".cs")) { - setIcon(Resources.csharpIcon); - } else if (name.endsWith(".c") || name.endsWith(".cpp") || name.endsWith(".h")) { - setIcon(Resources.cplusplusIcon); - } else if (name.endsWith(".apk") || name.endsWith(".dex")) { - setIcon(Resources.androidIcon); - } else if (name.endsWith(".png") || name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(".bmp") || name.endsWith(".gif")) { - setIcon(Resources.imageIcon); - } else if (name.endsWith(".class")) { - setIcon(Resources.classIcon); - } else if (name.endsWith(".java")) { - setIcon(Resources.javaIcon); - } else if (name.endsWith(".txt") || name.endsWith(".md")) { - setIcon(Resources.textIcon); - } else if (name.equals("decoded resources")) { - setIcon(Resources.decodedIcon); - } else if (name.endsWith(".properties") || name.endsWith(".xml") || name.endsWith(".mf") || name.endsWith(".config") || name.endsWith(".cfg")) { - setIcon(Resources.configIcon); - } else if (node.getChildCount() <= 0) { //random file - setIcon(Resources.fileIcon); - } else { //folder - ArrayList nodes = new ArrayList(); - ArrayList totalNodes = new ArrayList(); - - nodes.add(node); - totalNodes.add(node); - - boolean isJava = false; - boolean finished = false; - - while (!finished) { //may cause a clusterfuck with huge files - if (nodes.isEmpty()) - finished = true; - else { - TreeNode treeNode = nodes.get(0); - nodes.remove(treeNode); - int children = treeNode.getChildCount(); - if (children >= 1) - for (int i = 0; i < children; i++) { - TreeNode child = treeNode.getChildAt(i); - - if (!totalNodes.contains(child)) { - nodes.add(child); - totalNodes.add(child); - } - - if (child.toString().endsWith(".class")) - isJava = true; - } - - if (isJava) - nodes.clear(); - } - } - - if (isJava) - setIcon(Resources.packagesIcon); - else { - setIcon(Resources.folderIcon); - } - } - } - - return ret; - } - } - -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java deleted file mode 100644 index e25c0a3b..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java +++ /dev/null @@ -1,1297 +0,0 @@ -package the.bytecode.club.bytecodeviewer.gui; - -import org.apache.commons.io.FileUtils; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.*; -import the.bytecode.club.bytecodeviewer.decompilers.CFRDecompiler; -import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; -import the.bytecode.club.bytecodeviewer.decompilers.FernFlowerDecompiler; -import the.bytecode.club.bytecodeviewer.decompilers.ProcyonDecompiler; -import the.bytecode.club.bytecodeviewer.decompilers.bytecode.ClassNodeDecompiler; -import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameClasses; -import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameFields; -import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameMethods; -import the.bytecode.club.bytecodeviewer.plugin.PluginManager; -import the.bytecode.club.bytecodeviewer.plugin.preinstalled.*; - -import javax.swing.*; -import javax.swing.filechooser.FileFilter; -import java.awt.*; -import java.awt.event.*; -import java.io.File; -import java.util.*; -import java.util.List; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * The main file for the GUI.n - * - * @author Konloch - */ -public class MainViewerGUI extends JFrame implements FileChangeNotifier { - - public void pythonC() { - new FileChooser(Settings.PYTHON2_LOCATION, "Python (Or PyPy for speed) 2.7 Executable").run(); - } - - public void javac() { - new FileChooser(Settings.JAVAC_LOCATION, "javac executable (Requires JDK 'C:/Program Files/Java/jdk_xx/bin/javac.exe')").run(); - } - - public void java() { - new FileChooser(Settings.JAVA_LOCATION, "Java Executable (Requires JRE/JDK 'C:/Program Files/Java/jre_xx/bin/java.exe')").run(); - } - - public void pythonC3() { - new FileChooser(Settings.PYTHON3_LOCATION, "Python (Or PyPy for speed) 3.x Executable").run(); - } - - public void rtC() { - new FileChooser(Settings.RT_LOCATION, "Java rt.jar").run(); - } - - public void library() { - final JTextField text = new JTextField(); - text.setText(Settings.PATH.get()); - final JDialog dialog = new JDialog(); - dialog.setModal(true); - dialog.add(text); - dialog.setSize(500, 100); - dialog.setLocationRelativeTo(BytecodeViewer.viewer); - dialog.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - Settings.PATH.set(text.getText()); - } - }); - dialog.setVisible(true); - } - - public static final long serialVersionUID = 1851409230530948543L; - - private final ActionListener listener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - if (refreshOnChange.isSelected()) { - if (workPane.getCurrentViewer() == null) return; - workPane.refreshClass.doClick(); - } - } - }; - - private JMenu generateDecompilerMenu(Decompiler decompiler, int panelId) { - ButtonGroup group = allPanes.get(panelId); - JMenu menu = new JMenu(decompiler.getName()); - JRadioButtonMenuItem java = new JRadioButtonMenuItem(decompiler == Decompiler.SMALI ? "Smali" : "Java"); - java.addActionListener(listener); - JRadioButtonMenuItem bytecode = new JRadioButtonMenuItem("Bytecode"); - JCheckBoxMenuItem editable = new JCheckBoxMenuItem("Editable"); - JSeparator separator = new JSeparator(); - menu.add(java); - group.add(java); - allDecompilers.get(group).put(java, decompiler); - allDecompilersRev.get(group).put(decompiler, java); - if (decompiler == Decompiler.KRAKATAU) { - menu.add(bytecode); - group.add(bytecode); - bytecode.addActionListener(listener); - allDecompilers.get(group).put(bytecode, Decompiler.KRAKATAU_DA); - } - menu.add(separator); - menu.add(editable); - editButtons.get(group).put(decompiler, editable); - return menu; - } - - private JMenu generatePane(int id) { - JMenu menu = new JMenu("Pane " + (id + 1)); - JRadioButtonMenuItem none = new JRadioButtonMenuItem("None"); - JRadioButtonMenuItem bytecode = new JRadioButtonMenuItem("Bytecode"); - JRadioButtonMenuItem hexcode = new JRadioButtonMenuItem("Hexcode"); - ButtonGroup group = allPanes.get(id); - - group.add(none); - group.add(bytecode); - group.add(hexcode); - allDecompilers.get(group).put(none, null); - allDecompilersRev.get(group).put(null, none); - allDecompilers.get(group).put(bytecode, Decompiler.BYTECODE); - allDecompilersRev.get(group).put(Decompiler.BYTECODE, bytecode); - allDecompilers.get(group).put(hexcode, Decompiler.HEXCODE); - allDecompilersRev.get(group).put(Decompiler.HEXCODE, hexcode); - - menu.add(none); - menu.add(new JSeparator()); - menu.add(generateDecompilerMenu(Decompiler.PROCYON, id)); - menu.add(generateDecompilerMenu(Decompiler.CFR, id)); - menu.add(generateDecompilerMenu(Decompiler.JDGUI, id)); - menu.add(generateDecompilerMenu(Decompiler.FERNFLOWER, id)); - menu.add(generateDecompilerMenu(Decompiler.KRAKATAU, id)); - menu.add(new JSeparator()); - menu.add(generateDecompilerMenu(Decompiler.SMALI, id)); - menu.add(new JSeparator()); - menu.add(bytecode); - menu.add(hexcode); - return menu; - } - - public class Test implements KeyEventDispatcher { - @Override - public boolean dispatchKeyEvent(KeyEvent e) { - BytecodeViewer.checkHotKey(e); - return false; - } - } - - public FileNavigationPane cn = new FileNavigationPane(this); - public boolean isMaximized = false; - public JSplitPane sp1; - public JSplitPane sp2; - static ArrayList rfComps = new ArrayList(); - public final JMenuItem mntmNewWorkspace = new JMenuItem("New Workspace"); - public JMenu mnRecentFiles = new JMenu("Recent Files"); - public final JMenuItem mntmNewMenuItem = new JMenuItem("Decompile & Save All Classes.."); - public final JMenuItem mntmAbout = new JMenuItem("About"); - public final JMenuItem mntmStartExternalPlugin = new JMenuItem("Open Plugin.."); - public JMenu mnRecentPlugins = new JMenu("Recent Plugins"); - public final JMenuItem mntmStartZkmString = new JMenuItem("ZKM String Decrypter"); - public final JMenuItem mntmNewMenuItem_1 = new JMenuItem("Malicious Code Scanner"); - public final JMenuItem mntmNewMenuItem_2 = new JMenuItem("Allatori String Decrypter"); - public final JMenuItem mntmShowAllStrings = new JMenuItem("Show All Strings"); - public final JMenuItem mntmShowMainMethods = new JMenuItem("Show Main Methods"); - public final JMenuItem mntmNewMenuItem_3 = new JMenuItem("Save As Runnable Jar.."); - public final JMenuItem mntmReplaceStrings = new JMenuItem("Replace Strings"); - public final JCheckBoxMenuItem chckbxmntmNewCheckItem_12 = new JCheckBoxMenuItem("Update Check"); - public final JMenuItem mntmNewMenuItem_6 = new JMenuItem("Rename Fields"); - public final JMenuItem mntmNewMenuItem_7 = new JMenuItem("Rename Methods"); - public final JMenuItem mntmNewMenuItem_8 = new JMenuItem("Move All Classes Into Root Package"); - public final JMenuItem mntmNewMenuItem_9 = new JMenuItem("Control Flow"); - public final JMenuItem mntmNewMenuItem_10 = new JMenuItem("Junk Code"); - public final ButtonGroup obfuscatorGroup = new ButtonGroup(); - public final JRadioButtonMenuItem strongObf = new JRadioButtonMenuItem("Strong Obfuscation"); - public final JRadioButtonMenuItem lightObf = new JRadioButtonMenuItem("Light Obfuscation"); - public final JMenuItem mntmNewMenuItem_11 = new JMenuItem("Rename Classes"); - public final JMenuItem mntmNewMenuItem_12 = new JMenuItem("Decompile & Save Opened Class.."); - public WorkPane workPane = new WorkPane(this); - public final JCheckBoxMenuItem refreshOnChange = new JCheckBoxMenuItem("Refresh On View Change"); - public AboutWindow aboutWindow = new AboutWindow(); - public final JMenuItem mntmSaveAsApk = new JMenuItem("Save As DEX.."); - public final JMenuItem mntmCodeSequenceDiagram = new JMenuItem("Code Sequence Diagram"); - public final JCheckBoxMenuItem autoCompileSmali = new JCheckBoxMenuItem("Compile On Save"); - public final JMenuItem mntmNewMenuItem_13 = new JMenuItem("Compile"); - public final JCheckBoxMenuItem autoCompileOnRefresh = new JCheckBoxMenuItem("Compile On Refresh"); - public final JMenuItem mntmSetPythonDirectory = new JMenuItem("Set Python 2.7 Executable"); - public final JMenuItem mntmSetJreRt = new JMenuItem("Set JRE RT Library"); - public final JMenuItem mntmZstringarrayDecrypter = new JMenuItem("ZStringArray Decrypter"); - public final JMenuItem mntmRun = new JMenuItem("Run"); - public final JCheckBoxMenuItem decodeAPKResources = new JCheckBoxMenuItem("Decode APK Resources"); - public final ButtonGroup panelGroup1 = new ButtonGroup(); - public final ButtonGroup panelGroup2 = new ButtonGroup(); - public final ButtonGroup panelGroup3 = new ButtonGroup(); - public final JCheckBox mnShowContainer = new JCheckBox("Show Containing File's Name"); - private final JMenuItem mntmSetOpitonalLibrary = new JMenuItem("Set Optional Library Folder"); - private final JMenuItem mntmPingback = new JMenuItem("Pingback"); - private final JMenu mnFontSize = new JMenu("Font Size"); - private final JCheckBoxMenuItem chckbxmntmDeleteForiegnoutdatedLibs = new JCheckBoxMenuItem("Delete Foreign/Outdated Libs"); - private final JMenu mnApkConversion = new JMenu("APK Conversion"); - public final ButtonGroup apkConversionGroup = new ButtonGroup(); - public final JRadioButtonMenuItem apkConversionDex = new JRadioButtonMenuItem("Dex2Jar"); - public final JRadioButtonMenuItem apkConversionEnjarify = new JRadioButtonMenuItem("Enjarify"); - private final JMenuItem mntmSetPythonx = new JMenuItem("Set Python 3.X Executable"); - private final JMenuItem mntmReloadResources = new JMenuItem("Reload Resources"); - private final JMenuItem mntmSetJavacExecutable = new JMenuItem("Set Javac Executable"); - public List allPanes = Collections.unmodifiableList(Arrays.asList(panelGroup1, panelGroup2, panelGroup3)); - public Map> allDecompilers = new HashMap<>(); - public Map> allDecompilersRev = new HashMap<>(); - public Map> editButtons = new HashMap<>(); - - public MainViewerGUI() { - Decompiler.ensureInitted(); - allDecompilers.put(panelGroup1, new HashMap()); - allDecompilers.put(panelGroup2, new HashMap()); - allDecompilers.put(panelGroup3, new HashMap()); - allDecompilersRev.put(panelGroup1, new HashMap()); - allDecompilersRev.put(panelGroup2, new HashMap()); - allDecompilersRev.put(panelGroup3, new HashMap()); - editButtons.put(panelGroup1, new HashMap()); - editButtons.put(panelGroup2, new HashMap()); - editButtons.put(panelGroup3, new HashMap()); - KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new Test()); - this.addWindowStateListener(new WindowAdapter() { - @Override - public void windowStateChanged(WindowEvent evt) { - int oldState = evt.getOldState(); - int newState = evt.getNewState(); - - if ((oldState & Frame.ICONIFIED) == 0 && (newState & Frame.ICONIFIED) != 0) { - //System.out.println("Frame was iconized"); - } else if ((oldState & Frame.ICONIFIED) != 0 && (newState & Frame.ICONIFIED) == 0) { - //System.out.println("Frame was deiconized"); - } - - if ((oldState & Frame.MAXIMIZED_BOTH) == 0 && (newState & Frame.MAXIMIZED_BOTH) != 0) { - isMaximized = true; - } else if ((oldState & Frame.MAXIMIZED_BOTH) != 0 && (newState & Frame.MAXIMIZED_BOTH) == 0) { - isMaximized = false; - } - } - }); - this.setIconImages(Resources.iconList); - - JMenuBar menuBar = new JMenuBar(); - JMenu fileMenu = new JMenu("File"); - JMenu viewMenu = new JMenu("View"); - JMenu settingsMenu = new JMenu("Settings"); - JMenu obfuscateMenu = new JMenu("Obfuscate"); - JMenu pluginsMenu = new JMenu("Plugins"); - obfuscateMenu.setVisible(false); - setJMenuBar(menuBar); - - obfuscatorGroup.add(strongObf); - obfuscatorGroup.add(lightObf); - obfuscatorGroup.setSelected(strongObf.getModel(), true); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - - menuBar.add(fileMenu); - - mntmNewWorkspace.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - BytecodeViewer.resetWorkSpace(true); - } - }); - - JMenuItem mntmLoadJar = new JMenuItem("Add.."); - mntmLoadJar.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JFileChooser fc = new JFileChooser(); - try { - File f = new File(BytecodeViewer.lastDirectory); - if (f.exists()) fc.setSelectedFile(f); - } catch (Exception e2) { - - } - fc.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - if (f.isDirectory()) return true; - - String extension = MiscUtils.extension(f.getAbsolutePath()); - if (extension != null) - if (extension.equals("jar") || extension.equals("zip") || extension.equals("class") || extension.equals("apk") || extension.equals("dex")) - return true; - - return false; - } - - @Override - public String getDescription() { - return "APKs, DEX, Class Files or Zip/Jar Archives"; - } - }); - fc.setFileHidingEnabled(false); - fc.setAcceptAllFileFilterUsed(false); - int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - BytecodeViewer.lastDirectory = fc.getSelectedFile().getAbsolutePath(); - try { - BytecodeViewer.viewer.setIcon(true); - BytecodeViewer.openFiles(new File[]{fc.getSelectedFile()}, true); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e1) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); - } - } - } - }); - fileMenu.add(mntmLoadJar); - - fileMenu.add(new JSeparator()); - - fileMenu.add(mntmNewWorkspace); - - JMenuItem mntmSave = new JMenuItem("Save As Zip.."); - mntmSave.setActionCommand(""); - mntmSave.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - if (BytecodeViewer.getLoadedBytes().isEmpty()) { - BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); - return; - } - Thread t = new Thread() { - public void run() { - if (autoCompileSmali.isSelected() && !BytecodeViewer.compile(false)) return; - JFileChooser fc = new JFileChooser(); - fc.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("zip"); - } - - @Override - public String getDescription() { - return "Zip Archives"; - } - }); - fc.setFileHidingEnabled(false); - fc.setAcceptAllFileFilterUsed(false); - int returnVal = fc.showSaveDialog(MainViewerGUI.this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - if (!file.getAbsolutePath().endsWith(".zip")) - file = new File(file.getAbsolutePath() + ".zip"); - - if (file.exists()) { - JOptionPane pane = new JOptionPane("Are you sure you wish to overwrite this existing file?"); - Object[] options = new String[]{"Yes", "No"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Overwrite File"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result == 0) { - file.delete(); - } else { - return; - } - } - - final File file2 = file; - - BytecodeViewer.viewer.setIcon(true); - Thread t = new Thread() { - @Override - public void run() { - JarUtils.saveAsJar(BytecodeViewer.getLoadedBytes(), file2.getAbsolutePath()); - BytecodeViewer.viewer.setIcon(false); - } - }; - t.start(); - } - } - }; - t.start(); - } - }); - - fileMenu.add(new JSeparator()); - mntmReloadResources.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - JOptionPane pane = new JOptionPane("Are you sure you wish to reload the resources?"); - Object[] options = new String[]{"Yes", "No"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Reload Resources"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result == 0) { - ArrayList reopen = new ArrayList(); - for (FileContainer container : BytecodeViewer.files) - reopen.add(container.file); - - BytecodeViewer.files.clear(); - BytecodeViewer.openFiles(reopen.toArray(new File[reopen.size()]), false); - - //refresh panes - } - } - }); - - fileMenu.add(mntmReloadResources); - - fileMenu.add(new JSeparator()); - mntmNewMenuItem_3.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (BytecodeViewer.getLoadedBytes().isEmpty()) { - BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); - return; - } - Thread t = new Thread() { - public void run() { - if (autoCompileSmali.isSelected() && !BytecodeViewer.compile(false)) return; - JFileChooser fc = new JFileChooser(); - fc.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("zip"); - } - - @Override - public String getDescription() { - return "Zip Archives"; - } - }); - fc.setFileHidingEnabled(false); - fc.setAcceptAllFileFilterUsed(false); - int returnVal = fc.showSaveDialog(MainViewerGUI.this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - String path = file.getAbsolutePath(); - if (!path.endsWith(".jar")) path = path + ".jar"; - - if (new File(path).exists()) { - JOptionPane pane = new JOptionPane("Are you sure you wish to overwrite this existing file?"); - Object[] options = new String[]{"Yes", "No"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Overwrite File"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result == 0) { - file.delete(); - } else { - return; - } - } - - new ExportJar(path).setVisible(true); - } - } - }; - t.start(); - } - }); - mntmNewMenuItem_13.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - Thread t = new Thread() { - public void run() { - BytecodeViewer.compile(true); - } - }; - t.start(); - } - }); - mntmRun.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (BytecodeViewer.getLoadedBytes().isEmpty()) { - BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); - return; - } - new RunOptions().setVisible(true); - } - }); - - fileMenu.add(mntmRun); - - fileMenu.add(mntmNewMenuItem_13); - - fileMenu.add(new JSeparator()); - - fileMenu.add(mntmNewMenuItem_3); - mntmSaveAsApk.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - if (BytecodeViewer.getLoadedBytes().isEmpty()) { - BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); - return; - } - - Thread t = new Thread() { - public void run() { - if (autoCompileSmali.isSelected() && !BytecodeViewer.compile(false)) return; - JFileChooser fc = new JFileChooser(); - fc.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("dex"); - } - - @Override - public String getDescription() { - return "Android DEX Files"; - } - }); - fc.setFileHidingEnabled(false); - fc.setAcceptAllFileFilterUsed(false); - int returnVal = fc.showSaveDialog(MainViewerGUI.this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - final File file = fc.getSelectedFile(); - String output = file.getAbsolutePath(); - if (!output.endsWith(".dex")) output = output + ".dex"; - - final File file2 = new File(output); - - if (file2.exists()) { - JOptionPane pane = new JOptionPane("Are you sure you wish to overwrite this existing file?"); - Object[] options = new String[]{"Yes", "No"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Overwrite File"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result == 0) { - file.delete(); - } else { - return; - } - } - - Thread t = new Thread() { - @Override - public void run() { - BytecodeViewer.viewer.setIcon(true); - final String input = BytecodeViewer.tempDir.getAbsolutePath() + BytecodeViewer.fs + BytecodeViewer.getRandomizedName() + ".jar"; - JarUtils.saveAsJar(BytecodeViewer.getLoadedBytes(), input); - - Thread t = new Thread() { - @Override - public void run() { - Dex2Jar.saveAsDex(new File(input), file2); - - BytecodeViewer.viewer.setIcon(false); - } - }; - t.start(); - } - }; - t.start(); - } - } - }; - t.start(); - } - }); - - fileMenu.add(mntmSaveAsApk); - fileMenu.add(mntmSave); - mntmNewMenuItem.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - if (BytecodeViewer.files.isEmpty()) { - BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); - return; - } - - Thread t = new Thread() { - public void run() { - if (autoCompileSmali.isSelected() && !BytecodeViewer.compile(false)) return; - JFileChooser fc = new JFileChooser(); - fc.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("zip"); - } - - @Override - public String getDescription() { - return "Zip Archives"; - } - }); - fc.setFileHidingEnabled(false); - fc.setAcceptAllFileFilterUsed(false); - int returnVal = fc.showSaveDialog(MainViewerGUI.this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - if (!file.getAbsolutePath().endsWith(".zip")) - file = new File(file.getAbsolutePath() + ".zip"); - - if (file.exists()) { - JOptionPane pane = new JOptionPane("Are you sure you wish to overwrite this existing file?"); - Object[] options = new String[]{"Yes", "No"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Overwrite File"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result == 0) { - file.delete(); - } else { - return; - } - } - - BytecodeViewer.viewer.setIcon(true); - final String path = MiscUtils.append(file, ".zip"); // cheap hax cause - // string is final - - JOptionPane pane = new JOptionPane("What decompiler will you use?"); - Object[] options = new String[]{"Procyon", "CFR", "Fernflower", "Krakatau", "JD-GUI", "Cancel"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Select Decompiler"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result == 0) { - Thread t = new Thread() { - @Override - public void run() { - try { - Decompiler.PROCYON.decompileToZip(path); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - }; - t.start(); - } - if (result == 1) { - Thread t = new Thread() { - @Override - public void run() { - try { - Decompiler.CFR.decompileToZip(path); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - }; - t.start(); - } - if (result == 2) { - Thread t = new Thread() { - @Override - public void run() { - try { - Decompiler.FERNFLOWER.decompileToZip(path); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - }; - t.start(); - } - - if (result == 3) { - Thread t = new Thread() { - @Override - public void run() { - try { - Decompiler.KRAKATAU.decompileToZip(path); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - }; - t.start(); - } else if (result == 4) { - new Thread() { - @Override - public void run() { - try { - Decompiler.JDGUI.decompileToZip(path); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - }.start(); - } else { - BytecodeViewer.viewer.setIcon(false); - } - } - } - }; - t.start(); - } - }); - mntmNewMenuItem_12.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - if (workPane.getCurrentViewer() == null) { - BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); - return; - } - - Thread t = new Thread() { - public void run() { - if (autoCompileSmali.isSelected() && !BytecodeViewer.compile(false)) return; - final String s = workPane.getCurrentViewer().name; - - JFileChooser fc = new JFileChooser(); - fc.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("java"); - } - - @Override - public String getDescription() { - return "Java Source Files"; - } - }); - fc.setFileHidingEnabled(false); - fc.setAcceptAllFileFilterUsed(false); - int returnVal = fc.showSaveDialog(MainViewerGUI.this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - - BytecodeViewer.viewer.setIcon(true); - final String path = MiscUtils.append(file, ".java"); // cheap hax cause - // string is final - - if (new File(path).exists()) { - JOptionPane pane = new JOptionPane("Are you sure you wish to overwrite this existing file?"); - Object[] options = new String[]{"Yes", "No"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Overwrite File"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result == 0) { - file.delete(); - } else { - return; - } - } - - JOptionPane pane = new JOptionPane("What decompiler will you use?"); - Object[] options = new String[]{"Procyon", "CFR", "Fernflower", "Krakatau", "Cancel"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Select Decompiler"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - final String containerName = BytecodeViewer.files.get(0).name; - - if (result == 0) { - Thread t = new Thread() { - @Override - public void run() { - try { - ClassNode cn = BytecodeViewer.getClassNode(containerName, s); - byte[] bytes = BytecodeViewer.getClassBytes(containerName, s); - String contents = Decompiler.PROCYON.decompileClassNode(cn, bytes); - FileUtils.write(new File(path), contents, "UTF-8", false); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - }; - t.start(); - } - if (result == 1) { - Thread t = new Thread() { - @Override - public void run() { - try { - ClassNode cn = BytecodeViewer.getClassNode(containerName, s); - byte[] bytes = BytecodeViewer.getClassBytes(containerName, s); - String contents = Decompiler.CFR.decompileClassNode(cn, bytes); - FileUtils.write(new File(path), contents, "UTF-8", false); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - }; - t.start(); - } - if (result == 2) { - Thread t = new Thread() { - @Override - public void run() { - try { - ClassNode cn = BytecodeViewer.getClassNode(containerName, s); - byte[] bytes = BytecodeViewer.getClassBytes(containerName, s); - String contents = Decompiler.FERNFLOWER.decompileClassNode(cn, bytes); - FileUtils.write(new File(path), contents, "UTF-8", false); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - }; - t.start(); - } - if (result == 3) { - Thread t = new Thread() { - @Override - public void run() { - try { - ClassNode cn = BytecodeViewer.getClassNode(containerName, s); - byte[] bytes = BytecodeViewer.getClassBytes(containerName, s); - String contents = Decompiler.KRAKATAU.decompileClassNode(cn, bytes); - FileUtils.write(new File(path), contents, "UTF-8", false); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - }; - t.start(); - } - if (result == 4) { - BytecodeViewer.viewer.setIcon(false); - } - } - } - }; - t.start(); - } - }); - - fileMenu.add(mntmNewMenuItem_12); - fileMenu.add(mntmNewMenuItem); - fileMenu.add(new JSeparator()); - fileMenu.add(mnRecentFiles); - fileMenu.add(new JSeparator()); - mntmAbout.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - aboutWindow.setVisible(true); - } - }); - - fileMenu.add(mntmAbout); - - JMenuItem mntmExit = new JMenuItem("Exit"); - mntmExit.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - JOptionPane pane = new JOptionPane("Are you sure you want to exit?"); - Object[] options = new String[]{"Yes", "No"}; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Exit"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) result = k; - - if (result == 0) { - System.exit(0); - } - } - }); - mntmPingback.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - BytecodeViewer.pingback(); - } - }); - - fileMenu.add(mntmPingback); - fileMenu.add(mntmExit); - - menuBar.add(viewMenu); - viewMenu.add(generatePane(0)); - viewMenu.add(generatePane(1)); - viewMenu.add(generatePane(2)); - - - autoCompileSmali.setSelected(true); - - settingsMenu.add(autoCompileSmali); - autoCompileOnRefresh.setSelected(true); - - settingsMenu.add(autoCompileOnRefresh); - - settingsMenu.add(refreshOnChange); - - settingsMenu.add(new JSeparator()); - decodeAPKResources.setSelected(true); - - settingsMenu.add(decodeAPKResources); - - settingsMenu.add(mnApkConversion); - - mnApkConversion.add(apkConversionDex); - - mnApkConversion.add(apkConversionEnjarify); - - settingsMenu.add(new JSeparator()); - chckbxmntmNewCheckItem_12.setSelected(true); - settingsMenu.add(chckbxmntmNewCheckItem_12); - chckbxmntmDeleteForiegnoutdatedLibs.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - if (!chckbxmntmDeleteForiegnoutdatedLibs.isSelected()) { - BytecodeViewer.showMessage("WARNING: With this being toggled off outdated libraries will NOT be removed. It's also a security issue. ONLY TURN IT OFF IF YOU KNOW WHAT YOU'RE DOING."); - } - BytecodeViewer.deleteForiegnLibraries = chckbxmntmDeleteForiegnoutdatedLibs.isSelected(); - } - }); - chckbxmntmDeleteForiegnoutdatedLibs.setSelected(true); - - settingsMenu.add(chckbxmntmDeleteForiegnoutdatedLibs); - - settingsMenu.add(new JSeparator()); - mntmSetPythonDirectory.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - pythonC(); - } - }); - - settingsMenu.add(mntmSetPythonDirectory); - mntmSetJreRt.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - rtC(); - } - }); - mntmSetPythonx.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - pythonC3(); - } - }); - - settingsMenu.add(mntmSetPythonx); - - settingsMenu.add(mntmSetJreRt); - mntmSetOpitonalLibrary.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - library(); - } - }); - - settingsMenu.add(mntmSetOpitonalLibrary); - mntmSetJavacExecutable.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - javac(); - } - }); - - settingsMenu.add(mntmSetJavacExecutable); - - settingsMenu.add(new JSeparator()); - - JMenu cfrSettingsMenu = new JMenu("CFR"); - DecompilerSettings cfrSettings = Decompiler.CFR.getSettings(); - for (CFRDecompiler.Settings setting : CFRDecompiler.Settings.values()) { - cfrSettingsMenu.add(cfrSettings.getMenuItem(setting)); - } - settingsMenu.add(cfrSettingsMenu); - - JMenu fernflowerSettingMenu = new JMenu("FernFlower"); - DecompilerSettings fernflowerSettings = Decompiler.FERNFLOWER.getSettings(); - for (FernFlowerDecompiler.Settings setting : FernFlowerDecompiler.Settings.values()) { - fernflowerSettingMenu.add(fernflowerSettings.getMenuItem(setting)); - } - settingsMenu.add(fernflowerSettingMenu); - - JMenu procyonSettingsMenu = new JMenu("Procyon"); - DecompilerSettings procyonSettings = Decompiler.PROCYON.getSettings(); - for (ProcyonDecompiler.Settings setting : ProcyonDecompiler.Settings.values()) { - procyonSettingsMenu.add(procyonSettings.getMenuItem(setting)); - } - settingsMenu.add(procyonSettingsMenu); - - JMenu bytecodeSettingsMenu = new JMenu("Bytecode Decompiler"); - DecompilerSettings bytecodeSettings = Decompiler.BYTECODE.getSettings(); - for (ClassNodeDecompiler.Settings setting : ClassNodeDecompiler.Settings.values()) { - bytecodeSettingsMenu.add(bytecodeSettings.getMenuItem(setting)); - } - settingsMenu.add(bytecodeSettingsMenu); - - menuBar.add(settingsMenu); - menuBar.add(obfuscateMenu); - mntmNewMenuItem_6.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - if (BytecodeViewer.runningObfuscation) { - BytecodeViewer.showMessage("You're currently running an obfuscation task, wait for this to finish."); - return; - } - new RenameFields().start(); - workPane.refreshClass.doClick(); - cn.tree.updateUI(); - } - }); - - obfuscateMenu.add(strongObf); - - obfuscateMenu.add(lightObf); - - obfuscateMenu.add(new JSeparator()); - mntmNewMenuItem_8.setEnabled(false); - - obfuscateMenu.add(mntmNewMenuItem_8); - - obfuscateMenu.add(mntmNewMenuItem_6); - mntmNewMenuItem_7.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - if (BytecodeViewer.runningObfuscation) { - BytecodeViewer.showMessage("You're currently running an obfuscation task, wait for this to finish."); - return; - } - new RenameMethods().start(); - workPane.refreshClass.doClick(); - cn.tree.updateUI(); - } - }); - - obfuscateMenu.add(mntmNewMenuItem_7); - mntmNewMenuItem_11.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - if (BytecodeViewer.runningObfuscation) { - BytecodeViewer.showMessage("You're currently running an obfuscation task, wait for this to finish."); - return; - } - new RenameClasses().start(); - workPane.refreshClass.doClick(); - cn.tree.updateUI(); - } - }); - - obfuscateMenu.add(mntmNewMenuItem_11); - mntmNewMenuItem_9.setEnabled(false); - - obfuscateMenu.add(mntmNewMenuItem_9); - mntmNewMenuItem_10.setEnabled(false); - - obfuscateMenu.add(mntmNewMenuItem_10); - - menuBar.add(pluginsMenu); - pluginsMenu.add(mntmStartExternalPlugin); - pluginsMenu.add(new JSeparator()); - pluginsMenu.add(mnRecentPlugins); - pluginsMenu.add(new JSeparator()); - mntmCodeSequenceDiagram.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - if (BytecodeViewer.getLoadedClasses().isEmpty()) { - BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); - return; - } - PluginManager.runPlugin(new CodeSequenceDiagram()); - } - }); - - pluginsMenu.add(mntmCodeSequenceDiagram); - pluginsMenu.add(mntmNewMenuItem_1); - pluginsMenu.add(mntmShowMainMethods); - pluginsMenu.add(mntmShowAllStrings); - mntmReplaceStrings.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - if (BytecodeViewer.getLoadedClasses().isEmpty()) { - BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); - return; - } - new ReplaceStringsOptions().setVisible(true); - } - }); - - pluginsMenu.add(mntmReplaceStrings); - pluginsMenu.add(mntmNewMenuItem_2); - pluginsMenu.add(mntmStartZkmString); - mntmZstringarrayDecrypter.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - PluginManager.runPlugin(new ZStringArrayDecrypter()); - } - }); - - pluginsMenu.add(mntmZstringarrayDecrypter); - - menuBar.add(spinnerMenu); - - mntmStartExternalPlugin.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - JFileChooser fc = new JFileChooser(); - fc.setFileFilter(PluginManager.fileFilter()); - fc.setFileHidingEnabled(false); - fc.setAcceptAllFileFilterUsed(false); - int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); - - if (returnVal == JFileChooser.APPROVE_OPTION) try { - BytecodeViewer.viewer.setIcon(true); - BytecodeViewer.startPlugin(fc.getSelectedFile()); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e1) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); - } - } - }); - mntmStartZkmString.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - PluginManager.runPlugin(new ZKMStringDecrypter()); - } - }); - mntmNewMenuItem_2.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - if (BytecodeViewer.getLoadedClasses().isEmpty()) { - BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); - return; - } - new AllatoriStringDecrypterOptions().setVisible(true); - } - }); - mntmNewMenuItem_1.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (BytecodeViewer.getLoadedClasses().isEmpty()) { - BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); - return; - } - new MaliciousCodeScannerOptions().setVisible(true); - } - }); - mntmShowAllStrings.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - PluginManager.runPlugin(new ShowAllStrings()); - } - }); - - mntmShowMainMethods.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - PluginManager.runPlugin(new ShowMainMethods()); - } - }); - - setSize(new Dimension(800, 400)); - if (BytecodeViewer.previewCopy) - setTitle("Bytecode Viewer " + BytecodeViewer.version + " Preview - https://bytecodeviewer.com | https://the.bytecode.club - @Konloch"); - else - setTitle("Bytecode Viewer " + BytecodeViewer.version + " - https://bytecodeviewer.com | https://the.bytecode.club - @Konloch"); - - getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS)); - - // scrollPane.setViewportView(tree); - cn.setMinimumSize(new Dimension(200, 50)); - // panel.add(cn); - SearchingPane s = new SearchingPane(this); - s.setPreferredSize(new Dimension(200, 50)); - s.setMinimumSize(new Dimension(200, 50)); - s.setMaximumSize(new Dimension(200, 2147483647)); - // panel.add(s); - sp1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cn, s); - // panel.add(sp1); - cn.setPreferredSize(new Dimension(200, 50)); - cn.setMaximumSize(new Dimension(200, 2147483647)); - sp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp1, workPane); - getContentPane().add(sp2); - sp2.setResizeWeight(0.05); - sp1.setResizeWeight(0.5); - rfComps.add(cn); - - rfComps.add(s); - rfComps.add(workPane); - - apkConversionGroup.add(apkConversionDex); - apkConversionGroup.add(apkConversionEnjarify); - apkConversionGroup.setSelected(apkConversionDex.getModel(), true); - - fontSpinner.setPreferredSize(new Dimension(42, 20)); - fontSpinner.setSize(new Dimension(42, 20)); - fontSpinner.setModel(new SpinnerNumberModel(12, 1, null, 1)); - viewMenu.add(mnFontSize); - mnFontSize.add(fontSpinner); - - viewMenu.add(mnShowContainer); - mnShowContainer.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - JTabbedPane tabs = workPane.tabs; - Component[] components = tabs.getComponents(); - for (int i = 0; i < components.length; i++) { - Component c = components[i]; - if (c instanceof Viewer) { - ((Viewer) c).updateName(); - int idx = tabs.indexOfComponent(c); - tabs.setTabComponentAt(idx, new TabbedPane(c.getName(), tabs)); - workPane.tabs.setTitleAt(idx, c.getName()); - } - } - } - }); - panelGroup1.setSelected(allDecompilersRev.get(panelGroup1).get(Decompiler.FERNFLOWER).getModel(), true); - panelGroup2.setSelected(allDecompilersRev.get(panelGroup2).get(Decompiler.BYTECODE).getModel(), true); - panelGroup3.setSelected(allDecompilersRev.get(panelGroup3).get(null).getModel(), true); - this.setLocationRelativeTo(null); - } - - public JSpinner fontSpinner = new JSpinner(); - private JMenuItem spinnerMenu = new JMenuItem(""); - - public void setIcon(final boolean busy) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - if (busy) { - try { - spinnerMenu.setIcon(Resources.busyIcon); - } catch (NullPointerException e) { - spinnerMenu.setIcon(Resources.busyB64Icon); - } - } else spinnerMenu.setIcon(null); - spinnerMenu.updateUI(); - } - }); - } - - public void calledAfterLoad() { - chckbxmntmDeleteForiegnoutdatedLibs.setSelected(BytecodeViewer.deleteForiegnLibraries); - } - - @Override - public void openClassFile(final String name, String container, final ClassNode cn) { - for (final VisibleComponent vc : rfComps) { - vc.openClassFile(name, container, cn); - } - } - - @Override - public void openFile(final String name, String container, byte[] content) { - for (final VisibleComponent vc : rfComps) { - vc.openFile(name, container, content); - } - } - - public static T getComponent(final Class clazz) { - for (final VisibleComponent vc : rfComps) { - if (vc.getClass() == clazz) return clazz.cast(vc); - } - return null; - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/PaneUpdaterThread.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/PaneUpdaterThread.java deleted file mode 100644 index 1a9b566f..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/PaneUpdaterThread.java +++ /dev/null @@ -1,112 +0,0 @@ -package the.bytecode.club.bytecodeviewer.gui; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -import com.jhe.hexed.JHexEditor; -import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; -import org.fife.ui.rsyntaxtextarea.SyntaxConstants; -import org.fife.ui.rtextarea.RTextScrollPane; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.api.ExceptionUI; -import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; - -/** - * Updates a pane - * - * @author Konloch - */ -public class PaneUpdaterThread extends Thread { - - private Decompiler decompiler; - private int paneId; - private JPanel target; - private ClassViewer viewer; - private JButton button; - - public PaneUpdaterThread(ClassViewer viewer, Decompiler decompiler, int paneId, JPanel target, JButton button) { - this.decompiler = decompiler; - this.paneId = paneId; - this.target = target; - this.viewer = viewer; - this.button = button; - } - - public void run() { - try { - final byte[] b = BytecodeViewer.getClassBytes(viewer.container, viewer.cn.name + ".class"); - if (decompiler != Decompiler.HEXCODE) { - RSyntaxTextArea panelArea = new RSyntaxTextArea(); - panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); - panelArea.setCodeFoldingEnabled(true); - panelArea.setAntiAliasingEnabled(true); - final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); - panelArea.setText(decompiler.decompileClassNode(viewer.cn, b)); - panelArea.setCaretPosition(0); - panelArea.setEditable(viewer.isPaneEditable(paneId)); - panelArea.addKeyListener(new KeyListener() { - @Override - public void keyPressed(KeyEvent e) { - if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { - viewer.requestFocus(paneId); - } - - BytecodeViewer.checkHotKey(e); - } - - @Override - public void keyReleased(KeyEvent arg0) { - } - - @Override - public void keyTyped(KeyEvent arg0) { - } - }); - scrollPane.setColumnHeaderView(new JLabel(decompiler.getName() + " Decompiler - Editable: " + panelArea.isEditable())); - panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int) BytecodeViewer.viewer.fontSpinner.getValue())); - - SwingUtilities.invokeLater(new Runnable() { - public void run() { - target.add(scrollPane); - } - }); - viewer.updatePane(paneId, panelArea, decompiler); - } else { - final JHexEditor hex = new JHexEditor(b); - hex.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); - SwingUtilities.invokeLater(new Runnable() { - public void run() { - target.add(hex); - } - }); - } - } catch(Exception e) { - new ExceptionUI(e); - } finally { - viewer.resetDivider(); - BytecodeViewer.viewer.setIcon(false); - if(button != null) - button.setEnabled(true); - } - } -} \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/SearchingPane.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/SearchingPane.java deleted file mode 100644 index 655f6c4d..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/SearchingPane.java +++ /dev/null @@ -1,241 +0,0 @@ -package the.bytecode.club.bytecodeviewer.gui; - -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.FileChangeNotifier; -import the.bytecode.club.bytecodeviewer.searching.*; - -import javax.swing.*; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreePath; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * A pane dedicating to searching the loaded files. - * - * @author Konloch - * @author WaterWolf - * - */ - -@SuppressWarnings("rawtypes") -public class SearchingPane extends VisibleComponent { - - private static final long serialVersionUID = -1098524689236993932L; - - FileChangeNotifier fcn; - - JCheckBox exact = new JCheckBox("Exact"); - DefaultMutableTreeNode treeRoot = new DefaultMutableTreeNode("Root"); - JTree tree; - - SearchType searchType = null; - JComboBox searchRadiusBox; - - public JButton search = new JButton("Search"); - transient BackgroundSearchThread t = new BackgroundSearchThread(true) { - @Override - public void doSearch() { - // empty - } - - }; - - @SuppressWarnings("unchecked") - public SearchingPane(final FileChangeNotifier fcn) { - super("Search"); - - this.fcn = fcn; - - final JPanel optionPanel = new JPanel(new BorderLayout()); - - final JPanel searchRadiusOpt = new JPanel(new BorderLayout()); - - final JPanel searchOpts = new JPanel(new GridLayout(2, 1)); - - searchRadiusOpt.add(new JLabel("Search from "), BorderLayout.WEST); - - DefaultComboBoxModel model = new DefaultComboBoxModel(); - for (final SearchRadius st : SearchRadius.values()) { - model.addElement(st); - } - - searchRadiusBox = new JComboBox(model); - - searchRadiusOpt.add(searchRadiusBox, BorderLayout.CENTER); - - searchOpts.add(searchRadiusOpt); - - model = new DefaultComboBoxModel(); - for (final SearchType st : SearchType.values()) { - model.addElement(st); - } - - final JComboBox typeBox = new JComboBox(model); - final JPanel searchOptPanel = new JPanel(); - - final ItemListener il = new ItemListener() { - @Override - public void itemStateChanged(final ItemEvent arg0) { - searchOptPanel.removeAll(); - searchType = (SearchType) typeBox.getSelectedItem(); - searchOptPanel.add(searchType.details.getPanel()); - - searchOptPanel.revalidate(); - searchOptPanel.repaint(); - } - }; - - typeBox.addItemListener(il); - - typeBox.setSelectedItem(SearchType.LDC); - il.itemStateChanged(null); - - searchOpts.add(typeBox); - - optionPanel.add(searchOpts, BorderLayout.NORTH); - - JPanel p2 = new JPanel(); - p2.setLayout(new BorderLayout()); - p2.add(searchOptPanel, BorderLayout.NORTH); - p2.add(exact, BorderLayout.SOUTH); - - optionPanel.add(p2, BorderLayout.CENTER); - - search.addActionListener(new ActionListener() { - @Override - public void actionPerformed(final ActionEvent arg0) { - treeRoot.removeAllChildren(); - searchType = (SearchType) typeBox.getSelectedItem(); - final SearchRadius radius = (SearchRadius) searchRadiusBox - .getSelectedItem(); - final SearchResultNotifier srn = new SearchResultNotifier() { - @Override - public void notifyOfResult(String debug) { - treeRoot.add(new DefaultMutableTreeNode(debug)); - } - }; - if (radius == SearchRadius.All_Classes) { - if (t.finished) { - t = new BackgroundSearchThread() { - @Override - public void doSearch() { - - try { - Pattern.compile(RegexInsnFinder.processRegex(RegexSearch.searchText.getText()), Pattern.MULTILINE); - } catch (PatternSyntaxException ex) { - BytecodeViewer.showMessage("You have an error in your regex syntax."); - } - - for (ClassNode cln : BytecodeViewer.getLoadedClasses()) - searchType.details.search(cln, srn, exact.isSelected()); - - MainViewerGUI.getComponent(SearchingPane.class).search.setEnabled(true); - MainViewerGUI.getComponent(SearchingPane.class).search.setText("Search"); - tree.expandPath(new TreePath(tree.getModel().getRoot())); - tree.updateUI(); - } - - }; - MainViewerGUI.getComponent(SearchingPane.class).search - .setEnabled(false); - MainViewerGUI.getComponent(SearchingPane.class).search - .setText("Searching, please wait.."); - t.start(); - } else { // this should really never be called. - BytecodeViewer - .showMessage("You currently have a search performing in the background, please wait for that to finish."); - } - } else if (radius == SearchRadius.Current_Class) { - final Viewer cv = MainViewerGUI.getComponent(WorkPane.class).getCurrentViewer(); - if (cv != null) { - searchType.details.search(cv.cn, srn, - exact.isSelected()); - } - } - } - }); - - optionPanel.add(search, BorderLayout.SOUTH); - - this.tree = new JTree(treeRoot); - - getContentPane().setLayout(new BorderLayout()); - - getContentPane().add(new JScrollPane(optionPanel), BorderLayout.NORTH); - getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER); - - this.tree.addTreeSelectionListener(new TreeSelectionListener() { - @Override - public void valueChanged(final TreeSelectionEvent arg0) { - String path = arg0.getPath().toString(); - String containerName = arg0.getPath().getPathComponent(1).toString(); - - String className = path.split(", ")[1].split("\\.")[0]; - final ClassNode fN = BytecodeViewer.getClassNode(containerName, className); - if (fN != null) { - MainViewerGUI.getComponent(FileNavigationPane.class) - .openClassFileToWorkSpace(className + ".class", containerName, fN); - } - - System.out.println(className); - } - }); - - this.setVisible(true); - - } - - public enum SearchType { - LDC(new LDCSearch()), Regex(new RegexSearch()), MethodCall( - new MethodCallSearch()), FieldCall(new FieldCallSearch()); - - public final SearchTypeDetails details; - - SearchType(final SearchTypeDetails details) { - this.details = details; - } - } - - public enum SearchRadius { - All_Classes, Current_Class; - } - - public void resetWorkspace() { - treeRoot.removeAllChildren(); - tree.updateUI(); - } - - @Override - public void openFile(String name, String container, byte[] contents) { - // TODO Auto-generated method stub - - } - -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java deleted file mode 100644 index b3b310df..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java +++ /dev/null @@ -1,258 +0,0 @@ -package the.bytecode.club.bytecodeviewer.plugin.preinstalled; - -import org.objectweb.asm.tree.*; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.JarUtils; -import the.bytecode.club.bytecodeviewer.api.ExceptionUI; -import the.bytecode.club.bytecodeviewer.api.Plugin; -import the.bytecode.club.bytecodeviewer.api.PluginConsole; - -import javax.swing.*; -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * Coming soon. - * - * @author Konloch - * @author Szperak - * - */ - -public class AllatoriStringDecrypter extends Plugin { - - PluginConsole frame = new PluginConsole("Allatori decrypter"); - StringBuilder out = new StringBuilder(); - - private String className; - - - public AllatoriStringDecrypter(String className) { - this.className = className; - } - - @Override - public void execute(ArrayList classNodeList) { - JOptionPane pane = new JOptionPane( - "WARNING: This will load the classes into the JVM and execute allatori decrypter function" - + BytecodeViewer.nl - + "for each class. IF THE FILE YOU'RE LOADING IS MALICIOUS, DO NOT CONTINUE."); - Object[] options = new String[] { "Continue", "Cancel" }; - pane.setOptions(options); - JDialog dialog = pane.createDialog(BytecodeViewer.viewer, - "Bytecode Viewer - WARNING"); - dialog.setVisible(true); - Object obj = pane.getValue(); - int result = -1; - for (int k = 0; k < options.length; k++) - if (options[k].equals(obj)) - result = k; - - if (result == 0) { - try { - - if (!className.equals("*")) { - for (ClassNode classNode : classNodeList) { - if (classNode.name.equals(className)) - scanClassNode(classNode); - } - } else { - for (ClassNode classNode : classNodeList) { - scanClassNode(classNode); - } - } - }catch(Exception e){ - new ExceptionUI(e, "github.com/Szperak"); - } finally { - frame.appendText(out.toString()); - frame.setVisible(true); - } - } - } - - private void log(String msg){ - out.append(msg); - out.append(BytecodeViewer.nl); - } - - public void scanClassNode(ClassNode classNode) throws Exception { - for(Object method: classNode.methods){ - scanMethodNode(classNode, (MethodNode) method); - } - - } - - - public int readUnsignedShort(byte[] b, final int index) { - return ((b[index] & 0xFF) << 8) | (b[index + 1] & 0xFF); - } - private int getConstantPoolSize(String className){ - byte[] fileContents = BytecodeViewer.getFileContents(className+".class"); - return readUnsignedShort(fileContents, 8); - } - - - public void scanMethodNode(ClassNode classNode, MethodNode methodNode) throws Exception { - InsnList iList = methodNode.instructions; - - log("Scanning method " + methodNode.name+" of " + classNode.name); - - LdcInsnNode laststringldconstack = null; - for (AbstractInsnNode i : iList.toArray()) { - if(i instanceof LdcInsnNode) { - LdcInsnNode ldci = (LdcInsnNode) i; - if(ldci.cst instanceof String){ - laststringldconstack = ldci; - } - continue; - } else if(i instanceof MethodInsnNode) { - MethodInsnNode methodi = (MethodInsnNode) i; - - - - if(laststringldconstack != null && methodi.opcode() == 0xb8) { // Decryption is always a static call - 0xb8 - invokestatic - String decrypterclassname = methodi.owner; - String decryptermethodname = methodi.name; - - if(decrypterclassname.contains("$")) { // Decrypter is always a static method of other class's inner class - byte[] decrypterFileContents = BytecodeViewer.getFileContents(decrypterclassname+".class"); - - // We have to create new node for editing - // Also, one decrypter method could be used for multiple methods in code, what gives us only part of string decrypted - ClassNode decrypterclassnode = JarUtils.getNode(decrypterFileContents); - - if(decrypterclassnode != null) { - MethodNode decryptermethodnode = null; - for (Object uncasted : decrypterclassnode.methods) { - if (((MethodNode) uncasted).name.equals(decryptermethodname)) { - decryptermethodnode = (MethodNode) uncasted; - } - } - if(decryptermethodnode != null) { - - String keyString = (getConstantPoolSize(classNode.name)+ - classNode.name+ - methodNode.name+ - getConstantPoolSize(classNode.name) - ); - - int newHashCode = keyString.hashCode(); - - scanDecrypter(decryptermethodnode, newHashCode); - - try { - System.out.println("loading " + decrypterclassname); - - List> decrypterclasslist = the.bytecode.club.bytecodeviewer.api.BytecodeViewer - .loadClassesIntoClassLoader(new ArrayList( - Arrays.asList(new ClassNode[] { decrypterclassnode }))); - - String decrypted = invokeDecrypter(decrypterclasslist.get(0), decryptermethodname, (String) laststringldconstack.cst); - - if (decrypted != null) { - log("Succesfully invoked decrypter method: "+decrypted); - laststringldconstack.cst = decrypted; - iList.remove(methodi); - } - } catch (IndexOutOfBoundsException | ClassNotFoundException | IOException e) { - e.printStackTrace(); - log("Could not load decrypter class: " + decrypterclassname); - } - - }else{ - log("Could not find decrypter method ("+decryptermethodname+") of class "+decrypterclassname); - } - }else{ - log("Could not find decrypter ClassNode of class "+decrypterclassname); - } - } - } - - }else if(i instanceof InvokeDynamicInsnNode){ - InvokeDynamicInsnNode methodi = (InvokeDynamicInsnNode) i; - if(methodi.opcode() == 0xba){ - // TODO: Safe-reflection deobfuscator here - // Allatori replaces invokeinterface and invokestatic with invokedynamic - - //log(methodi.bsm.getOwner()+" dot "+methodi.bsm.getName()); - //iList.set(methodi, new MethodInsnNode(0xb8, methodi.bsm.getOwner(), methodi.bsm.getName(), methodi.bsm.getDesc(), false)); - - } - - - } - laststringldconstack = null; - } - } - - - private boolean scanDecrypter(MethodNode decryptermethodnode, int newHashCode){ - InsnList iList = decryptermethodnode.instructions; - - AbstractInsnNode insn = null, removeInsn = null; - for (AbstractInsnNode i : iList.toArray()) { - if(i instanceof MethodInsnNode){ - MethodInsnNode methodi = ((MethodInsnNode) i); - if("currentThread".equals(methodi.name)){ // find code form this instruction - insn = i; - break; - } - - } - - } - if(insn == null){ - return false; - } - - while(insn != null){ - if(insn instanceof MethodInsnNode){ - MethodInsnNode methodi = ((MethodInsnNode) insn); - if("hashCode".equals(methodi.name)){ // to this instruction - break; - } - } - removeInsn = insn; - insn = insn.getNext(); - iList.remove(removeInsn); // and remove it - } - if(insn == null) return false; - iList.set(insn, new LdcInsnNode(newHashCode)); // then replace it with pre-computed key LDC - return true; - } - - private String invokeDecrypter(Class decrypterclass, String name, String arg) throws Exception{ - try { - Method decryptermethod = decrypterclass.getDeclaredMethod(name, String.class); - - decryptermethod.setAccessible(true); - return (String) decryptermethod.invoke(null, arg); - - } catch (Exception e) { - log("Could not invoke decrypter method: "+name+" of class "+decrypterclass.getName()); - throw e; - } - } - -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java deleted file mode 100644 index 7a30601d..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java +++ /dev/null @@ -1,120 +0,0 @@ -package the.bytecode.club.bytecodeviewer.plugin.preinstalled; - -import org.objectweb.asm.tree.*; -import the.bytecode.club.bytecodeviewer.api.ExceptionUI; -import the.bytecode.club.bytecodeviewer.api.Plugin; -import the.bytecode.club.bytecodeviewer.api.PluginConsole; - -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.util.ArrayList; -import java.util.concurrent.atomic.AtomicBoolean; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * Simply shows all the non-empty strings in every single class - * - * @author Konloch - */ -public class ShowAllStrings extends Plugin { - @Override - public void execute(final ArrayList classNodeList) { - final PluginConsole frame = new PluginConsole("Show All Strings"); - final AtomicBoolean complete = new AtomicBoolean(false); - final Thread backgroundThread = new Thread() { - public void run() { - try { - for (ClassNode classNode : classNodeList) { - for (Object o : classNode.fields.toArray()) { - FieldNode f = (FieldNode) o; - Object v = f.value; - if (v instanceof String) { - String s = (String) v; - if (!s.isEmpty()) { - frame.appendText(String.format("%s.%s%s -> \"%s\"", classNode.name, f.name, f.desc, s.replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r"))); - } - } - if (v instanceof String[]) { - for (int i = 0; i < ((String[]) v).length; i++) { - String s = ((String[]) v)[i]; - if (!s.isEmpty()) { - frame.appendText(String.format("%s.%s%s[%s] -> \"%s\"", classNode.name, f.name, f.desc, i, s.replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r"))); - } - } - } - } - for (Object o : classNode.methods.toArray()) { - MethodNode m = (MethodNode) o; - InsnList iList = m.instructions; - for (AbstractInsnNode a : iList.toArray()) { - if (a instanceof LdcInsnNode) { - if (((LdcInsnNode) a).cst instanceof String) { - final String s = (String) ((LdcInsnNode) a).cst; - if (!s.isEmpty()) { - frame.appendText(String.format("%s.%s%s -> \"%s\"", classNode.name, m.name, m.desc, s.replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r"))); - } - } - } - } - } - } - } catch (Exception e) { - new ExceptionUI(e, "konloch@gmail.com"); - } finally { - complete.set(true); - } - } - }; - frame.setVisible(true); - frame.addWindowListener(new WindowListener() { - @Override - public void windowClosing(WindowEvent e) { - backgroundThread.stop(); - complete.set(true); - } - - @Override - public void windowOpened(WindowEvent e) { - } - - @Override - public void windowClosed(WindowEvent e) { - } - - @Override - public void windowIconified(WindowEvent e) { - } - - @Override - public void windowDeiconified(WindowEvent e) { - } - - @Override - public void windowActivated(WindowEvent e) { - } - - @Override - public void windowDeactivated(WindowEvent e) { - } - }); - backgroundThread.start(); - while (!complete.get()) ; - } -} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.java b/src/main/java/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.java deleted file mode 100644 index 6ed82e32..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.java +++ /dev/null @@ -1,414 +0,0 @@ -package the.bytecode.club.bytecodeviewer.searching; - -import org.objectweb.asm.tree.*; - -import java.rmi.UnexpectedException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -/** - * An instruction finder that finds regex patterns in a method's instruction - * list and returns an array with the found instructions. - * - * @author Frédéric Hannes - * - */ - -public class RegexInsnFinder { - - private static String[] opcodes = new String[]{"NOP", "ACONST_NULL", - "ICONST_M1", "ICONST_0", "ICONST_1", "ICONST_2", "ICONST_3", - "ICONST_4", "ICONST_5", "LCONST_0", "LCONST_1", "FCONST_0", - "FCONST_1", "FCONST_2", "DCONST_0", "DCONST_1", "BIPUSH", "SIPUSH", - "LDC", "LDC_W", "LDC2_W", "ILOAD", "LLOAD", "FLOAD", "DLOAD", - "ALOAD", "ILOAD_0", "ILOAD_1", "ILOAD_2", "ILOAD_3", "LLOAD_0", - "LLOAD_1", "LLOAD_2", "LLOAD_3", "FLOAD_0", "FLOAD_1", "FLOAD_2", - "FLOAD_3", "DLOAD_0", "DLOAD_1", "DLOAD_2", "DLOAD_3", "ALOAD_0", - "ALOAD_1", "ALOAD_2", "ALOAD_3", "IALOAD", "LALOAD", "FALOAD", - "DALOAD", "AALOAD", "BALOAD", "CALOAD", "SALOAD", "ISTORE", - "LSTORE", "FSTORE", "DSTORE", "ASTORE", "ISTORE_0", "ISTORE_1", - "ISTORE_2", "ISTORE_3", "LSTORE_0", "LSTORE_1", "LSTORE_2", - "LSTORE_3", "FSTORE_0", "FSTORE_1", "FSTORE_2", "FSTORE_3", - "DSTORE_0", "DSTORE_1", "DSTORE_2", "DSTORE_3", "ASTORE_0", - "ASTORE_1", "ASTORE_2", "ASTORE_3", "IASTORE", "LASTORE", - "FASTORE", "DASTORE", "AASTORE", "BASTORE", "CASTORE", "SASTORE", - "POP", "POP2", "DUP", "DUP_X1", "DUP_X2", "DUP2", "DUP2_X1", - "DUP2_X2", "SWAP", "IADD", "LADD", "FADD", "DADD", "ISUB", "LSUB", - "FSUB", "DSUB", "IMUL", "LMUL", "FMUL", "DMUL", "IDIV", "LDIV", - "FDIV", "DDIV", "IREM", "LREM", "FREM", "DREM", "INEG", "LNEG", - "FNEG", "DNEG", "ISHL", "LSHL", "ISHR", "LSHR", "IUSHR", "LUSHR", - "IAND", "LAND", "IOR", "LOR", "IXOR", "LXOR", "IINC", "I2L", "I2F", - "I2D", "L2I", "L2F", "L2D", "F2I", "F2L", "F2D", "D2I", "D2L", - "D2F", "I2B", "I2C", "I2S", "LCMP", "FCMPL", "FCMPG", "DCMPL", - "DCMPG", "IFEQ", "IFNE", "IFLT", "IFGE", "IFGT", "IFLE", - "IF_ICMPEQ", "IF_ICMPNE", "IF_ICMPLT", "IF_ICMPGE", "IF_ICMPGT", - "IF_ICMPLE", "IF_ACMPEQ", "IF_ACMPNE", "GOTO", "JSR", "RET", - "TABLESWITCH", "LOOKUPSWITCH", "IRETURN", "LRETURN", "FRETURN", - "DRETURN", "ARETURN", "RETURN", "GETSTATIC", "PUTSTATIC", - "GETFIELD", "PUTFIELD", "INVOKEVIRTUAL", "INVOKESPECIAL", - "INVOKESTATIC", "INVOKEINTERFACE", "INVOKEDYNAMIC", "NEW", - "NEWARRAY", "ANEWARRAY", "ARRAYLENGTH", "ATHROW", "CHECKCAST", - "INSTANCEOF", "MONITORENTER", "MONITOREXIT", "WIDE", - "MULTIANEWARRAY", "IFNULL", "IFNONNULL", "GOTO_W", "JSR_W"}; - - private static String[] opcodesVar = new String[]{"ILOAD", "LLOAD", - "FLOAD", "DLOAD", "ALOAD", "ISTORE", "LSTORE", "FSTORE", "DSTORE", - "ASTORE", "RET"}; - private static String opcodeVars = buildRegexItems(opcodesVar); - - private static String[] opcodesInt = new String[]{"BIPUSH", "SIPUSH", - "NEWARRAY"}; - private static String opcodesInts = buildRegexItems(opcodesInt); - - private static String[] opcodesField = new String[]{"GETSTATIC", - "PUTSTATIC", "GETFIELD", "PUTFIELD"}; - private static String opcodesFields = buildRegexItems(opcodesField); - - private static String[] opcodesMethod = new String[]{"INVOKEVIRTUAL", - "INVOKESPECIAL", "INVOKESTATIC", "INVOKEINTERFACE", "INVOKEDYNAMIC"}; - private static String opcodesMethods = buildRegexItems(opcodesMethod); - - private static String[] opcodesType = new String[]{"NEW", "ANEWARRAY", - "ARRAYLENGTH", "CHECKCAST", "INSTANCEOF"}; - private static String opcodesTypes = buildRegexItems(opcodesType); - - private static String[] opcodesIf = new String[]{"IFEQ", "IFNE", "IFLT", - "IFGE", "IFGT", "IFLE", "IF_ICMPEQ", "IF_ICMPNE", "IF_ICMPLT", - "IF_ICMPGE", "IF_ICMPGT", "IF_ICMPLE", "IF_ACMPEQ", "IF_ACMPNE"}; - private static String opcodesIfs = buildRegexItems(opcodesIf, false, false); - - private static String[] opcodesAny = new String[]{"NOP", "ACONST_NULL", - "ICONST_M1", "ICONST_0", "ICONST_1", "ICONST_2", "ICONST_3", - "ICONST_4", "ICONST_5", "LCONST_0", "LCONST_1", "FCONST_0", - "FCONST_1", "FCONST_2", "DCONST_0", "DCONST_1", "BIPUSH", "SIPUSH", - "LDC", "LDC_W", "LDC2_W", "ILOAD", "LLOAD", "FLOAD", "DLOAD", - "ALOAD", "IALOAD", "LALOAD", "FALOAD", "DALOAD", "AALOAD", - "BALOAD", "CALOAD", "SALOAD", "ISTORE", "LSTORE", "FSTORE", - "DSTORE", "ASTORE", "IASTORE", "LASTORE", "FASTORE", "DASTORE", - "AASTORE", "BASTORE", "CASTORE", "SASTORE", "POP", "POP2", "DUP", - "DUP_X1", "DUP_X2", "DUP2", "DUP2_X1", "DUP2_X2", "SWAP", "IADD", - "LADD", "FADD", "DADD", "ISUB", "LSUB", "FSUB", "DSUB", "IMUL", - "LMUL", "FMUL", "DMUL", "IDIV", "LDIV", "FDIV", "DDIV", "IREM", - "LREM", "FREM", "DREM", "INEG", "LNEG", "FNEG", "DNEG", "ISHL", - "LSHL", "ISHR", "LSHR", "IUSHR", "LUSHR", "IAND", "LAND", "IOR", - "LOR", "IXOR", "LXOR", "IINC", "I2L", "I2F", "I2D", "L2I", "L2F", - "L2D", "F2I", "F2L", "F2D", "D2I", "D2L", "D2F", "I2B", "I2C", - "I2S", "LCMP", "FCMPL", "FCMPG", "DCMPL", "DCMPG", "IFEQ", "IFNE", - "IFLT", "IFGE", "IFGT", "IFLE", "IF_ICMPEQ", "IF_ICMPNE", - "IF_ICMPLT", "IF_ICMPGE", "IF_ICMPGT", "IF_ICMPLE", "IF_ACMPEQ", - "IF_ACMPNE", "GOTO", "JSR", "RET", "TABLESWITCH", "LOOKUPSWITCH", - "IRETURN", "LRETURN", "FRETURN", "DRETURN", "ARETURN", "RETURN", - "GETSTATIC", "PUTSTATIC", "GETFIELD", "PUTFIELD", "INVOKEVIRTUAL", - "INVOKESPECIAL", "INVOKESTATIC", "INVOKEINTERFACE", - "INVOKEDYNAMIC", "NEW", "NEWARRAY", "ANEWARRAY", "ARRAYLENGTH", - "ATHROW", "CHECKCAST", "INSTANCEOF", "MONITORENTER", "MONITOREXIT", - "MULTIANEWARRAY", "IFNULL", "IFNONNULL"}; - private static String opcodesAnys = buildRegexItems(opcodesAny, false, - false); - - private static String buildRegexItems(final String[] items, - final boolean capture, final boolean stdRepl) { - if (items.length == 0) - return "()"; - String result = (stdRepl ? "\\b" : "") + "(" + (capture ? "" : "?:") - + items[0]; - for (int i = 1; i < items.length; i++) { - result += "|" + items[i]; - } - result += ")"; - return result; - } - - private static String buildRegexItems(final String[] items) { - return buildRegexItems(items, true, true); - } - - public static String processRegex(final String regex) { - String result = regex.trim(); - result = result.replaceAll("\\bANYINSN *", opcodesAnys); - result = result.replaceAll(opcodesInts - + "\\\\\\{\\s*(\\d+)\\s*\\\\\\} *", "$1\\\\{$2\\\\} "); - result = result.replaceAll(opcodesInts + " *", "$1\\\\{\\\\d+\\\\} "); - result = result.replaceAll( - "\\bLDC\\\\\\{(.*?)\\\\\\}(? il = new ArrayList(); - - final Iterator iIt = insnList.iterator(); - while (iIt.hasNext()) { - final AbstractInsnNode node = iIt.next(); - if (node.opcode() >= 0) { - il.add(node); - } - } - return il.toArray(new AbstractInsnNode[il.size()]); - } - - /** - * Refreshes the internal instruction list when you have made changes to the - * method. - */ - public void refresh() { - origInstructions = cleanInsn(mn.instructions); - final List il = new ArrayList(); - for (final AbstractInsnNode ain : mn.instructions.toArray()) - if (ain.opcode() >= 0) { - il.add(ain); - } - instructions = il.toArray(new AbstractInsnNode[il.size()]); - offsets = new int[instructions.length]; - insnString = ""; - for (int i = 0; i < instructions.length; i++) { - offsets[i] = -1; - final AbstractInsnNode ain = instructions[i]; - if (ain.opcode() >= 0) { - if (ain.opcode() >= opcodes.length) { - try { - throw new UnexpectedException( - "Unknown opcode encountered: " - + ain.opcode()); - } catch (final UnexpectedException e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - offsets[i] = insnString.length(); - insnString += opcodes[ain.opcode()]; - switch (ain.type()) { - case AbstractInsnNode.INT_INSN: - final IntInsnNode iin = (IntInsnNode) ain; - insnString += "{" + iin.operand + "}"; - break; - case AbstractInsnNode.LDC_INSN: - final LdcInsnNode lin = (LdcInsnNode) ain; - insnString += "{" + lin.cst.toString().replace("}", "\\}") - + "}"; - break; - case AbstractInsnNode.VAR_INSN: - final VarInsnNode vin = (VarInsnNode) ain; - insnString += "_" + vin.var; - break; - case AbstractInsnNode.IINC_INSN: - final IincInsnNode iiin = (IincInsnNode) ain; - insnString += "{" + iiin.var + "," + iiin.incr + "}"; - break; - case AbstractInsnNode.FIELD_INSN: - final FieldInsnNode fin = (FieldInsnNode) ain; - insnString += "{" + fin.desc + "," + fin.owner + "," - + fin.name + "}"; - break; - case AbstractInsnNode.METHOD_INSN: - final MethodInsnNode min = (MethodInsnNode) ain; - insnString += "{" + min.desc + "," + min.owner + "," - + min.name + "}"; - break; - case AbstractInsnNode.TYPE_INSN: - final TypeInsnNode tin = (TypeInsnNode) ain; - insnString += "{" + tin.desc + "}"; - break; - case AbstractInsnNode.MULTIANEWARRAY_INSN: - final MultiANewArrayInsnNode manain = (MultiANewArrayInsnNode) ain; - insnString += "{" + manain.dims + "," + manain.desc + "}"; - break; - default: - throw new IllegalArgumentException(String.valueOf(ain.type())); - } - insnString += " "; - } - } - } - - public void setMethod(final ClassNode ci, final MethodNode mi) { - this.mn = mi; - refresh(); - } - - private AbstractInsnNode[] makeResult(final int start, final int end) { - int startIndex = 0; - int endIndex = -1; - for (int i = 0; i < offsets.length - 1; i++) { - final int offset = offsets[i]; - if (offset == start) { - startIndex = i; - } - if ((offset < end) && (offsets[i + 1] >= end)) { - endIndex = i; - break; - } - } - if (endIndex == -1) { - endIndex = offsets.length - 1; - } - final int length = endIndex - startIndex + 1; - final AbstractInsnNode[] result = new AbstractInsnNode[length]; - System.arraycopy(origInstructions, startIndex, result, 0, length); - return result; - } - - /** - * Searches for a regex in the instruction list and returns the first match. - * - * @param regex - * the regular expression - * @return the matching instructions - */ - public AbstractInsnNode[] find(final String regex) { - try { - final Matcher regexMatcher = Pattern.compile(processRegex(regex), - Pattern.MULTILINE).matcher(insnString); - if (regexMatcher.find()) - return makeResult(regexMatcher.start(), regexMatcher.end()); - } catch (final PatternSyntaxException ex) { - //ignore, they fucked up regex - } - return new AbstractInsnNode[0]; - } - - /** - * Searches a regex in an instruction list and returns all matches. - * - * @param regex - * the regular expression - * @return a list with all sets of matching instructions - */ - public List findAll(final String regex) { - final List results = new ArrayList(); - try { - final Matcher regexMatcher = Pattern.compile(processRegex(regex), - Pattern.MULTILINE).matcher(insnString); - while (regexMatcher.find()) { - results.add(makeResult(regexMatcher.start(), regexMatcher.end())); - } - } catch (final PatternSyntaxException ex) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex); - } - return results; - } - - /** - * Searches for a regex in the instruction list and returns all groups for - * the first match. - * - * @param regex - * the regular expression - * @return the groups with matching instructions - */ - public AbstractInsnNode[][] findGroups(final String regex) { - try { - final Matcher regexMatcher = Pattern.compile(processRegex(regex), - Pattern.MULTILINE).matcher(insnString); - if (regexMatcher.find()) { - final AbstractInsnNode[][] result = new AbstractInsnNode[regexMatcher - .groupCount() + 1][0]; - for (int i = 0; i <= regexMatcher.groupCount(); i++) { - result[i] = makeResult(regexMatcher.start(i), - regexMatcher.end(i)); - } - return result; - } - } catch (final PatternSyntaxException ex) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex); - } - return new AbstractInsnNode[0][0]; - } - - /** - * Searches for a regex in the instruction list and returns all groups for - * all matches. - * - * @param regex - * the regular expression - * @return a list with all sets of groups with matching instructions - */ - public List findAllGroups(final String regex) { - final List results = new ArrayList(); - try { - final Matcher regexMatcher = Pattern.compile(processRegex(regex), - Pattern.MULTILINE).matcher(insnString); - if (regexMatcher.find()) { - final AbstractInsnNode[][] result = new AbstractInsnNode[regexMatcher - .groupCount() + 1][0]; - for (int i = 0; i <= regexMatcher.groupCount(); i++) { - result[i] = makeResult(regexMatcher.start(i), - regexMatcher.end(i)); - } - results.add(result); - } - } catch (final PatternSyntaxException ex) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex); - } - return results; - } - -} diff --git a/src/main/resources/Krakatau-8.zip b/src/main/resources/Krakatau-8.zip deleted file mode 100644 index 02e1d351..00000000 Binary files a/src/main/resources/Krakatau-8.zip and /dev/null differ diff --git a/src/main/resources/LICENSES/ASM.txt b/src/main/resources/LICENSES/ASM.txt deleted file mode 100644 index 7676ba54..00000000 --- a/src/main/resources/LICENSES/ASM.txt +++ /dev/null @@ -1,29 +0,0 @@ -Copyright (c) 2000-2011 INRIA, France Telecom -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/src/main/resources/LICENSES/Apache License 2.0.txt b/src/main/resources/LICENSES/Apache License 2.0.txt deleted file mode 100644 index 7a4a3ea2..00000000 --- a/src/main/resources/LICENSES/Apache License 2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/src/main/resources/LICENSES/ByteAnalysis.txt b/src/main/resources/LICENSES/ByteAnalysis.txt deleted file mode 100644 index 6f942c08..00000000 --- a/src/main/resources/LICENSES/ByteAnalysis.txt +++ /dev/null @@ -1 +0,0 @@ -NONE WHAT THE FUCK BIBL > https://github.com/TheBiblMan/Byte-Engineer-2 \ No newline at end of file diff --git a/src/main/resources/LICENSES/CFR.txt b/src/main/resources/LICENSES/CFR.txt deleted file mode 100644 index 55ad3e4f..00000000 --- a/src/main/resources/LICENSES/CFR.txt +++ /dev/null @@ -1,21 +0,0 @@ -Sourced from The MIT License (MIT) - -Copyright (c) 2011-2014 Lee Benfield - http://www.benf.org/other/cfr - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/src/main/resources/LICENSES/GPLv3.txt b/src/main/resources/LICENSES/GPLv3.txt deleted file mode 100644 index 16405446..00000000 --- a/src/main/resources/LICENSES/GPLv3.txt +++ /dev/null @@ -1,676 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - JD-GUI, a standalone graphical utility that displays Java sources from - CLASS files - Copyright (C) 2008-2015 Emmanuel Dupuy - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - JD-GUI Copyright (C) 2008-2015 Emmanuel Dupuy - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. \ No newline at end of file diff --git a/src/main/resources/LICENSES/JGraphX.txt b/src/main/resources/LICENSES/JGraphX.txt deleted file mode 100644 index fdb59b00..00000000 --- a/src/main/resources/LICENSES/JGraphX.txt +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2001-2014, JGraph Ltd -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the JGraph nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL JGRAPH BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/src/main/resources/LICENSES/Janino.txt b/src/main/resources/LICENSES/Janino.txt deleted file mode 100644 index a37bab2c..00000000 --- a/src/main/resources/LICENSES/Janino.txt +++ /dev/null @@ -1,30 +0,0 @@ -Janino - An embedded Java[TM] compiler - -Copyright (c) 2001-2007, Arno Unkrig -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials - provided with the distribution. - 3. The name of the author may not be used to endorse or promote - products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/src/main/resources/LICENSES/RSyntaxTextArea.txt b/src/main/resources/LICENSES/RSyntaxTextArea.txt deleted file mode 100644 index f0f2d4c7..00000000 --- a/src/main/resources/LICENSES/RSyntaxTextArea.txt +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2012, Robert Futrell -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the author nor the names of its contributors may - be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/src/main/resources/LICENSES/license.txt b/src/main/resources/LICENSES/license.txt deleted file mode 100644 index 8c94be34..00000000 --- a/src/main/resources/LICENSES/license.txt +++ /dev/null @@ -1,12 +0,0 @@ -imgscalr -> Apache License 2.0 -commons-cli -> Apache License 2.0 -commons-codec -> Apache License 2.0 -commons-lang3 -> Apache License 2.0 -commons-io -> Apache License 2.0 -isoparser -> Apache License 2.0 -zt-zip -> Apache License 2.0 -Procyon -> Apache License 2.0 -JD-GUI -> GPLv3 -apktool -> Apache License 2.0 -fernflower -> Apache License 2.0 -dex2jar -> Apache License 2.0 \ No newline at end of file diff --git a/src/main/resources/LICENSES/smali.txt b/src/main/resources/LICENSES/smali.txt deleted file mode 100644 index 4ce4514b..00000000 --- a/src/main/resources/LICENSES/smali.txt +++ /dev/null @@ -1,85 +0,0 @@ -The majority of smali/baksmali is written and copyrighted by me (Ben Gruver) -and released under the following license: - -******************************************************************************* -Copyright (c) 2010 Ben Gruver (JesusFreke) -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -******************************************************************************* - - -Unless otherwise stated in the code/commit message, any changes with the -committer of bgruv@google.com is copyrighted by Google Inc. and released -under the following license: - -******************************************************************************* -Copyright 2011, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -******************************************************************************* - - -Various portions of the code are taken from the Android Open Source Project, -and are used in accordance with the following license: - -******************************************************************************* -Copyright (C) 2007 The Android Open Source Project - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -******************************************************************************* \ No newline at end of file diff --git a/src/main/resources/enjarify-2.zip b/src/main/resources/enjarify-2.zip deleted file mode 100644 index 1d0b3cd6..00000000 Binary files a/src/main/resources/enjarify-2.zip and /dev/null differ diff --git a/src/me/konloch/kontainer/io/DiskReader.java b/src/me/konloch/kontainer/io/DiskReader.java new file mode 100644 index 00000000..c591d08d --- /dev/null +++ b/src/me/konloch/kontainer/io/DiskReader.java @@ -0,0 +1,106 @@ +package me.konloch.kontainer.io; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; + +/** + * Used to load from the disk, optional caching + * + * @author Konloch + * + */ + +public class DiskReader { + + public static Random random = new Random(); + public static HashMap> map = new HashMap>(); + + /** + * Used to load from file, allows caching + */ + public synchronized static ArrayList loadArrayList(String fileName, + boolean cache) { + ArrayList array = new ArrayList(); + if (!map.containsKey(fileName)) { + try { + File file = new File(fileName); + if (!file.exists()) // doesnt exist, return empty + return array; + + BufferedReader reader = new BufferedReader(new FileReader(file)); + String add; + + while ((add = reader.readLine()) != null) + array.add(add); + + reader.close(); + + if (cache) + map.put(fileName, array); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + array = map.get(fileName); + } + + return array; + + } + + /** + * Used to load from file + */ + public synchronized static String loadAsString(String fileName) + throws Exception { + String s = ""; + + BufferedReader reader = new BufferedReader(new FileReader(new File( + fileName))); + String add; + + while ((add = reader.readLine()) != null) + s += add + System.getProperty("line.separator"); + + reader.close(); + + return s; + } + + /** + * Used to load a string via line number lineNumber = -1 means random. + */ + public static String loadString(String fileName, int lineNumber, + boolean cache) throws Exception { + + ArrayList array; + if (!map.containsKey(fileName)) { + array = new ArrayList(); + File file = new File(fileName); + + BufferedReader reader = new BufferedReader(new FileReader(file)); + String add; + + while ((add = reader.readLine()) != null) + array.add(add); + + reader.close(); + + if (cache) + map.put(fileName, array); + } else { + array = map.get(fileName); + } + + if (lineNumber == -1) { + int size = array.size(); + return array.get(random.nextInt(size)); + } else + return array.get(lineNumber); + } + +} \ No newline at end of file diff --git a/src/me/konloch/kontainer/io/DiskWriter.java b/src/me/konloch/kontainer/io/DiskWriter.java new file mode 100644 index 00000000..2db4f601 --- /dev/null +++ b/src/me/konloch/kontainer/io/DiskWriter.java @@ -0,0 +1,200 @@ +package me.konloch.kontainer.io; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; + +/** + * This method will save to disk + * + * @author Konloch + * + */ + +public class DiskWriter { + + /** + * Used to insert a difference string with preserving the file extension + * + * @param fileName + * The file name + * @param difference + * Normally an integer + * @return The filename with the difference inserted and the file extension + * preserved + */ + public static String insertFileName(String fileName, String difference) { + String[] babe = fileName.split("\\."); + int count = 0; + int math = babe.length; + String m = ""; + + for (String s2 : babe) { + m += s2; + if (math - 2 == count) + m += difference + "."; + else if (math - 1 != count) + m += "."; + count++; + } + + return m; + } + + /** + * Writes a new line to the file, if it doesn't exist it will automatically + * create it. + * + * @param filename + * @param fileContents + * @param debug + */ + public static synchronized void writeNewLine(String filename, + byte[] fileContents, boolean debug) { + PrintWriter writer = null; + String original = filename; + int counter = 0; + + boolean saved = false; + while (!saved) { + try { + writer = new PrintWriter(new BufferedWriter(new FileWriter( + filename, true))); + writer.println(fileContents); + if (debug) + System.out.println("Saved " + filename + " to disk"); + saved = true; + } catch (Exception e) { + if (debug) + System.out.println("Failed saving, trying to save as " + + filename); + if (original.contains(".")) { + filename = insertFileName(original, "" + counter); + } else + filename = original + counter; + counter++; + } + } + writer.close(); + } + + /** + * Writes a string to the file + * + * @param filename + * @param lineToWrite + * @param debug + */ + public static synchronized void writeNewLine(String filename, + String lineToWrite, boolean debug) { + PrintWriter writer = null; + String original = filename; + int counter = 0; + + boolean saved = false; + while (!saved) { + try { + writer = new PrintWriter(new BufferedWriter(new FileWriter( + filename, true))); + writer.println(lineToWrite); + if (debug) + System.out.println("Saved " + filename + ">" + lineToWrite + + " to disk"); + saved = true; + } catch (Exception e) { + if (debug) + System.out.println("Failed saving, trying to save as " + + filename); + if (original.contains(".")) { + filename = insertFileName(original, "" + counter); + } else + filename = original + counter; + counter++; + } + } + writer.close(); + } + + /** + * Deletes the original file if it exists, then writes the fileContents[] to + * the file. + * + * @param filename + * @param fileContents + * @param debug + */ + public static synchronized void replaceFile(String filename, + byte[] fileContents, boolean debug) { + File f = new File(filename); + if (f.exists()) + f.delete(); + PrintWriter writer = null; + String original = filename; + int counter = 0; + + boolean saved = false; + while (!saved) { + try { + writer = new PrintWriter(new BufferedWriter(new FileWriter( + filename, true))); + writer.println(fileContents); + if (debug) + System.out.println("Saved " + filename + " to disk"); + saved = true; + } catch (Exception e) { + if (debug) + System.out.println("Failed saving, trying to save as " + + filename); + if (original.contains(".")) { + filename = insertFileName(original, "" + counter); + } else + filename = original + counter; + counter++; + } + } + writer.close(); + } + + /** + * Deletes the original file if it exists, then writes the lineToWrite to + * the file. + * + * @param filename + * @param lineToWrite + * @param debug + */ + public static synchronized void replaceFile(String filename, + String lineToWrite, boolean debug) { + File f = new File(filename); + if (f.exists()) + f.delete(); + PrintWriter writer = null; + String original = filename; + int counter = 0; + + boolean saved = false; + while (!saved) { + try { + writer = new PrintWriter(new BufferedWriter(new FileWriter( + filename, true))); + writer.println(lineToWrite); + if (debug) + System.out.println("Saved " + filename + ">" + lineToWrite + + " to disk"); + saved = true; + } catch (Exception e) { + if (debug) + System.out.println("Failed saving, trying to save as " + + filename + "_"); + if (original.contains(".")) { + filename = insertFileName(original, "" + counter); + } else + filename = original + counter; + counter++; + } + } + writer.close(); + } + +} \ No newline at end of file diff --git a/src/main/java/me/konloch/kontainer/io/HTTPRequest.java b/src/me/konloch/kontainer/io/HTTPRequest.java similarity index 100% rename from src/main/java/me/konloch/kontainer/io/HTTPRequest.java rename to src/me/konloch/kontainer/io/HTTPRequest.java diff --git a/src/main/java/org/apache/commons/cli/AlreadySelectedException.java b/src/org/apache/commons/cli/AlreadySelectedException.java similarity index 100% rename from src/main/java/org/apache/commons/cli/AlreadySelectedException.java rename to src/org/apache/commons/cli/AlreadySelectedException.java diff --git a/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java b/src/org/apache/commons/cli/AmbiguousOptionException.java similarity index 100% rename from src/main/java/org/apache/commons/cli/AmbiguousOptionException.java rename to src/org/apache/commons/cli/AmbiguousOptionException.java diff --git a/src/main/java/org/apache/commons/cli/BasicParser.java b/src/org/apache/commons/cli/BasicParser.java similarity index 100% rename from src/main/java/org/apache/commons/cli/BasicParser.java rename to src/org/apache/commons/cli/BasicParser.java diff --git a/src/main/java/org/apache/commons/cli/CommandLine.java b/src/org/apache/commons/cli/CommandLine.java similarity index 98% rename from src/main/java/org/apache/commons/cli/CommandLine.java rename to src/org/apache/commons/cli/CommandLine.java index adf9ab24..bac7bcd1 100644 --- a/src/main/java/org/apache/commons/cli/CommandLine.java +++ b/src/org/apache/commons/cli/CommandLine.java @@ -18,7 +18,12 @@ package org.apache.commons.cli; import java.io.Serializable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; /** * Represents list of arguments parsed against a {@link Options} descriptor. diff --git a/src/main/java/org/apache/commons/cli/CommandLineParser.java b/src/org/apache/commons/cli/CommandLineParser.java similarity index 100% rename from src/main/java/org/apache/commons/cli/CommandLineParser.java rename to src/org/apache/commons/cli/CommandLineParser.java diff --git a/src/main/java/org/apache/commons/cli/DefaultParser.java b/src/org/apache/commons/cli/DefaultParser.java similarity index 100% rename from src/main/java/org/apache/commons/cli/DefaultParser.java rename to src/org/apache/commons/cli/DefaultParser.java diff --git a/src/main/java/org/apache/commons/cli/GnuParser.java b/src/org/apache/commons/cli/GnuParser.java similarity index 100% rename from src/main/java/org/apache/commons/cli/GnuParser.java rename to src/org/apache/commons/cli/GnuParser.java diff --git a/src/main/java/org/apache/commons/cli/HelpFormatter.java b/src/org/apache/commons/cli/HelpFormatter.java similarity index 99% rename from src/main/java/org/apache/commons/cli/HelpFormatter.java rename to src/org/apache/commons/cli/HelpFormatter.java index 9420bd9a..9d9bbddd 100644 --- a/src/main/java/org/apache/commons/cli/HelpFormatter.java +++ b/src/org/apache/commons/cli/HelpFormatter.java @@ -17,8 +17,18 @@ package org.apache.commons.cli; -import java.io.*; -import java.util.*; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.Serializable; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; /** * A formatter of help messages for command line options. diff --git a/src/main/java/org/apache/commons/cli/MissingArgumentException.java b/src/org/apache/commons/cli/MissingArgumentException.java similarity index 100% rename from src/main/java/org/apache/commons/cli/MissingArgumentException.java rename to src/org/apache/commons/cli/MissingArgumentException.java diff --git a/src/main/java/org/apache/commons/cli/MissingOptionException.java b/src/org/apache/commons/cli/MissingOptionException.java similarity index 100% rename from src/main/java/org/apache/commons/cli/MissingOptionException.java rename to src/org/apache/commons/cli/MissingOptionException.java index 70f98071..b7df24e0 100644 --- a/src/main/java/org/apache/commons/cli/MissingOptionException.java +++ b/src/org/apache/commons/cli/MissingOptionException.java @@ -17,8 +17,8 @@ package org.apache.commons.cli; -import java.util.Iterator; import java.util.List; +import java.util.Iterator; /** * Thrown when a required option has not been provided. diff --git a/src/main/java/org/apache/commons/cli/Option.java b/src/org/apache/commons/cli/Option.java similarity index 100% rename from src/main/java/org/apache/commons/cli/Option.java rename to src/org/apache/commons/cli/Option.java diff --git a/src/main/java/org/apache/commons/cli/OptionBuilder.java b/src/org/apache/commons/cli/OptionBuilder.java similarity index 100% rename from src/main/java/org/apache/commons/cli/OptionBuilder.java rename to src/org/apache/commons/cli/OptionBuilder.java diff --git a/src/main/java/org/apache/commons/cli/OptionGroup.java b/src/org/apache/commons/cli/OptionGroup.java similarity index 100% rename from src/main/java/org/apache/commons/cli/OptionGroup.java rename to src/org/apache/commons/cli/OptionGroup.java diff --git a/src/main/java/org/apache/commons/cli/OptionValidator.java b/src/org/apache/commons/cli/OptionValidator.java similarity index 98% rename from src/main/java/org/apache/commons/cli/OptionValidator.java rename to src/org/apache/commons/cli/OptionValidator.java index 88c3c978..659ee43c 100644 --- a/src/main/java/org/apache/commons/cli/OptionValidator.java +++ b/src/org/apache/commons/cli/OptionValidator.java @@ -25,9 +25,6 @@ package org.apache.commons.cli; */ final class OptionValidator { - private OptionValidator() { - } - /** * Validates whether opt is a permissible Option * shortOpt. The rules that specify if the opt diff --git a/src/main/java/org/apache/commons/cli/Options.java b/src/org/apache/commons/cli/Options.java similarity index 97% rename from src/main/java/org/apache/commons/cli/Options.java rename to src/org/apache/commons/cli/Options.java index b60ef3d6..ba0af568 100644 --- a/src/main/java/org/apache/commons/cli/Options.java +++ b/src/org/apache/commons/cli/Options.java @@ -18,7 +18,14 @@ package org.apache.commons.cli; import java.io.Serializable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** * Main entry-point into the library. diff --git a/src/main/java/org/apache/commons/cli/ParseException.java b/src/org/apache/commons/cli/ParseException.java similarity index 100% rename from src/main/java/org/apache/commons/cli/ParseException.java rename to src/org/apache/commons/cli/ParseException.java diff --git a/src/main/java/org/apache/commons/cli/Parser.java b/src/org/apache/commons/cli/Parser.java similarity index 98% rename from src/main/java/org/apache/commons/cli/Parser.java rename to src/org/apache/commons/cli/Parser.java index 15f486a7..00252756 100644 --- a/src/main/java/org/apache/commons/cli/Parser.java +++ b/src/org/apache/commons/cli/Parser.java @@ -17,7 +17,12 @@ package org.apache.commons.cli; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.List; +import java.util.ListIterator; +import java.util.Properties; /** * Parser creates {@link CommandLine}s. diff --git a/src/main/java/org/apache/commons/cli/PatternOptionBuilder.java b/src/org/apache/commons/cli/PatternOptionBuilder.java similarity index 99% rename from src/main/java/org/apache/commons/cli/PatternOptionBuilder.java rename to src/org/apache/commons/cli/PatternOptionBuilder.java index 83373223..6a5c4cee 100644 --- a/src/main/java/org/apache/commons/cli/PatternOptionBuilder.java +++ b/src/org/apache/commons/cli/PatternOptionBuilder.java @@ -87,9 +87,6 @@ public class PatternOptionBuilder /** URL class */ public static final Class URL_VALUE = URL.class; - private PatternOptionBuilder() { - } - /** * Retrieve the class that ch represents. * diff --git a/src/main/java/org/apache/commons/cli/PosixParser.java b/src/org/apache/commons/cli/PosixParser.java similarity index 100% rename from src/main/java/org/apache/commons/cli/PosixParser.java rename to src/org/apache/commons/cli/PosixParser.java diff --git a/src/main/java/org/apache/commons/cli/TypeHandler.java b/src/org/apache/commons/cli/TypeHandler.java similarity index 99% rename from src/main/java/org/apache/commons/cli/TypeHandler.java rename to src/org/apache/commons/cli/TypeHandler.java index 3c9b7776..cc91274c 100644 --- a/src/main/java/org/apache/commons/cli/TypeHandler.java +++ b/src/org/apache/commons/cli/TypeHandler.java @@ -18,8 +18,10 @@ package org.apache.commons.cli; import java.io.File; + import java.net.MalformedURLException; import java.net.URL; + import java.util.Date; /** @@ -32,9 +34,6 @@ import java.util.Date; */ public class TypeHandler { - private TypeHandler() { - } - /** * Returns the Object of type obj * with the value of str. diff --git a/src/main/java/org/apache/commons/cli/UnrecognizedOptionException.java b/src/org/apache/commons/cli/UnrecognizedOptionException.java similarity index 100% rename from src/main/java/org/apache/commons/cli/UnrecognizedOptionException.java rename to src/org/apache/commons/cli/UnrecognizedOptionException.java diff --git a/src/main/java/org/apache/commons/cli/Util.java b/src/org/apache/commons/cli/Util.java similarity index 98% rename from src/main/java/org/apache/commons/cli/Util.java rename to src/org/apache/commons/cli/Util.java index 40841007..89cf5ff3 100644 --- a/src/main/java/org/apache/commons/cli/Util.java +++ b/src/org/apache/commons/cli/Util.java @@ -24,9 +24,6 @@ package org.apache.commons.cli; */ final class Util { - private Util() { - } - /** * Remove the hyphens from the beginning of str and * return the new String. diff --git a/src/org/apache/commons/cli/overview.html b/src/org/apache/commons/cli/overview.html new file mode 100644 index 00000000..3eab8062 --- /dev/null +++ b/src/org/apache/commons/cli/overview.html @@ -0,0 +1,43 @@ + + + +

Commons CLI -- version 1.3

+ +

The commons-cli package aides in parsing command-line arguments.

+ +

Allow command-line arguments to be parsed against a descriptor of + valid options (long and short), potentially with arguments.

+ +

command-line arguments may be of the typical String[] + form, but also may be a java.util.List. Indexes allow + for parsing only a portion of the command-line. Also, functionality + for parsing the command-line in phases is built in, allowing for + 'cvs-style' command-lines, where some global options are specified + before a 'command' argument, and command-specific options are + specified after the command argument: + + +

+        myApp -p <port> command -p <printer>
+    
+ + + +

The homepage for the project is + Apache Commons/ + diff --git a/src/main/java/org/apache/commons/cli/package-info.java b/src/org/apache/commons/cli/package-info.java similarity index 100% rename from src/main/java/org/apache/commons/cli/package-info.java rename to src/org/apache/commons/cli/package-info.java diff --git a/src/main/java/org/apache/commons/codec/BinaryDecoder.java b/src/org/apache/commons/codec/BinaryDecoder.java similarity index 100% rename from src/main/java/org/apache/commons/codec/BinaryDecoder.java rename to src/org/apache/commons/codec/BinaryDecoder.java diff --git a/src/main/java/org/apache/commons/codec/BinaryEncoder.java b/src/org/apache/commons/codec/BinaryEncoder.java similarity index 100% rename from src/main/java/org/apache/commons/codec/BinaryEncoder.java rename to src/org/apache/commons/codec/BinaryEncoder.java diff --git a/src/main/java/org/apache/commons/codec/CharEncoding.java b/src/org/apache/commons/codec/CharEncoding.java similarity index 100% rename from src/main/java/org/apache/commons/codec/CharEncoding.java rename to src/org/apache/commons/codec/CharEncoding.java diff --git a/src/main/java/org/apache/commons/codec/Charsets.java b/src/org/apache/commons/codec/Charsets.java similarity index 100% rename from src/main/java/org/apache/commons/codec/Charsets.java rename to src/org/apache/commons/codec/Charsets.java diff --git a/src/main/java/org/apache/commons/codec/Decoder.java b/src/org/apache/commons/codec/Decoder.java similarity index 100% rename from src/main/java/org/apache/commons/codec/Decoder.java rename to src/org/apache/commons/codec/Decoder.java diff --git a/src/main/java/org/apache/commons/codec/DecoderException.java b/src/org/apache/commons/codec/DecoderException.java similarity index 100% rename from src/main/java/org/apache/commons/codec/DecoderException.java rename to src/org/apache/commons/codec/DecoderException.java diff --git a/src/main/java/org/apache/commons/codec/Encoder.java b/src/org/apache/commons/codec/Encoder.java similarity index 100% rename from src/main/java/org/apache/commons/codec/Encoder.java rename to src/org/apache/commons/codec/Encoder.java diff --git a/src/main/java/org/apache/commons/codec/EncoderException.java b/src/org/apache/commons/codec/EncoderException.java similarity index 100% rename from src/main/java/org/apache/commons/codec/EncoderException.java rename to src/org/apache/commons/codec/EncoderException.java diff --git a/src/main/java/org/apache/commons/codec/StringDecoder.java b/src/org/apache/commons/codec/StringDecoder.java similarity index 100% rename from src/main/java/org/apache/commons/codec/StringDecoder.java rename to src/org/apache/commons/codec/StringDecoder.java diff --git a/src/main/java/org/apache/commons/codec/StringEncoder.java b/src/org/apache/commons/codec/StringEncoder.java similarity index 100% rename from src/main/java/org/apache/commons/codec/StringEncoder.java rename to src/org/apache/commons/codec/StringEncoder.java diff --git a/src/main/java/org/apache/commons/codec/StringEncoderComparator.java b/src/org/apache/commons/codec/StringEncoderComparator.java similarity index 100% rename from src/main/java/org/apache/commons/codec/StringEncoderComparator.java rename to src/org/apache/commons/codec/StringEncoderComparator.java diff --git a/src/main/java/org/apache/commons/codec/binary/Base32.java b/src/org/apache/commons/codec/binary/Base32.java similarity index 100% rename from src/main/java/org/apache/commons/codec/binary/Base32.java rename to src/org/apache/commons/codec/binary/Base32.java diff --git a/src/main/java/org/apache/commons/codec/binary/Base32InputStream.java b/src/org/apache/commons/codec/binary/Base32InputStream.java similarity index 100% rename from src/main/java/org/apache/commons/codec/binary/Base32InputStream.java rename to src/org/apache/commons/codec/binary/Base32InputStream.java diff --git a/src/main/java/org/apache/commons/codec/binary/Base32OutputStream.java b/src/org/apache/commons/codec/binary/Base32OutputStream.java similarity index 100% rename from src/main/java/org/apache/commons/codec/binary/Base32OutputStream.java rename to src/org/apache/commons/codec/binary/Base32OutputStream.java diff --git a/src/main/java/org/apache/commons/codec/binary/Base64.java b/src/org/apache/commons/codec/binary/Base64.java similarity index 100% rename from src/main/java/org/apache/commons/codec/binary/Base64.java rename to src/org/apache/commons/codec/binary/Base64.java diff --git a/src/main/java/org/apache/commons/codec/binary/Base64InputStream.java b/src/org/apache/commons/codec/binary/Base64InputStream.java similarity index 100% rename from src/main/java/org/apache/commons/codec/binary/Base64InputStream.java rename to src/org/apache/commons/codec/binary/Base64InputStream.java diff --git a/src/main/java/org/apache/commons/codec/binary/Base64OutputStream.java b/src/org/apache/commons/codec/binary/Base64OutputStream.java similarity index 100% rename from src/main/java/org/apache/commons/codec/binary/Base64OutputStream.java rename to src/org/apache/commons/codec/binary/Base64OutputStream.java diff --git a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java b/src/org/apache/commons/codec/binary/BaseNCodec.java similarity index 100% rename from src/main/java/org/apache/commons/codec/binary/BaseNCodec.java rename to src/org/apache/commons/codec/binary/BaseNCodec.java index e27d0be7..8d73442a 100644 --- a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java +++ b/src/org/apache/commons/codec/binary/BaseNCodec.java @@ -17,13 +17,13 @@ package org.apache.commons.codec.binary; +import java.util.Arrays; + import org.apache.commons.codec.BinaryDecoder; import org.apache.commons.codec.BinaryEncoder; import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.EncoderException; -import java.util.Arrays; - /** * Abstract superclass for Base-N encoders and decoders. * diff --git a/src/main/java/org/apache/commons/codec/binary/BaseNCodecInputStream.java b/src/org/apache/commons/codec/binary/BaseNCodecInputStream.java similarity index 100% rename from src/main/java/org/apache/commons/codec/binary/BaseNCodecInputStream.java rename to src/org/apache/commons/codec/binary/BaseNCodecInputStream.java index 9448768d..30b2cb3a 100644 --- a/src/main/java/org/apache/commons/codec/binary/BaseNCodecInputStream.java +++ b/src/org/apache/commons/codec/binary/BaseNCodecInputStream.java @@ -17,13 +17,13 @@ package org.apache.commons.codec.binary; -import org.apache.commons.codec.binary.BaseNCodec.Context; +import static org.apache.commons.codec.binary.BaseNCodec.EOF; import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; -import static org.apache.commons.codec.binary.BaseNCodec.EOF; +import org.apache.commons.codec.binary.BaseNCodec.Context; /** * Abstract superclass for Base-N input streams. diff --git a/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java b/src/org/apache/commons/codec/binary/BaseNCodecOutputStream.java similarity index 100% rename from src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java rename to src/org/apache/commons/codec/binary/BaseNCodecOutputStream.java index aa485e66..90d2f535 100644 --- a/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java +++ b/src/org/apache/commons/codec/binary/BaseNCodecOutputStream.java @@ -17,13 +17,13 @@ package org.apache.commons.codec.binary; -import org.apache.commons.codec.binary.BaseNCodec.Context; +import static org.apache.commons.codec.binary.BaseNCodec.EOF; import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; -import static org.apache.commons.codec.binary.BaseNCodec.EOF; +import org.apache.commons.codec.binary.BaseNCodec.Context; /** * Abstract superclass for Base-N output streams. diff --git a/src/main/java/org/apache/commons/codec/binary/BinaryCodec.java b/src/org/apache/commons/codec/binary/BinaryCodec.java similarity index 100% rename from src/main/java/org/apache/commons/codec/binary/BinaryCodec.java rename to src/org/apache/commons/codec/binary/BinaryCodec.java diff --git a/src/main/java/org/apache/commons/codec/binary/CharSequenceUtils.java b/src/org/apache/commons/codec/binary/CharSequenceUtils.java similarity index 98% rename from src/main/java/org/apache/commons/codec/binary/CharSequenceUtils.java rename to src/org/apache/commons/codec/binary/CharSequenceUtils.java index a693c0e8..b886a826 100644 --- a/src/main/java/org/apache/commons/codec/binary/CharSequenceUtils.java +++ b/src/org/apache/commons/codec/binary/CharSequenceUtils.java @@ -29,9 +29,6 @@ package org.apache.commons.codec.binary; */ public class CharSequenceUtils { - private CharSequenceUtils() { - } - /** * Green implementation of regionMatches. * diff --git a/src/main/java/org/apache/commons/codec/binary/Hex.java b/src/org/apache/commons/codec/binary/Hex.java similarity index 98% rename from src/main/java/org/apache/commons/codec/binary/Hex.java rename to src/org/apache/commons/codec/binary/Hex.java index 1f6d1f75..51857fe0 100644 --- a/src/main/java/org/apache/commons/codec/binary/Hex.java +++ b/src/org/apache/commons/codec/binary/Hex.java @@ -17,11 +17,16 @@ package org.apache.commons.codec.binary; -import org.apache.commons.codec.*; - import java.nio.ByteBuffer; import java.nio.charset.Charset; +import org.apache.commons.codec.BinaryDecoder; +import org.apache.commons.codec.BinaryEncoder; +import org.apache.commons.codec.CharEncoding; +import org.apache.commons.codec.Charsets; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.EncoderException; + /** * Converts hexadecimal Strings. The charset used for certain operation can be set, the default is set in * {@link #DEFAULT_CHARSET_NAME} diff --git a/src/main/java/org/apache/commons/codec/binary/StringUtils.java b/src/org/apache/commons/codec/binary/StringUtils.java similarity index 99% rename from src/main/java/org/apache/commons/codec/binary/StringUtils.java rename to src/org/apache/commons/codec/binary/StringUtils.java index ec24811c..84a2a727 100644 --- a/src/main/java/org/apache/commons/codec/binary/StringUtils.java +++ b/src/org/apache/commons/codec/binary/StringUtils.java @@ -17,13 +17,13 @@ package org.apache.commons.codec.binary; -import org.apache.commons.codec.CharEncoding; -import org.apache.commons.codec.Charsets; - import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.nio.charset.Charset; +import org.apache.commons.codec.CharEncoding; +import org.apache.commons.codec.Charsets; + /** * Converts String to and from bytes using the encodings required by the Java specification. These encodings are * specified in @@ -38,9 +38,6 @@ import java.nio.charset.Charset; */ public class StringUtils { - private StringUtils() { - } - /** *

* Compares two CharSequences, returning true if they represent equal sequences of characters. diff --git a/src/org/apache/commons/codec/binary/package.html b/src/org/apache/commons/codec/binary/package.html new file mode 100644 index 00000000..13345ece --- /dev/null +++ b/src/org/apache/commons/codec/binary/package.html @@ -0,0 +1,21 @@ + + + + Base64, Base32, Binary, and Hexadecimal String encoding and decoding. + + diff --git a/src/main/java/org/apache/commons/codec/digest/B64.java b/src/org/apache/commons/codec/digest/B64.java similarity index 100% rename from src/main/java/org/apache/commons/codec/digest/B64.java rename to src/org/apache/commons/codec/digest/B64.java diff --git a/src/main/java/org/apache/commons/codec/digest/Crypt.java b/src/org/apache/commons/codec/digest/Crypt.java similarity index 100% rename from src/main/java/org/apache/commons/codec/digest/Crypt.java rename to src/org/apache/commons/codec/digest/Crypt.java diff --git a/src/main/java/org/apache/commons/codec/digest/DigestUtils.java b/src/org/apache/commons/codec/digest/DigestUtils.java similarity index 99% rename from src/main/java/org/apache/commons/codec/digest/DigestUtils.java rename to src/org/apache/commons/codec/digest/DigestUtils.java index 8e9a1ebc..f5dc9a35 100644 --- a/src/main/java/org/apache/commons/codec/digest/DigestUtils.java +++ b/src/org/apache/commons/codec/digest/DigestUtils.java @@ -17,15 +17,15 @@ package org.apache.commons.codec.digest; -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.codec.binary.StringUtils; - import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; +import org.apache.commons.codec.binary.Hex; +import org.apache.commons.codec.binary.StringUtils; + /** * Operations to simplify common {@link java.security.MessageDigest} tasks. * This class is immutable and thread-safe. @@ -36,9 +36,6 @@ public class DigestUtils { private static final int STREAM_BUFFER_LENGTH = 1024; - private DigestUtils() { - } - /** * Read through an ByteBuffer and returns the digest for the data * diff --git a/src/main/java/org/apache/commons/codec/digest/HmacAlgorithms.java b/src/org/apache/commons/codec/digest/HmacAlgorithms.java similarity index 100% rename from src/main/java/org/apache/commons/codec/digest/HmacAlgorithms.java rename to src/org/apache/commons/codec/digest/HmacAlgorithms.java diff --git a/src/main/java/org/apache/commons/codec/digest/HmacUtils.java b/src/org/apache/commons/codec/digest/HmacUtils.java similarity index 99% rename from src/main/java/org/apache/commons/codec/digest/HmacUtils.java rename to src/org/apache/commons/codec/digest/HmacUtils.java index 9e382a6a..425db4ab 100644 --- a/src/main/java/org/apache/commons/codec/digest/HmacUtils.java +++ b/src/org/apache/commons/codec/digest/HmacUtils.java @@ -17,17 +17,18 @@ package org.apache.commons.codec.digest; -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.codec.binary.StringUtils; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; import java.io.IOException; import java.io.InputStream; import java.security.InvalidKeyException; import java.security.Key; import java.security.NoSuchAlgorithmException; +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; + +import org.apache.commons.codec.binary.Hex; +import org.apache.commons.codec.binary.StringUtils; + /** * Simplifies common {@link javax.crypto.Mac} tasks. This class is immutable and thread-safe. * @@ -44,9 +45,6 @@ public final class HmacUtils { private static final int STREAM_BUFFER_LENGTH = 1024; - private HmacUtils() { - } - /** * Returns an initialized Mac for the HmacMD5 algorithm. *

diff --git a/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java b/src/org/apache/commons/codec/digest/Md5Crypt.java similarity index 100% rename from src/main/java/org/apache/commons/codec/digest/Md5Crypt.java rename to src/org/apache/commons/codec/digest/Md5Crypt.java index 695cbd49..09625496 100644 --- a/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java +++ b/src/org/apache/commons/codec/digest/Md5Crypt.java @@ -16,13 +16,13 @@ */ package org.apache.commons.codec.digest; -import org.apache.commons.codec.Charsets; - import java.security.MessageDigest; import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.codec.Charsets; + /** * The libc crypt() "$1$" and Apache "$apr1$" MD5-based hash algorithm. *

diff --git a/src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java b/src/org/apache/commons/codec/digest/MessageDigestAlgorithms.java similarity index 100% rename from src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java rename to src/org/apache/commons/codec/digest/MessageDigestAlgorithms.java diff --git a/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java b/src/org/apache/commons/codec/digest/Sha2Crypt.java similarity index 100% rename from src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java rename to src/org/apache/commons/codec/digest/Sha2Crypt.java index 7d892f9c..6e568d7e 100644 --- a/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java +++ b/src/org/apache/commons/codec/digest/Sha2Crypt.java @@ -16,14 +16,14 @@ */ package org.apache.commons.codec.digest; -import org.apache.commons.codec.Charsets; - import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.codec.Charsets; + /** * SHA2-based Unix crypt implementation. *

diff --git a/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java b/src/org/apache/commons/codec/digest/UnixCrypt.java similarity index 100% rename from src/main/java/org/apache/commons/codec/digest/UnixCrypt.java rename to src/org/apache/commons/codec/digest/UnixCrypt.java index f428b8b0..151d9c89 100644 --- a/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java +++ b/src/org/apache/commons/codec/digest/UnixCrypt.java @@ -16,10 +16,10 @@ */ package org.apache.commons.codec.digest; -import org.apache.commons.codec.Charsets; - import java.util.Random; +import org.apache.commons.codec.Charsets; + /** * Unix crypt(3) algorithm implementation. *

diff --git a/src/org/apache/commons/codec/digest/package.html b/src/org/apache/commons/codec/digest/package.html new file mode 100644 index 00000000..22cceb4c --- /dev/null +++ b/src/org/apache/commons/codec/digest/package.html @@ -0,0 +1,24 @@ + + + + Simplifies common {@link java.security.MessageDigest} tasks and + includes a libc crypt(3) compatible crypt method that supports DES, + MD5, SHA-256 and SHA-512 based algorithms as well as the Apache + specific "$apr1$" variant. + + diff --git a/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java b/src/org/apache/commons/codec/language/AbstractCaverphone.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java rename to src/org/apache/commons/codec/language/AbstractCaverphone.java diff --git a/src/main/java/org/apache/commons/codec/language/Caverphone.java b/src/org/apache/commons/codec/language/Caverphone.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/Caverphone.java rename to src/org/apache/commons/codec/language/Caverphone.java diff --git a/src/main/java/org/apache/commons/codec/language/Caverphone1.java b/src/org/apache/commons/codec/language/Caverphone1.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/Caverphone1.java rename to src/org/apache/commons/codec/language/Caverphone1.java diff --git a/src/main/java/org/apache/commons/codec/language/Caverphone2.java b/src/org/apache/commons/codec/language/Caverphone2.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/Caverphone2.java rename to src/org/apache/commons/codec/language/Caverphone2.java diff --git a/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java b/src/org/apache/commons/codec/language/ColognePhonetic.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/ColognePhonetic.java rename to src/org/apache/commons/codec/language/ColognePhonetic.java index 1abb214d..01f395c3 100644 --- a/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java +++ b/src/org/apache/commons/codec/language/ColognePhonetic.java @@ -17,11 +17,11 @@ package org.apache.commons.codec.language; +import java.util.Locale; + import org.apache.commons.codec.EncoderException; import org.apache.commons.codec.StringEncoder; -import java.util.Locale; - /** * Encodes a string into a Cologne Phonetic value. *

diff --git a/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java b/src/org/apache/commons/codec/language/DaitchMokotoffSoundex.java similarity index 98% rename from src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java rename to src/org/apache/commons/codec/language/DaitchMokotoffSoundex.java index 7a3f2078..b33dbe83 100644 --- a/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java +++ b/src/org/apache/commons/codec/language/DaitchMokotoffSoundex.java @@ -16,13 +16,22 @@ */ package org.apache.commons.codec.language; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Scanner; +import java.util.Set; + import org.apache.commons.codec.CharEncoding; import org.apache.commons.codec.EncoderException; import org.apache.commons.codec.StringEncoder; -import java.io.InputStream; -import java.util.*; - /** * Encodes a string into a Daitch-Mokotoff Soundex value. *

diff --git a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java b/src/org/apache/commons/codec/language/DoubleMetaphone.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java rename to src/org/apache/commons/codec/language/DoubleMetaphone.java diff --git a/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java b/src/org/apache/commons/codec/language/MatchRatingApproachEncoder.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java rename to src/org/apache/commons/codec/language/MatchRatingApproachEncoder.java index d1fffc6f..95858b43 100644 --- a/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java +++ b/src/org/apache/commons/codec/language/MatchRatingApproachEncoder.java @@ -16,11 +16,11 @@ */ package org.apache.commons.codec.language; +import java.util.Locale; + import org.apache.commons.codec.EncoderException; import org.apache.commons.codec.StringEncoder; -import java.util.Locale; - /** * Match Rating Approach Phonetic Algorithm Developed by Western Airlines in 1977. * diff --git a/src/main/java/org/apache/commons/codec/language/Metaphone.java b/src/org/apache/commons/codec/language/Metaphone.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/Metaphone.java rename to src/org/apache/commons/codec/language/Metaphone.java diff --git a/src/main/java/org/apache/commons/codec/language/Nysiis.java b/src/org/apache/commons/codec/language/Nysiis.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/Nysiis.java rename to src/org/apache/commons/codec/language/Nysiis.java index ff4db54a..14c1505c 100644 --- a/src/main/java/org/apache/commons/codec/language/Nysiis.java +++ b/src/org/apache/commons/codec/language/Nysiis.java @@ -17,11 +17,11 @@ package org.apache.commons.codec.language; +import java.util.regex.Pattern; + import org.apache.commons.codec.EncoderException; import org.apache.commons.codec.StringEncoder; -import java.util.regex.Pattern; - /** * Encodes a string into a NYSIIS value. NYSIIS is an encoding used to relate similar names, but can also be used as a * general purpose scheme to find word with similar phonemes. diff --git a/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java b/src/org/apache/commons/codec/language/RefinedSoundex.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/RefinedSoundex.java rename to src/org/apache/commons/codec/language/RefinedSoundex.java diff --git a/src/main/java/org/apache/commons/codec/language/Soundex.java b/src/org/apache/commons/codec/language/Soundex.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/Soundex.java rename to src/org/apache/commons/codec/language/Soundex.java diff --git a/src/main/java/org/apache/commons/codec/language/SoundexUtils.java b/src/org/apache/commons/codec/language/SoundexUtils.java similarity index 99% rename from src/main/java/org/apache/commons/codec/language/SoundexUtils.java rename to src/org/apache/commons/codec/language/SoundexUtils.java index 0e17df1e..6409eb24 100644 --- a/src/main/java/org/apache/commons/codec/language/SoundexUtils.java +++ b/src/org/apache/commons/codec/language/SoundexUtils.java @@ -30,9 +30,6 @@ import org.apache.commons.codec.StringEncoder; */ final class SoundexUtils { - private SoundexUtils() { - } - /** * Cleans up the input string before Soundex processing by only returning * upper case letters. diff --git a/src/main/java/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java b/src/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java rename to src/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java diff --git a/src/main/java/org/apache/commons/codec/language/bm/Lang.java b/src/org/apache/commons/codec/language/bm/Lang.java similarity index 97% rename from src/main/java/org/apache/commons/codec/language/bm/Lang.java rename to src/org/apache/commons/codec/language/bm/Lang.java index e7e69ac6..a7ebba6e 100644 --- a/src/main/java/org/apache/commons/codec/language/bm/Lang.java +++ b/src/org/apache/commons/codec/language/bm/Lang.java @@ -18,7 +18,16 @@ package org.apache.commons.codec.language.bm; import java.io.InputStream; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Scanner; +import java.util.Set; import java.util.regex.Pattern; /** diff --git a/src/main/java/org/apache/commons/codec/language/bm/Languages.java b/src/org/apache/commons/codec/language/bm/Languages.java similarity index 97% rename from src/main/java/org/apache/commons/codec/language/bm/Languages.java rename to src/org/apache/commons/codec/language/bm/Languages.java index 15048299..e092c15c 100644 --- a/src/main/java/org/apache/commons/codec/language/bm/Languages.java +++ b/src/org/apache/commons/codec/language/bm/Languages.java @@ -18,7 +18,13 @@ package org.apache.commons.codec.language.bm; import java.io.InputStream; -import java.util.*; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashSet; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Scanner; +import java.util.Set; /** * Language codes. diff --git a/src/main/java/org/apache/commons/codec/language/bm/NameType.java b/src/org/apache/commons/codec/language/bm/NameType.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/bm/NameType.java rename to src/org/apache/commons/codec/language/bm/NameType.java diff --git a/src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java b/src/org/apache/commons/codec/language/bm/PhoneticEngine.java similarity index 98% rename from src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java rename to src/org/apache/commons/codec/language/bm/PhoneticEngine.java index 50b594f7..490757be 100644 --- a/src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java +++ b/src/org/apache/commons/codec/language/bm/PhoneticEngine.java @@ -17,11 +17,22 @@ package org.apache.commons.codec.language.bm; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + import org.apache.commons.codec.language.bm.Languages.LanguageSet; import org.apache.commons.codec.language.bm.Rule.Phoneme; -import java.util.*; - /** * Converts words into potential phonetic representations. *

diff --git a/src/main/java/org/apache/commons/codec/language/bm/ResourceConstants.java b/src/org/apache/commons/codec/language/bm/ResourceConstants.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/bm/ResourceConstants.java rename to src/org/apache/commons/codec/language/bm/ResourceConstants.java diff --git a/src/main/java/org/apache/commons/codec/language/bm/Rule.java b/src/org/apache/commons/codec/language/bm/Rule.java similarity index 98% rename from src/main/java/org/apache/commons/codec/language/bm/Rule.java rename to src/org/apache/commons/codec/language/bm/Rule.java index 18415c40..eacbae85 100644 --- a/src/main/java/org/apache/commons/codec/language/bm/Rule.java +++ b/src/org/apache/commons/codec/language/bm/Rule.java @@ -17,13 +17,23 @@ package org.apache.commons.codec.language.bm; -import org.apache.commons.codec.language.bm.Languages.LanguageSet; - import java.io.InputStream; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Scanner; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.codec.language.bm.Languages.LanguageSet; + /** * A phoneme rule. *

diff --git a/src/main/java/org/apache/commons/codec/language/bm/RuleType.java b/src/org/apache/commons/codec/language/bm/RuleType.java similarity index 100% rename from src/main/java/org/apache/commons/codec/language/bm/RuleType.java rename to src/org/apache/commons/codec/language/bm/RuleType.java diff --git a/src/org/apache/commons/codec/language/bm/package.html b/src/org/apache/commons/codec/language/bm/package.html new file mode 100644 index 00000000..95a02ebb --- /dev/null +++ b/src/org/apache/commons/codec/language/bm/package.html @@ -0,0 +1,21 @@ + + + + Implementation details of the Beider-Morse codec. + + diff --git a/src/org/apache/commons/codec/language/package.html b/src/org/apache/commons/codec/language/package.html new file mode 100644 index 00000000..6e337668 --- /dev/null +++ b/src/org/apache/commons/codec/language/package.html @@ -0,0 +1,21 @@ + + + + Language and phonetic encoders. + + diff --git a/src/main/java/org/apache/commons/codec/net/BCodec.java b/src/org/apache/commons/codec/net/BCodec.java similarity index 97% rename from src/main/java/org/apache/commons/codec/net/BCodec.java rename to src/org/apache/commons/codec/net/BCodec.java index 3ad863cb..651ed979 100644 --- a/src/main/java/org/apache/commons/codec/net/BCodec.java +++ b/src/org/apache/commons/codec/net/BCodec.java @@ -17,12 +17,16 @@ package org.apache.commons.codec.net; -import org.apache.commons.codec.*; -import org.apache.commons.codec.binary.Base64; - import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; +import org.apache.commons.codec.Charsets; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.EncoderException; +import org.apache.commons.codec.StringDecoder; +import org.apache.commons.codec.StringEncoder; +import org.apache.commons.codec.binary.Base64; + /** * Identical to the Base64 encoding defined by RFC 1521 * and allows a character set to be specified. diff --git a/src/main/java/org/apache/commons/codec/net/QCodec.java b/src/org/apache/commons/codec/net/QCodec.java similarity index 98% rename from src/main/java/org/apache/commons/codec/net/QCodec.java rename to src/org/apache/commons/codec/net/QCodec.java index 19d2bb5d..584b3ff0 100644 --- a/src/main/java/org/apache/commons/codec/net/QCodec.java +++ b/src/org/apache/commons/codec/net/QCodec.java @@ -17,12 +17,16 @@ package org.apache.commons.codec.net; -import org.apache.commons.codec.*; - import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.util.BitSet; +import org.apache.commons.codec.Charsets; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.EncoderException; +import org.apache.commons.codec.StringDecoder; +import org.apache.commons.codec.StringEncoder; + /** * Similar to the Quoted-Printable content-transfer-encoding defined in * RFC 1521 and designed to allow text containing mostly ASCII diff --git a/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java b/src/org/apache/commons/codec/net/QuotedPrintableCodec.java similarity index 98% rename from src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java rename to src/org/apache/commons/codec/net/QuotedPrintableCodec.java index dfa5f60d..82b88617 100644 --- a/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java +++ b/src/org/apache/commons/codec/net/QuotedPrintableCodec.java @@ -17,9 +17,6 @@ package org.apache.commons.codec.net; -import org.apache.commons.codec.*; -import org.apache.commons.codec.binary.StringUtils; - import java.io.ByteArrayOutputStream; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; @@ -27,6 +24,15 @@ import java.nio.charset.IllegalCharsetNameException; import java.nio.charset.UnsupportedCharsetException; import java.util.BitSet; +import org.apache.commons.codec.BinaryDecoder; +import org.apache.commons.codec.BinaryEncoder; +import org.apache.commons.codec.Charsets; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.EncoderException; +import org.apache.commons.codec.StringDecoder; +import org.apache.commons.codec.StringEncoder; +import org.apache.commons.codec.binary.StringUtils; + /** * Codec for the Quoted-Printable section of RFC 1521. *

diff --git a/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java b/src/org/apache/commons/codec/net/RFC1522Codec.java similarity index 100% rename from src/main/java/org/apache/commons/codec/net/RFC1522Codec.java rename to src/org/apache/commons/codec/net/RFC1522Codec.java index 1c4e3193..6cad34f9 100644 --- a/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java +++ b/src/org/apache/commons/codec/net/RFC1522Codec.java @@ -17,13 +17,13 @@ package org.apache.commons.codec.net; +import java.io.UnsupportedEncodingException; +import java.nio.charset.Charset; + import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.EncoderException; import org.apache.commons.codec.binary.StringUtils; -import java.io.UnsupportedEncodingException; -import java.nio.charset.Charset; - /** * Implements methods common to all codecs defined in RFC 1522. *

diff --git a/src/main/java/org/apache/commons/codec/net/URLCodec.java b/src/org/apache/commons/codec/net/URLCodec.java similarity index 97% rename from src/main/java/org/apache/commons/codec/net/URLCodec.java rename to src/org/apache/commons/codec/net/URLCodec.java index 9bf7e38d..e53cd635 100644 --- a/src/main/java/org/apache/commons/codec/net/URLCodec.java +++ b/src/org/apache/commons/codec/net/URLCodec.java @@ -17,13 +17,19 @@ package org.apache.commons.codec.net; -import org.apache.commons.codec.*; -import org.apache.commons.codec.binary.StringUtils; - import java.io.ByteArrayOutputStream; import java.io.UnsupportedEncodingException; import java.util.BitSet; +import org.apache.commons.codec.BinaryDecoder; +import org.apache.commons.codec.BinaryEncoder; +import org.apache.commons.codec.CharEncoding; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.EncoderException; +import org.apache.commons.codec.StringDecoder; +import org.apache.commons.codec.StringEncoder; +import org.apache.commons.codec.binary.StringUtils; + /** * Implements the 'www-form-urlencoded' encoding scheme, also misleadingly known as URL encoding. *

diff --git a/src/main/java/org/apache/commons/codec/net/Utils.java b/src/org/apache/commons/codec/net/Utils.java similarity index 98% rename from src/main/java/org/apache/commons/codec/net/Utils.java rename to src/org/apache/commons/codec/net/Utils.java index a927468a..c482c0ab 100644 --- a/src/main/java/org/apache/commons/codec/net/Utils.java +++ b/src/org/apache/commons/codec/net/Utils.java @@ -29,9 +29,6 @@ import org.apache.commons.codec.DecoderException; */ class Utils { - private Utils() { - } - /** * Returns the numeric value of the character b in radix 16. * diff --git a/src/org/apache/commons/codec/net/package.html b/src/org/apache/commons/codec/net/package.html new file mode 100644 index 00000000..2b8ceab2 --- /dev/null +++ b/src/org/apache/commons/codec/net/package.html @@ -0,0 +1,23 @@ + + + +

+ Network related encoding and decoding. +

+ + diff --git a/src/org/apache/commons/codec/overview.html b/src/org/apache/commons/codec/overview.html new file mode 100644 index 00000000..76b0a621 --- /dev/null +++ b/src/org/apache/commons/codec/overview.html @@ -0,0 +1,29 @@ + + + + +

+This document is the API specification for the Apache Commons Codec Library, version 1.3. +

+

+This library requires a JRE version of 1.2.2 or greater. +The hypertext links originating from this document point to Sun's version 1.3 API as the 1.2.2 API documentation +is no longer on-line. +

+ + diff --git a/src/org/apache/commons/codec/package.html b/src/org/apache/commons/codec/package.html new file mode 100644 index 00000000..fc1fac13 --- /dev/null +++ b/src/org/apache/commons/codec/package.html @@ -0,0 +1,100 @@ + + + + + + +

Interfaces and classes used by + the various implementations in the sub-packages.

+ +

Definitive implementations of commonly used encoders and decoders.

+ +

Codec is currently comprised of a modest set of utilities and a + simple framework for String encoding and decoding in three categories: + Binary Encoders, Language Encoders, and Network Encoders.

+ +

Binary Encoders

+ + + + + + + + + + + + + + +
+ + org.apache.commons.codec.binary.Base64 + + Provides Base64 content-transfer-encoding as defined in + RFC 2045 + Production
+ + org.apache.commons.codec.binary.Hex + + Converts an array of bytes into an array of characters + representing the hexadecimal values of each byte in order + Production
+

+ Language Encoders +

+

+ Codec contains a number of commonly used language and phonetic + encoders +

+ + + + + + + + + + + + + +
+ org.apache.commons.codec.language.Soundex + Implementation of the Soundex algorithm.Production
+ org.apache.commons.codec.language.Metaphone + Implementation of the Metaphone algorithm.Production
+

Network Encoders

+

+

Codec contains network related encoders

+ + + + + + + + +
+ org.apache.commons.codec.net.URLCodec + Implements the 'www-form-urlencoded' encoding scheme.Production
+
+ + diff --git a/src/main/java/org/imgscalr/AsyncScalr.java b/src/org/imgscalr/AsyncScalr.java similarity index 98% rename from src/main/java/org/imgscalr/AsyncScalr.java rename to src/org/imgscalr/AsyncScalr.java index ff888872..3be52752 100644 --- a/src/main/java/org/imgscalr/AsyncScalr.java +++ b/src/org/imgscalr/AsyncScalr.java @@ -15,17 +15,23 @@ */ package org.imgscalr; -import org.imgscalr.Scalr.Method; -import org.imgscalr.Scalr.Mode; -import org.imgscalr.Scalr.Rotation; - -import java.awt.*; +import java.awt.Color; import java.awt.image.BufferedImage; import java.awt.image.BufferedImageOp; import java.awt.image.ImagingOpException; -import java.util.concurrent.*; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.imgscalr.Scalr.Method; +import org.imgscalr.Scalr.Mode; +import org.imgscalr.Scalr.Rotation; + /** * Class used to provide the asynchronous versions of all the methods defined in * {@link Scalr} for the purpose of efficiently handling large amounts of image diff --git a/src/main/java/org/imgscalr/Scalr.java b/src/org/imgscalr/Scalr.java similarity index 99% rename from src/main/java/org/imgscalr/Scalr.java rename to src/org/imgscalr/Scalr.java index 0b28035a..d08911c1 100644 --- a/src/main/java/org/imgscalr/Scalr.java +++ b/src/org/imgscalr/Scalr.java @@ -15,12 +15,28 @@ */ package org.imgscalr; -import javax.imageio.ImageIO; -import java.awt.*; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.RenderingHints; +import java.awt.Transparency; import java.awt.color.ColorSpace; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; -import java.awt.image.*; +import java.awt.image.AreaAveragingScaleFilter; +import java.awt.image.BufferedImage; +import java.awt.image.BufferedImageOp; +import java.awt.image.ColorConvertOp; +import java.awt.image.ColorModel; +import java.awt.image.ConvolveOp; +import java.awt.image.ImagingOpException; +import java.awt.image.IndexColorModel; +import java.awt.image.Kernel; +import java.awt.image.RasterFormatException; +import java.awt.image.RescaleOp; + +import javax.imageio.ImageIO; /** * Class used to implement performant, high-quality and intelligent image diff --git a/src/main/java/org/objectweb/asm/AnnotationVisitor.java b/src/org/objectweb/asm/AnnotationVisitor.java similarity index 100% rename from src/main/java/org/objectweb/asm/AnnotationVisitor.java rename to src/org/objectweb/asm/AnnotationVisitor.java diff --git a/src/main/java/org/objectweb/asm/AnnotationWriter.java b/src/org/objectweb/asm/AnnotationWriter.java similarity index 100% rename from src/main/java/org/objectweb/asm/AnnotationWriter.java rename to src/org/objectweb/asm/AnnotationWriter.java diff --git a/src/main/java/org/objectweb/asm/Attribute.java b/src/org/objectweb/asm/Attribute.java similarity index 100% rename from src/main/java/org/objectweb/asm/Attribute.java rename to src/org/objectweb/asm/Attribute.java diff --git a/src/main/java/org/objectweb/asm/ByteVector.java b/src/org/objectweb/asm/ByteVector.java similarity index 100% rename from src/main/java/org/objectweb/asm/ByteVector.java rename to src/org/objectweb/asm/ByteVector.java diff --git a/src/main/java/org/objectweb/asm/ClassReader.java b/src/org/objectweb/asm/ClassReader.java similarity index 100% rename from src/main/java/org/objectweb/asm/ClassReader.java rename to src/org/objectweb/asm/ClassReader.java diff --git a/src/main/java/org/objectweb/asm/ClassVisitor.java b/src/org/objectweb/asm/ClassVisitor.java similarity index 100% rename from src/main/java/org/objectweb/asm/ClassVisitor.java rename to src/org/objectweb/asm/ClassVisitor.java diff --git a/src/main/java/org/objectweb/asm/ClassWriter.java b/src/org/objectweb/asm/ClassWriter.java similarity index 100% rename from src/main/java/org/objectweb/asm/ClassWriter.java rename to src/org/objectweb/asm/ClassWriter.java diff --git a/src/main/java/org/objectweb/asm/Context.java b/src/org/objectweb/asm/Context.java similarity index 100% rename from src/main/java/org/objectweb/asm/Context.java rename to src/org/objectweb/asm/Context.java diff --git a/src/main/java/org/objectweb/asm/Edge.java b/src/org/objectweb/asm/Edge.java similarity index 100% rename from src/main/java/org/objectweb/asm/Edge.java rename to src/org/objectweb/asm/Edge.java diff --git a/src/main/java/org/objectweb/asm/FieldVisitor.java b/src/org/objectweb/asm/FieldVisitor.java similarity index 100% rename from src/main/java/org/objectweb/asm/FieldVisitor.java rename to src/org/objectweb/asm/FieldVisitor.java diff --git a/src/main/java/org/objectweb/asm/FieldWriter.java b/src/org/objectweb/asm/FieldWriter.java similarity index 100% rename from src/main/java/org/objectweb/asm/FieldWriter.java rename to src/org/objectweb/asm/FieldWriter.java diff --git a/src/main/java/org/objectweb/asm/Frame.java b/src/org/objectweb/asm/Frame.java similarity index 100% rename from src/main/java/org/objectweb/asm/Frame.java rename to src/org/objectweb/asm/Frame.java diff --git a/src/main/java/org/objectweb/asm/Handle.java b/src/org/objectweb/asm/Handle.java similarity index 100% rename from src/main/java/org/objectweb/asm/Handle.java rename to src/org/objectweb/asm/Handle.java diff --git a/src/main/java/org/objectweb/asm/Handler.java b/src/org/objectweb/asm/Handler.java similarity index 100% rename from src/main/java/org/objectweb/asm/Handler.java rename to src/org/objectweb/asm/Handler.java diff --git a/src/main/java/org/objectweb/asm/Item.java b/src/org/objectweb/asm/Item.java similarity index 100% rename from src/main/java/org/objectweb/asm/Item.java rename to src/org/objectweb/asm/Item.java diff --git a/src/main/java/org/objectweb/asm/Label.java b/src/org/objectweb/asm/Label.java similarity index 100% rename from src/main/java/org/objectweb/asm/Label.java rename to src/org/objectweb/asm/Label.java diff --git a/src/main/java/org/objectweb/asm/MethodVisitor.java b/src/org/objectweb/asm/MethodVisitor.java similarity index 100% rename from src/main/java/org/objectweb/asm/MethodVisitor.java rename to src/org/objectweb/asm/MethodVisitor.java diff --git a/src/main/java/org/objectweb/asm/MethodWriter.java b/src/org/objectweb/asm/MethodWriter.java similarity index 100% rename from src/main/java/org/objectweb/asm/MethodWriter.java rename to src/org/objectweb/asm/MethodWriter.java diff --git a/src/main/java/org/objectweb/asm/Opcodes.java b/src/org/objectweb/asm/Opcodes.java similarity index 100% rename from src/main/java/org/objectweb/asm/Opcodes.java rename to src/org/objectweb/asm/Opcodes.java diff --git a/src/main/java/org/objectweb/asm/Type.java b/src/org/objectweb/asm/Type.java similarity index 100% rename from src/main/java/org/objectweb/asm/Type.java rename to src/org/objectweb/asm/Type.java diff --git a/src/main/java/org/objectweb/asm/TypePath.java b/src/org/objectweb/asm/TypePath.java similarity index 100% rename from src/main/java/org/objectweb/asm/TypePath.java rename to src/org/objectweb/asm/TypePath.java diff --git a/src/main/java/org/objectweb/asm/TypeReference.java b/src/org/objectweb/asm/TypeReference.java similarity index 100% rename from src/main/java/org/objectweb/asm/TypeReference.java rename to src/org/objectweb/asm/TypeReference.java diff --git a/src/main/java/org/objectweb/asm/commons/AdviceAdapter.java b/src/org/objectweb/asm/commons/AdviceAdapter.java similarity index 99% rename from src/main/java/org/objectweb/asm/commons/AdviceAdapter.java rename to src/org/objectweb/asm/commons/AdviceAdapter.java index d5a406cd..ca31ede9 100644 --- a/src/main/java/org/objectweb/asm/commons/AdviceAdapter.java +++ b/src/org/objectweb/asm/commons/AdviceAdapter.java @@ -29,13 +29,17 @@ */ package org.objectweb.asm.commons; -import org.objectweb.asm.*; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; + /** * A {@link org.objectweb.asm.MethodVisitor} to insert before, after and around * advices in methods and constructors. diff --git a/src/main/java/org/objectweb/asm/commons/AnalyzerAdapter.java b/src/org/objectweb/asm/commons/AnalyzerAdapter.java similarity index 99% rename from src/main/java/org/objectweb/asm/commons/AnalyzerAdapter.java rename to src/org/objectweb/asm/commons/AnalyzerAdapter.java index 74c9a945..884f9466 100644 --- a/src/main/java/org/objectweb/asm/commons/AnalyzerAdapter.java +++ b/src/org/objectweb/asm/commons/AnalyzerAdapter.java @@ -29,13 +29,17 @@ */ package org.objectweb.asm.commons; -import org.objectweb.asm.*; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; + /** * A {@link MethodVisitor} that keeps track of stack map frame changes between * {@link #visitFrame(int, int, Object[], int, Object[]) visitFrame} calls. This diff --git a/src/main/java/org/objectweb/asm/commons/CodeSizeEvaluator.java b/src/org/objectweb/asm/commons/CodeSizeEvaluator.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/CodeSizeEvaluator.java rename to src/org/objectweb/asm/commons/CodeSizeEvaluator.java diff --git a/src/main/java/org/objectweb/asm/commons/GeneratorAdapter.java b/src/org/objectweb/asm/commons/GeneratorAdapter.java similarity index 99% rename from src/main/java/org/objectweb/asm/commons/GeneratorAdapter.java rename to src/org/objectweb/asm/commons/GeneratorAdapter.java index 4ef36379..dbaf1d73 100644 --- a/src/main/java/org/objectweb/asm/commons/GeneratorAdapter.java +++ b/src/org/objectweb/asm/commons/GeneratorAdapter.java @@ -29,12 +29,17 @@ */ package org.objectweb.asm.commons; -import org.objectweb.asm.*; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; + /** * A {@link org.objectweb.asm.MethodVisitor} with convenient methods to generate * code. For example, using this adapter, the class below diff --git a/src/main/java/org/objectweb/asm/commons/InstructionAdapter.java b/src/org/objectweb/asm/commons/InstructionAdapter.java similarity index 99% rename from src/main/java/org/objectweb/asm/commons/InstructionAdapter.java rename to src/org/objectweb/asm/commons/InstructionAdapter.java index d4496e3b..872e1569 100644 --- a/src/main/java/org/objectweb/asm/commons/InstructionAdapter.java +++ b/src/org/objectweb/asm/commons/InstructionAdapter.java @@ -30,7 +30,11 @@ package org.objectweb.asm.commons; -import org.objectweb.asm.*; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; /** * A {@link MethodVisitor} providing a more detailed API to generate and diff --git a/src/main/java/org/objectweb/asm/commons/JSRInlinerAdapter.java b/src/org/objectweb/asm/commons/JSRInlinerAdapter.java similarity index 97% rename from src/main/java/org/objectweb/asm/commons/JSRInlinerAdapter.java rename to src/org/objectweb/asm/commons/JSRInlinerAdapter.java index cad43769..5c0ad085 100644 --- a/src/main/java/org/objectweb/asm/commons/JSRInlinerAdapter.java +++ b/src/org/objectweb/asm/commons/JSRInlinerAdapter.java @@ -29,13 +29,30 @@ */ package org.objectweb.asm.commons; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; -import org.objectweb.asm.tree.*; - -import java.util.*; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.InsnList; +import org.objectweb.asm.tree.InsnNode; +import org.objectweb.asm.tree.JumpInsnNode; +import org.objectweb.asm.tree.LabelNode; +import org.objectweb.asm.tree.LocalVariableNode; +import org.objectweb.asm.tree.LookupSwitchInsnNode; +import org.objectweb.asm.tree.MethodNode; +import org.objectweb.asm.tree.TableSwitchInsnNode; +import org.objectweb.asm.tree.TryCatchBlockNode; /** * A {@link org.objectweb.asm.MethodVisitor} that removes JSR instructions and diff --git a/src/main/java/org/objectweb/asm/commons/LocalVariablesSorter.java b/src/org/objectweb/asm/commons/LocalVariablesSorter.java similarity index 98% rename from src/main/java/org/objectweb/asm/commons/LocalVariablesSorter.java rename to src/org/objectweb/asm/commons/LocalVariablesSorter.java index 7d221059..295c319b 100644 --- a/src/main/java/org/objectweb/asm/commons/LocalVariablesSorter.java +++ b/src/org/objectweb/asm/commons/LocalVariablesSorter.java @@ -29,7 +29,12 @@ */ package org.objectweb.asm.commons; -import org.objectweb.asm.*; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.TypePath; /** * A {@link MethodVisitor} that renumbers local variables in their order of diff --git a/src/main/java/org/objectweb/asm/commons/Method.java b/src/org/objectweb/asm/commons/Method.java similarity index 99% rename from src/main/java/org/objectweb/asm/commons/Method.java rename to src/org/objectweb/asm/commons/Method.java index 97136159..6f980967 100644 --- a/src/main/java/org/objectweb/asm/commons/Method.java +++ b/src/org/objectweb/asm/commons/Method.java @@ -29,11 +29,11 @@ */ package org.objectweb.asm.commons; -import org.objectweb.asm.Type; - import java.util.HashMap; import java.util.Map; +import org.objectweb.asm.Type; + /** * A named method descriptor. * diff --git a/src/main/java/org/objectweb/asm/commons/Remapper.java b/src/org/objectweb/asm/commons/Remapper.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/Remapper.java rename to src/org/objectweb/asm/commons/Remapper.java diff --git a/src/main/java/org/objectweb/asm/commons/RemappingAnnotationAdapter.java b/src/org/objectweb/asm/commons/RemappingAnnotationAdapter.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/RemappingAnnotationAdapter.java rename to src/org/objectweb/asm/commons/RemappingAnnotationAdapter.java diff --git a/src/main/java/org/objectweb/asm/commons/RemappingClassAdapter.java b/src/org/objectweb/asm/commons/RemappingClassAdapter.java similarity index 95% rename from src/main/java/org/objectweb/asm/commons/RemappingClassAdapter.java rename to src/org/objectweb/asm/commons/RemappingClassAdapter.java index 8c2e7103..c0b52cae 100644 --- a/src/main/java/org/objectweb/asm/commons/RemappingClassAdapter.java +++ b/src/org/objectweb/asm/commons/RemappingClassAdapter.java @@ -30,7 +30,12 @@ package org.objectweb.asm.commons; -import org.objectweb.asm.*; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.TypePath; /** * A {@link ClassVisitor} for type remapping. diff --git a/src/main/java/org/objectweb/asm/commons/RemappingFieldAdapter.java b/src/org/objectweb/asm/commons/RemappingFieldAdapter.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/RemappingFieldAdapter.java rename to src/org/objectweb/asm/commons/RemappingFieldAdapter.java diff --git a/src/main/java/org/objectweb/asm/commons/RemappingMethodAdapter.java b/src/org/objectweb/asm/commons/RemappingMethodAdapter.java similarity index 97% rename from src/main/java/org/objectweb/asm/commons/RemappingMethodAdapter.java rename to src/org/objectweb/asm/commons/RemappingMethodAdapter.java index 6a47f80d..c9badc2a 100644 --- a/src/main/java/org/objectweb/asm/commons/RemappingMethodAdapter.java +++ b/src/org/objectweb/asm/commons/RemappingMethodAdapter.java @@ -30,7 +30,12 @@ package org.objectweb.asm.commons; -import org.objectweb.asm.*; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.TypePath; /** * A {@link LocalVariablesSorter} for type mapping. diff --git a/src/main/java/org/objectweb/asm/commons/RemappingSignatureAdapter.java b/src/org/objectweb/asm/commons/RemappingSignatureAdapter.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/RemappingSignatureAdapter.java rename to src/org/objectweb/asm/commons/RemappingSignatureAdapter.java diff --git a/src/main/java/org/objectweb/asm/commons/SerialVersionUIDAdder.java b/src/org/objectweb/asm/commons/SerialVersionUIDAdder.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/SerialVersionUIDAdder.java rename to src/org/objectweb/asm/commons/SerialVersionUIDAdder.java index e50ca385..180281a8 100644 --- a/src/main/java/org/objectweb/asm/commons/SerialVersionUIDAdder.java +++ b/src/org/objectweb/asm/commons/SerialVersionUIDAdder.java @@ -29,11 +29,6 @@ */ package org.objectweb.asm.commons; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - import java.io.ByteArrayOutputStream; import java.io.DataOutput; import java.io.DataOutputStream; @@ -43,6 +38,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + /** * A {@link ClassVisitor} that adds a serial version unique identifier to a * class if missing. Here is typical usage of this class: diff --git a/src/main/java/org/objectweb/asm/commons/SimpleRemapper.java b/src/org/objectweb/asm/commons/SimpleRemapper.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/SimpleRemapper.java rename to src/org/objectweb/asm/commons/SimpleRemapper.java diff --git a/src/main/java/org/objectweb/asm/commons/StaticInitMerger.java b/src/org/objectweb/asm/commons/StaticInitMerger.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/StaticInitMerger.java rename to src/org/objectweb/asm/commons/StaticInitMerger.java diff --git a/src/main/java/org/objectweb/asm/commons/TableSwitchGenerator.java b/src/org/objectweb/asm/commons/TableSwitchGenerator.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/TableSwitchGenerator.java rename to src/org/objectweb/asm/commons/TableSwitchGenerator.java diff --git a/src/main/java/org/objectweb/asm/commons/TryCatchBlockSorter.java b/src/org/objectweb/asm/commons/TryCatchBlockSorter.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/TryCatchBlockSorter.java rename to src/org/objectweb/asm/commons/TryCatchBlockSorter.java index ce5d06c2..a9c51923 100644 --- a/src/main/java/org/objectweb/asm/commons/TryCatchBlockSorter.java +++ b/src/org/objectweb/asm/commons/TryCatchBlockSorter.java @@ -30,14 +30,14 @@ package org.objectweb.asm.commons; +import java.util.Collections; +import java.util.Comparator; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.MethodNode; import org.objectweb.asm.tree.TryCatchBlockNode; -import java.util.Collections; -import java.util.Comparator; - /** * A {@link MethodVisitor} adapter to sort the exception handlers. The handlers * are sorted in a method innermost-to-outermost. This allows the programmer to diff --git a/src/main/java/org/objectweb/asm/commons/cfg/Block.java b/src/org/objectweb/asm/commons/cfg/Block.java similarity index 97% rename from src/main/java/org/objectweb/asm/commons/cfg/Block.java rename to src/org/objectweb/asm/commons/cfg/Block.java index 1012f2cd..13c1cebd 100644 --- a/src/main/java/org/objectweb/asm/commons/cfg/Block.java +++ b/src/org/objectweb/asm/commons/cfg/Block.java @@ -1,5 +1,11 @@ package org.objectweb.asm.commons.cfg; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Stack; + import org.objectweb.asm.Label; import org.objectweb.asm.commons.cfg.query.InsnQuery; import org.objectweb.asm.commons.cfg.tree.NodeTree; @@ -9,8 +15,6 @@ import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.LabelNode; import org.objectweb.asm.tree.MethodNode; -import java.util.*; - /** * @author Tyler Sedlar */ diff --git a/src/main/java/org/objectweb/asm/commons/cfg/BlockVisitor.java b/src/org/objectweb/asm/commons/cfg/BlockVisitor.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/BlockVisitor.java rename to src/org/objectweb/asm/commons/cfg/BlockVisitor.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/CallVisitor.java b/src/org/objectweb/asm/commons/cfg/CallVisitor.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/CallVisitor.java rename to src/org/objectweb/asm/commons/cfg/CallVisitor.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/InsnVisitor.java b/src/org/objectweb/asm/commons/cfg/InsnVisitor.java similarity index 96% rename from src/main/java/org/objectweb/asm/commons/cfg/InsnVisitor.java rename to src/org/objectweb/asm/commons/cfg/InsnVisitor.java index 64c55003..82708f25 100644 --- a/src/main/java/org/objectweb/asm/commons/cfg/InsnVisitor.java +++ b/src/org/objectweb/asm/commons/cfg/InsnVisitor.java @@ -1,6 +1,12 @@ package org.objectweb.asm.commons.cfg; -import org.objectweb.asm.*; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.TypePath; public class InsnVisitor extends MethodVisitor { diff --git a/src/main/java/org/objectweb/asm/commons/cfg/graph/CallGraph.java b/src/org/objectweb/asm/commons/cfg/graph/CallGraph.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/graph/CallGraph.java rename to src/org/objectweb/asm/commons/cfg/graph/CallGraph.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/graph/Digraph.java b/src/org/objectweb/asm/commons/cfg/graph/Digraph.java similarity index 95% rename from src/main/java/org/objectweb/asm/commons/cfg/graph/Digraph.java rename to src/org/objectweb/asm/commons/cfg/graph/Digraph.java index a6476ccf..417bf322 100644 --- a/src/main/java/org/objectweb/asm/commons/cfg/graph/Digraph.java +++ b/src/org/objectweb/asm/commons/cfg/graph/Digraph.java @@ -1,8 +1,13 @@ package org.objectweb.asm.commons.cfg.graph; -import org.objectweb.asm.commons.cfg.Block; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; -import java.util.*; +import org.objectweb.asm.commons.cfg.Block; /** * @author Tyler Sedlar diff --git a/src/main/java/org/objectweb/asm/commons/cfg/graph/FlowGraph.java b/src/org/objectweb/asm/commons/cfg/graph/FlowGraph.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/graph/FlowGraph.java rename to src/org/objectweb/asm/commons/cfg/graph/FlowGraph.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/query/InsnQuery.java b/src/org/objectweb/asm/commons/cfg/query/InsnQuery.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/query/InsnQuery.java rename to src/org/objectweb/asm/commons/cfg/query/InsnQuery.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/query/MemberQuery.java b/src/org/objectweb/asm/commons/cfg/query/MemberQuery.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/query/MemberQuery.java rename to src/org/objectweb/asm/commons/cfg/query/MemberQuery.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/query/NumberQuery.java b/src/org/objectweb/asm/commons/cfg/query/NumberQuery.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/query/NumberQuery.java rename to src/org/objectweb/asm/commons/cfg/query/NumberQuery.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/NodeTree.java b/src/org/objectweb/asm/commons/cfg/tree/NodeTree.java similarity index 99% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/NodeTree.java rename to src/org/objectweb/asm/commons/cfg/tree/NodeTree.java index 7c6a2533..20f3ad7a 100644 --- a/src/main/java/org/objectweb/asm/commons/cfg/tree/NodeTree.java +++ b/src/org/objectweb/asm/commons/cfg/tree/NodeTree.java @@ -1,14 +1,14 @@ package org.objectweb.asm.commons.cfg.tree; +import static org.objectweb.asm.tree.AbstractInsnNode.LABEL; + +import java.util.Arrays; + import org.objectweb.asm.commons.cfg.Block; import org.objectweb.asm.commons.cfg.tree.node.AbstractNode; import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.MethodNode; -import java.util.Arrays; - -import static org.objectweb.asm.tree.AbstractInsnNode.LABEL; - /** * @author Tyler Sedlar */ diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/NodeVisitor.java b/src/org/objectweb/asm/commons/cfg/tree/NodeVisitor.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/NodeVisitor.java rename to src/org/objectweb/asm/commons/cfg/tree/NodeVisitor.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/Tree.java b/src/org/objectweb/asm/commons/cfg/tree/Tree.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/Tree.java rename to src/org/objectweb/asm/commons/cfg/tree/Tree.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/AbstractNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/AbstractNode.java similarity index 90% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/AbstractNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/AbstractNode.java index c1cf2ba7..a5f71b52 100644 --- a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/AbstractNode.java +++ b/src/org/objectweb/asm/commons/cfg/tree/node/AbstractNode.java @@ -1,17 +1,36 @@ package org.objectweb.asm.commons.cfg.tree.node; +import static org.objectweb.asm.tree.AbstractInsnNode.FIELD_INSN; +import static org.objectweb.asm.tree.AbstractInsnNode.FRAME; +import static org.objectweb.asm.tree.AbstractInsnNode.IINC_INSN; +import static org.objectweb.asm.tree.AbstractInsnNode.INSN; +import static org.objectweb.asm.tree.AbstractInsnNode.INT_INSN; +import static org.objectweb.asm.tree.AbstractInsnNode.JUMP_INSN; +import static org.objectweb.asm.tree.AbstractInsnNode.LABEL; +import static org.objectweb.asm.tree.AbstractInsnNode.LDC_INSN; +import static org.objectweb.asm.tree.AbstractInsnNode.LINE; +import static org.objectweb.asm.tree.AbstractInsnNode.LOOKUPSWITCH_INSN; +import static org.objectweb.asm.tree.AbstractInsnNode.METHOD_INSN; +import static org.objectweb.asm.tree.AbstractInsnNode.MULTIANEWARRAY_INSN; +import static org.objectweb.asm.tree.AbstractInsnNode.TABLESWITCH_INSN; +import static org.objectweb.asm.tree.AbstractInsnNode.TYPE_INSN; +import static org.objectweb.asm.tree.AbstractInsnNode.VAR_INSN; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import org.objectweb.asm.Opcodes; import org.objectweb.asm.commons.cfg.tree.NodeTree; import org.objectweb.asm.commons.cfg.tree.NodeVisitor; import org.objectweb.asm.commons.cfg.tree.Tree; import org.objectweb.asm.commons.util.Assembly; -import org.objectweb.asm.tree.*; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.objectweb.asm.tree.AbstractInsnNode.*; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldInsnNode; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MethodNode; public class AbstractNode extends Tree implements Opcodes { diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/ArithmeticNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/ArithmeticNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/ArithmeticNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/ArithmeticNode.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/ConstantNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/ConstantNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/ConstantNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/ConstantNode.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/ConversionNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/ConversionNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/ConversionNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/ConversionNode.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/FieldMemberNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/FieldMemberNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/FieldMemberNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/FieldMemberNode.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/IincNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/IincNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/IincNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/IincNode.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/JumpNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/JumpNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/JumpNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/JumpNode.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/MethodMemberNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/MethodMemberNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/MethodMemberNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/MethodMemberNode.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/NumberNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/NumberNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/NumberNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/NumberNode.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/ReferenceNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/ReferenceNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/ReferenceNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/ReferenceNode.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/TargetNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/TargetNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/TargetNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/TargetNode.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/TypeNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/TypeNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/TypeNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/TypeNode.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/node/VariableNode.java b/src/org/objectweb/asm/commons/cfg/tree/node/VariableNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/node/VariableNode.java rename to src/org/objectweb/asm/commons/cfg/tree/node/VariableNode.java diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/util/TreeBuilder.java b/src/org/objectweb/asm/commons/cfg/tree/util/TreeBuilder.java similarity index 86% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/util/TreeBuilder.java rename to src/org/objectweb/asm/commons/cfg/tree/util/TreeBuilder.java index 9b7d85b3..178844d6 100644 --- a/src/main/java/org/objectweb/asm/commons/cfg/tree/util/TreeBuilder.java +++ b/src/org/objectweb/asm/commons/cfg/tree/util/TreeBuilder.java @@ -1,17 +1,39 @@ package org.objectweb.asm.commons.cfg.tree.util; -import org.objectweb.asm.Type; -import org.objectweb.asm.commons.cfg.Block; -import org.objectweb.asm.commons.cfg.tree.NodeTree; -import org.objectweb.asm.commons.cfg.tree.node.*; -import org.objectweb.asm.tree.*; +import static org.objectweb.asm.Opcodes.*; import java.util.ArrayList; import java.util.List; -import static org.objectweb.asm.Opcodes.*; - //import org.nullbool.api.obfuscation.cfg.FlowBlock; +import org.objectweb.asm.Type; +import org.objectweb.asm.commons.cfg.Block; +import org.objectweb.asm.commons.cfg.tree.NodeTree; +import org.objectweb.asm.commons.cfg.tree.node.AbstractNode; +import org.objectweb.asm.commons.cfg.tree.node.ArithmeticNode; +import org.objectweb.asm.commons.cfg.tree.node.ConstantNode; +import org.objectweb.asm.commons.cfg.tree.node.ConversionNode; +import org.objectweb.asm.commons.cfg.tree.node.FieldMemberNode; +import org.objectweb.asm.commons.cfg.tree.node.IincNode; +import org.objectweb.asm.commons.cfg.tree.node.JumpNode; +import org.objectweb.asm.commons.cfg.tree.node.MethodMemberNode; +import org.objectweb.asm.commons.cfg.tree.node.NumberNode; +import org.objectweb.asm.commons.cfg.tree.node.TypeNode; +import org.objectweb.asm.commons.cfg.tree.node.VariableNode; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.FieldInsnNode; +import org.objectweb.asm.tree.IincInsnNode; +import org.objectweb.asm.tree.InsnNode; +import org.objectweb.asm.tree.IntInsnNode; +import org.objectweb.asm.tree.JumpInsnNode; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.LookupSwitchInsnNode; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MethodNode; +import org.objectweb.asm.tree.MultiANewArrayInsnNode; +import org.objectweb.asm.tree.TableSwitchInsnNode; +import org.objectweb.asm.tree.TypeInsnNode; +import org.objectweb.asm.tree.VarInsnNode; /** * @author Tyler Sedlar diff --git a/src/main/java/org/objectweb/asm/commons/cfg/tree/util/TreeSize.java b/src/org/objectweb/asm/commons/cfg/tree/util/TreeSize.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/cfg/tree/util/TreeSize.java rename to src/org/objectweb/asm/commons/cfg/tree/util/TreeSize.java diff --git a/src/main/java/org/objectweb/asm/commons/util/Assembly.java b/src/org/objectweb/asm/commons/util/Assembly.java similarity index 93% rename from src/main/java/org/objectweb/asm/commons/util/Assembly.java rename to src/org/objectweb/asm/commons/util/Assembly.java index 6182846d..fc82b3aa 100644 --- a/src/main/java/org/objectweb/asm/commons/util/Assembly.java +++ b/src/org/objectweb/asm/commons/util/Assembly.java @@ -1,12 +1,30 @@ package org.objectweb.asm.commons.util; -import org.objectweb.asm.Label; -import org.objectweb.asm.tree.*; +import static org.objectweb.asm.tree.AbstractInsnNode.*; import java.util.Arrays; import java.util.Collection; -import static org.objectweb.asm.tree.AbstractInsnNode.*; +import org.objectweb.asm.Label; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldInsnNode; +import org.objectweb.asm.tree.FieldNode; +import org.objectweb.asm.tree.FrameNode; +import org.objectweb.asm.tree.IincInsnNode; +import org.objectweb.asm.tree.IntInsnNode; +import org.objectweb.asm.tree.InvokeDynamicInsnNode; +import org.objectweb.asm.tree.JumpInsnNode; +import org.objectweb.asm.tree.LabelNode; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.LineNumberNode; +import org.objectweb.asm.tree.LookupSwitchInsnNode; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MethodNode; +import org.objectweb.asm.tree.MultiANewArrayInsnNode; +import org.objectweb.asm.tree.TableSwitchInsnNode; +import org.objectweb.asm.tree.TypeInsnNode; +import org.objectweb.asm.tree.VarInsnNode; /** * @author Tyler Sedlar diff --git a/src/main/java/org/objectweb/asm/commons/util/JarArchive.java b/src/org/objectweb/asm/commons/util/JarArchive.java similarity index 100% rename from src/main/java/org/objectweb/asm/commons/util/JarArchive.java rename to src/org/objectweb/asm/commons/util/JarArchive.java diff --git a/src/main/java/org/objectweb/asm/signature/SignatureReader.java b/src/org/objectweb/asm/signature/SignatureReader.java similarity index 100% rename from src/main/java/org/objectweb/asm/signature/SignatureReader.java rename to src/org/objectweb/asm/signature/SignatureReader.java diff --git a/src/main/java/org/objectweb/asm/signature/SignatureVisitor.java b/src/org/objectweb/asm/signature/SignatureVisitor.java similarity index 100% rename from src/main/java/org/objectweb/asm/signature/SignatureVisitor.java rename to src/org/objectweb/asm/signature/SignatureVisitor.java diff --git a/src/main/java/org/objectweb/asm/signature/SignatureWriter.java b/src/org/objectweb/asm/signature/SignatureWriter.java similarity index 100% rename from src/main/java/org/objectweb/asm/signature/SignatureWriter.java rename to src/org/objectweb/asm/signature/SignatureWriter.java diff --git a/src/main/java/org/objectweb/asm/tree/AbstractInsnNode.java b/src/org/objectweb/asm/tree/AbstractInsnNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/AbstractInsnNode.java rename to src/org/objectweb/asm/tree/AbstractInsnNode.java index 7a8ed6a8..19093171 100644 --- a/src/main/java/org/objectweb/asm/tree/AbstractInsnNode.java +++ b/src/org/objectweb/asm/tree/AbstractInsnNode.java @@ -29,12 +29,12 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.MethodVisitor; - import java.util.ArrayList; import java.util.List; import java.util.Map; +import org.objectweb.asm.MethodVisitor; + /** * A node that represents a bytecode instruction. An instruction can appear * at most once in at most one {@link InsnList} at a time. diff --git a/src/main/java/org/objectweb/asm/tree/AnnotationNode.java b/src/org/objectweb/asm/tree/AnnotationNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/AnnotationNode.java rename to src/org/objectweb/asm/tree/AnnotationNode.java index af500fde..18bb60d5 100644 --- a/src/main/java/org/objectweb/asm/tree/AnnotationNode.java +++ b/src/org/objectweb/asm/tree/AnnotationNode.java @@ -29,12 +29,12 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - import java.util.ArrayList; import java.util.List; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Opcodes; + /** * A node that represents an annotationn. * diff --git a/src/main/java/org/objectweb/asm/tree/ClassNode.java b/src/org/objectweb/asm/tree/ClassNode.java similarity index 97% rename from src/main/java/org/objectweb/asm/tree/ClassNode.java rename to src/org/objectweb/asm/tree/ClassNode.java index 2a4ee0e2..9ddd5718 100644 --- a/src/main/java/org/objectweb/asm/tree/ClassNode.java +++ b/src/org/objectweb/asm/tree/ClassNode.java @@ -29,9 +29,19 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; -import java.util.*; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.TypePath; /** * A node that represents a class. diff --git a/src/main/java/org/objectweb/asm/tree/FieldInsnNode.java b/src/org/objectweb/asm/tree/FieldInsnNode.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/FieldInsnNode.java rename to src/org/objectweb/asm/tree/FieldInsnNode.java index ea4e49f2..7975b569 100644 --- a/src/main/java/org/objectweb/asm/tree/FieldInsnNode.java +++ b/src/org/objectweb/asm/tree/FieldInsnNode.java @@ -29,10 +29,10 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.MethodVisitor; - import java.util.Map; +import org.objectweb.asm.MethodVisitor; + /** * A node that represents a field instruction. A field instruction is an * instruction that loads or stores the value of a field of an object. diff --git a/src/main/java/org/objectweb/asm/tree/FieldNode.java b/src/org/objectweb/asm/tree/FieldNode.java similarity index 98% rename from src/main/java/org/objectweb/asm/tree/FieldNode.java rename to src/org/objectweb/asm/tree/FieldNode.java index 681746fd..fcd41cb2 100644 --- a/src/main/java/org/objectweb/asm/tree/FieldNode.java +++ b/src/org/objectweb/asm/tree/FieldNode.java @@ -29,11 +29,16 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.*; - import java.util.ArrayList; import java.util.List; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.TypePath; + /** * A node that represents a field. * diff --git a/src/main/java/org/objectweb/asm/tree/FrameNode.java b/src/org/objectweb/asm/tree/FrameNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/FrameNode.java rename to src/org/objectweb/asm/tree/FrameNode.java index 2f6695c6..4f5bc5e9 100644 --- a/src/main/java/org/objectweb/asm/tree/FrameNode.java +++ b/src/org/objectweb/asm/tree/FrameNode.java @@ -29,14 +29,14 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + /** * A node that represents a stack map frame. These nodes are pseudo instruction * nodes in order to be inserted in an instruction list. In fact these nodes diff --git a/src/main/java/org/objectweb/asm/tree/IincInsnNode.java b/src/org/objectweb/asm/tree/IincInsnNode.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/IincInsnNode.java rename to src/org/objectweb/asm/tree/IincInsnNode.java index f661fa61..e847494b 100644 --- a/src/main/java/org/objectweb/asm/tree/IincInsnNode.java +++ b/src/org/objectweb/asm/tree/IincInsnNode.java @@ -29,11 +29,11 @@ */ package org.objectweb.asm.tree; +import java.util.Map; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; -import java.util.Map; - /** * A node that represents an IINC instruction. * diff --git a/src/main/java/org/objectweb/asm/tree/InnerClassNode.java b/src/org/objectweb/asm/tree/InnerClassNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/InnerClassNode.java rename to src/org/objectweb/asm/tree/InnerClassNode.java diff --git a/src/main/java/org/objectweb/asm/tree/InsnList.java b/src/org/objectweb/asm/tree/InsnList.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/InsnList.java rename to src/org/objectweb/asm/tree/InsnList.java index 2482c403..52769b0f 100644 --- a/src/main/java/org/objectweb/asm/tree/InsnList.java +++ b/src/org/objectweb/asm/tree/InsnList.java @@ -29,11 +29,11 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.MethodVisitor; - import java.util.ListIterator; import java.util.NoSuchElementException; +import org.objectweb.asm.MethodVisitor; + /** * A doubly linked list of {@link AbstractInsnNode} objects. This * implementation is not thread safe. diff --git a/src/main/java/org/objectweb/asm/tree/InsnNode.java b/src/org/objectweb/asm/tree/InsnNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/InsnNode.java rename to src/org/objectweb/asm/tree/InsnNode.java index 7284d6e2..1e973eb1 100644 --- a/src/main/java/org/objectweb/asm/tree/InsnNode.java +++ b/src/org/objectweb/asm/tree/InsnNode.java @@ -29,10 +29,10 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.MethodVisitor; - import java.util.Map; +import org.objectweb.asm.MethodVisitor; + /** * A node that represents a zero operand instruction. * diff --git a/src/main/java/org/objectweb/asm/tree/IntInsnNode.java b/src/org/objectweb/asm/tree/IntInsnNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/IntInsnNode.java rename to src/org/objectweb/asm/tree/IntInsnNode.java index 1d40761f..bbe2e458 100644 --- a/src/main/java/org/objectweb/asm/tree/IntInsnNode.java +++ b/src/org/objectweb/asm/tree/IntInsnNode.java @@ -29,11 +29,11 @@ */ package org.objectweb.asm.tree; +import java.util.Map; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.util.Printer; -import java.util.Map; - /** * A node that represents an instruction with a single int operand. * diff --git a/src/main/java/org/objectweb/asm/tree/InvokeDynamicInsnNode.java b/src/org/objectweb/asm/tree/InvokeDynamicInsnNode.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/InvokeDynamicInsnNode.java rename to src/org/objectweb/asm/tree/InvokeDynamicInsnNode.java index 6210002b..eb330d67 100644 --- a/src/main/java/org/objectweb/asm/tree/InvokeDynamicInsnNode.java +++ b/src/org/objectweb/asm/tree/InvokeDynamicInsnNode.java @@ -29,12 +29,12 @@ */ package org.objectweb.asm.tree; +import java.util.Map; + import org.objectweb.asm.Handle; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; -import java.util.Map; - /** * A node that represents an invokedynamic instruction. * diff --git a/src/main/java/org/objectweb/asm/tree/JumpInsnNode.java b/src/org/objectweb/asm/tree/JumpInsnNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/JumpInsnNode.java rename to src/org/objectweb/asm/tree/JumpInsnNode.java index bfed663f..970803b9 100644 --- a/src/main/java/org/objectweb/asm/tree/JumpInsnNode.java +++ b/src/org/objectweb/asm/tree/JumpInsnNode.java @@ -29,10 +29,10 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.MethodVisitor; - import java.util.Map; +import org.objectweb.asm.MethodVisitor; + /** * A node that represents a jump instruction. A jump instruction is an * instruction that may jump to another instruction. diff --git a/src/main/java/org/objectweb/asm/tree/LabelNode.java b/src/org/objectweb/asm/tree/LabelNode.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/LabelNode.java rename to src/org/objectweb/asm/tree/LabelNode.java index 4171cc5f..f568e216 100644 --- a/src/main/java/org/objectweb/asm/tree/LabelNode.java +++ b/src/org/objectweb/asm/tree/LabelNode.java @@ -29,11 +29,11 @@ */ package org.objectweb.asm.tree; +import java.util.Map; + import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; -import java.util.Map; - /** * An {@link AbstractInsnNode} that encapsulates a {@link Label}. */ diff --git a/src/main/java/org/objectweb/asm/tree/LdcInsnNode.java b/src/org/objectweb/asm/tree/LdcInsnNode.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/LdcInsnNode.java rename to src/org/objectweb/asm/tree/LdcInsnNode.java index fcd91247..108087f5 100644 --- a/src/main/java/org/objectweb/asm/tree/LdcInsnNode.java +++ b/src/org/objectweb/asm/tree/LdcInsnNode.java @@ -29,11 +29,11 @@ */ package org.objectweb.asm.tree; +import java.util.Map; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; -import java.util.Map; - /** * A node that represents an LDC instruction. * diff --git a/src/main/java/org/objectweb/asm/tree/LineNumberNode.java b/src/org/objectweb/asm/tree/LineNumberNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/LineNumberNode.java rename to src/org/objectweb/asm/tree/LineNumberNode.java index b0956fc6..9d11404d 100644 --- a/src/main/java/org/objectweb/asm/tree/LineNumberNode.java +++ b/src/org/objectweb/asm/tree/LineNumberNode.java @@ -29,10 +29,10 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.MethodVisitor; - import java.util.Map; +import org.objectweb.asm.MethodVisitor; + /** * A node that represents a line number declaration. These nodes are pseudo * instruction nodes in order to be inserted in an instruction list. diff --git a/src/main/java/org/objectweb/asm/tree/LocalVariableAnnotationNode.java b/src/org/objectweb/asm/tree/LocalVariableAnnotationNode.java similarity index 97% rename from src/main/java/org/objectweb/asm/tree/LocalVariableAnnotationNode.java rename to src/org/objectweb/asm/tree/LocalVariableAnnotationNode.java index 91ad76ad..4ca7da4b 100644 --- a/src/main/java/org/objectweb/asm/tree/LocalVariableAnnotationNode.java +++ b/src/org/objectweb/asm/tree/LocalVariableAnnotationNode.java @@ -30,12 +30,16 @@ package org.objectweb.asm.tree; -import org.objectweb.asm.*; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.TypePath; +import org.objectweb.asm.TypeReference; + /** * A node that represents a type annotation on a local or resource variable. * diff --git a/src/main/java/org/objectweb/asm/tree/LocalVariableNode.java b/src/org/objectweb/asm/tree/LocalVariableNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/LocalVariableNode.java rename to src/org/objectweb/asm/tree/LocalVariableNode.java diff --git a/src/main/java/org/objectweb/asm/tree/LookupSwitchInsnNode.java b/src/org/objectweb/asm/tree/LookupSwitchInsnNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/LookupSwitchInsnNode.java rename to src/org/objectweb/asm/tree/LookupSwitchInsnNode.java index f21a5191..fb28e259 100644 --- a/src/main/java/org/objectweb/asm/tree/LookupSwitchInsnNode.java +++ b/src/org/objectweb/asm/tree/LookupSwitchInsnNode.java @@ -29,15 +29,15 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + /** * A node that represents a LOOKUPSWITCH instruction. * diff --git a/src/main/java/org/objectweb/asm/tree/MethodInsnNode.java b/src/org/objectweb/asm/tree/MethodInsnNode.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/MethodInsnNode.java rename to src/org/objectweb/asm/tree/MethodInsnNode.java index 4413f0ac..98c65758 100644 --- a/src/main/java/org/objectweb/asm/tree/MethodInsnNode.java +++ b/src/org/objectweb/asm/tree/MethodInsnNode.java @@ -29,11 +29,11 @@ */ package org.objectweb.asm.tree; +import java.util.Map; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; -import java.util.Map; - /** * A node that represents a method instruction. A method instruction is an * instruction that invokes a method. diff --git a/src/main/java/org/objectweb/asm/tree/MethodNode.java b/src/org/objectweb/asm/tree/MethodNode.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/MethodNode.java rename to src/org/objectweb/asm/tree/MethodNode.java index adc1d94c..d125d982 100644 --- a/src/main/java/org/objectweb/asm/tree/MethodNode.java +++ b/src/org/objectweb/asm/tree/MethodNode.java @@ -29,13 +29,21 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.*; -import org.objectweb.asm.commons.cfg.query.InsnQuery; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.TypePath; +import org.objectweb.asm.commons.cfg.query.InsnQuery; + /** * A node that represents a method. * diff --git a/src/main/java/org/objectweb/asm/tree/MultiANewArrayInsnNode.java b/src/org/objectweb/asm/tree/MultiANewArrayInsnNode.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/MultiANewArrayInsnNode.java rename to src/org/objectweb/asm/tree/MultiANewArrayInsnNode.java index 1d13a6fb..649967c7 100644 --- a/src/main/java/org/objectweb/asm/tree/MultiANewArrayInsnNode.java +++ b/src/org/objectweb/asm/tree/MultiANewArrayInsnNode.java @@ -29,11 +29,11 @@ */ package org.objectweb.asm.tree; +import java.util.Map; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; -import java.util.Map; - /** * A node that represents a MULTIANEWARRAY instruction. * diff --git a/src/main/java/org/objectweb/asm/tree/ParameterNode.java b/src/org/objectweb/asm/tree/ParameterNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/ParameterNode.java rename to src/org/objectweb/asm/tree/ParameterNode.java diff --git a/src/main/java/org/objectweb/asm/tree/TableSwitchInsnNode.java b/src/org/objectweb/asm/tree/TableSwitchInsnNode.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/TableSwitchInsnNode.java rename to src/org/objectweb/asm/tree/TableSwitchInsnNode.java index 83d6662b..fb80e639 100644 --- a/src/main/java/org/objectweb/asm/tree/TableSwitchInsnNode.java +++ b/src/org/objectweb/asm/tree/TableSwitchInsnNode.java @@ -29,15 +29,15 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + /** * A node that represents a TABLESWITCH instruction. * diff --git a/src/main/java/org/objectweb/asm/tree/TryCatchBlockNode.java b/src/org/objectweb/asm/tree/TryCatchBlockNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/TryCatchBlockNode.java rename to src/org/objectweb/asm/tree/TryCatchBlockNode.java index f226d877..7a33a9fd 100644 --- a/src/main/java/org/objectweb/asm/tree/TryCatchBlockNode.java +++ b/src/org/objectweb/asm/tree/TryCatchBlockNode.java @@ -29,10 +29,10 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.MethodVisitor; - import java.util.List; +import org.objectweb.asm.MethodVisitor; + /** * A node that represents a try catch block. * diff --git a/src/main/java/org/objectweb/asm/tree/TypeAnnotationNode.java b/src/org/objectweb/asm/tree/TypeAnnotationNode.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/TypeAnnotationNode.java rename to src/org/objectweb/asm/tree/TypeAnnotationNode.java diff --git a/src/main/java/org/objectweb/asm/tree/TypeInsnNode.java b/src/org/objectweb/asm/tree/TypeInsnNode.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/TypeInsnNode.java rename to src/org/objectweb/asm/tree/TypeInsnNode.java index 45b80e33..7b5876a5 100644 --- a/src/main/java/org/objectweb/asm/tree/TypeInsnNode.java +++ b/src/org/objectweb/asm/tree/TypeInsnNode.java @@ -29,10 +29,10 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.MethodVisitor; - import java.util.Map; +import org.objectweb.asm.MethodVisitor; + /** * A node that represents a type instruction. A type instruction is an * instruction that takes a type descriptor as parameter. diff --git a/src/main/java/org/objectweb/asm/tree/VarInsnNode.java b/src/org/objectweb/asm/tree/VarInsnNode.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/VarInsnNode.java rename to src/org/objectweb/asm/tree/VarInsnNode.java index c4635848..8a489f2d 100644 --- a/src/main/java/org/objectweb/asm/tree/VarInsnNode.java +++ b/src/org/objectweb/asm/tree/VarInsnNode.java @@ -29,10 +29,10 @@ */ package org.objectweb.asm.tree; -import org.objectweb.asm.MethodVisitor; - import java.util.Map; +import org.objectweb.asm.MethodVisitor; + /** * A node that represents a local variable instruction. A local variable * instruction is an instruction that loads or stores the value of a local diff --git a/src/main/java/org/objectweb/asm/tree/analysis/Analyzer.java b/src/org/objectweb/asm/tree/analysis/Analyzer.java similarity index 97% rename from src/main/java/org/objectweb/asm/tree/analysis/Analyzer.java rename to src/org/objectweb/asm/tree/analysis/Analyzer.java index 6d039a69..a0673c7b 100644 --- a/src/main/java/org/objectweb/asm/tree/analysis/Analyzer.java +++ b/src/org/objectweb/asm/tree/analysis/Analyzer.java @@ -29,15 +29,24 @@ */ package org.objectweb.asm.tree.analysis; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.*; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.IincInsnNode; +import org.objectweb.asm.tree.InsnList; +import org.objectweb.asm.tree.JumpInsnNode; +import org.objectweb.asm.tree.LabelNode; +import org.objectweb.asm.tree.LookupSwitchInsnNode; +import org.objectweb.asm.tree.MethodNode; +import org.objectweb.asm.tree.TableSwitchInsnNode; +import org.objectweb.asm.tree.TryCatchBlockNode; +import org.objectweb.asm.tree.VarInsnNode; + /** * A semantic bytecode analyzer. This class does not fully check that JSR and * RET instructions are valid. diff --git a/src/main/java/org/objectweb/asm/tree/analysis/AnalyzerException.java b/src/org/objectweb/asm/tree/analysis/AnalyzerException.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/analysis/AnalyzerException.java rename to src/org/objectweb/asm/tree/analysis/AnalyzerException.java diff --git a/src/main/java/org/objectweb/asm/tree/analysis/BasicInterpreter.java b/src/org/objectweb/asm/tree/analysis/BasicInterpreter.java similarity index 96% rename from src/main/java/org/objectweb/asm/tree/analysis/BasicInterpreter.java rename to src/org/objectweb/asm/tree/analysis/BasicInterpreter.java index 74166f74..40699fa8 100644 --- a/src/main/java/org/objectweb/asm/tree/analysis/BasicInterpreter.java +++ b/src/org/objectweb/asm/tree/analysis/BasicInterpreter.java @@ -29,12 +29,19 @@ */ package org.objectweb.asm.tree.analysis; +import java.util.List; + import org.objectweb.asm.Handle; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; -import org.objectweb.asm.tree.*; - -import java.util.List; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.FieldInsnNode; +import org.objectweb.asm.tree.IntInsnNode; +import org.objectweb.asm.tree.InvokeDynamicInsnNode; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MultiANewArrayInsnNode; +import org.objectweb.asm.tree.TypeInsnNode; /** * An {@link Interpreter} for {@link BasicValue} values. diff --git a/src/main/java/org/objectweb/asm/tree/analysis/BasicValue.java b/src/org/objectweb/asm/tree/analysis/BasicValue.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/analysis/BasicValue.java rename to src/org/objectweb/asm/tree/analysis/BasicValue.java diff --git a/src/main/java/org/objectweb/asm/tree/analysis/BasicVerifier.java b/src/org/objectweb/asm/tree/analysis/BasicVerifier.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/analysis/BasicVerifier.java rename to src/org/objectweb/asm/tree/analysis/BasicVerifier.java index 2ab62118..2de80ec0 100644 --- a/src/main/java/org/objectweb/asm/tree/analysis/BasicVerifier.java +++ b/src/org/objectweb/asm/tree/analysis/BasicVerifier.java @@ -29,14 +29,14 @@ */ package org.objectweb.asm.tree.analysis; +import java.util.List; + import org.objectweb.asm.Type; import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.FieldInsnNode; import org.objectweb.asm.tree.InvokeDynamicInsnNode; import org.objectweb.asm.tree.MethodInsnNode; -import java.util.List; - /** * An extended {@link BasicInterpreter} that checks that bytecode instructions * are correctly used. diff --git a/src/main/java/org/objectweb/asm/tree/analysis/Frame.java b/src/org/objectweb/asm/tree/analysis/Frame.java similarity index 98% rename from src/main/java/org/objectweb/asm/tree/analysis/Frame.java rename to src/org/objectweb/asm/tree/analysis/Frame.java index 650b552a..95f3db0c 100644 --- a/src/main/java/org/objectweb/asm/tree/analysis/Frame.java +++ b/src/org/objectweb/asm/tree/analysis/Frame.java @@ -29,13 +29,18 @@ */ package org.objectweb.asm.tree.analysis; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.*; - import java.util.ArrayList; import java.util.List; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.IincInsnNode; +import org.objectweb.asm.tree.InvokeDynamicInsnNode; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MultiANewArrayInsnNode; +import org.objectweb.asm.tree.VarInsnNode; + /** * A symbolic execution stack frame. A stack frame contains a set of local * variable slots, and an operand stack. Warning: long and double values are diff --git a/src/main/java/org/objectweb/asm/tree/analysis/Interpreter.java b/src/org/objectweb/asm/tree/analysis/Interpreter.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/analysis/Interpreter.java rename to src/org/objectweb/asm/tree/analysis/Interpreter.java index 419aa13e..94e08ea2 100644 --- a/src/main/java/org/objectweb/asm/tree/analysis/Interpreter.java +++ b/src/org/objectweb/asm/tree/analysis/Interpreter.java @@ -29,11 +29,11 @@ */ package org.objectweb.asm.tree.analysis; +import java.util.List; + import org.objectweb.asm.Type; import org.objectweb.asm.tree.AbstractInsnNode; -import java.util.List; - /** * A semantic bytecode interpreter. More precisely, this interpreter only * manages the computation of values from other values: it does not manage the diff --git a/src/main/java/org/objectweb/asm/tree/analysis/SimpleVerifier.java b/src/org/objectweb/asm/tree/analysis/SimpleVerifier.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/analysis/SimpleVerifier.java rename to src/org/objectweb/asm/tree/analysis/SimpleVerifier.java index 7492f1d2..c8ee087d 100644 --- a/src/main/java/org/objectweb/asm/tree/analysis/SimpleVerifier.java +++ b/src/org/objectweb/asm/tree/analysis/SimpleVerifier.java @@ -29,10 +29,10 @@ */ package org.objectweb.asm.tree.analysis; -import org.objectweb.asm.Type; - import java.util.List; +import org.objectweb.asm.Type; + /** * An extended {@link BasicVerifier} that performs more precise verifications. * This verifier computes exact class types, instead of using a single "object diff --git a/src/main/java/org/objectweb/asm/tree/analysis/SmallSet.java b/src/org/objectweb/asm/tree/analysis/SmallSet.java similarity index 96% rename from src/main/java/org/objectweb/asm/tree/analysis/SmallSet.java rename to src/org/objectweb/asm/tree/analysis/SmallSet.java index 675a053a..0cf6ccfb 100644 --- a/src/main/java/org/objectweb/asm/tree/analysis/SmallSet.java +++ b/src/org/objectweb/asm/tree/analysis/SmallSet.java @@ -29,7 +29,11 @@ */ package org.objectweb.asm.tree.analysis; -import java.util.*; +import java.util.AbstractSet; +import java.util.HashSet; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Set; /** * A set of at most two elements. diff --git a/src/main/java/org/objectweb/asm/tree/analysis/SourceInterpreter.java b/src/org/objectweb/asm/tree/analysis/SourceInterpreter.java similarity index 96% rename from src/main/java/org/objectweb/asm/tree/analysis/SourceInterpreter.java rename to src/org/objectweb/asm/tree/analysis/SourceInterpreter.java index adac143a..cfac8271 100644 --- a/src/main/java/org/objectweb/asm/tree/analysis/SourceInterpreter.java +++ b/src/org/objectweb/asm/tree/analysis/SourceInterpreter.java @@ -29,14 +29,18 @@ */ package org.objectweb.asm.tree.analysis; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.*; - import java.util.HashSet; import java.util.List; import java.util.Set; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.FieldInsnNode; +import org.objectweb.asm.tree.InvokeDynamicInsnNode; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.MethodInsnNode; + /** * An {@link Interpreter} for {@link SourceValue} values. * diff --git a/src/main/java/org/objectweb/asm/tree/analysis/SourceValue.java b/src/org/objectweb/asm/tree/analysis/SourceValue.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/analysis/SourceValue.java rename to src/org/objectweb/asm/tree/analysis/SourceValue.java index 476e5b97..f87fc9e8 100644 --- a/src/main/java/org/objectweb/asm/tree/analysis/SourceValue.java +++ b/src/org/objectweb/asm/tree/analysis/SourceValue.java @@ -29,10 +29,10 @@ */ package org.objectweb.asm.tree.analysis; -import org.objectweb.asm.tree.AbstractInsnNode; - import java.util.Set; +import org.objectweb.asm.tree.AbstractInsnNode; + /** * A {@link Value} that is represented by its type in a two types type system. * This type system distinguishes the ONEWORD and TWOWORDS types. diff --git a/src/main/java/org/objectweb/asm/tree/analysis/Subroutine.java b/src/org/objectweb/asm/tree/analysis/Subroutine.java similarity index 99% rename from src/main/java/org/objectweb/asm/tree/analysis/Subroutine.java rename to src/org/objectweb/asm/tree/analysis/Subroutine.java index b08c9a21..27396715 100644 --- a/src/main/java/org/objectweb/asm/tree/analysis/Subroutine.java +++ b/src/org/objectweb/asm/tree/analysis/Subroutine.java @@ -29,12 +29,12 @@ */ package org.objectweb.asm.tree.analysis; -import org.objectweb.asm.tree.JumpInsnNode; -import org.objectweb.asm.tree.LabelNode; - import java.util.ArrayList; import java.util.List; +import org.objectweb.asm.tree.JumpInsnNode; +import org.objectweb.asm.tree.LabelNode; + /** * A method subroutine (corresponds to a JSR instruction). * diff --git a/src/main/java/org/objectweb/asm/tree/analysis/Value.java b/src/org/objectweb/asm/tree/analysis/Value.java similarity index 100% rename from src/main/java/org/objectweb/asm/tree/analysis/Value.java rename to src/org/objectweb/asm/tree/analysis/Value.java diff --git a/src/main/java/org/objectweb/asm/util/ASMifiable.java b/src/org/objectweb/asm/util/ASMifiable.java similarity index 100% rename from src/main/java/org/objectweb/asm/util/ASMifiable.java rename to src/org/objectweb/asm/util/ASMifiable.java index f03e3e0d..dcefe677 100644 --- a/src/main/java/org/objectweb/asm/util/ASMifiable.java +++ b/src/org/objectweb/asm/util/ASMifiable.java @@ -29,10 +29,10 @@ */ package org.objectweb.asm.util; -import org.objectweb.asm.Label; - import java.util.Map; +import org.objectweb.asm.Label; + /** * An {@link org.objectweb.asm.Attribute Attribute} that can print the ASM code * to create an equivalent attribute. diff --git a/src/main/java/org/objectweb/asm/util/ASMifier.java b/src/org/objectweb/asm/util/ASMifier.java similarity index 99% rename from src/main/java/org/objectweb/asm/util/ASMifier.java rename to src/org/objectweb/asm/util/ASMifier.java index a93109ac..e03fd09b 100644 --- a/src/main/java/org/objectweb/asm/util/ASMifier.java +++ b/src/org/objectweb/asm/util/ASMifier.java @@ -29,13 +29,19 @@ */ package org.objectweb.asm.util; -import org.objectweb.asm.*; - import java.io.FileInputStream; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.TypePath; + /** * A {@link Printer} that prints the ASM code to generate the classes if visits. * diff --git a/src/main/java/org/objectweb/asm/util/CheckAnnotationAdapter.java b/src/org/objectweb/asm/util/CheckAnnotationAdapter.java similarity index 100% rename from src/main/java/org/objectweb/asm/util/CheckAnnotationAdapter.java rename to src/org/objectweb/asm/util/CheckAnnotationAdapter.java diff --git a/src/main/java/org/objectweb/asm/util/CheckClassAdapter.java b/src/org/objectweb/asm/util/CheckClassAdapter.java similarity index 98% rename from src/main/java/org/objectweb/asm/util/CheckClassAdapter.java rename to src/org/objectweb/asm/util/CheckClassAdapter.java index bd9ccd6c..210e2389 100644 --- a/src/main/java/org/objectweb/asm/util/CheckClassAdapter.java +++ b/src/org/objectweb/asm/util/CheckClassAdapter.java @@ -29,7 +29,25 @@ */ package org.objectweb.asm.util; -import org.objectweb.asm.*; +import java.io.FileInputStream; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.TypePath; +import org.objectweb.asm.TypeReference; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodNode; import org.objectweb.asm.tree.analysis.Analyzer; @@ -37,10 +55,6 @@ import org.objectweb.asm.tree.analysis.BasicValue; import org.objectweb.asm.tree.analysis.Frame; import org.objectweb.asm.tree.analysis.SimpleVerifier; -import java.io.FileInputStream; -import java.io.PrintWriter; -import java.util.*; - /** * A {@link ClassVisitor} that checks that its methods are properly used. More * precisely this class adapter checks each method call individually, based diff --git a/src/main/java/org/objectweb/asm/util/CheckFieldAdapter.java b/src/org/objectweb/asm/util/CheckFieldAdapter.java similarity index 95% rename from src/main/java/org/objectweb/asm/util/CheckFieldAdapter.java rename to src/org/objectweb/asm/util/CheckFieldAdapter.java index 7c06959a..0b2e0e5b 100644 --- a/src/main/java/org/objectweb/asm/util/CheckFieldAdapter.java +++ b/src/org/objectweb/asm/util/CheckFieldAdapter.java @@ -29,7 +29,12 @@ */ package org.objectweb.asm.util; -import org.objectweb.asm.*; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.TypePath; +import org.objectweb.asm.TypeReference; /** * A {@link FieldVisitor} that checks that its methods are properly used. diff --git a/src/main/java/org/objectweb/asm/util/CheckMethodAdapter.java b/src/org/objectweb/asm/util/CheckMethodAdapter.java similarity index 99% rename from src/main/java/org/objectweb/asm/util/CheckMethodAdapter.java rename to src/org/objectweb/asm/util/CheckMethodAdapter.java index b1c7017f..477584a3 100644 --- a/src/main/java/org/objectweb/asm/util/CheckMethodAdapter.java +++ b/src/org/objectweb/asm/util/CheckMethodAdapter.java @@ -29,17 +29,30 @@ */ package org.objectweb.asm.util; -import org.objectweb.asm.*; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.TypePath; +import org.objectweb.asm.TypeReference; import org.objectweb.asm.tree.MethodNode; import org.objectweb.asm.tree.analysis.Analyzer; import org.objectweb.asm.tree.analysis.BasicValue; import org.objectweb.asm.tree.analysis.BasicVerifier; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.reflect.Field; -import java.util.*; - /** * A {@link MethodVisitor} that checks that its methods are properly used. More * precisely this method adapter checks each instruction individually, i.e., diff --git a/src/main/java/org/objectweb/asm/util/CheckSignatureAdapter.java b/src/org/objectweb/asm/util/CheckSignatureAdapter.java similarity index 100% rename from src/main/java/org/objectweb/asm/util/CheckSignatureAdapter.java rename to src/org/objectweb/asm/util/CheckSignatureAdapter.java diff --git a/src/main/java/org/objectweb/asm/util/Printer.java b/src/org/objectweb/asm/util/Printer.java similarity index 99% rename from src/main/java/org/objectweb/asm/util/Printer.java rename to src/org/objectweb/asm/util/Printer.java index 3b27d514..50513c84 100644 --- a/src/main/java/org/objectweb/asm/util/Printer.java +++ b/src/org/objectweb/asm/util/Printer.java @@ -29,12 +29,16 @@ */ package org.objectweb.asm.util; -import org.objectweb.asm.*; - import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.TypePath; + /** * An abstract converter from visit events to text. * diff --git a/src/main/java/org/objectweb/asm/util/Textifiable.java b/src/org/objectweb/asm/util/Textifiable.java similarity index 100% rename from src/main/java/org/objectweb/asm/util/Textifiable.java rename to src/org/objectweb/asm/util/Textifiable.java index 6ed4c19e..aad97ba2 100644 --- a/src/main/java/org/objectweb/asm/util/Textifiable.java +++ b/src/org/objectweb/asm/util/Textifiable.java @@ -29,10 +29,10 @@ */ package org.objectweb.asm.util; -import org.objectweb.asm.Label; - import java.util.Map; +import org.objectweb.asm.Label; + /** * An {@link org.objectweb.asm.Attribute Attribute} that can print a readable * representation of itself. diff --git a/src/main/java/org/objectweb/asm/util/Textifier.java b/src/org/objectweb/asm/util/Textifier.java similarity index 99% rename from src/main/java/org/objectweb/asm/util/Textifier.java rename to src/org/objectweb/asm/util/Textifier.java index 393a02d9..895c7e2b 100644 --- a/src/main/java/org/objectweb/asm/util/Textifier.java +++ b/src/org/objectweb/asm/util/Textifier.java @@ -29,14 +29,21 @@ */ package org.objectweb.asm.util; -import org.objectweb.asm.*; -import org.objectweb.asm.signature.SignatureReader; - import java.io.FileInputStream; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.TypePath; +import org.objectweb.asm.TypeReference; +import org.objectweb.asm.signature.SignatureReader; + /** * A {@link Printer} that prints a disassembled view of the classes it visits. * diff --git a/src/main/java/org/objectweb/asm/util/TraceAnnotationVisitor.java b/src/org/objectweb/asm/util/TraceAnnotationVisitor.java similarity index 100% rename from src/main/java/org/objectweb/asm/util/TraceAnnotationVisitor.java rename to src/org/objectweb/asm/util/TraceAnnotationVisitor.java diff --git a/src/main/java/org/objectweb/asm/util/TraceClassVisitor.java b/src/org/objectweb/asm/util/TraceClassVisitor.java similarity index 96% rename from src/main/java/org/objectweb/asm/util/TraceClassVisitor.java rename to src/org/objectweb/asm/util/TraceClassVisitor.java index e65965fb..3ca59781 100644 --- a/src/main/java/org/objectweb/asm/util/TraceClassVisitor.java +++ b/src/org/objectweb/asm/util/TraceClassVisitor.java @@ -29,10 +29,16 @@ */ package org.objectweb.asm.util; -import org.objectweb.asm.*; - import java.io.PrintWriter; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.TypePath; + /** * A {@link ClassVisitor} that prints the classes it visits with a * {@link Printer}. This class visitor can be used in the middle of a class diff --git a/src/main/java/org/objectweb/asm/util/TraceFieldVisitor.java b/src/org/objectweb/asm/util/TraceFieldVisitor.java similarity index 94% rename from src/main/java/org/objectweb/asm/util/TraceFieldVisitor.java rename to src/org/objectweb/asm/util/TraceFieldVisitor.java index 7e4a10b1..dbb3be03 100644 --- a/src/main/java/org/objectweb/asm/util/TraceFieldVisitor.java +++ b/src/org/objectweb/asm/util/TraceFieldVisitor.java @@ -29,7 +29,11 @@ */ package org.objectweb.asm.util; -import org.objectweb.asm.*; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.TypePath; /** * A {@link FieldVisitor} that prints the fields it visits with a diff --git a/src/main/java/org/objectweb/asm/util/TraceMethodVisitor.java b/src/org/objectweb/asm/util/TraceMethodVisitor.java similarity index 97% rename from src/main/java/org/objectweb/asm/util/TraceMethodVisitor.java rename to src/org/objectweb/asm/util/TraceMethodVisitor.java index 0e190a84..5f72ac61 100644 --- a/src/main/java/org/objectweb/asm/util/TraceMethodVisitor.java +++ b/src/org/objectweb/asm/util/TraceMethodVisitor.java @@ -29,7 +29,13 @@ */ package org.objectweb.asm.util; -import org.objectweb.asm.*; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.TypePath; /** * A {@link MethodVisitor} that prints the methods it visits with a diff --git a/src/main/java/org/objectweb/asm/util/TraceSignatureVisitor.java b/src/org/objectweb/asm/util/TraceSignatureVisitor.java similarity index 100% rename from src/main/java/org/objectweb/asm/util/TraceSignatureVisitor.java rename to src/org/objectweb/asm/util/TraceSignatureVisitor.java diff --git a/src/main/java/org/objectweb/asm/xml/ASMContentHandler.java b/src/org/objectweb/asm/xml/ASMContentHandler.java similarity index 99% rename from src/main/java/org/objectweb/asm/xml/ASMContentHandler.java rename to src/org/objectweb/asm/xml/ASMContentHandler.java index 9b2d3968..7d1d0743 100644 --- a/src/main/java/org/objectweb/asm/xml/ASMContentHandler.java +++ b/src/org/objectweb/asm/xml/ASMContentHandler.java @@ -29,16 +29,24 @@ */ package org.objectweb.asm.xml; -import org.objectweb.asm.*; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.TypePath; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + /** * A {@link org.xml.sax.ContentHandler ContentHandler} that transforms XML * document into Java class file. This class can be feeded by any kind of SAX diff --git a/src/main/java/org/objectweb/asm/xml/Processor.java b/src/org/objectweb/asm/xml/Processor.java similarity index 97% rename from src/main/java/org/objectweb/asm/xml/Processor.java rename to src/org/objectweb/asm/xml/Processor.java index 6f5193b0..24f0ab03 100644 --- a/src/main/java/org/objectweb/asm/xml/Processor.java +++ b/src/org/objectweb/asm/xml/Processor.java @@ -29,24 +29,42 @@ */ package org.objectweb.asm.xml; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.xml.sax.*; -import org.xml.sax.ext.LexicalHandler; -import org.xml.sax.helpers.AttributesImpl; -import org.xml.sax.helpers.DefaultHandler; -import org.xml.sax.helpers.XMLReaderFactory; +import java.io.BufferedOutputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; -import javax.xml.transform.*; +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamSource; -import java.io.*; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; -import java.util.zip.ZipOutputStream; + +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassWriter; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.ext.LexicalHandler; +import org.xml.sax.helpers.AttributesImpl; +import org.xml.sax.helpers.DefaultHandler; +import org.xml.sax.helpers.XMLReaderFactory; /** * Processor is a command line tool that can be used for bytecode waving diff --git a/src/main/java/org/objectweb/asm/xml/SAXAdapter.java b/src/org/objectweb/asm/xml/SAXAdapter.java similarity index 100% rename from src/main/java/org/objectweb/asm/xml/SAXAdapter.java rename to src/org/objectweb/asm/xml/SAXAdapter.java diff --git a/src/main/java/org/objectweb/asm/xml/SAXAnnotationAdapter.java b/src/org/objectweb/asm/xml/SAXAnnotationAdapter.java similarity index 100% rename from src/main/java/org/objectweb/asm/xml/SAXAnnotationAdapter.java rename to src/org/objectweb/asm/xml/SAXAnnotationAdapter.java diff --git a/src/main/java/org/objectweb/asm/xml/SAXClassAdapter.java b/src/org/objectweb/asm/xml/SAXClassAdapter.java similarity index 98% rename from src/main/java/org/objectweb/asm/xml/SAXClassAdapter.java rename to src/org/objectweb/asm/xml/SAXClassAdapter.java index 54c8f652..6d415229 100644 --- a/src/main/java/org/objectweb/asm/xml/SAXClassAdapter.java +++ b/src/org/objectweb/asm/xml/SAXClassAdapter.java @@ -29,7 +29,12 @@ */ package org.objectweb.asm.xml; -import org.objectweb.asm.*; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.TypePath; import org.xml.sax.ContentHandler; import org.xml.sax.helpers.AttributesImpl; diff --git a/src/main/java/org/objectweb/asm/xml/SAXCodeAdapter.java b/src/org/objectweb/asm/xml/SAXCodeAdapter.java similarity index 98% rename from src/main/java/org/objectweb/asm/xml/SAXCodeAdapter.java rename to src/org/objectweb/asm/xml/SAXCodeAdapter.java index e105e450..b6b8ed10 100644 --- a/src/main/java/org/objectweb/asm/xml/SAXCodeAdapter.java +++ b/src/org/objectweb/asm/xml/SAXCodeAdapter.java @@ -29,13 +29,19 @@ */ package org.objectweb.asm.xml; -import org.objectweb.asm.*; -import org.objectweb.asm.util.Printer; -import org.xml.sax.helpers.AttributesImpl; - import java.util.HashMap; import java.util.Map; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Handle; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.TypePath; +import org.objectweb.asm.util.Printer; +import org.xml.sax.helpers.AttributesImpl; + /** * A {@link MethodVisitor} that generates SAX 2.0 events from the visited * method. diff --git a/src/main/java/org/objectweb/asm/xml/SAXFieldAdapter.java b/src/org/objectweb/asm/xml/SAXFieldAdapter.java similarity index 100% rename from src/main/java/org/objectweb/asm/xml/SAXFieldAdapter.java rename to src/org/objectweb/asm/xml/SAXFieldAdapter.java diff --git a/src/resources/1.gif b/src/resources/1.gif new file mode 100644 index 00000000..1441be36 Binary files /dev/null and b/src/resources/1.gif differ diff --git a/src/resources/android.png b/src/resources/android.png new file mode 100644 index 00000000..6c242f0a Binary files /dev/null and b/src/resources/android.png differ diff --git a/src/resources/bat.png b/src/resources/bat.png new file mode 100644 index 00000000..c28dd638 Binary files /dev/null and b/src/resources/bat.png differ diff --git a/src/resources/c#.png b/src/resources/c#.png new file mode 100644 index 00000000..ffb8fc93 Binary files /dev/null and b/src/resources/c#.png differ diff --git a/src/resources/c++.png b/src/resources/c++.png new file mode 100644 index 00000000..a87cf847 Binary files /dev/null and b/src/resources/c++.png differ diff --git a/src/resources/class.png b/src/resources/class.png new file mode 100644 index 00000000..0a7d6f4a Binary files /dev/null and b/src/resources/class.png differ diff --git a/src/resources/config.png b/src/resources/config.png new file mode 100644 index 00000000..106f5aa3 Binary files /dev/null and b/src/resources/config.png differ diff --git a/src/resources/decoded.png b/src/resources/decoded.png new file mode 100644 index 00000000..44ccbf81 Binary files /dev/null and b/src/resources/decoded.png differ diff --git a/src/resources/file.png b/src/resources/file.png new file mode 100644 index 00000000..8b8b1ca0 Binary files /dev/null and b/src/resources/file.png differ diff --git a/src/resources/folder.png b/src/resources/folder.png new file mode 100644 index 00000000..784e8fa4 Binary files /dev/null and b/src/resources/folder.png differ diff --git a/src/resources/image.png b/src/resources/image.png new file mode 100644 index 00000000..4a158fef Binary files /dev/null and b/src/resources/image.png differ diff --git a/src/resources/intro.html b/src/resources/intro.html new file mode 100644 index 00000000..2ae6f8a1 --- /dev/null +++ b/src/resources/intro.html @@ -0,0 +1,78 @@ +Bytecode Viewer (BCV) was designed to be extremely user and beginner friendly, because of this almost everything is accessible through an interface, settings, tools, etc. This means if you give BCV a try you should get the gist of it can do, however for those who don't want to run BCV until they're convinced they should use it, below is a complete list of features BCV has, and what they do. + +

Command Line Interface (CLI):

+
    +
  • -help Displays the help menu
  • +
  • -list Displays the available decompilers
  • +
  • -decompiler [decompiler] Selects the decompiler, procyon by default
  • +
  • -i [input file] Selects the input file (Jar, Class, APK, ZIP, DEX all work automatically)
  • +
  • -o [output file] Selects the output file (Java or Java-Bytecode)
  • +
  • -t [target classname] Must either be the fully qualified classname or "all" to decompile all as zip
  • +
  • -nowait Doesn't wait for the user to read the CLI messages
  • +
+ +

File:

+
    +
  • Add (Ctrl + O) - If you add a jar/zip BCV will unzip it, if you add an APK or DEX file, BCV will run dex2jar then run the jar input process.
  • +
  • New Workspace (Ctrl + N) - It clears the opened jars/resources.
  • +
  • Run (Ctrl + R) - Runs the classfiles you've loaded into BCV in a secure sandboxed JVM instance that you can fully debug.
  • +
  • Compile (Ctrl + T) - Tries to compile all of the editable panes you've selected, if it's Java it'll compile with Ranino. Krakatau and *Smali use their own assemblers.
  • +
  • Save As Jar - Export the class files and loaded resources as a runnable Jar file.
  • +
  • Save As DEX - Run jar2dex and export the Classfiles as DEX.
  • +
  • Save Files As - Save all the Classfiles and resources as a zip.
  • +
  • Save Java File As - Save the currently opened decompiled Classfile.
  • +
  • Save Java Files As - Save all of the decompiled Classfiles as a zip.
  • +
  • Recent Files - Last 25 files/directories you've opened with BCV.
  • +
  • About - A small information window about BCV.
  • +
  • Exit - Closes BCV.
  • +
+ +

View Panes:

+
    +
  • Editable - Defines if that viewing pane will be editable.
  • +
  • None - Nothing will be displayed.
  • +
  • Procyon - Decompiles with Procyon decompiler.
  • +
  • CFR - Decompilers with CFR decompiler.
  • +
  • FernFlower - Decompiles with FernFlower decompiler.
  • +
  • JD-GUI - Decompiles with JD-GUI decompiler.
  • +
  • Krakatau Java - Decompiles with Krakatau decompiler.
  • +
  • Krakatau Bytecode - Disassembles with Krakatau disassembler.
  • +
  • Smali - Disassembles with Smali.
  • +
  • Bytecode - Decompiles the Bytecode via CFIDE. Not Editable.
  • +
  • Hexcode - Shows the classfile in a hex viewer. Not Editable.
  • +
+ +

Settings:

+
    +
  • Compile On Save - If selected whenever you do one of the File>Save * functions it will try to compile before it saves.
  • +
  • Compile On Refresh - If selected whenever you press refresh it compile before it reloads the resource/class.
  • +
  • Update Check - If selected it queries https://github.com/Konloch/bytecode-viewer to ensure you've got the latest version.
  • +
  • Refresh On View Change - If selected whenever you change an option in the View Panes it will refresh the currently opened resources/class.
  • +
  • Decode APK Resources - If selected whenever you add an APK, it will first run APKTool.jar to decode the resources.
  • +
  • Set Python 2.7 Executable - Set the Python 2.7 executable if you want Krakatau decompiler/disassembler/assembler to work.
  • +
  • Set JRE RT Library - Set the JRE RT library for Krakatau decompiler.
  • +
+ +

Plugins:

+
    +
  • Open Plugin - Open a .java plugin created for BCV.
  • +
  • Recent Plugins - Last 25 plugins you've opened with BCV.
  • +
  • Code Sequence Diagram - Builds a crude code sequence diagram for the classfile that's currently opened.
  • +
  • Malicious Code Scanner - Allows you to define what to search for, and outputs what it found.
  • +
  • Show Main Methods - Detects and outputs all of the public static void main(String[]) functions.
  • +
  • Show All Strings - Grabs then outputs all of the strings in every classfile.
  • +
  • Replace Strings - Allows you to do a simple permanent .replace on the classfile strings, very useful for URL swapping.
  • +
  • Allatori String Decrypter - Decrypts the Allatori obfuscated/encrypted strings.
  • +
  • ZKM String Decrypter - Decrypts the ZKM obfuscated/encrypted strings.
  • +
  • ZStringArray String Decrypter - Decrypts the ZStringArray obfuscated/encrypted strings.
  • +
+ +

Notes:

+
    +
  • If BCV fails to boot simply append -clean as an argument to clean the lib directory.
  • +
  • Relax and take notes, while I take tokes of the marijuana smoke.
  • +
  • BCV was created out of love for Java Reverse engineering.
  • +
  • Bytecode Viewer's Homepage is http://bytecodeviewer.com
  • +
+ + \ No newline at end of file diff --git a/src/resources/jar.png b/src/resources/jar.png new file mode 100644 index 00000000..b1d0b57d Binary files /dev/null and b/src/resources/jar.png differ diff --git a/src/resources/java.png b/src/resources/java.png new file mode 100644 index 00000000..4eb93e6f Binary files /dev/null and b/src/resources/java.png differ diff --git a/src/resources/package.png b/src/resources/package.png new file mode 100644 index 00000000..0afea5b8 Binary files /dev/null and b/src/resources/package.png differ diff --git a/src/resources/sh.png b/src/resources/sh.png new file mode 100644 index 00000000..b3d8ce01 Binary files /dev/null and b/src/resources/sh.png differ diff --git a/src/resources/text.png b/src/resources/text.png new file mode 100644 index 00000000..b93e7760 Binary files /dev/null and b/src/resources/text.png differ diff --git a/src/resources/zip.png b/src/resources/zip.png new file mode 100644 index 00000000..fd4bbccd Binary files /dev/null and b/src/resources/zip.png differ diff --git a/src/the/bytecode/club/bootloader/AbstractLoaderFactory.java b/src/the/bytecode/club/bootloader/AbstractLoaderFactory.java new file mode 100644 index 00000000..6db1faba --- /dev/null +++ b/src/the/bytecode/club/bootloader/AbstractLoaderFactory.java @@ -0,0 +1,79 @@ +package the.bytecode.club.bootloader; + +import java.util.HashMap; +import java.util.Map; + +import the.bytecode.club.bootloader.resource.ExternalResource; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created 21 Jul 2015 00:18:07 + */ +public final class AbstractLoaderFactory { + + private static final String DEFAULT_KEY = "default-factory"; + private static final Map> FACTORYCACHE = new HashMap>(); + + public static void register(LoaderFactory factory) { + register(DEFAULT_KEY, factory); + } + + public static void register(String key, LoaderFactory factory) { + if(key == null || factory == null) { + throw new IllegalArgumentException("null key or factory"); + } + + if(FACTORYCACHE.containsKey(key)) { + throw new IllegalArgumentException("factory already registered with key: " + key); + } + + FACTORYCACHE.put(key, factory); + } + + public static void unregister(String key) { + if(key == null) { + throw new IllegalArgumentException("null key"); + } + + if(!FACTORYCACHE.containsKey(key)) { + throw new IllegalArgumentException("factory doesn't key for key: " + key); + } + + FACTORYCACHE.remove(key); + } + + public static > LoaderFactory find() { + return find(DEFAULT_KEY); + } + + @SuppressWarnings("unchecked") + public static > LoaderFactory find(String key) { + if(key == null) { + throw new IllegalArgumentException("null key"); + } + + if(!FACTORYCACHE.containsKey(key)) { + throw new IllegalArgumentException("factory doesn't key for key: " + key); + } + + return (LoaderFactory) FACTORYCACHE.get(key); + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/Boot.java b/src/the/bytecode/club/bootloader/Boot.java new file mode 100644 index 00000000..5ab43f28 --- /dev/null +++ b/src/the/bytecode/club/bootloader/Boot.java @@ -0,0 +1,468 @@ +package the.bytecode.club.bootloader; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; + +import org.apache.commons.io.FileUtils; + +import me.konloch.kontainer.io.HTTPRequest; +import the.bytecode.club.bootloader.resource.EmptyExternalResource; +import the.bytecode.club.bootloader.resource.ExternalResource; +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.ZipUtils; +import the.bytecode.club.bytecodeviewer.api.ExceptionUI; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Konloch + * @author Bibl (don't ban me pls) + * @created 19 Jul 2015 03:22:37 + */ +public class Boot { + + /*flags*/ + public static boolean globalstop = false; + public static boolean completedboot = false; + public static boolean downloading = false; + + private static InitialBootScreen screen; + private static List libsList = new ArrayList(); + private static List libsFileList = new ArrayList(); + private static List urlList = new ArrayList(); + + static { + try { + screen = new InitialBootScreen(); + } catch(Exception e) { + new ExceptionUI(e); + } + } + + public static void boot(String[] args, boolean CLI) throws Exception { + bootstrap(); + ILoader loader = findLoader(); + + if(!CLI) + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + screen.setVisible(true); + } + }); + + create(loader, args.length > 0 ? Boolean.valueOf(args[0]) : true); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + screen.setVisible(false); + } + }); + } + + public static void hide() { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + screen.setVisible(false); + } + }); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private static void create(ILoader loader, boolean clean) throws Exception { + setState("Bytecode Viewer Boot Screen - Checking Libraries..."); + final File libsDirectory = libsDir(); + + populateUrlList(); + + if(globalstop) { + while(true) { + Thread.sleep(100);//just keep this thread halted. + } + } + + if (urlList.isEmpty()) { + JOptionPane.showMessageDialog(null, "Bytecode Viewer ran into an issue, for some reason github is not returning what we're expecting. Please try rebooting, if this issue persists please contact @Konloch.", "Error", JOptionPane.ERROR_MESSAGE); + return; + } + + if (clean) + libsDirectory.delete(); + + if (!libsDirectory.exists()) + libsDirectory.mkdir(); + + populateLibsDirectory(); + + screen.getProgressBar().setMaximum(urlList.size() * 2); + + int completedCheck = 0; + + for (String s : urlList) { + String fileName = s.substring("https://github.com/Konloch/bytecode-viewer/blob/master/libs/".length(), s.length()); + File file = new File(libsDirectory, fileName); + + boolean passed = false; + while (!passed) { + if (!libsList.contains(fileName)) { + downloading = true; + setState("Bytecode Viewer Boot Screen - Downloading " + fileName + "..."); + System.out.println("Downloading " + fileName); + + InputStream is = null; + FileOutputStream fos = null; + try { + is = new URL("https://github.com/Konloch/bytecode-viewer/raw/master/libs/" + fileName).openConnection().getInputStream(); + fos = new FileOutputStream(file); + System.out.println("Downloading from " + s); + byte[] buffer = new byte[8192]; + int len; + int downloaded = 0; + boolean flag = false; + while ((len = is.read(buffer)) > 0) { + fos.write(buffer, 0, len); + fos.flush(); + downloaded += 8192; + int mbs = downloaded / 1048576; + if (mbs % 5 == 0 && mbs != 0) { + if (!flag) + System.out.println("Downloaded " + mbs + "MBs so far"); + flag = true; + } else + flag = false; + } + } finally { + try { + if (is != null) { + is.close(); + } + } finally { + if (fos != null) { + fos.flush(); + } + if (fos != null) { + fos.close(); + } + } + } + + try { + setState("Bytecode Viewer Boot Screen - Verifying " + fileName + "..."); + System.out.println("Verifying " + fileName + "..."); + + File f = new File(BytecodeViewer.tempDirectory, "temp"); + ZipUtils.zipFile(file, f); + f.delete(); + + libsFileList.add(file.getAbsolutePath()); + System.out.println("Download finished!"); + passed = true; + } catch(Exception e) { + e.printStackTrace(); + System.out.println("Jar or Zip" + file.getAbsolutePath() + " is corrupt, redownloading."); + file.delete(); + } + } else if(BytecodeViewer.verify) { //verify its not corrupt each boot (adds 3 seconds boot time) + try { + setState("Bytecode Viewer Boot Screen - Verifying " + fileName + "..."); + System.out.println("Verifying " + fileName + "..."); + + File f = new File(BytecodeViewer.tempDirectory, "temp"); + ZipUtils.zipFile(file, f); + f.delete(); + + passed = true; + } catch(Exception e) { + e.printStackTrace(); + System.out.println("Jar or Zip" + file.getAbsolutePath() + " is corrupt, redownloading."); + libsFileList.remove(file.getAbsolutePath()); + file.delete(); + } + } else { + passed = true; + } + } + + completedCheck++; + screen.getProgressBar().setValue(completedCheck); + } + + setState("Bytecode Viewer Boot Screen - Checking & Deleting Foreign/Outdated Libraries..."); + System.out.println("Checking & Deleting foreign/outdated libraries"); + for (String s : libsFileList) { + File f = new File(s); + boolean delete = true; + for (String urlS : urlList) { + String fileName = urlS.substring("https://github.com/Konloch/bytecode-viewer/blob/master/libs/".length(), urlS.length()); + if (fileName.equals(f.getName())) + delete = false; + } + if (delete) { + f.delete(); + System.out.println("Detected & Deleted Foriegn/Outdated Jar/File: " + f.getName()); + } + } + + setState("Bytecode Viewer Boot Screen - Loading Libraries..."); + System.out.println("Loading libraries..."); + + for (String s : libsFileList) { + if (s.endsWith(".jar")) { + File f = new File(s); + if (f.exists()) { + setState("Bytecode Viewer Boot Screen - Loading Library " + f.getName()); + System.out.println("Loading library " + f.getName()); + + try { + ExternalResource res = new EmptyExternalResource(f.toURI().toURL()); + loader.bind(res); + System.out.println("Succesfully loaded " + f.getName()); + } catch (Exception e) { + e.printStackTrace(); + f.delete(); + JOptionPane.showMessageDialog(null, "Error, Library " + f.getName() + " is corrupt, please restart to redownload it.", + "Error", JOptionPane.ERROR_MESSAGE); + } + } + + completedCheck++; + screen.getProgressBar().setValue(completedCheck); + } + } + + checkKrakatau(); + completedCheck++; + screen.getProgressBar().setValue(completedCheck); + + checkEnjarify(); + completedCheck++; + screen.getProgressBar().setValue(completedCheck); + + setState("Bytecode Viewer Boot Screen - Booting!"); + completedboot = true; + } + + public static File libsDir() { + File dir = new File(System.getProperty("user.home"), ".Bytecode-Viewer"); + while (!dir.exists()) + dir.mkdirs(); + + return new File(dir, "libs"); + } + + public static void setState(String s) { + screen.setTitle(s); + } + + public static ILoader findLoader() { + // TODO: Find from providers + // return new LibraryClassLoader(); + + // TODO: Catch + return AbstractLoaderFactory.find().spawnLoader(); + } + + private static void bootstrap() { + AbstractLoaderFactory.register(new LoaderFactory() { + @Override + public ILoader spawnLoader() { + return new ClassPathLoader(); + } + }); + } + + public static void populateUrlList() throws Exception { + HTTPRequest req = new HTTPRequest(new URL("https://github.com/Konloch/bytecode-viewer/tree/master/libs")); + req.setTimeout(30000); + for (String s : req.read()) + if (s.contains("href=\"/Konloch/bytecode-viewer/blob/master/libs/")) { + urlList.add("https://github.com" + s.split(" 0) { + fos.write(buffer, 0, len); + fos.flush(); + downloaded += 8192; + int mbs = downloaded / 1048576; + if (mbs % 5 == 0 && mbs != 0) { + if (!flag) + System.out.println("Downloaded " + mbs + "MBs so far"); + flag = true; + } else + flag = false; + } + } catch(Exception e) { + e.printStackTrace(); + } finally { + try { + if (is != null) { + is.close(); + } + } finally { + if (fos != null) { + fos.flush(); + } + if (fos != null) { + fos.close(); + } + } + } + + try { + setState("Bytecode Viewer Boot Screen - Verifying " + fileName + "..."); + System.out.println("Verifying " + fileName + "..."); + + File f = new File(BytecodeViewer.tempDirectory, "temp"); + ZipUtils.zipFile(file, f); + f.delete(); + + libsFileList.add(file.getAbsolutePath()); + System.out.println("Download finished!"); + passed = true; + } catch(Exception e) { + e.printStackTrace(); + System.out.println("Jar or Zip" + file.getAbsolutePath() + " is corrupt, redownloading."); + file.delete(); + } + } else + passed = true; + } + } + } + + public static void checkEnjarify() { + setState("Bytecode Viewer Boot Screen - Checking Enjarify..."); + System.out.println("Checking enjarify"); + File enjarifyZip = null; + for(File f : new File(BytecodeViewer.libsDirectory).listFiles()) { + if(f.getName().toLowerCase().startsWith("enjarify-")) { + BytecodeViewer.enjarifyVersion = f.getName().split("-")[1].split("\\.")[0]; + enjarifyZip = f; + } + } + + for(File f : new File(BytecodeViewer.getBCVDirectory()).listFiles()) { + if(f.getName().toLowerCase().startsWith("enjarify_") && !f.getName().split("_")[1].split("\\.")[0].equals(BytecodeViewer.enjarifyVersion)) { + setState("Bytecode Viewer Boot Screen - Removing Outdated " + f.getName() + "..."); + System.out.println("Removing oudated " + f.getName()); + try { + FileUtils.deleteDirectory(f); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + BytecodeViewer.enjarifyWorkingDirectory = BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "enjarify_" + BytecodeViewer.enjarifyVersion + BytecodeViewer.fs + "enjarify-master"; + File enjarifyDirectory = new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "enjarify_" + BytecodeViewer.enjarifyVersion); + if(!enjarifyDirectory.exists()) { + try { + setState("Bytecode Viewer Boot Screen - Updating to "+enjarifyDirectory.getName()+"..."); + ZipUtils.unzipFilesToPath(enjarifyZip.getAbsolutePath(), enjarifyDirectory.getAbsolutePath()); + System.out.println("Updated to enjarify v" + BytecodeViewer.enjarifyVersion); + } catch(Exception e) { + BytecodeViewer.showMessage("ERROR: There was an issue unzipping enjarify (possibly corrupt). Restart BCV."+BytecodeViewer.nl+ + "If the error persists contact @Konloch."); + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + enjarifyZip.delete(); + } + } + + } + + public static void checkKrakatau() { + setState("Bytecode Viewer Boot Screen - Checking Krakatau..."); + System.out.println("Checking krakatau"); + + File krakatauZip = null; + for(File f : new File(BytecodeViewer.libsDirectory).listFiles()) { + if(f.getName().toLowerCase().startsWith("krakatau-")) { + BytecodeViewer.krakatauVersion = f.getName().split("-")[1].split("\\.")[0]; + krakatauZip = f; + } + } + + for(File f : new File(BytecodeViewer.getBCVDirectory()).listFiles()) { + if(f.getName().toLowerCase().startsWith("krakatau_") && !f.getName().split("_")[1].split("\\.")[0].equals(BytecodeViewer.krakatauVersion)) { + setState("Bytecode Viewer Boot Screen - Removing Outdated " + f.getName() + "..."); + System.out.println("Removing oudated " + f.getName()); + try { + FileUtils.deleteDirectory(f); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + BytecodeViewer.krakatauWorkingDirectory = BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "krakatau_" + BytecodeViewer.krakatauVersion + BytecodeViewer.fs + "Krakatau-master"; + File krakatauDirectory = new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "krakatau_" + BytecodeViewer.krakatauVersion); + if(!krakatauDirectory.exists()) { + try { + setState("Bytecode Viewer Boot Screen - Updating to "+krakatauDirectory.getName()+"..."); + ZipUtils.unzipFilesToPath(krakatauZip.getAbsolutePath(), krakatauDirectory.getAbsolutePath()); + System.out.println("Updated to krakatau v" + BytecodeViewer.krakatauVersion); + } catch(Exception e) { + BytecodeViewer.showMessage("ERROR: There was an issue unzipping Krakatau decompiler (possibly corrupt). Restart BCV."+BytecodeViewer.nl+ + "If the error persists contact @Konloch."); + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + krakatauZip.delete(); + } + } + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/ClassPathLoader.java b/src/the/bytecode/club/bootloader/ClassPathLoader.java new file mode 100644 index 00000000..46ad0b3f --- /dev/null +++ b/src/the/bytecode/club/bootloader/ClassPathLoader.java @@ -0,0 +1,85 @@ +package the.bytecode.club.bootloader; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; + +import the.bytecode.club.bootloader.resource.ExternalResource; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created 21 Jul 2015 00:09:53 + */ +public class ClassPathLoader implements ILoader { + + void extendClassPath(URL url) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException { + URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); + Class urlClass = URLClassLoader.class; + Method method = urlClass.getDeclaredMethod("addURL", new Class[] { URL.class }); + method.setAccessible(true); + method.invoke(urlClassLoader, new Object[] { url }); + } + + /* + * (non-Javadoc) + * + * @see the.bytecode.club.bootloader.ILoader#bind(the.bytecode.club.bootloader .resource.ExternalResource) + */ + @Override + public void bind(ExternalResource resource) { + try { + if (resource != null) { + URL url = resource.getLocation(); + if (url != null) { + extendClassPath(url); + } + } + }/* catch (IOException e) { + System.err.println("Error loading resource."); + e.printStackTrace(); + }*/ catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + System.err.println("Error reflecting URLClassLoader.addURL(URL) ?"); + e.printStackTrace(); + } + } + + /* + * (non-Javadoc) + * + * @see the.bytecode.club.bootloader.ILoader#findClass(java.lang.String) + */ + @Override + public Class findClass(String name) throws ClassNotFoundException, NoClassDefFoundError { + return Class.forName(name); + } + + /* + * (non-Javadoc) + * + * @see the.bytecode.club.bootloader.ILoader#loadClass(java.lang.String) + */ + @Override + public Class loadClass(String name) throws ClassNotFoundException, NoClassDefFoundError { + return findClass(name); + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/ILoader.java b/src/the/bytecode/club/bootloader/ILoader.java new file mode 100644 index 00000000..85926238 --- /dev/null +++ b/src/the/bytecode/club/bootloader/ILoader.java @@ -0,0 +1,34 @@ +package the.bytecode.club.bootloader; + +import the.bytecode.club.bootloader.resource.ExternalResource; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created 19 Jul 2015 02:29:43 + */ +public abstract interface ILoader { + + public abstract void bind(ExternalResource resource); + + abstract Class findClass(String name) throws ClassNotFoundException, NoClassDefFoundError; + + public abstract Class loadClass(String name) throws ClassNotFoundException, NoClassDefFoundError; +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/InitialBootScreen.java b/src/the/bytecode/club/bootloader/InitialBootScreen.java new file mode 100644 index 00000000..c3b1b9b6 --- /dev/null +++ b/src/the/bytecode/club/bootloader/InitialBootScreen.java @@ -0,0 +1,104 @@ +package the.bytecode.club.bootloader; + +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.Toolkit; +import java.io.IOException; + +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.JProgressBar; +import javax.swing.JScrollPane; +import javax.swing.text.html.HTMLEditorKit; + +import the.bytecode.club.bytecodeviewer.Resources; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Konloch + * @author Bibl (don't ban me pls) + * @created 19 Jul 2015 04:12:21 + */ +public class InitialBootScreen extends JFrame { + private static final long serialVersionUID = -1098467609722393444L; + + private JProgressBar progressBar = new JProgressBar(); + + public InitialBootScreen() throws IOException { + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.setIconImages(Resources.iconList); + + int i = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight(); + if(i >= 840) + setSize(new Dimension(600, 800)); + else if(i >= 640) + setSize(new Dimension(500, 600)); + else if(i >= 440) + setSize(new Dimension(400, 400)); + else + setSize(Toolkit.getDefaultToolkit().getScreenSize()); + + setTitle("Bytecode Viewer Boot Screen - Starting Up"); + GridBagLayout gridBagLayout = new GridBagLayout(); + gridBagLayout.columnWidths = new int[]{0, 0}; + gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + gridBagLayout.columnWeights = new double[]{1.0, Double.MIN_VALUE}; + gridBagLayout.rowWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; + getContentPane().setLayout(gridBagLayout); + + JScrollPane scrollPane = new JScrollPane(); + GridBagConstraints gbc_scrollPane = new GridBagConstraints(); + gbc_scrollPane.gridheight = 24; + gbc_scrollPane.insets = new Insets(0, 0, 5, 0); + gbc_scrollPane.fill = GridBagConstraints.BOTH; + gbc_scrollPane.gridx = 0; + gbc_scrollPane.gridy = 0; + getContentPane().add(scrollPane, gbc_scrollPane); + + JEditorPane editorPane = new JEditorPane(); + editorPane.setEditorKit(new HTMLEditorKit()); + + editorPane.setText(convertStreamToString(InitialBootScreen.class.getClassLoader().getResourceAsStream("resources/intro.html"))); + + scrollPane.setViewportView(editorPane); + + GridBagConstraints gbc_progressBar = new GridBagConstraints(); + gbc_progressBar.fill = GridBagConstraints.HORIZONTAL; + gbc_progressBar.gridx = 0; + gbc_progressBar.gridy = 24; + getContentPane().add(progressBar, gbc_progressBar); + this.setLocationRelativeTo(null); + } + + static String convertStreamToString(java.io.InputStream is) throws IOException { + @SuppressWarnings("resource") + java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); + String string = s.hasNext() ? s.next() : ""; + is.close(); + s.close(); + return string; + } + + public JProgressBar getProgressBar() { + return progressBar; + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/LibraryClassLoader.java b/src/the/bytecode/club/bootloader/LibraryClassLoader.java new file mode 100644 index 00000000..d675ad3c --- /dev/null +++ b/src/the/bytecode/club/bootloader/LibraryClassLoader.java @@ -0,0 +1,172 @@ +package the.bytecode.club.bootloader; + +import java.io.IOException; +import java.lang.reflect.Modifier; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bootloader.resource.ExternalResource; +import the.bytecode.club.bootloader.resource.JarContents; +import the.bytecode.club.bootloader.util.ClassTree; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created 19 Jul 2015 02:48:41 + * + * TODO: Resource loading + */ +@Deprecated +public class LibraryClassLoader extends ClassLoader implements ILoader> { + + private final Set> binded; + private final Map> classCache; + private final ClassTree tree; + + public LibraryClassLoader() { + binded = new HashSet>(); + classCache = new HashMap>(); + tree = new ClassTree(); + } + + /* (non-Javadoc) + * @see the.bytecode.club.bytecodeviewer.loadermodel.ILoader#bind(the.bytecode.club.bytecodeviewer.loadermodel.ExternalResource) + */ + @Override + public void bind(ExternalResource> resource) { + try { + JarContents contents = resource.load(); + if(contents != null) { + binded.add(contents); + tree.build(contents.getClassContents().namedMap()); + } else { + System.err.println("Null contents?"); + } + } catch(IOException e) { + e.printStackTrace(); + } + } + + /* (non-Javadoc) + * @see the.bytecode.club.bytecodeviewer.loadermodel.ILoader#loadClass(java.lang.String) + */ + @Override + public Class findClass(String name) throws ClassNotFoundException, NoClassDefFoundError { + String byte_name = name.replace(".", "/"); + if(classCache.containsKey(byte_name)) + return classCache.get(byte_name); + + ClassNode cn = null; + for(JarContents contents : binded) { + cn = contents.getClassContents().namedMap().get(byte_name); + if(cn != null) + break; + } + + if(cn != null) { + Class klass = define(cn); + if(klass != null) { + classCache.put(byte_name, klass); + return klass; + } + } + + return super.loadClass(name); + } + + protected Class define(ClassNode cn) { + ClassWriter writer = new ResolvingClassWriter(tree); + cn.accept(cn); + byte[] bytes = writer.toByteArray(); + return defineClass(bytes, 0, bytes.length); + } + + public class ResolvingClassWriter extends ClassWriter { + + private final ClassTree classTree; + + public ResolvingClassWriter(ClassTree classTree) { + super(ClassWriter.COMPUTE_FRAMES); + this.classTree = classTree; + } + + @Deprecated + void update(Map classes) { + classTree.build(classes); + } + + @Override + protected String getCommonSuperClass(final String type1, final String type2) { + ClassNode ccn = classTree.getClass(type1); + ClassNode dcn = classTree.getClass(type2); + + //System.out.println(type1 + " " + type2); + if(ccn == null) { + classTree.build(create_quick(type1)); + return getCommonSuperClass(type1, type2); + } + + if(dcn == null) { + classTree.build(create_quick(type2)); + return getCommonSuperClass(type1, type2); + } + + Set c = classTree.getSupers(ccn); + Set d = classTree.getSupers(dcn); + + if(c.contains(dcn)) + return type1; + + if(d.contains(ccn)) + return type2; + + if(Modifier.isInterface(ccn.access) || Modifier.isInterface(dcn.access)) { + return "java/lang/Object"; + } else { + do { + ClassNode nccn = classTree.getClass(ccn.superName); + if(nccn == null) + break; + ccn = nccn; + c = classTree.getSupers(ccn); + } while(!c.contains(dcn)); + return ccn.name; + } + } + + public ClassNode create_quick(String name) { + try { + ClassReader cr = new ClassReader(name); + ClassNode cn = new ClassNode(); + cr.accept(cn, ClassReader.SKIP_CODE | ClassReader.SKIP_FRAMES | ClassReader.SKIP_DEBUG); + return cn; + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/LoaderFactory.java b/src/the/bytecode/club/bootloader/LoaderFactory.java new file mode 100644 index 00000000..47c9310b --- /dev/null +++ b/src/the/bytecode/club/bootloader/LoaderFactory.java @@ -0,0 +1,28 @@ +package the.bytecode.club.bootloader; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created 21 Jul 2015 00:14:53 + */ +public abstract interface LoaderFactory { + + public abstract ILoader spawnLoader(); +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/resource/DataContainer.java b/src/the/bytecode/club/bootloader/resource/DataContainer.java new file mode 100644 index 00000000..28f64556 --- /dev/null +++ b/src/the/bytecode/club/bootloader/resource/DataContainer.java @@ -0,0 +1,46 @@ +package the.bytecode.club.bootloader.resource; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created ages ago + */ +public abstract class DataContainer extends ArrayList { + + private static final long serialVersionUID = -9022506488647444546L; + + public DataContainer() { + this(16); + } + + public DataContainer(int cap) { + super(cap); + } + + public DataContainer(Collection data) { + addAll(data); + } + + public abstract Map namedMap(); +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/resource/EmptyExternalResource.java b/src/the/bytecode/club/bootloader/resource/EmptyExternalResource.java new file mode 100644 index 00000000..0903a722 --- /dev/null +++ b/src/the/bytecode/club/bootloader/resource/EmptyExternalResource.java @@ -0,0 +1,44 @@ +package the.bytecode.club.bootloader.resource; + +import java.io.IOException; +import java.net.URL; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created 21 Jul 2015 00:29:11 + */ +public class EmptyExternalResource extends ExternalResource { + + /** + * @param location + */ + public EmptyExternalResource(URL location) { + super(location); + } + + /* (non-Javadoc) + * @see the.bytecode.club.bootloader.resource.ExternalResource#load() + */ + @Override + public T load() throws IOException { + throw new UnsupportedOperationException(); + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/resource/ExternalLibrary.java b/src/the/bytecode/club/bootloader/resource/ExternalLibrary.java new file mode 100644 index 00000000..34000f40 --- /dev/null +++ b/src/the/bytecode/club/bootloader/resource/ExternalLibrary.java @@ -0,0 +1,105 @@ +package the.bytecode.club.bootloader.resource; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.JarURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Enumeration; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.tree.ClassNode; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created 19 Jul 2015 02:33:23 + */ +public class ExternalLibrary extends ExternalResource> { + + /** + * @param location + */ + public ExternalLibrary(URL location) { + super(location); + } + + /** + * @param jar + */ + public ExternalLibrary(JarInfo jar) { + super(createJarURL(jar)); + } + + public static URL createJarURL(JarInfo jar) { + try { + return jar.formattedURL(); + } catch(MalformedURLException e) { + e.printStackTrace(); + return null; + } + } + + public static byte[] read(InputStream in) throws IOException { + ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = in.read(buffer)) != -1) + byteArrayOut.write(buffer, 0, bytesRead); + byteArrayOut.close(); + return byteArrayOut.toByteArray(); + } + + protected ClassNode create(byte[] b) { + ClassReader cr = new ClassReader(b); + ClassNode cn = new ClassNode(); + cr.accept(cn, 0); + return cn; + } + + /* (non-Javadoc) + * @see the.bytecode.club.bytecodeviewer.loadermodel.ExternalResource#load() + */ + @Override + public JarContents load() throws IOException { + JarContents contents = new JarContents(); + + JarURLConnection con = (JarURLConnection) getLocation().openConnection(); + JarFile jar = con.getJarFile(); + + Enumeration entries = jar.entries(); + while(entries.hasMoreElements()) { + JarEntry entry = entries.nextElement(); + byte[] bytes = read(jar.getInputStream(entry)); + if (entry.getName().endsWith(".class")) { + ClassNode cn = create(bytes); + contents.getClassContents().add(cn); + } else { + JarResource resource = new JarResource(entry.getName(), bytes); + contents.getResourceContents().add(resource); + } + } + + return contents; + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/resource/ExternalResource.java b/src/the/bytecode/club/bootloader/resource/ExternalResource.java new file mode 100644 index 00000000..ffbbef6a --- /dev/null +++ b/src/the/bytecode/club/bootloader/resource/ExternalResource.java @@ -0,0 +1,73 @@ +package the.bytecode.club.bootloader.resource; + +import java.io.IOException; +import java.net.URL; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created 19 Jul 2015 02:30:30 + */ +public abstract class ExternalResource { + + private final URL location; + + public ExternalResource(URL location) { + if(location == null) + throw new IllegalArgumentException(); + this.location = location; + } + + public URL getLocation() { + return location; + } + + public abstract T load() throws IOException; + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((location == null) ? 0 : location.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ExternalResource other = (ExternalResource) obj; + if (location == null) { + if (other.location != null) + return false; + } else if (!location.equals(other.location)) + return false; + return true; + } + + @Override + public String toString() { + return "Library @" + location.toExternalForm(); + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/resource/JarContents.java b/src/the/bytecode/club/bootloader/resource/JarContents.java new file mode 100644 index 00000000..03518b85 --- /dev/null +++ b/src/the/bytecode/club/bootloader/resource/JarContents.java @@ -0,0 +1,160 @@ +package the.bytecode.club.bootloader.resource; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.objectweb.asm.tree.ClassNode; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created ages ago + */ +public class JarContents { + + private final DataContainer classContents; + private final DataContainer resourceContents; + + public JarContents() { + classContents = new ClassNodeContainer(); + resourceContents = new ResourceContainer(); + } + + public JarContents(DataContainer classContents, DataContainer resourceContents) { + this.classContents = classContents == null ? new ClassNodeContainer() : classContents; + this.resourceContents = resourceContents == null ? new ResourceContainer() : resourceContents; + } + + public final DataContainer getClassContents() { + return classContents; + } + + public final DataContainer getResourceContents() { + return resourceContents; + } + + public void merge(JarContents contents) { + classContents.addAll(contents.classContents); + resourceContents.addAll(contents.resourceContents); + } + + public JarContents add(JarContents contents) { + List c1 = classContents; + List c2 = contents.classContents; + + List r1 = resourceContents; + List r2 = contents.resourceContents; + + List c3 = new ArrayList(c1.size() + c2.size()); + c3.addAll(c1); + c3.addAll(c2); + + List r3 = new ArrayList(r1.size() + r2.size()); + r3.addAll(r1); + r3.addAll(r2); + + return new JarContents(new ClassNodeContainer<>(c3), new ResourceContainer(r3)); + } + + public static class ClassNodeContainer extends DataContainer { + private static final long serialVersionUID = -6169578803641192235L; + + private Map lastMap = new HashMap(); + private boolean invalidated; + + public ClassNodeContainer() { + this(16); + } + + public ClassNodeContainer(int cap) { + super(cap); + } + + public ClassNodeContainer(Collection data) { + super(data); + } + + @Override + public boolean add(C c) { + invalidated = true; + return super.add(c); + } + + @Override + public boolean addAll(Collection c) { + invalidated = true; + return super.addAll(c); + } + + @Override + public boolean remove(Object c) { + invalidated = true; + return super.remove(c); + } + + @Override + public Map namedMap() { + if (invalidated) { + invalidated = false; + Map nodeMap = new HashMap(); + Iterator it = iterator(); + while (it.hasNext()) { + C cn = it.next(); + if (nodeMap.containsKey(cn.name)) { + it.remove(); + } else { + nodeMap.put(cn.name, cn); + } + } + lastMap = nodeMap; + } + return lastMap; + } + } + + public static class ResourceContainer extends DataContainer { + private static final long serialVersionUID = -6169578803641192235L; + + public ResourceContainer() { + this(16); + } + + public ResourceContainer(int cap) { + super(cap); + } + + public ResourceContainer(List data) { + addAll(data); + } + + @Override + public Map namedMap() { + Map map = new HashMap(); + for (JarResource resource : this) { + map.put(resource.getName(), resource); + } + return map; + } + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/resource/JarInfo.java b/src/the/bytecode/club/bootloader/resource/JarInfo.java new file mode 100644 index 00000000..1f2f2f89 --- /dev/null +++ b/src/the/bytecode/club/bootloader/resource/JarInfo.java @@ -0,0 +1,123 @@ +package the.bytecode.club.bootloader.resource; + +import java.io.File; +import java.net.JarURLConnection; +import java.net.MalformedURLException; +import java.net.URL; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * Holds information about a single local or external JarFile. + * + * @author Bibl + * @created ages ago + */ +public class JarInfo { + + private final String path; + private final JarType type; + + /** + * Creates a new holder as the JarFile is on the local system. + * + * @param path Path to jar. + */ + public JarInfo(File path) { + this(path.getAbsolutePath(), JarType.FILE); + } + + /** + * Creates a new holder. + * + * @param path Path to jar. + * @param type Type of jar. + */ + public JarInfo(String path, JarType type) { + this.path = path; + this.type = type; + } + + /** + * Creates a new holder. + * + * @param url URL to jar. + */ + public JarInfo(URL url) { + this(url.toExternalForm(), JarType.WEB); + } + + /** + * @return Real path to JarFile. + */ + public final String getPath() { + return path; + } + + public final JarType getType() { + return type; + } + + /** + * Formats a string ready for a {@link JarURLConnection} to connect to. + * + * @param url Location of the JarFile. + * @param type Type of JarFile. + * @return The formatted url. + * @throws MalformedURLException + */ + public URL formattedURL() throws MalformedURLException { + StringBuilder sb = new StringBuilder().append("jar:").append(type.prefix()).append(path); + if (type.equals(JarType.FILE) && !path.endsWith(".jar")) { + File file = new File(path); + if (!file.exists()) + sb.append(".jar"); + } + sb.append("!/"); + return new URL(sb.toString()); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = (prime * result) + ((path == null) ? 0 : path.hashCode()); + result = (prime * result) + ((type == null) ? 0 : type.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + JarInfo other = (JarInfo) obj; + if (path == null) { + if (other.path != null) + return false; + } else if (!path.equals(other.path)) + return false; + if (type != other.type) + return false; + return true; + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/resource/JarResource.java b/src/the/bytecode/club/bootloader/resource/JarResource.java new file mode 100644 index 00000000..113eeef6 --- /dev/null +++ b/src/the/bytecode/club/bootloader/resource/JarResource.java @@ -0,0 +1,72 @@ +package the.bytecode.club.bootloader.resource; + +import java.util.Arrays; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created ages ago + */ +public class JarResource { + + private final String name; + private final byte[] data; + + public JarResource(String name, byte[] data) { + this.name = name; + this.data = data; + } + + public String getName() { + return name; + } + + public byte[] getData() { + return data; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = (prime * result) + Arrays.hashCode(data); + result = (prime * result) + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + JarResource other = (JarResource) obj; + if (!Arrays.equals(data, other.data)) + return false; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/resource/JarType.java b/src/the/bytecode/club/bootloader/resource/JarType.java new file mode 100644 index 00000000..a9f60c71 --- /dev/null +++ b/src/the/bytecode/club/bootloader/resource/JarType.java @@ -0,0 +1,43 @@ +package the.bytecode.club.bootloader.resource; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * Type of Jar Stored. + * @author Bibl + * @created ages ago + */ +public enum JarType { + + /** Local file **/ + FILE("file:"), + /** External URL **/ + WEB(""); + + private final String prefix; + + private JarType(String prefix) { + this.prefix = prefix; + } + + /** Gets the prefix for the JarURLConnection. **/ + public String prefix() { + return prefix; + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/resource/LocateableJarContents.java b/src/the/bytecode/club/bootloader/resource/LocateableJarContents.java new file mode 100644 index 00000000..eb9575e7 --- /dev/null +++ b/src/the/bytecode/club/bootloader/resource/LocateableJarContents.java @@ -0,0 +1,46 @@ +package the.bytecode.club.bootloader.resource; + +import java.net.URL; + +import org.objectweb.asm.tree.ClassNode; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created ages ago + */ +public class LocateableJarContents extends JarContents { + + private final URL[] jarUrls; + + public LocateableJarContents(URL... jarUrls) { + super(); + this.jarUrls = jarUrls; + } + + public LocateableJarContents(DataContainer classContents, DataContainer resourceContents, URL... jarUrls) { + super(classContents, resourceContents); + this.jarUrls = jarUrls; + } + + public URL[] getJarUrls() { + return jarUrls; + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/util/ClassHelper.java b/src/the/bytecode/club/bootloader/util/ClassHelper.java new file mode 100644 index 00000000..c8738e55 --- /dev/null +++ b/src/the/bytecode/club/bootloader/util/ClassHelper.java @@ -0,0 +1,53 @@ +package the.bytecode.club.bootloader.util; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +import org.objectweb.asm.tree.ClassNode; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created 25 May 2015 (actually before this) + */ +public class ClassHelper { + + public static Map convertToMap(Collection classes) { + Map map = new HashMap(); + for (ClassNode cn : classes) { + map.put(cn.name, cn); + } + return map; + } + + public static Map copyOf(Map src) { + Map dst = new HashMap(); + copy(src, dst); + return dst; + } + + public static void copy(Map src, Map dst) { + for(Entry e : src.entrySet()) { + dst.put(e.getKey(), e.getValue()); + } + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/util/ClassTree.java b/src/the/bytecode/club/bootloader/util/ClassTree.java new file mode 100644 index 00000000..b55023ec --- /dev/null +++ b/src/the/bytecode/club/bootloader/util/ClassTree.java @@ -0,0 +1,225 @@ +package the.bytecode.club.bootloader.util; + +import static the.bytecode.club.bootloader.util.ClassHelper.convertToMap; +import static the.bytecode.club.bootloader.util.ClassHelper.copyOf; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.MethodNode; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created 25 May 2015 (actually before this) + */ +public class ClassTree { + private static final SetCreator SET_CREATOR = new SetCreator(); + + private final Map classes; + private final NullPermeableHashMap> supers; + private final NullPermeableHashMap> delgates; + + public ClassTree() { + classes = new HashMap(); + supers = new NullPermeableHashMap>(SET_CREATOR); + delgates = new NullPermeableHashMap>(SET_CREATOR); + } + + public ClassTree(Collection classes) { + this(convertToMap(classes)); + } + + public ClassTree(Map classes_) { + classes = copyOf(classes_); + supers = new NullPermeableHashMap>(SET_CREATOR); + delgates = new NullPermeableHashMap>(SET_CREATOR); + + build(classes); + } + + // TODO: optimise + public void build(Map classes) { + for (ClassNode node : classes.values()) { + for (String iface : node.interfaces) { + ClassNode ifacecs = classes.get(iface); + if (ifacecs == null) + continue; + + getDelegates0(ifacecs).add(node); + + Set superinterfaces = new HashSet(); + buildSubTree(classes, superinterfaces, ifacecs); + + getSupers0(node).addAll(superinterfaces); + } + ClassNode currentSuper = classes.get(node.superName); + while (currentSuper != null) { + getDelegates0(currentSuper).add(node); + getSupers0(node).add(currentSuper); + for (String iface : currentSuper.interfaces) { + ClassNode ifacecs = classes.get(iface); + if (ifacecs == null) + continue; + getDelegates0(ifacecs).add(currentSuper); + Set superinterfaces = new HashSet(); + buildSubTree(classes, superinterfaces, ifacecs); + getSupers0(currentSuper).addAll(superinterfaces); + getSupers0(node).addAll(superinterfaces); + } + currentSuper = classes.get(currentSuper.superName); + } + + getSupers0(node); + getDelegates0(node); + } + } + + public void build(ClassNode node) { + for (String iface : node.interfaces) { + ClassNode ifacecs = classes.get(iface); + if (ifacecs == null) + continue; + + getDelegates0(ifacecs).add(node); + + Set superinterfaces = new HashSet(); + buildSubTree(classes, superinterfaces, ifacecs); + + getSupers0(node).addAll(superinterfaces); + } + ClassNode currentSuper = classes.get(node.superName); + while (currentSuper != null) { + getDelegates0(currentSuper).add(node); + getSupers0(node).add(currentSuper); + for (String iface : currentSuper.interfaces) { + ClassNode ifacecs = classes.get(iface); + if (ifacecs == null) + continue; + getDelegates0(ifacecs).add(currentSuper); + Set superinterfaces = new HashSet(); + buildSubTree(classes, superinterfaces, ifacecs); + getSupers0(currentSuper).addAll(superinterfaces); + getSupers0(node).addAll(superinterfaces); + } + currentSuper = classes.get(currentSuper.superName); + } + + getSupers0(node); + getDelegates0(node); + + classes.put(node.name, node); + } + + private void buildSubTree(Map classes, Collection superinterfaces, ClassNode current) { + superinterfaces.add(current); + for (String iface : current.interfaces) { + ClassNode cs = classes.get(iface); + if(cs != null) { + getDelegates0(cs).add(current); + buildSubTree(classes, superinterfaces, cs); + } else { + // System.out.println("Null interface -> " + iface); + } + } + } + + public Set getMethodsFromSuper(MethodNode m) { + return getMethodsFromSuper(m.owner, m.name, m.desc); + } + + public Set getMethodsFromSuper(ClassNode node, String name, String desc) { + Set methods = new HashSet(); + for (ClassNode super_ : getSupers(node)) { + for (MethodNode mn : super_.methods) { + if (mn.name.equals(name) && mn.desc.equals(desc)) { + methods.add(mn); + } + } + } + return methods; + } + + public Set getMethodsFromDelegates(MethodNode m) { + return getMethodsFromDelegates(m.owner, m.name, m.desc); + } + + public Set getMethodsFromDelegates(ClassNode node, String name, String desc) { + Set methods = new HashSet(); + for (ClassNode delegate : getDelegates(node)) { + for (MethodNode mn : delegate.methods) { + if (mn.name.equals(name) && mn.desc.equals(desc)) { + methods.add(mn); + } + } + } + return methods; + } + + public MethodNode getFirstMethodFromSuper(ClassNode node, String name, String desc) { + for (ClassNode super_ : getSupers(node)) { + for (MethodNode mn : super_.methods) { + if (mn.name.equals(name) && mn.desc.equals(desc)) { + return mn; + } + } + } + return null; + } + + public ClassNode getClass(String name) { + return classes.get(name); + } + + public boolean isInherited(ClassNode cn, String name, String desc) { + return getFirstMethodFromSuper(cn, name, desc) != null; + } + + public boolean isInherited(ClassNode first, MethodNode mn) { + return mn.owner.name.equals(first.name) && isInherited(mn.owner, mn.name, mn.desc); + } + + private Set getSupers0(ClassNode cn) { + return supers.getNonNull(cn); + } + + private Set getDelegates0(ClassNode cn) { + return delgates.getNonNull(cn); + } + + public Map getClasses() { + return classes; + } + + public Set getSupers(ClassNode cn) { + return Collections.unmodifiableSet(supers.get(cn)); + // return supers.get(cn); + } + + public Set getDelegates(ClassNode cn) { + return Collections.unmodifiableSet(delgates.get(cn)); + // return delgates.get(cn); + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/util/NullCreator.java b/src/the/bytecode/club/bootloader/util/NullCreator.java new file mode 100644 index 00000000..8137fe95 --- /dev/null +++ b/src/the/bytecode/club/bootloader/util/NullCreator.java @@ -0,0 +1,31 @@ +package the.bytecode.club.bootloader.util; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created ages ago + */ +public class NullCreator implements ValueCreator { + + @Override + public V create() { + return null; + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/util/NullPermeableHashMap.java b/src/the/bytecode/club/bootloader/util/NullPermeableHashMap.java new file mode 100644 index 00000000..3213ff6e --- /dev/null +++ b/src/the/bytecode/club/bootloader/util/NullPermeableHashMap.java @@ -0,0 +1,49 @@ +package the.bytecode.club.bootloader.util; + +import java.util.HashMap; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created ages ago + */ +public class NullPermeableHashMap extends HashMap { + + private static final long serialVersionUID = 1L; + + private final ValueCreator creator; + + public NullPermeableHashMap(ValueCreator creator) { + this.creator = creator; + } + + public NullPermeableHashMap() { + this(new NullCreator()); + } + + public V getNonNull(K k) { + V val = get(k); + if (val == null) { + val = creator.create(); + put(k, val); + } + return val; + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/util/SetCreator.java b/src/the/bytecode/club/bootloader/util/SetCreator.java new file mode 100644 index 00000000..49382624 --- /dev/null +++ b/src/the/bytecode/club/bootloader/util/SetCreator.java @@ -0,0 +1,34 @@ +package the.bytecode.club.bootloader.util; + +import java.util.HashSet; +import java.util.Set; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created 25 May 2015 (actually before this) + */ +public class SetCreator implements ValueCreator> { + + @Override + public Set create() { + return new HashSet(); + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bootloader/util/ValueCreator.java b/src/the/bytecode/club/bootloader/util/ValueCreator.java new file mode 100644 index 00000000..81f15569 --- /dev/null +++ b/src/the/bytecode/club/bootloader/util/ValueCreator.java @@ -0,0 +1,28 @@ +package the.bytecode.club.bootloader.util; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * @author Bibl (don't ban me pls) + * @created ages ago + */ +public abstract interface ValueCreator { + + public abstract V create(); +} \ No newline at end of file diff --git a/src/the/bytecode/club/bytecodeviewer/APKTool.java b/src/the/bytecode/club/bytecodeviewer/APKTool.java new file mode 100644 index 00000000..111a4a9c --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/APKTool.java @@ -0,0 +1,47 @@ +package the.bytecode.club.bytecodeviewer; + +import java.io.File; + +import org.apache.commons.io.FileUtils; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +public class APKTool { + + public static synchronized void decodeResources(File input, File output) { + try { + File dir = new File(BytecodeViewer.tempDirectory+BytecodeViewer.fs+"Decoded Resources"); + FileUtils.deleteDirectory(dir); + brut.apktool.Main.main(new String[]{"-s", "-f", "-o", dir.getAbsolutePath(), "decode", input.getAbsolutePath()}); + File original = new File(dir.getAbsolutePath() + BytecodeViewer.fs + "original"); + FileUtils.deleteDirectory(original); + File classes = new File(dir.getAbsolutePath() + BytecodeViewer.fs + "classes.dex"); + classes.delete(); + File apktool = new File(dir.getAbsolutePath() + BytecodeViewer.fs + "apktool.yml"); + apktool.delete(); + File zip = new File(BytecodeViewer.tempDirectory+BytecodeViewer.fs+MiscUtils.randomString(12)+".zip"); + ZipUtils.zipFolder(dir.getAbsolutePath(), zip.getAbsolutePath(), null); + if(zip.exists()) + zip.renameTo(output); + FileUtils.deleteDirectory(dir); + } catch(Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } +} diff --git a/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java new file mode 100644 index 00000000..130177dd --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -0,0 +1,1311 @@ +package the.bytecode.club.bytecodeviewer; + +import java.awt.Desktop; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.UIManager; +import javax.swing.filechooser.FileFilter; + +import me.konloch.kontainer.io.DiskReader; +import me.konloch.kontainer.io.DiskWriter; +import me.konloch.kontainer.io.HTTPRequest; + +import org.apache.commons.io.FileUtils; +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bootloader.Boot; +import the.bytecode.club.bootloader.ILoader; +import the.bytecode.club.bootloader.resource.EmptyExternalResource; +import the.bytecode.club.bootloader.resource.ExternalResource; +import the.bytecode.club.bytecodeviewer.api.ClassNodeLoader; +import the.bytecode.club.bytecodeviewer.gui.ClassViewer; +import the.bytecode.club.bytecodeviewer.gui.FileNavigationPane; +import the.bytecode.club.bytecodeviewer.gui.MainViewerGUI; +import the.bytecode.club.bytecodeviewer.gui.RunOptions; +import the.bytecode.club.bytecodeviewer.gui.SearchingPane; +import the.bytecode.club.bytecodeviewer.gui.SystemErrConsole; +import the.bytecode.club.bytecodeviewer.gui.WorkPane; +import the.bytecode.club.bytecodeviewer.obfuscators.mapping.Refactorer; +import the.bytecode.club.bytecodeviewer.plugin.PluginManager; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * A lightweight Java Reverse Engineering suite, developed by Konloch - http://konloch.me + * + * Are you a Java Reverse Engineer? Or maybe you want to learn Java Reverse Engineering? + * Join The Bytecode Club, we're noob friendly, and censorship free. + * + * http://the.bytecode.club + * + * All you have to do is add a jar or class file into the workspace, select the + * file you want then it will start decompiling the class in the background, + * when it's done it will show the Source code, Bytecode and Hexcode of the + * class file you chose. + * + * There is also a plugin system that will allow you to interact with the loaded + * classfiles, for example you can write a String deobfuscator, a malicious code + * searcher, or something else you can think of. You can either use one of the + * pre-written plugins, or write your own. It supports groovy + * scripting. Once a plugin is activated, it will send a ClassNode ArrayList of + * every single class loaded in the file system to the execute function, this + * allows the user to handle it completely using ASM. + * + * TODO: + * + * 3.0.0: (RETIREMENT PARTY, WOHOOO) + * Add obfuscation: + * - Add integer boxing and other obfuscation methods contra implemented + * - Insert unadded/debug opcodes to try to fuck up decompilers + * - ClassAnylyzterAdapter + * Add the jump/save mark system Ida Pro has. + * Add class annotations to bytecode decompiler. + * EVERYTHING BUG FREE, CHECK 100% + * bytecode editor that works by editing per method instead of entire class, methods are in a pane like the file navigator + * Make the tabs menu and middle mouse button click work on the tab itself not just the close button. + * + * before 3.0.0: + * EVERYTHING ON THE FUCKING GITHUB ISSUES LOL + * make it use that global last used inside of export as jar + * Spiffy up the plugin console with hilighted lines + * Take https://github.com/ptnkjke/Java-Bytecode-Editor visualize + * make zipfile not include the decode shit + * add stackmapframes to bytecode decompiler + * add stackmapframes remover? + * make ez-injection plugin console show all sys.out calls + * add JEB decompiler optionally, requires them to add jeb library jar externally and disable update check ? + * add decompile as zip for krakatau-bytecode, jd-gui and smali for CLI + * fix hook inject for EZ-Injection + * fix classfile searcher + * make the decompilers launch in a separate process? + * + * -----2.9.9-----: + * 08/01/2015 - Fixed a pingback concurrency exception issue. + * 08/03/2015 - Fixed a typo for FernFlower decompiler. + * 08/03/2015 - Fixed an issue with Krakatau Decompiler as zip. + * 08/07/2015 - "Fixed" an issue with Enjarify and latest PyPy3 bin. + * 08/07/2015 - FernFlower & CFR Decompiler now launch in their own process with the 'slimjar' version. + * 08/07/2015 - Switched the ClassViewer up slightly so it utilizes the event dispatch thread. + * 08/07/2015 - Fixed? CFIDE's Bytecode Decompiler on TableSwitchs + * + * @author Konloch + * + */ + +public class BytecodeViewer { + + /*per version*/ + public static String version = "2.9.9"; + public static boolean previewCopy = false; + public static boolean fatJar = false; //could be automatic by checking if it's loaded a class named whatever for a library + /*the rest*/ + public static boolean verify = false; //eventually may be a setting + public static String[] args; + public static MainViewerGUI viewer = null; + public static ClassNodeLoader loader = new ClassNodeLoader(); //might be insecure due to assholes targeting BCV, however that's highly unlikely. + public static SecurityMan sm = new SecurityMan(); //might be insecure due to assholes targeting BCV, however that's highly unlikely. + public static String python = ""; + public static String python3 = ""; + public static String rt = ""; + public static String library = ""; + public static String javac = ""; + public static String java = ""; + public static ArrayList files = new ArrayList(); //all of BCV's loaded files/classes/etc + private static int maxRecentFiles = 25; + public static String fs = System.getProperty("file.separator"); + public static String nl = System.getProperty("line.separator"); + private static File BCVDir = new File(System.getProperty("user.home") + fs + ".Bytecode-Viewer"); + private static String filesName = getBCVDirectory() + fs + "recentfiles.bcv"; + private static String pluginsName = getBCVDirectory() + fs + "recentplugins.bcv"; + public static String settingsName = getBCVDirectory() + fs + "settings.bcv"; + public static String tempDirectory = getBCVDirectory() + fs + "bcv_temp" + fs; + public static String libsDirectory = getBCVDirectory() + fs + "libs" + fs; + public static String krakatauWorkingDirectory = ""; + public static String krakatauVersion = ""; + public static String enjarifyWorkingDirectory = ""; + public static String enjarifyVersion = ""; + private static ArrayList recentFiles = DiskReader.loadArrayList(filesName, false); + private static ArrayList recentPlugins = DiskReader.loadArrayList(pluginsName, false); + public static boolean runningObfuscation = false; + private static long start = System.currentTimeMillis(); + public static String lastDirectory = ""; + public static ArrayList createdProcesses = new ArrayList(); + public static Refactorer refactorer = new Refactorer(); + public static boolean pingback = false; + public static boolean deleteForiegnLibraries = true; + + /** + * The version checker thread + */ + private static Thread versionChecker = new Thread() { + @Override + public void run() { + try { + HTTPRequest r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/VERSION")); + final String version = r.readSingle(); + try { + int simplemaths = Integer.parseInt(version.replace(".", "")); + int simplemaths2 = Integer.parseInt(BytecodeViewer.version.replace(".", "")); + if(simplemaths2 > simplemaths) + return; //developer version + } catch(Exception e) { + + } + + if (!BytecodeViewer.version.equals(version)) { + r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/README.txt")); + String[] readme = r.read(); + + String changelog = "Unable to load change log, please try again later."+nl; + boolean trigger = false; + boolean finalTrigger = false; + for(String st : readme) { + if(st.equals("--- "+BytecodeViewer.version+" ---:")) { + changelog = ""; + trigger = true; + } else if(trigger) { + if(st.startsWith("--- ")) + finalTrigger = true; + + if(finalTrigger) + changelog += st + nl; + } + } + + JOptionPane pane = new JOptionPane("Your version: " + + BytecodeViewer.version + + ", latest version: " + + version + + nl + + nl + + "Changes since your version:" + + nl + + changelog + + nl + + "What would you like to do?"); + Object[] options = new String[] { "Open The Download Page", "Download The Updated Jar", "Do Nothing" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, + "Bytecode Viewer - Outdated Version"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + if(Desktop.isDesktopSupported()) + { + Desktop.getDesktop().browse(new URI("https://github.com/Konloch/bytecode-viewer/releases")); + } else { + showMessage("Cannot open the page, please manually type it."+nl+"https://github.com/Konloch/bytecode-viewer/releases"); + } + } + if(result == 1) { + JFileChooser fc = new JFileChooser(); + try { + fc.setCurrentDirectory(new File(".").getAbsoluteFile()); //set the current working directory + } catch(Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("zip"); + } + + @Override + public String getDescription() { + return "Zip Archives"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showSaveDialog(viewer); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + if(!file.getAbsolutePath().endsWith(".zip")) + file = new File(file.getAbsolutePath()+".zip"); + + if(file.exists()) { + pane = new JOptionPane("The file " + file + " exists, would you like to overwrite it?"); + options = new String[] { "Yes", "No" }; + pane.setOptions(options); + dialog = pane.createDialog(BytecodeViewer.viewer, + "Bytecode Viewer - Overwrite File"); + dialog.setVisible(true); + obj = pane.getValue(); + result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result != 0) + return; + + file.delete(); + } + + final File finalFile = file; + Thread downloadThread = new Thread() { + @Override + public void run() { + try { + InputStream is = new URL("https://github.com/Konloch/bytecode-viewer/releases/download/v"+version+"/BytecodeViewer."+version+".zip").openConnection().getInputStream(); + FileOutputStream fos = new FileOutputStream(finalFile); + try { + System.out.println("Downloading from https://github.com/Konloch/bytecode-viewer/releases/download/v"+version+"/BytecodeViewer."+version+".zip"); + byte[] buffer = new byte[8192]; + int len; + int downloaded = 0; + boolean flag = false; + showMessage("Downloading the jar in the background, when it's finished you will be alerted with another message box."+nl+nl+"Expect this to take several minutes."); + while ((len = is.read(buffer)) > 0) { + fos.write(buffer, 0, len); + fos.flush(); + downloaded += 8192; + int mbs = downloaded / 1048576; + if(mbs % 5 == 0 && mbs != 0) { + if(!flag) + System.out.println("Downloaded " + mbs + "MBs so far"); + flag = true; + } else + flag = false; + } + } finally { + try { + if (is != null) { + is.close(); + } + } finally { + if (fos != null) { + fos.flush(); + fos.close(); + } + } + } + System.out.println("Download finished!"); + showMessage("Download successful! You can find the updated program at " + finalFile.getAbsolutePath()); + } catch(FileNotFoundException e) { + showMessage("Unable to download, the zip file has not been uploaded yet, please try again in about 10 minutes."); + } catch(Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + + } + }; + downloadThread.start(); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + }; + + /** + * Pings back to bytecodeviewer.com to be added into the total running statistics + */ + private static Thread PingBack = new Thread() { + @Override + public void run() { + try { + new HTTPRequest(new URL("https://bytecodeviewer.com/add.php")).read(); + } catch(Exception e) { + pingback = false; + } + } + }; + + /** + * Downloads & installs the krakatau & enjarify zips + */ + private static Thread InstallFatJar = new Thread() { + @Override + public void run() { + try { + Boot.populateUrlList(); + Boot.populateLibsDirectory(); + Boot.downloadZipsOnly(); + Boot.checkKrakatau(); + Boot.checkEnjarify(); + } catch(Exception e) { + e.printStackTrace(); + } + } + }; + + /** + * Used to check incase booting failed for some reason, this kicks in as a fail safe + */ + private static Thread bootCheck = new Thread() { + boolean finished = false; + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void run() { + long start = System.currentTimeMillis(); + + while(!finished) { + if(System.currentTimeMillis() - start >= 7000) { //7 second failsafe + if(!Boot.completedboot && !Boot.downloading) { + if(Boot.libsDir() == null || Boot.libsDir().listFiles() == null || Boot.libsDir().listFiles().length <= 0) { + BytecodeViewer.showMessage( + "Github is loading extremely slow, BCV needs to download libraries from github in order"+nl+ + "to work, please try ajusting your network settings or manually downloading these libraries"+nl+ + "if this error persists."); + finished = true; + return; + } + + Boot.setState("Bytecode Viewer Boot Screen (OFFLINE MODE) - Unable to connect to github, force booting..."); + System.out.println("Unable to connect to github, force booting..."); + List libsList = new ArrayList(); + List libsFileList = new ArrayList(); + if(Boot.libsDir() != null) + for (File f : Boot.libsDir().listFiles()) { + libsList.add(f.getName()); + libsFileList.add(f.getAbsolutePath()); + } + + ILoader loader = Boot.findLoader(); + + for (String s : libsFileList) { + if (s.endsWith(".jar")) { + File f = new File(s); + if (f.exists()) { + Boot.setState("Bytecode Viewer Boot Screen (OFFLINE MODE) - Force Loading Library " + f.getName()); + System.out.println("Force loading library " + f.getName()); + + try { + ExternalResource res = new EmptyExternalResource(f.toURI().toURL()); + loader.bind(res); + System.out.println("Succesfully loaded " + f.getName()); + } catch (Exception e) { + e.printStackTrace(); + f.delete(); + JOptionPane.showMessageDialog(null, "Error, Library " + f.getName() + " is corrupt, please restart to redownload it.", + "Error", JOptionPane.ERROR_MESSAGE); + } + } + } + } + + Boot.globalstop = false; + Boot.hide(); + + if(CommandLineInput.parseCommandLine(args) == CommandLineInput.OPEN_FILE) + BytecodeViewer.BOOT(false); + else { + BytecodeViewer.BOOT(true); + CommandLineInput.executeCommandLine(args); + } + } + finished = true; + } + try { + Thread.sleep(100); + } catch (InterruptedException e) { + } + } + } + }; + + public static void pingback() { + JOptionPane pane = new JOptionPane( + "Would you like to 'pingback' to https://bytecodeviewer.com to be counted in the global users for BCV?"); + Object[] options = new String[] { "Yes", "No" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, + "Bytecode Viewer - Optional Pingback"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + try { + if(!PingBack.isAlive()) + PingBack.start(); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + } + + /** + * Grab the byte array from the loaded Class object + * @param clazz + * @return + * @throws IOException + */ + public static byte[] getClassFile(Class clazz) throws IOException { + InputStream is = clazz.getResourceAsStream( "/" + clazz.getName().replace('.', '/') + ".class"); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + int r = 0; + byte[] buffer = new byte[8192]; + while((r=is.read(buffer))>=0) { + baos.write(buffer, 0, r); + } + return baos.toByteArray(); + } + + /** + * Main startup + * @param args files you want to open or CLI + */ + public static void main(String[] args) { + BytecodeViewer.args = args; + System.out.println("https://the.bytecode.club - Created by @Konloch - Bytecode Viewer " + version); + System.setSecurityManager(sm); + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + if(previewCopy && !CommandLineInput.containsCommand(args)) + showMessage("WARNING: This is a preview/dev copy, you WON'T be alerted when "+version+" is actually out if you use this."+nl+ + "Make sure to watch the repo: https://github.com/Konloch/bytecode-viewer for "+version+"'s release"); + + viewer = new MainViewerGUI(); + Settings.loadGUI(); + + int CLI = CommandLineInput.parseCommandLine(args); + + if(CLI == CommandLineInput.STOP) + return; + + if(!fatJar) { + bootCheck.start(); + + if(CLI == CommandLineInput.OPEN_FILE) + Boot.boot(args, false); + else + Boot.boot(args, true); + } else + InstallFatJar.start(); + + if(CLI == CommandLineInput.OPEN_FILE) + BytecodeViewer.BOOT(false); + else { + BytecodeViewer.BOOT(true); + CommandLineInput.executeCommandLine(args); + } + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + + /** + * Boot after all of the libraries have been loaded + * @param cli is it running CLI mode or not + */ + public static void BOOT(boolean cli) { + cleanup(); + Runtime.getRuntime().addShutdownHook(new Thread() { + @Override + public void run() { + for(Process proc : createdProcesses) + proc.destroy(); + Settings.saveGUI(); + cleanup(); + } + }); + + viewer.calledAfterLoad(); + resetRecentFilesMenu(); + + if(!pingback) { + PingBack.start(); + pingback = true; + } + + if(viewer.chckbxmntmNewCheckItem_12.isSelected()) + versionChecker.start(); + + if(!cli) + viewer.setVisible(true); + + System.out.println("Start up took " + ((System.currentTimeMillis() - start) / 1000) + " seconds"); + + if(!cli) + if (args.length >= 1) + for (String s : args) { + openFiles(new File[] { new File(s) }, true); + } + } + + /** + * because Smali and Baksmali System.exit if it failed + * @param i + */ + public static void exit(int i) { + + } + + /** + * Returns the java command it can use to launch the decompilers + * @return + */ + public static synchronized String getJavaCommand() { + try { + sm.stopBlocking(); + ProcessBuilder pb = new ProcessBuilder("java", "-version"); + Process p = pb.start(); + sm.setBlocking(); + if(p != null) + return "java"; //java is set + } catch(Exception e) { //ignore + sm.setBlocking(); + boolean empty = java.isEmpty(); + while(empty) { + showMessage("You need to set your Java path, this requires the JRE to be downloaded."+BytecodeViewer.nl+ + "(C:/programfiles/Java/JRE_xx/bin/java.exe)"); + viewer.java(); + empty = java.isEmpty(); + } + } + return java; + } + + /** + * Returns the currently opened ClassNode + * @return the currently opened ClassNode + */ + public static ClassNode getCurrentlyOpenedClassNode() { + return viewer.workPane.getCurrentViewer().cn; + } + + /** + * Returns the ClassNode by the specified name + * @param name the class name + * @return the ClassNode instance + */ + public static ClassNode getClassNode(String name) { + for(FileContainer container : files) + for(ClassNode c : container.classes) + if(c.name.equals(name)) + return c; + + return null; + } + + /** + * Grabs the file contents of the loaded resources. + * @param name the file name + * @return the file contents as a byte[] + */ + public static byte[] getFileContents(String name) { + for(FileContainer container : files) { + HashMap files = container.files; + if(files.containsKey(name)) + return files.get(name); + } + + return null; + } + + /** + * Replaces an old node with a new instance + * @param oldNode the old instance + * @param newNode the new instance + */ + public static void updateNode(ClassNode oldNode, ClassNode newNode) { + for(FileContainer container : files) { + if(container.classes.remove(oldNode)) + container.classes.add(newNode); + } + } + + /** + * Gets all of the loaded classes as an array list + * @return the loaded classes as an array list + */ + public static ArrayList getLoadedClasses() { + ArrayList a = new ArrayList(); + + for(FileContainer container : files) + for(ClassNode c : container.classes) + if(!a.contains(c)) + a.add(c); + + return a; + } + + /** + * Compile all of the compilable panes that're opened. + * @param message if it should send a message saying it's compiled sucessfully. + * @return true if no errors, false if it failed to compile. + */ + public static boolean compile(boolean message) { + BytecodeViewer.viewer.setIcon(true); + boolean actuallyTried = false; + + for(java.awt.Component c : BytecodeViewer.viewer.workPane.getLoadedViewers()) { + if(c instanceof ClassViewer) { + ClassViewer cv = (ClassViewer) c; + if( cv.smali1 != null && cv.smali1.isEditable() || + cv.smali2 != null && cv.smali2.isEditable() || + cv.smali3 != null && cv.smali3.isEditable()) + { + actuallyTried = true; + Object smali[] = cv.getSmali(); + if(smali != null) { + ClassNode origNode = (ClassNode) smali[0]; + String smaliText = (String) smali[1]; + byte[] smaliCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.smali.compile(smaliText, origNode.name); + if(smaliCompiled != null) { + ClassNode newNode = JarUtils.getNode(smaliCompiled); + BytecodeViewer.updateNode(origNode, newNode); + } else { + BytecodeViewer.showMessage("There has been an error with assembling your Smali code, please check this. Class: " + origNode.name); + BytecodeViewer.viewer.setIcon(false); + return false; + } + } + } + + + if(cv.krakatau1 != null && cv.krakatau1.isEditable() || + cv.krakatau2 != null && cv.krakatau2.isEditable() || + cv.krakatau3 != null && cv.krakatau3.isEditable()) + { + actuallyTried = true; + Object krakatau[] = cv.getKrakatau(); + if(krakatau != null) { + ClassNode origNode = (ClassNode) krakatau[0]; + String krakatauText = (String) krakatau[1]; + byte[] krakatauCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.krakatau.compile(krakatauText, origNode.name); + if(krakatauCompiled != null) { + ClassNode newNode = JarUtils.getNode(krakatauCompiled); + BytecodeViewer.updateNode(origNode, newNode); + } else { + BytecodeViewer.showMessage("There has been an error with assembling your Krakatau Bytecode, please check this. Class: " + origNode.name); + BytecodeViewer.viewer.setIcon(false); + return false; + } + } + } + + if( cv.java1 != null && cv.java1.isEditable() || + cv.java2 != null && cv.java2.isEditable() || + cv.java3 != null && cv.java3.isEditable()) + { + actuallyTried = true; + Object java[] = cv.getJava(); + if(java != null) { + ClassNode origNode = (ClassNode) java[0]; + String javaText = (String) java[1]; + + SystemErrConsole errConsole = new SystemErrConsole("Java Compile Issues"); + errConsole.setText("Error compiling class: " + origNode.name + nl + "Keep in mind most decompilers cannot produce compilable classes"+nl+nl); + + byte[] javaCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.java.compile(javaText, origNode.name); + if(javaCompiled != null) { + ClassNode newNode = JarUtils.getNode(javaCompiled); + BytecodeViewer.updateNode(origNode, newNode); + errConsole.finished(); + } else { + errConsole.pretty(); + errConsole.setVisible(true); + errConsole.finished(); + BytecodeViewer.viewer.setIcon(false); + return false; + } + } + } + } + } + + if(message) + if(actuallyTried) + BytecodeViewer.showMessage("Compiled Successfully."); + else + BytecodeViewer.showMessage("You have no editable panes opened, make one editable and try again."); + + BytecodeViewer.viewer.setIcon(false); + return true; + } + + private static boolean update = true; + + /** + * Opens a file, optional if it should append to the recent files menu + * @param files the file(s) you wish to open + * @param recentFiles if it should append to the recent files menu + */ + public static void openFiles(final File[] files, boolean recentFiles) { + if(recentFiles) + for (File f : files) + if(f.exists()) + BytecodeViewer.addRecentFile(f); + + BytecodeViewer.viewer.setIcon(true); + update = true; + + Thread t = new Thread() { + @Override + public void run() { + try { + for (final File f : files) { + final String fn = f.getName(); + if(!f.exists()) { + update = false; + showMessage("The file " + f.getAbsolutePath() + " could not be found."); + } else { + if(f.isDirectory()) { + FileContainer container = new FileContainer(f); + HashMap files = new HashMap(); + boolean finished = false; + ArrayList totalFiles = new ArrayList(); + totalFiles.add(f); + String dir = f.getAbsolutePath();//f.getAbsolutePath().substring(0, f.getAbsolutePath().length()-f.getName().length()); + + while(!finished) { + boolean added = false; + for(int i = 0; i < totalFiles.size(); i++) { + File child = totalFiles.get(i); + if(child.listFiles() != null) + for(File rocket : child.listFiles()) + if(!totalFiles.contains(rocket)) { + totalFiles.add(rocket); + added = true; + } + } + + if(!added) { + for(File child : totalFiles) + if(child.isFile()) { + String fileName = child.getAbsolutePath().substring(dir.length()+1, child.getAbsolutePath().length()).replaceAll("\\\\", "\\/"); + + + files.put(fileName, Files.readAllBytes(Paths.get(child.getAbsolutePath()))); + } + finished = true; + } + } + container.files = files; + BytecodeViewer.files.add(container); + } else { + if (fn.endsWith(".jar") || fn.endsWith(".zip")) { + try { + JarUtils.put(f); + } catch (final Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + update = false; + } + + } else if (fn.endsWith(".class")) { + try { + byte[] bytes = JarUtils.getBytes(new FileInputStream(f)); + String cafebabe = String.format("%02X", bytes[0]) + + String.format("%02X", bytes[1]) + + String.format("%02X", bytes[2]) + + String.format("%02X", bytes[3]); + if(cafebabe.toLowerCase().equals("cafebabe")) { + final ClassNode cn = JarUtils.getNode(bytes); + + FileContainer container = new FileContainer(f); + container.classes.add(cn); + BytecodeViewer.files.add(container); + } else { + showMessage(fn+": Header does not start with CAFEBABE, ignoring."); + update = false; + } + } catch (final Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + update = false; + } + } else if(fn.endsWith(".apk")) { + try { + BytecodeViewer.viewer.setIcon(true); + FileContainer container = new FileContainer(f); + + if(viewer.decodeAPKResources.isSelected()) { + File decodedResources = new File(tempDirectory + fs + MiscUtils.randomString(32) + ".apk"); + APKTool.decodeResources(f, decodedResources); + container.files = JarUtils.loadResources(decodedResources); + } + + container.files.putAll(JarUtils.loadResources(f)); + + String name = getRandomizedName()+".jar"; + File output = new File(tempDirectory + fs + name); + + if(BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionDex.getModel())) + Dex2Jar.dex2Jar(f, output); + else if(BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel())) + Enjarify.apk2Jar(f, output); + + container.classes = JarUtils.loadClasses(output); + + BytecodeViewer.viewer.setIcon(false); + BytecodeViewer.files.add(container); + } catch (final Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + return; + } else if(fn.endsWith(".dex")) { + try { + BytecodeViewer.viewer.setIcon(true); + FileContainer container = new FileContainer(f); + + String name = getRandomizedName()+".jar"; + File output = new File(tempDirectory + fs + name); + + if(BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionDex.getModel())) + Dex2Jar.dex2Jar(f, output); + else if(BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel())) + Enjarify.apk2Jar(f, output); + + container.classes = JarUtils.loadClasses(output); + + BytecodeViewer.viewer.setIcon(false); + BytecodeViewer.files.add(container); + } catch (final Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + return; + } else { + HashMap files = new HashMap(); + byte[] bytes = JarUtils.getBytes(new FileInputStream(f)); + files.put(f.getName(), bytes); + + + FileContainer container = new FileContainer(f); + container.files = files; + BytecodeViewer.files.add(container); + } + } + } + } + } catch (final Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } finally { + BytecodeViewer.viewer.setIcon(false); + + if(update) + try { + MainViewerGUI.getComponent(FileNavigationPane.class).updateTree(); + } catch(java.lang.NullPointerException e) { + } + } + } + }; + t.start(); + } + + /** + * Starts the specified plugin + * @param file the file of the plugin + */ + public static void startPlugin(File file) { + if (!file.exists()) + return; + + try { + PluginManager.runPlugin(file); + } catch (Throwable e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + addRecentPlugin(file); + } + + /** + * Send a message to alert the user + * @param message the message you need to send + */ + public static void showMessage(String message) { + JOptionPane.showMessageDialog(viewer, message); + } + + /** + * Resets the workspace with optional user input required + * @param ask if should require user input or not + */ + public static void resetWorkSpace(boolean ask) { + if(!ask) { + files.clear(); + MainViewerGUI.getComponent(FileNavigationPane.class).resetWorkspace(); + MainViewerGUI.getComponent(WorkPane.class).resetWorkspace(); + MainViewerGUI.getComponent(SearchingPane.class).resetWorkspace(); + the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().clear(); + } else { + JOptionPane pane = new JOptionPane( + "Are you sure you want to reset the workspace?\n\rIt will also reset your file navigator and search."); + Object[] options = new String[] { "Yes", "No" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(viewer, + "Bytecode Viewer - Reset Workspace"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + files.clear(); + MainViewerGUI.getComponent(FileNavigationPane.class).resetWorkspace(); + MainViewerGUI.getComponent(WorkPane.class).resetWorkspace(); + MainViewerGUI.getComponent(SearchingPane.class).resetWorkspace(); + the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().clear(); + } + } + } + + private static ArrayList killList = new ArrayList(); + + /** + * Add the recent file + * @param f the recent file + */ + public static void addRecentFile(File f) { + for (int i = 0; i < recentFiles.size(); i++) { // remove dead strings + String s = recentFiles.get(i); + if (s.isEmpty() || i > maxRecentFiles) + killList.add(s); + } + if (!killList.isEmpty()) { + for (String s : killList) + recentFiles.remove(s); + killList.clear(); + } + + if (recentFiles.contains(f.getAbsolutePath())) // already added on the list + recentFiles.remove(f.getAbsolutePath()); + if (recentFiles.size() >= maxRecentFiles) + recentFiles.remove(maxRecentFiles - 1); // zero indexing + + recentFiles.add(0, f.getAbsolutePath()); + DiskWriter.replaceFile(filesName, quickConvert(recentFiles), false); + resetRecentFilesMenu(); + } + + private static ArrayList killList2 = new ArrayList(); + + /** + * Add to the recent plugin list + * @param f the plugin file + */ + public static void addRecentPlugin(File f) { + for (int i = 0; i < recentPlugins.size(); i++) { // remove dead strings + String s = recentPlugins.get(i); + if (s.isEmpty() || i > maxRecentFiles) + killList2.add(s); + } + if (!killList2.isEmpty()) { + for (String s : killList2) + recentPlugins.remove(s); + killList2.clear(); + } + + if (recentPlugins.contains(f.getAbsolutePath())) // already added on the list + recentPlugins.remove(f.getAbsolutePath()); + if (recentPlugins.size() >= maxRecentFiles) + recentPlugins.remove(maxRecentFiles - 1); // zero indexing + + recentPlugins.add(0, f.getAbsolutePath()); + DiskWriter.replaceFile(pluginsName, quickConvert(recentPlugins), false); + resetRecentFilesMenu(); + } + + /** + * resets the recent files menu + */ + public static void resetRecentFilesMenu() { + viewer.mnRecentFiles.removeAll(); + for (String s : recentFiles) + if (!s.isEmpty()) { + JMenuItem m = new JMenuItem(s); + m.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JMenuItem m = (JMenuItem) e.getSource(); + openFiles(new File[] { new File(m.getText()) }, true); + } + }); + viewer.mnRecentFiles.add(m); + } + viewer.mnRecentPlugins.removeAll(); + for (String s : recentPlugins) + if (!s.isEmpty()) { + JMenuItem m = new JMenuItem(s); + m.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JMenuItem m = (JMenuItem) e.getSource(); + startPlugin(new File(m.getText())); + } + }); + viewer.mnRecentPlugins.add(m); + } + } + + private static File tempF = null; + + /** + * Clears the temp directory + */ + public static void cleanup() { + tempF = new File(tempDirectory); + + try { + FileUtils.deleteDirectory(tempF); + } catch (Exception e) { + } + + while (!tempF.exists()) // keep making dirs + tempF.mkdir(); + } + + public static ArrayList createdRandomizedNames = new ArrayList(); + + /** + * Ensures it will only return a uniquely generated names, contains a dupe checker to be sure + * @return the unique randomized name of 25 characters. + */ + public static String getRandomizedName() { + boolean generated = false; + String name = ""; + while(!generated) { + String randomizedName = MiscUtils.randomString(25); + if(!createdRandomizedNames.contains(randomizedName)) { + createdRandomizedNames.add(randomizedName); + name = randomizedName; + generated = true; + } + } + return name; + } + + /** + * Returns the BCV directory + * @return the static BCV directory + */ + public static String getBCVDirectory() { + while (!BCVDir.exists()) + BCVDir.mkdirs(); + + if (!BCVDir.isHidden() && isWindows()) + hideFile(BCVDir); + + return BCVDir.getAbsolutePath(); + } + + /** + * Checks if the OS contains 'win' + * @return true if the os.name property contains 'win' + */ + private static boolean isWindows() { + return System.getProperty("os.name").toLowerCase().contains("win"); + } + + /** + * Runs the windows command to hide files + * @param f file you want hidden + */ + private static void hideFile(File f) { + sm.stopBlocking(); + try { + // Hide file by running attrib system command (on Windows) + Runtime.getRuntime().exec("attrib +H " + f.getAbsolutePath()); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + sm.setBlocking(); + } + + /** + * Converts an array list to a string + * @param a array + * @return string with newline per array object + */ + private static String quickConvert(ArrayList a) { + String s = ""; + for (String r : a) + s += r + nl; + return s; + } + + private static long last = System.currentTimeMillis(); + /** + * Checks the hotkeys + * @param e + */ + public static void checkHotKey(KeyEvent e) { + if(System.currentTimeMillis() - last <= (4000)) + return; + + if ((e.getKeyCode() == KeyEvent.VK_O) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + last = System.currentTimeMillis(); + JFileChooser fc = new JFileChooser(); + try { + fc.setSelectedFile(new File(BytecodeViewer.lastDirectory)); + } catch(Exception e2) { + + } + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + if (f.isDirectory()) + return true; + + String extension = MiscUtils.extension(f.getAbsolutePath()); + if (extension != null) + if (extension.equals("jar") || extension.equals("zip") + || extension.equals("class") || extension.equals("apk") + || extension.equals("dex")) + return true; + + return false; + } + + @Override + public String getDescription() { + return "APKs, DEX, Class Files or Zip/Jar Archives"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); + + if (returnVal == JFileChooser.APPROVE_OPTION) { + BytecodeViewer.lastDirectory = fc.getSelectedFile().getAbsolutePath(); + try { + BytecodeViewer.viewer.setIcon(true); + BytecodeViewer.openFiles(new File[] { fc.getSelectedFile() }, true); + BytecodeViewer.viewer.setIcon(false); + } catch (Exception e1) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); + } + } + } else if ((e.getKeyCode() == KeyEvent.VK_N) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + last = System.currentTimeMillis(); + BytecodeViewer.resetWorkSpace(true); + } else if ((e.getKeyCode() == KeyEvent.VK_T) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + last = System.currentTimeMillis(); + Thread t = new Thread() { + public void run() { + BytecodeViewer.compile(true); + } + }; + t.start(); + } else if ((e.getKeyCode() == KeyEvent.VK_R) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + last = System.currentTimeMillis(); + if(BytecodeViewer.getLoadedClasses().isEmpty()) { + BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); + return; + } + new RunOptions().setVisible(true); + } else if ((e.getKeyCode() == KeyEvent.VK_S) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + last = System.currentTimeMillis(); + + if(BytecodeViewer.getLoadedClasses().isEmpty()) { + BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); + return; + } + + Thread t = new Thread() { + public void run() { + if(viewer.autoCompileSmali.isSelected() && !BytecodeViewer.compile(false)) + return; + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("zip"); + } + + @Override + public String getDescription() { + return "Zip Archives"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showSaveDialog(viewer); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + if(!file.getAbsolutePath().endsWith(".zip")) + file = new File(file.getAbsolutePath()+".zip"); + + if(file.exists()) { + JOptionPane pane = new JOptionPane( + "Are you sure you wish to overwrite this existing file?"); + Object[] options = new String[] { "Yes", "No" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, + "Bytecode Viewer - Overwrite File"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + file.delete(); + } else { + return; + } + } + + final File file2 = file; + + BytecodeViewer.viewer.setIcon(true); + Thread t = new Thread() { + @Override + public void run() { + JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), + file2.getAbsolutePath()); + BytecodeViewer.viewer.setIcon(false); + } + }; + t.start(); + } + } + }; + t.start(); + } else if ((e.getKeyCode() == KeyEvent.VK_W) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + last = System.currentTimeMillis(); + if(viewer.workPane.getCurrentViewer() != null) + viewer.workPane.tabs.remove(viewer.workPane.getCurrentViewer()); + } + } +} diff --git a/src/the/bytecode/club/bytecodeviewer/CommandLineInput.java b/src/the/bytecode/club/bytecodeviewer/CommandLineInput.java new file mode 100644 index 00000000..eec77495 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/CommandLineInput.java @@ -0,0 +1,339 @@ +package the.bytecode.club.bytecodeviewer; + +import java.io.File; + +import me.konloch.kontainer.io.DiskWriter; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.DefaultParser; +import org.apache.commons.cli.Options; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * + * Used to allow BCV to be integrated as CLI instead of GUI. + * + * @author Konloch + * + */ + +public class CommandLineInput { + + + private static final Options options = new Options(); + private static final CommandLineParser parser = new DefaultParser(); + + /*BECAUSE WHO DOESN'T LOVE MAGIC NUMBERS*/ + public static int STOP = -1; + public static int OPEN_FILE = 0; + public static int CLI = 1; + + static { + options.addOption("help", false, "prints the help menu."); + options.addOption("list", false, "lists all the available decompilers for BCV " + BytecodeViewer.version+"."); + options.addOption("decompiler", true, "sets the decompiler, procyon by default."); + options.addOption("i", true, "sets the input."); + options.addOption("o", true, "sets the output."); + options.addOption("t", true, "sets the target class to decompile, append all to decomp all as zip."); + options.addOption("nowait", true, "won't wait the 5 seconds to allow the user to read the CLI."); + } + + public static boolean containsCommand(String[] args) { + if(args == null || args.length == 0) + return false; + + try { + CommandLine cmd = parser.parse(options, args); + if( + cmd.hasOption("help") || + cmd.hasOption("list") || + cmd.hasOption("decompiler") || + cmd.hasOption("i") || + cmd.hasOption("o") || + cmd.hasOption("t") || + cmd.hasOption("nowait") + ) { + return true; + } + } catch (Exception e) { + e.printStackTrace(); + } + + return false; + } + + public static int parseCommandLine(String[] args) { + if(!containsCommand(args)) + return OPEN_FILE; + try { + CommandLine cmd = parser.parse(options, args); + if(cmd.hasOption("list")) { + System.out.println("Procyon"); + System.out.println("CFR"); + System.out.println("FernFlower"); + System.out.println("Krakatau"); + System.out.println("Krakatau-Bytecode"); + System.out.println("JD-GUI"); + System.out.println("Smali"); + return STOP; + } else if(cmd.hasOption("help")) { + for(String s : new String[] { + "-help Displays the help menu", + "-list Displays the available decompilers", + "-decompiler Selects the decompiler, procyon by default", + "-i Selects the input file", + "-o Selects the output file", + "-t Must either be the fully qualified classname or \"all\" to decompile all as zip", + "-nowait Doesn't wait for the user to read the CLI messages" + }) + System.out.println(s); + return STOP; + } else { + if(cmd.getOptionValue("i") == null) { + System.err.println("Set the input with -i"); + return STOP; + } if(cmd.getOptionValue("o") == null) { + System.err.println("Set the output with -o"); + return STOP; + } if(cmd.getOptionValue("t") == null) { + System.err.println("Set the target with -t"); + return STOP; + } + + File input = new File(cmd.getOptionValue("i")); + File output = new File(cmd.getOptionValue("o")); + String decompiler = cmd.getOptionValue("decompiler"); + + if(!input.exists()) { + System.err.println(input.getAbsolutePath() + " does not exist."); + return STOP; + } + + if(output.exists()) { + System.err.println("WARNING: Deleted old " + output.getAbsolutePath() + "."); + output.delete(); + } + + //check if zip, jar, apk, dex, or class + //if its zip/jar/apk/dex attempt unzip as whole zip + //if its just class allow any + + if( + decompiler != null && + !decompiler.equalsIgnoreCase("procyon") && + !decompiler.equalsIgnoreCase("cfr") && + !decompiler.equalsIgnoreCase("fernflower") && + !decompiler.equalsIgnoreCase("krakatau") && + !decompiler.equalsIgnoreCase("krakatau-bytecode") && + !decompiler.equalsIgnoreCase("jd-gui") && + !decompiler.equalsIgnoreCase("smali") + ) { + System.out.println("Error, no decompiler called '" + decompiler + "' found. Type -decompiler-list for the list"); + } + + + if(!cmd.hasOption("nowait")) + Thread.sleep(5 * 1000); + + return CLI; + } + } catch(Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + + return OPEN_FILE; + } + + public static void executeCommandLine(String[] args) { + try { + CommandLine cmd = parser.parse(options, args); + String decompiler = cmd.getOptionValue("decompiler"); + File input = new File(cmd.getOptionValue("i")); + File output = new File(cmd.getOptionValue("o")); + String target = cmd.getOptionValue("t"); + + if(cmd.getOptionValue("decompiler") == null) { + System.out.println("You can define another decompiler by appending -decompiler \"name\", by default procyon has been set."); + decompiler = "procyon"; + } + + //check if zip, jar, apk, dex, or class + //if its zip/jar/apk/dex attempt unzip as whole zip + //if its just class allow any + + if(decompiler.equalsIgnoreCase("procyon")) { + System.out.println("Decompiling " + input.getAbsolutePath() + " with Procyon"); + BytecodeViewer.openFiles(new File[]{input}, false); + + Thread.sleep(5 * 1000); + + if(target.equalsIgnoreCase("all")) { + Decompiler.procyon.decompileToZip(output.getAbsolutePath()); + } else { + try { + ClassNode cn = BytecodeViewer.getClassNode(target); + final ClassWriter cw = accept(cn); + String contents = Decompiler.procyon.decompileClassNode(cn, cw.toByteArray()); + DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI( e); + } + } + } else if(decompiler.equalsIgnoreCase("cfr")) { + System.out.println("Decompiling " + input.getAbsolutePath() + " with CFR"); + BytecodeViewer.openFiles(new File[]{input}, false); + + Thread.sleep(5 * 1000); + + if(target.equalsIgnoreCase("all")) { + Decompiler.cfr.decompileToZip(output.getAbsolutePath()); + } else { + try { + ClassNode cn = BytecodeViewer.getClassNode(target); + final ClassWriter cw = accept(cn); + String contents = Decompiler.cfr.decompileClassNode(cn, cw.toByteArray()); + DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI( e); + } + } + } else if(decompiler.equalsIgnoreCase("fernflower")) { + System.out.println("Decompiling " + input.getAbsolutePath() + " with FernFlower"); + BytecodeViewer.openFiles(new File[]{input}, false); + + Thread.sleep(5 * 1000); + + if(target.equalsIgnoreCase("all")) { + Decompiler.fernflower.decompileToZip(output.getAbsolutePath()); + } else { + try { + ClassNode cn = BytecodeViewer.getClassNode(target); + final ClassWriter cw = accept(cn); + String contents = Decompiler.fernflower.decompileClassNode(cn, cw.toByteArray()); + DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI( e); + } + } + } else if(decompiler.equalsIgnoreCase("krakatau")) { + System.out.println("Decompiling " + input.getAbsolutePath() + " with Krakatau"); + BytecodeViewer.openFiles(new File[]{input}, false); + + Thread.sleep(5 * 1000); + + if(target.equalsIgnoreCase("all")) { + Decompiler.krakatau.decompileToZip(output.getAbsolutePath()); + } else { + try { + ClassNode cn = BytecodeViewer.getClassNode(target); + final ClassWriter cw = accept(cn); + String contents = Decompiler.krakatau.decompileClassNode(cn, cw.toByteArray()); + DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI( e); + } + } + } else if(decompiler.equalsIgnoreCase("krakatau-bytecode")) { + System.out.println("Decompiling " + input.getAbsolutePath() + " with Krakatau-Bytecode"); + BytecodeViewer.openFiles(new File[]{input}, false); + + Thread.sleep(5 * 1000); + + if(target.equalsIgnoreCase("all")) { + System.out.println("Coming soon."); + //Decompiler.krakatauDA.decompileToZip(output.getAbsolutePath()); + } else { + try { + ClassNode cn = BytecodeViewer.getClassNode(target); + final ClassWriter cw = accept(cn); + String contents = Decompiler.krakatauDA.decompileClassNode(cn, cw.toByteArray()); + DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI( e); + } + } + } else if(decompiler.equalsIgnoreCase("jd-gui")) { + System.out.println("Decompiling " + input.getAbsolutePath() + " with JD-GUI"); + BytecodeViewer.openFiles(new File[]{input}, false); + + Thread.sleep(5 * 1000); + + if(target.equalsIgnoreCase("all")) { + System.out.println("Coming soon."); + //Decompiler.jdgui.decompileToZip(output.getAbsolutePath()); + } else { + try { + ClassNode cn = BytecodeViewer.getClassNode(target); + final ClassWriter cw = accept(cn); + String contents = Decompiler.jdgui.decompileClassNode(cn, cw.toByteArray()); + DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI( e); + } + } + } else if(decompiler.equalsIgnoreCase("smali")) { + System.out.println("Decompiling " + input.getAbsolutePath() + " with Smali"); + BytecodeViewer.openFiles(new File[]{input}, false); + + Thread.sleep(5 * 1000); + + if(target.equalsIgnoreCase("all")) { + System.out.println("Coming soon."); + //Decompiler.smali.decompileToZip(output.getAbsolutePath()); + } else { + try { + ClassNode cn = BytecodeViewer.getClassNode(target); + final ClassWriter cw = accept(cn); + String contents = Decompiler.smali.decompileClassNode(cn, cw.toByteArray()); + DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI( e); + } + } + } + + System.out.println("Finished."); + System.out.println("Bytecode Viewer CLI v" + BytecodeViewer.version + " by @Konloch - http://bytecodeviewer.com"); + System.exit(0); + } catch(Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + + public static ClassWriter accept(ClassNode cn) { + ClassWriter cw = new ClassWriter(0); + try { + cn.accept(cw); + } catch(Exception e) { + e.printStackTrace(); + try { + Thread.sleep(200); + cn.accept(cw); + } catch (InterruptedException e1) { } + } + return cw; + } + +} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/Dex2Jar.java b/src/the/bytecode/club/bytecodeviewer/Dex2Jar.java similarity index 100% rename from src/main/java/the/bytecode/club/bytecodeviewer/Dex2Jar.java rename to src/the/bytecode/club/bytecodeviewer/Dex2Jar.java diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/Enjarify.java b/src/the/bytecode/club/bytecodeviewer/Enjarify.java similarity index 93% rename from src/main/java/the/bytecode/club/bytecodeviewer/Enjarify.java rename to src/the/bytecode/club/bytecodeviewer/Enjarify.java index 62ece596..348f5bec 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/Enjarify.java +++ b/src/the/bytecode/club/bytecodeviewer/Enjarify.java @@ -35,12 +35,12 @@ public class Enjarify { * @param output the output .jar file */ public static synchronized void apk2Jar(File input, File output) { - if(Settings.PYTHON3_LOCATION.isEmpty()) { + if(BytecodeViewer.python3.equals("")) { BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 3.x executable path."); BytecodeViewer.viewer.pythonC3(); } - if(Settings.PYTHON3_LOCATION.isEmpty()) { + if(BytecodeViewer.python3.equals("")) { BytecodeViewer.showMessage("You need to set Python!"); return; } @@ -48,7 +48,7 @@ public class Enjarify { BytecodeViewer.sm.stopBlocking(); try { ProcessBuilder pb = new ProcessBuilder( - Settings.PYTHON3_LOCATION.get(), + BytecodeViewer.python3, "-O", "-m", "enjarify.main", @@ -58,7 +58,7 @@ public class Enjarify { "-f" ); - pb.directory(BytecodeViewer.enjarifyDirectory); + pb.directory(new File(BytecodeViewer.enjarifyWorkingDirectory)); Process process = pb.start(); BytecodeViewer.createdProcesses.add(process); process.waitFor(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/FileChangeNotifier.java b/src/the/bytecode/club/bytecodeviewer/FileChangeNotifier.java similarity index 92% rename from src/main/java/the/bytecode/club/bytecodeviewer/FileChangeNotifier.java rename to src/the/bytecode/club/bytecodeviewer/FileChangeNotifier.java index ee4d69af..b1dd34bd 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/FileChangeNotifier.java +++ b/src/the/bytecode/club/bytecodeviewer/FileChangeNotifier.java @@ -28,6 +28,6 @@ import org.objectweb.asm.tree.ClassNode; */ public interface FileChangeNotifier { - void openClassFile(String name, String container, ClassNode cn); - void openFile(String name, String container, byte[] contents); + public void openClassFile(String name, ClassNode cn); + public void openFile(String name, byte[] contents); } \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/FileContainer.java b/src/the/bytecode/club/bytecodeviewer/FileContainer.java similarity index 66% rename from src/main/java/the/bytecode/club/bytecodeviewer/FileContainer.java rename to src/the/bytecode/club/bytecodeviewer/FileContainer.java index 6e61f468..2746ba0f 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/FileContainer.java +++ b/src/the/bytecode/club/bytecodeviewer/FileContainer.java @@ -1,12 +1,10 @@ package the.bytecode.club.bytecodeviewer; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.tree.ClassNode; - import java.io.File; -import java.util.Collection; +import java.util.ArrayList; import java.util.HashMap; -import java.util.Map; + +import org.objectweb.asm.tree.ClassNode; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -34,6 +32,7 @@ import java.util.Map; */ public class FileContainer { + public FileContainer(File f) { this.file = f; this.name = f.getName(); @@ -43,36 +42,6 @@ public class FileContainer { public String name; public HashMap files = new HashMap(); - private Map classes = new HashMap(); + public ArrayList classes = new ArrayList(); - public ClassNode getClassNode(String name) { - if (!classes.containsKey(name)) { - byte[] bytes = files.get(name + ".class"); - if (bytes != null) { - ClassReader reader = new ClassReader(bytes); - ClassNode classNode = new ClassNode(); - reader.accept(classNode, ClassReader.EXPAND_FRAMES); - classes.put(name, classNode); - } - } - return classes.get(name); - } - - public Map getData() { - return files; - } - - public boolean remove(ClassNode classNode) { - return classes.remove(classNode.name) != null; - } - - @Deprecated - public void add(ClassNode classNode) { - classes.put(classNode.name, classNode); - } - - @Deprecated - public Collection values() { - return classes.values(); - } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/FileDrop.java b/src/the/bytecode/club/bytecodeviewer/FileDrop.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/FileDrop.java rename to src/the/bytecode/club/bytecodeviewer/FileDrop.java index 6784774c..379648e7 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/FileDrop.java +++ b/src/the/bytecode/club/bytecodeviewer/FileDrop.java @@ -1,7 +1,11 @@ package the.bytecode.club.bytecodeviewer; import java.awt.datatransfer.DataFlavor; -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.PrintStream; +import java.io.Reader; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -331,7 +335,8 @@ public class FileDrop { // Get a useful list final java.util.List fileList = (java.util.List) tr .getTransferData(java.awt.datatransfer.DataFlavor.javaFileListFlavor); - final java.util.Iterator iterator = fileList.iterator(); + final java.util.Iterator iterator = fileList + .iterator(); // Convert list to array final java.io.File[] filesTemp = new java.io.File[fileList @@ -461,7 +466,7 @@ public class FileDrop { catch (final Exception e) { support = false; } // end catch - supportsDnD = support; + supportsDnD = new Boolean(support); } // end if: first time through return supportsDnD.booleanValue(); } // end supportsDnD diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/JarUtils.java b/src/the/bytecode/club/bytecodeviewer/JarUtils.java similarity index 78% rename from src/main/java/the/bytecode/club/bytecodeviewer/JarUtils.java rename to src/the/bytecode/club/bytecodeviewer/JarUtils.java index d9955650..8e148d00 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/JarUtils.java +++ b/src/the/bytecode/club/bytecodeviewer/JarUtils.java @@ -1,18 +1,24 @@ package the.bytecode.club.bytecodeviewer; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.tree.ClassNode; - -import java.io.*; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; -import java.util.Map; import java.util.Map.Entry; import java.util.jar.JarOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +import me.konloch.kontainer.io.DiskWriter; + +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.tree.ClassNode; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -41,9 +47,6 @@ import java.util.zip.ZipInputStream; public class JarUtils { - private JarUtils() { - } - /** * Loads the classes and resources from the input jar file * @param jarFile the input jar file @@ -60,14 +63,26 @@ public class JarUtils { try { final String name = entry.getName(); final byte[] bytes = getBytes(jis); - if(!files.containsKey(name)){ - if (!name.endsWith(".class")) { - if(!entry.isDirectory()) - files.put(name, bytes); - } else { + if (!name.endsWith(".class")) { + if(!entry.isDirectory()) files.put(name, bytes); + } else { + String cafebabe = String.format("%02X", bytes[0]) + + String.format("%02X", bytes[1]) + + String.format("%02X", bytes[2]) + + String.format("%02X", bytes[3]); + if(cafebabe.toLowerCase().equals("cafebabe")) { + try { + final ClassNode cn = getNode(bytes); + container.classes.add(cn); + } catch(Exception e) { + e.printStackTrace(); + } + } else { + System.out.println(jarFile+">"+name+": Header does not start with CAFEBABE, ignoring."); } } + } catch(Exception e) { new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); } finally { @@ -90,7 +105,10 @@ public class JarUtils { final String name = entry.getName(); if (name.endsWith(".class")) { byte[] bytes = getBytes(jis); - String cafebabe = String.format("%02X%02X%02X%02X", bytes[0], bytes[1], bytes[2], bytes[3]); + String cafebabe = String.format("%02X", bytes[0]) + + String.format("%02X", bytes[1]) + + String.format("%02X", bytes[2]) + + String.format("%02X", bytes[3]); if(cafebabe.toLowerCase().equals("cafebabe")) { try { final ClassNode cn = getNode(bytes); @@ -195,9 +213,9 @@ public class JarUtils { */ public static void saveAsJar(ArrayList nodeList, String path, String manifest) { - try (JarOutputStream out = new JarOutputStream( - new FileOutputStream(path))) { - + try { + JarOutputStream out = new JarOutputStream( + new FileOutputStream(path)); for (ClassNode cn : nodeList) { ClassWriter cw = new ClassWriter(0); cn.accept(cw); @@ -221,6 +239,7 @@ public class JarUtils { } } + out.close(); } catch (IOException e) { new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); } @@ -232,7 +251,8 @@ public class JarUtils { * @param path the exact jar output path */ public static void saveAsJarClassesOnly(ArrayList nodeList, String path) { - try (JarOutputStream out = new JarOutputStream(new FileOutputStream(path))) { + try { + JarOutputStream out = new JarOutputStream(new FileOutputStream(path)); ArrayList noDupe = new ArrayList(); for (ClassNode cn : nodeList) { ClassWriter cw = new ClassWriter(0); @@ -249,39 +269,53 @@ public class JarUtils { } noDupe.clear(); + out.close(); } catch (IOException e) { new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); } } - public static void saveAsJarClassesOnly(Map nodeList, String path) { - try (JarOutputStream out = new JarOutputStream(new FileOutputStream(path))) { - ArrayList noDupe = new ArrayList(); - for (Entry cn : nodeList.entrySet()) { - String name = cn.getKey(); - if(!noDupe.contains(name)) { - noDupe.add(name); - out.putNextEntry(new ZipEntry(name)); - out.write(cn.getValue()); - out.closeEntry(); - } + /** + * Saves a jar without the manifest + * @param nodeList The loaded ClassNodes + * @param path the exact jar output path + */ + public static void saveAsJarClassesOnlyToDir(ArrayList nodeList, String dir) { + try { + for (ClassNode cn : nodeList) { + ClassWriter cw = new ClassWriter(0); + cn.accept(cw); + + String name = dir + BytecodeViewer.fs + cn.name + ".class"; + File f = new File(name); + f.mkdirs(); + + DiskWriter.replaceFile(name, cw.toByteArray(), false); } - - noDupe.clear(); - } catch (IOException e) { + } catch (Exception e) { new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); } } - public static void saveAsJar(Map nodeList, String path) { - try (JarOutputStream out = new JarOutputStream(new FileOutputStream(path))) { + /** + * Saves a jar without the manifest + * @param nodeList The loaded ClassNodes + * @param path the exact jar output path + */ + public static void saveAsJar(ArrayList nodeList, String path) { + try { + JarOutputStream out = new JarOutputStream(new FileOutputStream(path)); ArrayList noDupe = new ArrayList(); - for (Entry entry : nodeList.entrySet()) { - String name = entry.getKey(); + for (ClassNode cn : nodeList) { + ClassWriter cw = new ClassWriter(0); + cn.accept(cw); + + String name = cn.name + ".class"; + if(!noDupe.contains(name)) { noDupe.add(name); out.putNextEntry(new ZipEntry(name)); - out.write(entry.getValue()); + out.write(cw.toByteArray()); out.closeEntry(); } } @@ -300,8 +334,10 @@ public class JarUtils { } noDupe.clear(); + out.close(); } catch (IOException e) { new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); } } + } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/MiscUtils.java b/src/the/bytecode/club/bytecodeviewer/MiscUtils.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/MiscUtils.java rename to src/the/bytecode/club/bytecodeviewer/MiscUtils.java index a62cf50b..2b46c415 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/MiscUtils.java +++ b/src/the/bytecode/club/bytecodeviewer/MiscUtils.java @@ -36,9 +36,6 @@ public class MiscUtils { private static final String AN = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; private static Random rnd = new Random(); - private MiscUtils() { - } - /** * Returns a random string without numbers * @param len the length of the String @@ -82,7 +79,7 @@ public class MiscUtils { sb.append(AN.charAt(rnd.nextInt(AN.length()))); return sb.toString(); } - + /** * Checks the file system to ensure it's a unique name * @param start directory it'll be in diff --git a/src/the/bytecode/club/bytecodeviewer/NewlineOutputStream.java b/src/the/bytecode/club/bytecodeviewer/NewlineOutputStream.java new file mode 100644 index 00000000..b24626f1 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/NewlineOutputStream.java @@ -0,0 +1,71 @@ +package the.bytecode.club.bytecodeviewer; + +import java.io.*; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * Convert the various newline conventions to the local platform's + * newline convention.

+ * + * This stream can be used with the Message.writeTo method to + * generate a message that uses the local plaform's line terminator + * for the purpose of (e.g.) saving the message to a local file. + */ +public class NewlineOutputStream extends FilterOutputStream { + private int lastb = -1; + private static byte[] newline; + + public NewlineOutputStream(OutputStream os) { + super(os); + if (newline == null) { + String s = System.getProperty("line.separator"); + if (s == null || s.length() <= 0) + s = "\n"; + try { + newline = s.getBytes("iso-8859-1"); // really us-ascii + } catch (UnsupportedEncodingException ex) { + // should never happen + newline = new byte[] { (byte)'\n' }; + } + } + } + + public void write(int b) throws IOException { + if (b == '\r') { + out.write(newline); + } else if (b == '\n') { + if (lastb != '\r') + out.write(newline); + } else { + out.write(b); + } + lastb = b; + } + + public void write(byte b[]) throws IOException { + write(b, 0, b.length); + } + + public void write(byte b[], int off, int len) throws IOException { + for (int i = 0 ; i < len ; i++) { + write(b[off + i]); + } + } +} \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/Resources.java b/src/the/bytecode/club/bytecodeviewer/Resources.java similarity index 93% rename from src/main/java/the/bytecode/club/bytecodeviewer/Resources.java rename to src/the/bytecode/club/bytecodeviewer/Resources.java index a607f867..e3e7494c 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/Resources.java +++ b/src/the/bytecode/club/bytecodeviewer/Resources.java @@ -1,14 +1,16 @@ package the.bytecode.club.bytecodeviewer; -import org.imgscalr.Scalr; - -import javax.imageio.ImageIO; -import javax.swing.*; -import javax.xml.bind.DatatypeConverter; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; +import java.io.File; import java.util.ArrayList; +import javax.imageio.ImageIO; +import javax.swing.ImageIcon; + +import org.apache.commons.codec.binary.Base64; +import org.imgscalr.Scalr; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -35,6 +37,7 @@ import java.util.ArrayList; */ public class Resources { + public static ArrayList iconList; public static BufferedImage icon; public static ImageIcon nextIcon; @@ -63,27 +66,27 @@ public class Resources { icon = b642IMG("iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAUd0lEQVR42pWaWXRbVZaGq5iHqgaSeJZsy7YkD7KtwZItebblQfI8x/HseIodO3bixE5iZw4ZSBwyACkCXQ003dD0oigq1UBqFVQ1HSB0wkyvXt1VPNSiavHCC288/b3/I11ZSszQDzuRfO89Z39n/3uffST9BMBP17Dbgna72B1hdmfQ7hK7W+yeoN0btPvE7v8Rdl+Y3Rsc4+7guHcF5wif9/ag3fYd/v70J/zHWlGFcLPRKqth99Yoc1TVKssTc1b74Krxw1Vbh3yxAl+9Mre/QZmnrvFHG+/Xnud4alwxzpEXnJOm+UGfbEH/wv2NAHkwMQ4P6GLk/1hlDyXFKVuXFI/1yQnKolJ0yqLTEhFjTEKsKRlxZgPi01OQkJ6qTJeRBn2mEYlZpjWN13gP7+VzfJ7G8WjRqXo1xwZDQmhe+kBfHhR7QHz7O300fq6LUhYBQkJ1UxDkFggZdEMQIJoTCkCsAhDn6TgdpKMWE5KyzcqSc9JDZsjNCL3WridZAmA3Q3F8zhMVBFpHELGHxJcHk2KVPZAYE4K5BYSkD+hjQuR8kAMQYENKgkwgUTBJFMzJgQhkpIrzRnHKJA6axdl0pFgzkGrNRJotS5nRbokw7e8pco8GRygugk4ixYXhAnGhOF90ml7Nvd5AX7SoRMKsGRElK7mJD9E4SFSqTg1KgLh0wy0AdF5z2uTIRrozV1lmvg2ZBQHLyLfK33KQnifX8nJgFuO9fC5VQaWr8RhRXWaaWijO92NgbAGQ2whyG5NIu0FJag0IDs5JOBkBtJXXnKfjWW47LG4HcgqdyC1yKePrDAFItaSjrrkZlf5aZBXYA4AuawgqHIgLxQXjvFTB98GEg9zOivCglhffAcHBExkFmSyVEZDJzQQQhyyePOSI07aSAjjKPMgrL4SroliZvbgAxpwsxCcnYmFxCecvXESO3J9bnK8gCa8BMaoE4kJpMFRBOMw6gXkoOT6Q0wSRIJCBIHcQRCW43EDqDWEQISkpGUkUZLJwADpkF+ed4nS+twTu6jJ4aspR5KtU5iwrRGqmGdHxsThw6GH8540PYfU4FSShrQIfDqRJjtHRpHYzDP3UYOh7BIjKizCImLBIECItGIV0mYzyCQeg83S6xF+FsvoaVDT6UNHkQ2WzH56qMqRlmRGTEIdXXn0Nn/3XfyOvxKPu98hzrspiNQ6BuDAZIlGTRIdRZ/T1QZjwnFkfBhMEuUOBcPNR0dCqk0psyYkwCA6uRYGTEqCgqlQ5pJwXx6ta61HT1ghfRzPqulrh72xBcXUFjJnikCEZX/71b3j5lcvweMvU/XyOz3MhOJ6t1I1siQ7nYdTDYeLCCgAXW4PhhqmB3EkQXogS2mgJoQbBnOBg5iAEJ+FkXEXKp7SuWjlU3dqgnG7obkdzTyda+zYq87U2wlnkRoopDTc++Bh/+cuXKCorRXldDfwCW9VSr57nOIW1FaHoMN/CYbiY9Id+xQRh1gfzJS8AcidB7mJLsCEsGvGSF1piU043Q2hR8LbUqdVv3NShHO8c6kX35gFsHO5H48Y2FFaUIiM7C+9eu64glvYdQk6eHcXectS3NaO5u0M9z0iWN9SqcZln4TBUAnOT/hAmVvKFix0VlFgECPsbai9cUoSgpJiAlJOCqAhAcFJGgfJp6e1SAD2jg+gbG1IgzRs7UFpVia6Nm1Qk/ud//4yz5x6HMcOM6lofnrz0Dzh3/hfo6utF86ZO1As0x2NucXwtMlw85gwXU5MYFzk8KvSdDAS5mw2bqlJCy8RiLWcZ5P7AxGZZVRASfkaiRiZtkMkZhY2b+9E/sRlDk2MKpLGjFUXlpZjfvgs3PvwEH3/yOfbvPwxjuhm/fOYf8e9vvysgzwhQLfwivc7BXrT1dytZMr+4SJrMuHicfy2JMSrMlXCQe9jFxgabP1Yplj5TUFLc1LgvsMIQolpkUC+RaBMIrv7g5CjGtk1hZOsWtG/qQrFAbN+xC1ffuaZs8/AI0rMy8MaVN/H21fewY24n7K481DT40SPPD2wZQffIINoHNikYRobzMAdZAMIlZpAughILj0oQ5G4FwjY60H6kqd4nPBr2Ug8KRLclPi+8Uk7rJKnDIcbntmJqfhaD4yPw+mrQ2NiE16/8Hr9784/o6elDVrZFVao3//Af6O7ugaekGM0dbRjdOqGem9g+jeGpcSVNRoZyZe6xlLMqUmL0g2U/PCparlBNZCDIfTwXaF0smzmjndGwSzTy4SwvEklVKv3WtjUpTXcN94mcRjA+uxXTu3Zgascs2ro7kV/oxpGDD+OV37yGixefRq7VionxSbz2xu/x9N8/B19DHQZGhrF99y4sHlzGrn17sG1xXsEMTY2pxWmVnGNF43zFzBeJSq4WFVGJIawcMyr54SA85Kg9wxLIDbP0RtluSfASt0SjFKX+alUqlaT6N6F3bBgj01uwded2zC/txuT2GdSKkzaHHXsXlvDiS7/C0p59sOU51PuXX/ktnnn2BYxOTuDQsaM4fuYUDj9yHEtHDwrMXswszKtFYa6xcDQyX0RiLMtuRiWYK1QJ/WMOa70Y1cRTJkHuJ4g+2Ayy32GlYtuQJ+1FoWi1vKEGvvYmVaG6JbmZ2JM7tmHH3gXsObQf2xd3oqG1GQ6XE16vV5L6n3Di2CNwFeSju6sbz7/wr3j+n1/C/gNH8MjZM3j0icdw8uyKgtl75IBajKn5OWyWPNsk+dLau1Gi0qKiwvmZo/SHjSkrqdaLMR0iQArrm0K9VGAHt6vdmzW92FelcoPRYEL2jQ9jdNukksTCgSUcOH4Eew/vx/D4KMq9FXA4nVjYuRtPXHwK3qpquPLzsXLqLC6JtC499QwOHDyIxy5dFJgLOPHoaRw88TB2H9yH2d07g1EZQYdUMs5HFZTI/JSXVZpP+mVy5Cj5Mw14fmFaUFUE+VkAJF2BsNRlMcklyZhsJRJeVhKGm2Fngm9hNJYW1WoePX0Cx8WhveJM56aNKJRkZiQO7T+Co4eOocDjRkVlJc6dewLnH38SS4t7ce7i4wrm1PlHceTUcSwzKsu7VfIPSeIzB5tkk2U5LpUKRj8oc/pF2ROERYkgVJMG8nOCJNsyVGebLocgljx2pu6aMpQ2VKO2owlNvZ1SJgcwPD2BrbvmsFO0ve/oIRw6eQwPnzqJA0cPY3JmGg3NTSguLYGnqBB75hcxsnkMnsJC7J5fwKmV85id3YaVC+fEzmLPgWVMz2/Hlu3bML1zToFsnqa8BpSMKWfKmvKiP9myMbN6pQWrF8twEOT+EIjBlgmjyCpDwpcjna2zskhqeYXqhfydzWiV0tgzOoSRmUlMyaTbJEFp01KxRqcmML5nAVv2L2Fibhua21pRXlmhgFrkdUlpKZb278P8rnlMTm9V0DM75tAiZXho2zTmDu7H7IF9GJb9aLOU5V6Rb5vIuK6rRXXQ3CBVnhQ51WnT6LCoPOHmHQFS1NCMFLu06XIczZBzQW6pdLfeYhT6pew2+VVDyIF7mB+zUypHugf7pBVpx+Dhneh/dDtGji6iV2S3eWwU/UMD8NXXobS8DCXSJBaJ3Ljj1/p96B4dwYgk9qaJUSVBp0jPXVGOscO7MHZ8D/okR/rGN0s+9oRAWP6dFUVKKQGQ1ZblVhChNLnkwORxKBBXVUkARAbyy4BtgwIyIWVXIHqkspRJL0X9dqxsRd2ZLvScmsPwyUUMHV/ExCMSmZNLGDy2gMkTSxgVB2ljx/Zg4uG9GDu0G91Sasu90sIXiWSsufANSJtydExanj6BEZDBntDmWOT3KoXkFAtIgYDkfS+InDmENrMwEqSSHW4YyGbJkY1DfSiuKBMHcpQTnqoK+Po60TEzis7FKWxankPv8nZ0755F5/wU2qZG0CiFoqqlUUXHH9wYB8dGUFvvh1U64s6js2jcJ/f2daNXgYi0NkaC5JbkC4hNpQDbFX12JIiqWioi+bkKxFrmhrN6NSI+GbBFVmzT+BCGZyYwtHUMrbKTl1fLzuspkI1PHNklSbo8g3x3AdyFHpXshcVFyviaVlpThVZpRYYlp3bI7j4kJbuithrt+6ZRd3pMnK5Hx0BgwbhwfpmX89MPSj1HgdgVSHIkyGr5NUhEjAKSoSIiIIxInRcVLX7UdjULiPRXY4MKZGJ+BpPz2zAoeq6u96kmsPPELPLP1sK70o+qlSHUr4yj9/wONJ+eRN3KKGrPDKPqXDfKzrZh+MRuDEk0muQQ1rl3Kxr2TaBICkt9e7N0DUNqwVpl4agEzu8REEdFoQJJl4ikUVpSZfU5kSBqQzTkWWAU/WUUOZBTVgCHt0g2G2nbm+UE2Cnlt1/OHSP9GJBojAvI3NKCql6N7a0qKlaHDcWSM22LW1C9bwydJ+fQviI92LFtqFwaQc3iKHxjvaiRHbu5pwteiYQqrdKMukuL1EGrR1qf/qlRdI32o0mkWiNlv1yqpluqFkGyJUfS3QEQgz0TOqlcESB8Y8iTiBTkIt1jR3ZpPmyVhXDWlMLtkzJaL7t7Wx3quqXXosSCkWGj1yqnvKKyEqXzmr52lLf4VM/FPkszQlrtNtidDlRUV6G5vQ1V0inz2Ov1VauKxkgMz2xB36Ts7Jt7UbepTfLTL3tZOezlHpF7AbKk/JoFJJURsUtEcs3azr7aayULSJpIyywgFgGxlrtV0rNZe/rZX+K996/h2vX38f6N67j+wQ1lNz78ANdv3MB7167htddfx9DFnYifM+PUSxfxzqfX8f5nHyp757PruPr5+3j783dx7fMPcOPjj/DBRx8qY9fM/z/65GM8/9KL2CiLxHz0yrnHKXtHdVMdrr73jti72LZnF8yy2KmiHoLoRFrBXmu1jU/Ky0SKKxsmt1SuYicsYmbpa5IzTHjrj3/At99++4PGHT7N6/pR92rmcLtw6syKev31119jZHZSJXmBHORMVgt+9eqv1bU//flPqv8zyhaRIiCJtnToJCLhIPfyTaIjEwanBWmUl+QJJWaQ/ishLQmv/+4KvvnmG7wh/8clJkBnTkFcmZzWii3QS7/Da7TlfcvYEB0Ver+0zPfRyqJiohEdGwN9UqKcGDORK3LLkvKdYjYiK9+BL//2V/XMv115XQ5VXlhcUgl7u0NjDU+Oq+6DqmEaJNrFt1xTxHnkngBIBpKdWQrEVGhTkUmSDjPOkIhf/+ZVfPXVV3jzrbfglx27fcsAyqe8qJvtQNNEj7pGm5EdOz4lMfR+z/ISdGkGJKYbZXXZWUt5L3HBXOVBqt+DzMZiGCWC8bKyW+dmQs8NSDXkZ8U3RL58z/nV5wguWeh8UYmoR28VEJFW8IQYOLPzjU5CRZBUudEoECzF/FIm1qCXg9K/4IsvvvhBe/vaVaTU2ULvdz55GMZdXmQv+8XqkLfcCveODngmO+EZaUGWvwyJIhWdOKgvtOClV15Wz1195yoW9uwOjZNfXoxUh0VFI8WZjSRRj17Kb7xEJPJTFHlDkPCopIjMdNJdRicn4JnnnsWnn36KK1euYEqavsmtk9gytWpHjh5R12l1XW2h1wvHDqGorxFlo51wDrXAvaUTjplOlC0OoGR5ALZjnXDtakdavQdRqUnSrhSGntVsVhpN7uKEoF/0Ty+JnmA1Iy7XGAGiPteKt5mgE90lOSXp87PVBhlvNiAqMR6/uPQkrkllevKpS4hN0iFaH4/ohFisj4nCA+seUs0hr9N8sqlpr2ePLiOztxbZIw2wjNYjc7wettk2uKc7YOmqgbGhHGZpy3UpyYhL0quxF/buDj1PSWW4pNy6AipJEbUwl3XBaMTmpEV8QKc+Mo2zEkQSOE+i4pJ+X17HyZl4Q2Iczsr54S3Jj8u/vYwLjz8WsvOPXcDZ8+fw1NNPqes0drva6xdefAHn5Pq58+eD/59bfX/hvBojU/Imxy0V0p4NvSkFaZIbly9fVs+zDVJduUBQ8owGVUP1xIu/casgqx9iM0zxNnMQJpBM/HJynS5WDkSn8brsEz9kzz33HAymNJxeWflR99PUuaeuElbZswwWM2KT9eiSanX60TOBz55FHZQUKyohwmUVm50a8SH2HXzDMDEqCazP6maT+gBsnT4WD8VHY11CDNbr4pTUopMSVBFgRYsXbSeI6YwpSDKnKtMbDdCn3Wq61OSQ8R5GwSXdg6fBC7u3ULXn8cZkxBh0MNosSt6MhEGKAfc5vSMSIsaSEvG1gvrGihcYKoaModPxgcwUxPAbVhk4OkWH2NRENVGCSRyTQpAkVS1ZSnRKdjpM/CyM3xvy2yd5bRJHzLbskJlsgb8ZZZMz5sp+YM1SZ3BHVTHyastgqypCZlGe6mrVV3z8ZoxVSiKSREkJCBc4zmoUkDRZeClEqyC3h0BiLKkBGEqMkREQwuhpUueTRGps1FSXLMmXLg0mD2FZMjmbOVuFR/QqTkm77RC55NHktbMqYHzNv7H5s8n5O1daIBtfC4BVopFdXiB7jFPywaYqJsssO41wCEqfqqF6YrIJkhrx1Zv6MpQgNEZFg2FkqEmGleGlVpl43DA5qaUsHznigLXSA5s4Y68WZ0UqTllhl68M+f7ykPE9/87rvM8uAHyGz3McjmcutMPksQXKv0CoUuvQImG6BSJKIhIEuS309TTDFAETJrNwGE6gdn+ZkBNnFOchq9QVgsqtcIfAFJw4rDlN4zXel122CsCWiIujVSctJ1hqVXLbAnlBnwK5ETD6HP6tbghEg9HyRYPhQIENMzMExAk1IDqhQdExDWwt4zXNeS0C4QCMgkps+2qZ1UrtzRBRWQYNZPW3KPxjOEwE0BpS44RahDQoJbswsLVM9XFB5/nMzQCBDS9dLZ4CCEaCdjME7ZYf1WzINIQufh/MzUA3Q4WDrWW8pjmvSehmGYWi8B1y0vxcEyTiJ05r/Mwp7wd+5vRdP2XiMTrc1vqZE8dZ62dOed/zMyfbWj9z+n/+8OyuNX54ds/3/OjsZzfZzT8+uzdsjO/68dkP/vDs/wBUXNeRym9KEQAAAABJRU5ErkJggg=="); nextIcon = new ImageIcon(b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYqPBJSG/ZAAAASUlEQVR42mNgwAbS0oAEE4yHyWBmYAzjYDC694OJ4f9+BoY3H0BSbz6A2MxA6VciFyDqGAWQTWVkYEkCUrcOsDD8OwtkvMViMwAb8xEUHlHcFAAAAABJRU5ErkJggg==")); prevIcon = new ImageIcon(b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYgKhxpRi1AAAATElEQVR42mNgwAZYHIAEExA7qUAYLApMDmCGEwODCojByM/A8FEAyPi/moFh9QewYjCAM1iA+D2KqYwMrIlA6tUGFoa/Z4GMt1hsBgCe1wuKber+SwAAAABJRU5ErkJggg==")); - busyIcon = new ImageIcon(Resources.class.getClass().getResource("/1.gif")); + busyIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/1.gif")); busyB64Icon = new ImageIcon(b642IMG("R0lGODlhEAALAPQAAP///wAAANra2tDQ0Orq6gcHBwAAAC8vL4KCgmFhYbq6uiMjI0tLS4qKimVlZb6+vicnJwUFBU9PT+bm5tjY2PT09Dk5Odzc3PLy8ra2tqCgoMrKyu7u7gAAAAAAAAAAACH5BAkLAAAAIf4aQ3JlYXRlZCB3aXRoIGFqYXhsb2FkLmluZm8AIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJCwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJCwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHTuBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V55zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAAABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7")); - batIcon = new ImageIcon(Resources.class.getClass().getResource("/bat.png")); - shIcon = new ImageIcon(Resources.class.getClass().getResource("/sh.png")); - csharpIcon = new ImageIcon(Resources.class.getClass().getResource("/c#.png")); - cplusplusIcon = new ImageIcon(Resources.class.getClass().getResource("/c++.png")); - configIcon = new ImageIcon(Resources.class.getClass().getResource("/config.png")); - jarIcon = new ImageIcon(Resources.class.getClass().getResource("/jar.png")); - zipIcon= new ImageIcon(Resources.class.getClass().getResource("/zip.png")); - packagesIcon = new ImageIcon(Resources.class.getClass().getResource("/package.png")); - folderIcon = new ImageIcon(Resources.class.getClass().getResource("/folder.png")); - androidIcon = new ImageIcon(Resources.class.getClass().getResource("/android.png")); - fileIcon = new ImageIcon(Resources.class.getClass().getResource("/file.png")); - textIcon = new ImageIcon(Resources.class.getClass().getResource("/text.png")); - classIcon = new ImageIcon(Resources.class.getClass().getResource("/class.png")); - imageIcon = new ImageIcon(Resources.class.getClass().getResource("/image.png")); - decodedIcon = new ImageIcon(Resources.class.getClass().getResource("/decoded.png")); - javaIcon = new ImageIcon(Resources.class.getClass().getResource("/java.png")); + batIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/bat.png")); + shIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/sh.png")); + csharpIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/c#.png")); + cplusplusIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/c++.png")); + configIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/config.png")); + jarIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/jar.png")); + zipIcon= new ImageIcon(Resources.class.getClass().getResource("/resources/zip.png")); + packagesIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/package.png")); + folderIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/folder.png")); + androidIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/android.png")); + fileIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/file.png")); + textIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/text.png")); + classIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/class.png")); + imageIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/image.png")); + decodedIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/decoded.png")); + javaIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/java.png")); - iconList = new ArrayList<>(); + iconList = new ArrayList(); int size = 16; for (int i = 0; i < 24; i++) { iconList.add(resize(icon, size, size)); @@ -103,13 +106,24 @@ public class Resources { byte[] imageByte; try { - imageByte = DatatypeConverter.parseBase64Binary(imageString); + imageByte = Base64.decodeBase64(imageString); ByteArrayInputStream bis = new ByteArrayInputStream(imageByte); image = ImageIO.read(bis); bis.close(); } catch (Exception e) { new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); } + return image; } + + public static String findLibrary(String nameContains) { + for(File f : new File(BytecodeViewer.libsDirectory).listFiles()) { + if(f.getName().contains(nameContains)) + return f.getAbsolutePath(); + } + + return null; + } + } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/SecurityMan.java b/src/the/bytecode/club/bytecodeviewer/SecurityMan.java similarity index 100% rename from src/main/java/the/bytecode/club/bytecodeviewer/SecurityMan.java rename to src/the/bytecode/club/bytecodeviewer/SecurityMan.java diff --git a/src/the/bytecode/club/bytecodeviewer/Settings.java b/src/the/bytecode/club/bytecodeviewer/Settings.java new file mode 100644 index 00000000..2ac538f9 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/Settings.java @@ -0,0 +1,420 @@ +package the.bytecode.club.bytecodeviewer; + +import javax.swing.JFrame; + +import me.konloch.kontainer.io.DiskReader; +import me.konloch.kontainer.io.DiskWriter; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * Used to handle loading/saving the GUI (options). + * + * @author Konloch + * + */ + +public class Settings { + + public static void saveGUI() { + try { + DiskWriter.replaceFile(BytecodeViewer.settingsName, "", false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.rbr.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.rsy.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.din.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.dc4.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.das.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.hes.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.hdc.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.dgs.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.ner.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.den.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.rgn.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.bto.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.nns.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.uto.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.udv.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.rer.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.fdi.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.asc.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.decodeenumswitch.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.sugarenums.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.decodestringswitch.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.arrayiter.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.collectioniter.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.innerclasses.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.removeboilerplate.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.removeinnerclasssynthetics.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.decodelambdas.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.hidebridgemethods.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.liftconstructorinit.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.removedeadmethods.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.removebadgenerics.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.sugarasserts.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.sugarboxing.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.showversion.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.decodefinally.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.tidymonitors.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.lenient.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.dumpclasspath.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.comments.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forcetopsort.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forcetopsortaggress.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.stringbuffer.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.stringbuilder.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.silent.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.recover.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.eclipse.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.override.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.showinferrable.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.aexagg.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forcecondpropagate.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.hideutf.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.hidelongstrings.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.commentmonitor.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.allowcorrecting.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.labelledblocks.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.j14classobj.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.hidelangimports.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.recoverytypeclash.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.recoverytypehints.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forceturningifs.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forloopaggcapture.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forceexceptionprune.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmShowDebugLine.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmSimplifyMemberReferences.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.mnMergeVariables.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_1.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_2.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_3.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_4.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_5.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_6.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_7.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_8.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_9.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_10.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_11.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.debugHelpers.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "deprecated", false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_12.isSelected()), false); + if(BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1None.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "0", false); + else if(BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Proc.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "1", false); + else if(BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1CFR.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "2", false); + else if(BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Fern.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "3", false); + else if(BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Bytecode.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "4", false); + else if(BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Hexcode.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "5", false); + else if(BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Smali.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "6", false); + else if(BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Krakatau.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "7", false); + else if(BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1KrakatauBytecode.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "8", false); + else if(BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1JDGUI.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "9", false); + + if(BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2None.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "0", false); + else if(BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2Proc.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "1", false); + else if(BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2CFR.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "2", false); + else if(BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2Fern.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "3", false); + else if(BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2Bytecode.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "4", false); + else if(BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2Hexcode.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "5", false); + else if(BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2Smali.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "6", false); + else if(BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2Krakatau.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "7", false); + else if(BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2KrakatauBytecode.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "8", false); + else if(BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2JDGUI.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "9", false); + + if(BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3None.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "0", false); + else if(BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3Proc.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "1", false); + else if(BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3CFR.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "2", false); + else if(BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3Fern.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "3", false); + else if(BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3Bytecode.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "4", false); + else if(BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3Hexcode.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "5", false); + else if(BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3Smali.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "6", false); + else if(BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3Krakatau.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "7", false); + else if(BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3KrakatauBytecode.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "8", false); + else if(BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3JDGUI.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "9", false); + + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.refreshOnChange.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.isMaximized), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.autoCompileSmali.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.lastDirectory, false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.python, false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.rt, false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel1Proc_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel1CFR_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel1Fern_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel1Krakatau_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel1Smali_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel2Proc_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel2CFR_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel2Fern_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel2Krakatau_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel2Smali_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel3Proc_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel3CFR_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel3Fern_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel3Krakatau_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel3Smali_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.decodeAPKResources.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.library, false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.pingback), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel1JDGUI_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel2JDGUI_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel3JDGUI_E.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.fontSpinner.getValue()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.deleteForiegnLibraries), false); + if(BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionDex.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "0", false); + else if(BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel())) + DiskWriter.writeNewLine(BytecodeViewer.settingsName, "1", false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.python3, false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.javac, false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.java, false); + } catch(Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + + public static void loadGUI() { //utilizes the Disk Reader's caching system. + try { + BytecodeViewer.viewer.rbr.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 1, true))); + BytecodeViewer.viewer.rsy.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 2, false))); + BytecodeViewer.viewer.din.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 3, false))); + BytecodeViewer.viewer.dc4.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 4, false))); + BytecodeViewer.viewer.das.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 5, false))); + BytecodeViewer.viewer.hes.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 6, false))); + BytecodeViewer.viewer.hdc.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 7, false))); + BytecodeViewer.viewer.dgs.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 8, false))); + BytecodeViewer.viewer.ner.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 9, false))); + BytecodeViewer.viewer.den.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 10, false))); + BytecodeViewer.viewer.rgn.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 11, false))); + BytecodeViewer.viewer.bto.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 12, false))); + BytecodeViewer.viewer.nns.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 13, false))); + BytecodeViewer.viewer.uto.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 14, false))); + BytecodeViewer.viewer.udv.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 15, false))); + BytecodeViewer.viewer.rer.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 16, false))); + BytecodeViewer.viewer.fdi.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 17, false))); + BytecodeViewer.viewer.asc.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 18, false))); + BytecodeViewer.viewer.decodeenumswitch.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 19, false))); + BytecodeViewer.viewer.sugarenums.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 20, false))); + BytecodeViewer.viewer.decodestringswitch.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 21, false))); + BytecodeViewer.viewer.arrayiter.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 22, false))); + BytecodeViewer.viewer.collectioniter.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 23, false))); + BytecodeViewer.viewer.innerclasses.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 24, false))); + BytecodeViewer.viewer.removeboilerplate.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 25, false))); + BytecodeViewer.viewer.removeinnerclasssynthetics.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 26, false))); + BytecodeViewer.viewer.decodelambdas.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 27, false))); + BytecodeViewer.viewer.hidebridgemethods.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 28, false))); + BytecodeViewer.viewer.liftconstructorinit.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 29, false))); + BytecodeViewer.viewer.removedeadmethods.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 30, false))); + BytecodeViewer.viewer.removebadgenerics.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 31, false))); + BytecodeViewer.viewer.sugarasserts.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 32, false))); + BytecodeViewer.viewer.sugarboxing.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 33, false))); + BytecodeViewer.viewer.showversion.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 34, false))); + BytecodeViewer.viewer.decodefinally.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 35, false))); + BytecodeViewer.viewer.tidymonitors.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 36, false))); + BytecodeViewer.viewer.lenient.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 37, false))); + BytecodeViewer.viewer.dumpclasspath.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 38, false))); + BytecodeViewer.viewer.comments.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 39, false))); + BytecodeViewer.viewer.forcetopsort.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 40, false))); + BytecodeViewer.viewer.forcetopsortaggress.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 41, false))); + BytecodeViewer.viewer.stringbuffer.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 42, false))); + BytecodeViewer.viewer.stringbuilder.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 43, false))); + BytecodeViewer.viewer.silent.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 44, false))); + BytecodeViewer.viewer.recover.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 45, false))); + BytecodeViewer.viewer.eclipse.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 46, false))); + BytecodeViewer.viewer.override.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 47, false))); + BytecodeViewer.viewer.showinferrable.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 48, false))); + BytecodeViewer.viewer.aexagg.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 49, false))); + BytecodeViewer.viewer.forcecondpropagate.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 50, false))); + BytecodeViewer.viewer.hideutf.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 51, false))); + BytecodeViewer.viewer.hidelongstrings.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 52, false))); + BytecodeViewer.viewer.commentmonitor.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 53, false))); + BytecodeViewer.viewer.allowcorrecting.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 54, false))); + BytecodeViewer.viewer.labelledblocks.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 55, false))); + BytecodeViewer.viewer.j14classobj.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 56, false))); + BytecodeViewer.viewer.hidelangimports.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 57, false))); + BytecodeViewer.viewer.recoverytypeclash.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 58, false))); + BytecodeViewer.viewer.recoverytypehints.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 59, false))); + BytecodeViewer.viewer.forceturningifs.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 60, false))); + BytecodeViewer.viewer.forloopaggcapture.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 61, false))); + BytecodeViewer.viewer.forceexceptionprune.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 62, false))); + BytecodeViewer.viewer.chckbxmntmShowDebugLine.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 63, false))); + BytecodeViewer.viewer.chckbxmntmSimplifyMemberReferences.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 64, false))); + BytecodeViewer.viewer.mnMergeVariables.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 65, false))); + BytecodeViewer.viewer.chckbxmntmNewCheckItem_1.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 66, false))); + BytecodeViewer.viewer.chckbxmntmNewCheckItem_2.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 67, false))); + BytecodeViewer.viewer.chckbxmntmNewCheckItem_3.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 68, false))); + BytecodeViewer.viewer.chckbxmntmNewCheckItem_4.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 69, false))); + BytecodeViewer.viewer.chckbxmntmNewCheckItem_5.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 70, false))); + BytecodeViewer.viewer.chckbxmntmNewCheckItem_6.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 71, false))); + BytecodeViewer.viewer.chckbxmntmNewCheckItem_7.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 72, false))); + BytecodeViewer.viewer.chckbxmntmNewCheckItem_8.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 73, false))); + BytecodeViewer.viewer.chckbxmntmNewCheckItem_9.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 74, false))); + BytecodeViewer.viewer.chckbxmntmNewCheckItem_10.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 75, false))); + BytecodeViewer.viewer.chckbxmntmNewCheckItem_11.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 76, false))); + BytecodeViewer.viewer.chckbxmntmAppendBrackets.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 77, false))); + BytecodeViewer.viewer.debugHelpers.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 78, false))); + //79 is deprecated + BytecodeViewer.viewer.chckbxmntmNewCheckItem_12.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 80, false))); + int decompiler = Integer.parseInt(DiskReader.loadString(BytecodeViewer.settingsName, 81, false)); + if(decompiler == 0) + BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1None.getModel(), true); + else if(decompiler == 1) + BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1Proc.getModel(), true); + else if(decompiler == 2) + BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1CFR.getModel(), true); + else if(decompiler == 3) + BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1Fern.getModel(), true); + else if(decompiler == 4) + BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1Bytecode.getModel(), true); + else if(decompiler == 5) + BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1Hexcode.getModel(), true); + else if(decompiler == 6) + BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1Smali.getModel(), true); + else if(decompiler == 7) + BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1Krakatau.getModel(), true); + else if(decompiler == 8) + BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1KrakatauBytecode.getModel(), true); + else if(decompiler == 9) + BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1JDGUI.getModel(), true); + + decompiler = Integer.parseInt(DiskReader.loadString(BytecodeViewer.settingsName, 82, false)); + if(decompiler == 0) + BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2None.getModel(), true); + else if(decompiler == 1) + BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2Proc.getModel(), true); + else if(decompiler == 2) + BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2CFR.getModel(), true); + else if(decompiler == 3) + BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2Fern.getModel(), true); + else if(decompiler == 4) + BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2Bytecode.getModel(), true); + else if(decompiler == 5) + BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2Hexcode.getModel(), true); + else if(decompiler == 6) + BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2Smali.getModel(), true); + else if(decompiler == 7) + BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2Krakatau.getModel(), true); + else if(decompiler == 8) + BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2KrakatauBytecode.getModel(), true); + else if(decompiler == 9) + BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2JDGUI.getModel(), true); + + decompiler = Integer.parseInt(DiskReader.loadString(BytecodeViewer.settingsName, 83, false)); + if(decompiler == 0) + BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3None.getModel(), true); + else if(decompiler == 1) + BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3Proc.getModel(), true); + else if(decompiler == 2) + BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3CFR.getModel(), true); + else if(decompiler == 3) + BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3Fern.getModel(), true); + else if(decompiler == 4) + BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3Bytecode.getModel(), true); + else if(decompiler == 5) + BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3Hexcode.getModel(), true); + else if(decompiler == 6) + BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3Smali.getModel(), true); + else if(decompiler == 7) + BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3Krakatau.getModel(), true); + else if(decompiler == 8) + BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3KrakatauBytecode.getModel(), true); + else if(decompiler == 9) + BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3JDGUI.getModel(), true); + + BytecodeViewer.viewer.refreshOnChange.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 84, false))); + + boolean bool = Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 85, false)); + if(bool) { + BytecodeViewer.viewer.setExtendedState(JFrame.MAXIMIZED_BOTH); + BytecodeViewer.viewer.isMaximized = true; + } + BytecodeViewer.viewer.autoCompileSmali.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 86, false))); + BytecodeViewer.viewer.autoCompileOnRefresh.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 87, false))); + BytecodeViewer.lastDirectory = DiskReader.loadString(BytecodeViewer.settingsName, 88, false); + BytecodeViewer.python = DiskReader.loadString(BytecodeViewer.settingsName, 89, false); + BytecodeViewer.rt = DiskReader.loadString(BytecodeViewer.settingsName, 90, false); + BytecodeViewer.viewer.panel1Proc_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 91, false))); + BytecodeViewer.viewer.panel1CFR_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 92, false))); + BytecodeViewer.viewer.panel1Fern_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 93, false))); + BytecodeViewer.viewer.panel1Krakatau_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 94, false))); + BytecodeViewer.viewer.panel1Smali_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 95, false))); + BytecodeViewer.viewer.panel2Proc_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 96, false))); + BytecodeViewer.viewer.panel2CFR_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 97, false))); + BytecodeViewer.viewer.panel2Fern_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 98, false))); + BytecodeViewer.viewer.panel2Krakatau_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 99, false))); + BytecodeViewer.viewer.panel2Smali_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 100, false))); + BytecodeViewer.viewer.panel3Proc_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 101, false))); + BytecodeViewer.viewer.panel3CFR_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 101, false))); + BytecodeViewer.viewer.panel3Fern_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 103, false))); + BytecodeViewer.viewer.panel3Krakatau_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 104, false))); + BytecodeViewer.viewer.panel3Smali_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 105, false))); + BytecodeViewer.viewer.decodeAPKResources.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 106, false))); + BytecodeViewer.library = DiskReader.loadString(BytecodeViewer.settingsName, 107, false); + BytecodeViewer.pingback = Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 108, false)); + BytecodeViewer.viewer.panel1JDGUI_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 109, false))); + BytecodeViewer.viewer.panel2JDGUI_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 110, false))); + BytecodeViewer.viewer.panel3JDGUI_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 111, false))); + BytecodeViewer.viewer.fontSpinner.setValue(Integer.parseInt(DiskReader.loadString(BytecodeViewer.settingsName, 112, false))); + BytecodeViewer.deleteForiegnLibraries = Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 113, false)); + decompiler = Integer.parseInt(DiskReader.loadString(BytecodeViewer.settingsName, 114, false)); + if(decompiler == 0) + BytecodeViewer.viewer.apkConversionGroup.setSelected(BytecodeViewer.viewer.apkConversionDex.getModel(), true); + else if(decompiler == 1) + BytecodeViewer.viewer.apkConversionGroup.setSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel(), true); + BytecodeViewer.python3 = DiskReader.loadString(BytecodeViewer.settingsName, 115, false); + BytecodeViewer.javac = DiskReader.loadString(BytecodeViewer.settingsName, 116, false); + BytecodeViewer.java = DiskReader.loadString(BytecodeViewer.settingsName, 117, false); + } catch(Exception e) { + //ignore because errors are expected, first start up and outdated settings. + //e.printStackTrace(); + } + } + +} \ No newline at end of file diff --git a/src/the/bytecode/club/bytecodeviewer/ZipUtils.java b/src/the/bytecode/club/bytecodeviewer/ZipUtils.java new file mode 100644 index 00000000..ed014a30 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/ZipUtils.java @@ -0,0 +1,157 @@ +package the.bytecode.club.bytecodeviewer; + +import java.io.*; +import java.util.Enumeration; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * Rudimentary utility class for Zip archives. + */ +public final class ZipUtils { + + /** + * Unzip files to path. + * + * @param zipFileName the zip file name + * @param fileExtractPath the file extract path + * @throws IOException Signals that an I/O exception has occurred. + */ + public static void unzipFilesToPath(String jarPath, String destinationDir) throws IOException { + File file = new File(jarPath); + JarFile jar = new JarFile(file); + + // fist get all directories, + // then make those directory on the destination Path + for (Enumeration enums = jar.entries(); enums.hasMoreElements();) { + JarEntry entry = (JarEntry) enums.nextElement(); + + String fileName = destinationDir + File.separator + entry.getName(); + File f = new File(fileName); + + if (fileName.endsWith("/")) { + f.mkdirs(); + } + + } + + //now create all files + for (Enumeration enums = jar.entries(); enums.hasMoreElements();) { + JarEntry entry = (JarEntry) enums.nextElement(); + + String fileName = destinationDir + File.separator + entry.getName(); + File f = new File(fileName); + + if (!fileName.endsWith("/")) { + InputStream is = jar.getInputStream(entry); + FileOutputStream fos = new FileOutputStream(f); + + // write contents of 'is' to 'fos' + while (is.available() > 0) { + fos.write(is.read()); + } + + fos.close(); + is.close(); + } + } + + try { + jar.close(); + } catch(Exception e) { + + } + } + + public static void zipFile(File inputFile, File outputZip) { + byte[] buffer = new byte[1024]; + + try { + FileOutputStream fos = new FileOutputStream(outputZip); + ZipOutputStream zos = new ZipOutputStream(fos); + ZipEntry ze= new ZipEntry(inputFile.getName()); + zos.putNextEntry(ze); + FileInputStream in = new FileInputStream(inputFile); + + int len; + while ((len = in.read(buffer)) > 0) { + zos.write(buffer, 0, len); + } + + in.close(); + zos.closeEntry(); + + zos.close(); + } catch(Exception e) { + e.printStackTrace(); + } + } + + public static void zipFolder(String srcFolder, String destZipFile, String ignore) throws Exception { + ZipOutputStream zip = null; + FileOutputStream fileWriter = null; + + fileWriter = new FileOutputStream(destZipFile); + zip = new ZipOutputStream(fileWriter); + + addFolderToZip("", srcFolder, zip, ignore); + zip.flush(); + zip.close(); + } + + public static void addFileToZip(String path, String srcFile, ZipOutputStream zip, String ignore) + throws Exception { + + File folder = new File(srcFile); + if (folder.isDirectory()) { + addFolderToZip(path, srcFile, zip, ignore); + } else { + byte[] buf = new byte[1024]; + int len; + FileInputStream in = new FileInputStream(srcFile); + ZipEntry entry = null; + if(ignore == null) + entry = new ZipEntry(path + "/" + folder.getName()); + else + entry = new ZipEntry(path.replace(ignore, "BCV_Krakatau") + "/" + folder.getName()); + zip.putNextEntry(entry); + while ((len = in.read(buf)) > 0) { + zip.write(buf, 0, len); + } + in.close(); + } + } + + public static void addFolderToZip(String path, String srcFolder, ZipOutputStream zip, String ignore) + throws Exception { + File folder = new File(srcFolder); + + for (String fileName : folder.list()) { + if (path.equals("")) { + addFileToZip(folder.getName(), srcFolder + "/" + fileName, zip, ignore); + } else { + addFileToZip(path + "/" + folder.getName(), srcFolder + "/" + fileName, zip, ignore); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/ASMUtil_OLD.java b/src/the/bytecode/club/bytecodeviewer/api/ASMUtil_OLD.java similarity index 93% rename from src/main/java/the/bytecode/club/bytecodeviewer/api/ASMUtil_OLD.java rename to src/the/bytecode/club/bytecodeviewer/api/ASMUtil_OLD.java index 412304f5..966d6d6e 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/ASMUtil_OLD.java +++ b/src/the/bytecode/club/bytecodeviewer/api/ASMUtil_OLD.java @@ -1,10 +1,19 @@ package the.bytecode.club.bytecodeviewer.api; -import org.objectweb.asm.tree.*; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; - import java.util.List; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldInsnNode; +import org.objectweb.asm.tree.FieldNode; +import org.objectweb.asm.tree.InnerClassNode; +import org.objectweb.asm.tree.LocalVariableNode; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MethodNode; +import org.objectweb.asm.tree.TypeInsnNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/BytecodeHook.java b/src/the/bytecode/club/bytecodeviewer/api/BytecodeHook.java similarity index 100% rename from src/main/java/the/bytecode/club/bytecodeviewer/api/BytecodeHook.java rename to src/the/bytecode/club/bytecodeviewer/api/BytecodeHook.java diff --git a/src/the/bytecode/club/bytecodeviewer/api/BytecodeViewer.java b/src/the/bytecode/club/bytecodeviewer/api/BytecodeViewer.java new file mode 100644 index 00000000..2cbc345c --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/api/BytecodeViewer.java @@ -0,0 +1,274 @@ +package the.bytecode.club.bytecodeviewer.api; + +import java.io.File; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.JarUtils; +import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; +import the.bytecode.club.bytecodeviewer.plugin.preinstalled.EZInjection; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * The official API for BCV, this was designed for plugin authors and + * people utilizing EZ-Injection. + * + * @author Konloch + * + */ + +public class BytecodeViewer { + + private static URLClassLoader cl; + + /** + * Grab the loader instance + * + * @return + */ + public static ClassNodeLoader getClassNodeLoader() { + return the.bytecode.club.bytecodeviewer.BytecodeViewer.loader; + } + + /** + * Returns the URLClassLoader instance + * @return the URLClassLoader instance + */ + public static URLClassLoader getClassLoaderInstance() { + return cl; + } + + /** + * Re-instances the URLClassLoader and loads a jar to it. + * @param path + * @return The loaded classes into the new URLClassLoader instance + * @author Cafebabe + */ + public static List> loadClassesIntoClassLoader() { + try { + File f = new File( + the.bytecode.club.bytecodeviewer.BytecodeViewer.tempDirectory + + the.bytecode.club.bytecodeviewer.BytecodeViewer.fs + + "loaded_temp.jar"); + JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), f.getAbsolutePath()); + JarFile jarFile = new JarFile(""+f.getAbsolutePath()); + Enumeration e = jarFile.entries(); + URL[] urls = { new URL("jar:file:" + ""+f.getAbsolutePath()+"!/") }; + cl = URLClassLoader.newInstance(urls); + List> ret = new ArrayList>(); + + while (e.hasMoreElements()) + { + JarEntry je = (JarEntry) e.nextElement(); + if(je.isDirectory() || !je.getName().endsWith(".class")) + continue; + String className = je.getName().replace("/", ".").replace(".class", ""); + className = className.replace('/', '.'); + try{ + ret.add(cl.loadClass(className)); + } + catch(Exception e2) + { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e2); + } + } + jarFile.close(); + + return ret; + } + catch(Exception e) + { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + return null; + } + + /** + * Creates a new instance of the ClassNode loader. + */ + public static void createNewClassNodeLoaderInstance() { + the.bytecode.club.bytecodeviewer.BytecodeViewer.loader.clear(); + the.bytecode.club.bytecodeviewer.BytecodeViewer.loader = new ClassNodeLoader(); + } + + /** + * Used to start a plugin from file. + * + * @param plugin + * the file of the plugin + */ + public static void startPlugin(File plugin) { + the.bytecode.club.bytecodeviewer.BytecodeViewer.startPlugin(plugin); + } + + /** + * Used to load classes/jars into BCV. + * + * @param files + * an array of the files you want loaded. + * @param recentFiles + * if it should save to the recent files menu. + */ + public static void openFiles(File[] files, boolean recentFiles) { + the.bytecode.club.bytecodeviewer.BytecodeViewer.openFiles(files, recentFiles); + } + + /** + * Returns the currently opened class node, if nothing is opened it'll return null. + * @return The opened class node or a null if nothing is opened + */ + public static ClassNode getCurrentlyOpenedClassNode() { + return the.bytecode.club.bytecodeviewer.BytecodeViewer.getCurrentlyOpenedClassNode(); + } + + /** + * Used to load a ClassNode. + * + * @param name + * the full name of the ClassNode + * @return the ClassNode + */ + public static ClassNode getClassNode(String name) { + return the.bytecode.club.bytecodeviewer.BytecodeViewer + .getClassNode(name); + } + + /** + * Used to grab the loaded ClassNodes. + * + * @return the loaded classes + */ + public static ArrayList getLoadedClasses() { + return the.bytecode.club.bytecodeviewer.BytecodeViewer + .getLoadedClasses(); + } + + /** + * Used to insert a Bytecode Hook using EZ-Injection. + * + * @param hook + */ + public static void insertHook(BytecodeHook hook) { + EZInjection.hookArray.add(hook); + } + + /** + * This will ask the user if they really want to reset the workspace, then + * it'll reset the work space. + * + * @param ask + * if it should ask the user about resetting the workspace + */ + public static void resetWorkSpace(boolean ask) { + the.bytecode.club.bytecodeviewer.BytecodeViewer.resetWorkSpace(ask); + } + + /** + * If true, it will display the busy icon, if false it will remove it if + * it's displayed. + * + * @param busy + * if it should display the busy icon or not + */ + public static void setBusy(boolean busy) { + the.bytecode.club.bytecodeviewer.BytecodeViewer.viewer.setIcon(busy); + } + + /** + * Sends a small window popup with the defined message. + * + * @param message + * the message you want to display + */ + public static void showMessage(String message) { + the.bytecode.club.bytecodeviewer.BytecodeViewer.showMessage(message); + } + + /** + * Returns the wrapped Krakatau Decompiler instance. + * @return The wrapped Krakatau Decompiler instance + */ + public static Decompiler getKrakatauDecompiler() { + return Decompiler.krakatau; + } + + /** + * Returns the wrapped Procyon Decompiler instance. + * @return The wrapped Procyon Decompiler instance + */ + public static Decompiler getProcyonDecompiler() { + return Decompiler.procyon; + } + + /** + * Returns the wrapped CFR Decompiler instance. + * @return The wrapped CFR Decompiler instance + */ + public static Decompiler getCFRDecompiler() { + return Decompiler.cfr; + } + + /** + * Returns the wrapped FernFlower Decompiler instance. + * @return The wrapped FernFlower Decompiler instance + */ + public static Decompiler getFernFlowerDecompiler() { + return Decompiler.fernflower; + } + + /** + * Returns the wrapped Krakatau Disassembler instance. + * @return The wrapped Krakatau Disassembler instance + */ + public static Decompiler getKrakatauDisassembler() { + return Decompiler.krakatauDA; + } + + /** + * Returns the wrapped Krakatau Assembler instance. + * @return The wrapped Krakatau Assembler instance + */ + public static the.bytecode.club.bytecodeviewer.compilers.Compiler getKrakatauCompiler() { + return the.bytecode.club.bytecodeviewer.compilers.Compiler.krakatau; + } + + /** + * Returns the wrapped Smali Assembler instance. + * @return The wrapped Smali Assembler instance + */ + public static the.bytecode.club.bytecodeviewer.compilers.Compiler getSmaliCompiler() { + return the.bytecode.club.bytecodeviewer.compilers.Compiler.smali; + } + + /** + * Returns the wrapped JD-GUI Decompiler instance. + * @return The wrapped JD-GUI Decompiler instance + */ + public static the.bytecode.club.bytecodeviewer.decompilers.Decompiler getDJGUIDecompiler() { + return the.bytecode.club.bytecodeviewer.decompilers.Decompiler.jdgui; + } +} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.java b/src/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.java similarity index 97% rename from src/main/java/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.java rename to src/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.java index df5faec7..1a06011f 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.java +++ b/src/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.java @@ -1,8 +1,5 @@ package the.bytecode.club.bytecodeviewer.api; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.tree.ClassNode; - import java.security.AllPermission; import java.security.CodeSource; import java.security.Permissions; @@ -12,6 +9,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.tree.ClassNode; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -38,10 +38,6 @@ import java.util.HashMap; public final class ClassNodeLoader extends ClassLoader { - public ClassNodeLoader() { - super(ClassLoader.getSystemClassLoader()); - } - private HashMap classes = new HashMap(); /** @@ -114,7 +110,7 @@ public final class ClassNodeLoader extends ClassLoader { if (classes.containsKey(name)) { return nodeToClass(classes.get(name)); } else { - return super.findClass(name); + return super.loadClass(name); } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java b/src/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java similarity index 94% rename from src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java rename to src/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java index c4453cf6..3ccde5e4 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java +++ b/src/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java @@ -1,13 +1,18 @@ package the.bytecode.club.bytecodeviewer.api; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.io.PrintWriter; +import java.io.StringWriter; + +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Resources; -import javax.swing.*; -import java.awt.*; -import java.io.PrintWriter; -import java.io.StringWriter; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -74,6 +79,7 @@ public class ExceptionUI extends JFrame { } private void setup(Throwable e, String author) { + this.setIconImages(Resources.iconList); setSize(new Dimension(600, 400)); setTitle("Bytecode Viewer " + BytecodeViewer.version @@ -91,6 +97,7 @@ public class ExceptionUI extends JFrame { txtrBytecodeViewerIs.setText("Bytecode Viewer Version: " + BytecodeViewer.version+ ", Preview Copy: " + BytecodeViewer.previewCopy + + ", Fat Jar: " + BytecodeViewer.fatJar + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString()); this.setLocationRelativeTo(null); this.setVisible(true); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/Plugin.java b/src/the/bytecode/club/bytecodeviewer/api/Plugin.java similarity index 96% rename from src/main/java/the/bytecode/club/bytecodeviewer/api/Plugin.java rename to src/the/bytecode/club/bytecodeviewer/api/Plugin.java index 8475ba8b..5ea5700e 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/Plugin.java +++ b/src/the/bytecode/club/bytecodeviewer/api/Plugin.java @@ -1,10 +1,11 @@ package the.bytecode.club.bytecodeviewer.api; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; - import java.util.ArrayList; +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -36,11 +37,11 @@ public abstract class Plugin extends Thread { public void run() { BytecodeViewer.viewer.setIcon(true); try { - if(BytecodeViewer.getLoadedBytes().isEmpty()) { + if(BytecodeViewer.getLoadedClasses().isEmpty()) { BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); return; } - execute(BytecodeViewer.loadAllClasses()); + execute(BytecodeViewer.getLoadedClasses()); } catch (Exception e) { new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); } finally { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/PluginConsole.java b/src/the/bytecode/club/bytecodeviewer/api/PluginConsole.java similarity index 94% rename from src/main/java/the/bytecode/club/bytecodeviewer/api/PluginConsole.java rename to src/the/bytecode/club/bytecodeviewer/api/PluginConsole.java index fd0d97b5..b8db5db1 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/PluginConsole.java +++ b/src/the/bytecode/club/bytecodeviewer/api/PluginConsole.java @@ -1,18 +1,31 @@ package the.bytecode.club.bytecodeviewer.api; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.Resources; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JTextField; -import javax.swing.*; -import javax.swing.text.DefaultHighlighter; -import javax.swing.text.Highlighter; -import javax.swing.text.JTextComponent; -import java.awt.*; +import java.awt.Color; +import java.awt.Dimension; + +import javax.swing.JScrollPane; + +import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; +import javax.swing.JTextArea; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.Resources; + +import javax.swing.JPanel; +import javax.swing.text.DefaultHighlighter; +import javax.swing.text.Highlighter; +import javax.swing.text.JTextComponent; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -242,8 +255,10 @@ public class PluginConsole extends JFrame { * the string you want to append */ public void appendText(String t) { - textArea.append(t + "\r\n"); - textArea.setCaretPosition(textArea.getText().length()); + textArea.setText((textArea.getText().isEmpty() ? "" : textArea + .getText() + "\r\n") + + t); + textArea.setCaretPosition(0); } /** diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/compilers/Compiler.java b/src/the/bytecode/club/bytecodeviewer/compilers/Compiler.java similarity index 100% rename from src/main/java/the/bytecode/club/bytecodeviewer/compilers/Compiler.java rename to src/the/bytecode/club/bytecodeviewer/compilers/Compiler.java diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java b/src/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java similarity index 81% rename from src/main/java/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java rename to src/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java index 7d5b86dc..39e051f0 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java +++ b/src/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java @@ -1,12 +1,15 @@ package the.bytecode.club.bytecodeviewer.compilers; -import org.apache.commons.io.FileUtils; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import me.konloch.kontainer.io.DiskWriter; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.JarUtils; import the.bytecode.club.bytecodeviewer.MiscUtils; -import the.bytecode.club.bytecodeviewer.Settings; - -import java.io.*; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -37,31 +40,27 @@ public class JavaCompiler extends Compiler { @Override public byte[] compile(String contents, String name) { - String fileStart = BytecodeViewer.tempDir.getAbsolutePath() + BytecodeViewer.fs + "temp"+MiscUtils.randomString(12)+BytecodeViewer.fs; - String fileStart2 = BytecodeViewer.tempDir.getAbsolutePath() + BytecodeViewer.fs + "temp"+MiscUtils.randomString(12)+BytecodeViewer.fs; + String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp"+MiscUtils.randomString(12)+BytecodeViewer.fs; + String fileStart2 = BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp"+MiscUtils.randomString(12)+BytecodeViewer.fs; File java = new File(fileStart + BytecodeViewer.fs + name + ".java"); File clazz = new File(fileStart2 + BytecodeViewer.fs + name + ".class"); - File cp = new File(BytecodeViewer.tempDir, "cpath_"+MiscUtils.randomString(12)+".jar"); + File cp = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "cpath_"+MiscUtils.randomString(12)+".jar"); File tempD = new File(fileStart + BytecodeViewer.fs + name.substring(0,name.length() - name.split("/")[name.split("/").length-1].length())); tempD.mkdirs(); new File(fileStart2).mkdirs(); - if(Settings.JAVAC_LOCATION.isEmpty()) { + if(BytecodeViewer.javac.equals("")) { BytecodeViewer.showMessage("You need to set your Javac path, this requires the JDK to be downloaded."+BytecodeViewer.nl+"(C:/programfiles/Java/JRE_xx/bin/javac.exe)"); BytecodeViewer.viewer.javac(); } - if(Settings.JAVAC_LOCATION.isEmpty()) { + if(BytecodeViewer.javac.equals("")) { BytecodeViewer.showMessage("You need to set Javac!"); return null; } - - try { - FileUtils.write(java, contents, "UTF-8", false); - } catch (IOException e) { - e.printStackTrace(); - } - JarUtils.saveAsJar(BytecodeViewer.getLoadedBytes(), cp.getAbsolutePath()); + + DiskWriter.replaceFile(java.getAbsolutePath(), contents, false); + JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), cp.getAbsolutePath()); boolean cont = true; BytecodeViewer.sm.stopBlocking(); @@ -69,18 +68,18 @@ public class JavaCompiler extends Compiler { String log = ""; ProcessBuilder pb; - if(Settings.PATH.isEmpty()) { + if(BytecodeViewer.library.isEmpty()) { pb = new ProcessBuilder( - Settings.JAVAC_LOCATION.get(), + BytecodeViewer.javac, "-d", fileStart2, "-classpath", cp.getAbsolutePath(), java.getAbsolutePath() ); } else { pb = new ProcessBuilder( - Settings.JAVAC_LOCATION.get(), + BytecodeViewer.javac, "-d", fileStart2, - "-classpath", cp.getAbsolutePath()+";"+Settings.PATH.get(), + "-classpath", cp.getAbsolutePath()+";"+BytecodeViewer.library, java.getAbsolutePath() ); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/compilers/KrakatauAssembler.java b/src/the/bytecode/club/bytecodeviewer/compilers/KrakatauAssembler.java similarity index 80% rename from src/main/java/the/bytecode/club/bytecodeviewer/compilers/KrakatauAssembler.java rename to src/the/bytecode/club/bytecodeviewer/compilers/KrakatauAssembler.java index 2f2c7165..b677eace 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/compilers/KrakatauAssembler.java +++ b/src/the/bytecode/club/bytecodeviewer/compilers/KrakatauAssembler.java @@ -1,12 +1,14 @@ package the.bytecode.club.bytecodeviewer.compilers; -import org.apache.commons.io.FileUtils; +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; + +import me.konloch.kontainer.io.DiskWriter; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.JarUtils; import the.bytecode.club.bytecodeviewer.MiscUtils; -import the.bytecode.club.bytecodeviewer.Settings; - -import java.io.*; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -36,12 +38,12 @@ public class KrakatauAssembler extends Compiler { @Override public byte[] compile(String contents, String name) { - if(Settings.PYTHON2_LOCATION.isEmpty()) { + if(BytecodeViewer.python.equals("")) { BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path."); BytecodeViewer.viewer.pythonC(); } - - if(Settings.PYTHON2_LOCATION.isEmpty()) { + + if(BytecodeViewer.python.equals("")) { BytecodeViewer.showMessage("You need to set Python!"); return null; } @@ -49,28 +51,24 @@ public class KrakatauAssembler extends Compiler { String origName = name; name = MiscUtils.randomString(20); - File tempD = new File(BytecodeViewer.tempDir, BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs); + File tempD = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs); tempD.mkdir(); File tempJ = new File(tempD.getAbsolutePath() + BytecodeViewer.fs+name+".j"); - try { - FileUtils.write(tempJ, contents, "UTF-8", false); - } catch (IOException e) { - e.printStackTrace(); - } - - final File tempDirectory = new File(BytecodeViewer.tempDir, BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs); + DiskWriter.replaceFile(tempJ.getAbsolutePath(), contents, true); + + final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs); tempDirectory.mkdir(); - final File tempJar = new File(BytecodeViewer.tempDir, BytecodeViewer.fs + "temp"+MiscUtils.randomString(32)+".jar"); - JarUtils.saveAsJar(BytecodeViewer.getLoadedBytes(), tempJar.getAbsolutePath()); + final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp"+MiscUtils.randomString(32)+".jar"); + JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); BytecodeViewer.sm.stopBlocking(); String log = ""; try { ProcessBuilder pb = new ProcessBuilder( - Settings.PYTHON2_LOCATION.get(), + BytecodeViewer.python, "-O", //love you storyyeller <3 - BytecodeViewer.krakatauDirectory.getAbsolutePath() + BytecodeViewer.fs + "assemble.py", + BytecodeViewer.krakatauWorkingDirectory + BytecodeViewer.fs + "assemble.py", "-out", tempDirectory.getAbsolutePath(), tempJ.getAbsolutePath() diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/compilers/SmaliAssembler.java b/src/the/bytecode/club/bytecodeviewer/compilers/SmaliAssembler.java similarity index 91% rename from src/main/java/the/bytecode/club/bytecodeviewer/compilers/SmaliAssembler.java rename to src/the/bytecode/club/bytecodeviewer/compilers/SmaliAssembler.java index eff95ec0..8053b5b2 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/compilers/SmaliAssembler.java +++ b/src/the/bytecode/club/bytecodeviewer/compilers/SmaliAssembler.java @@ -1,13 +1,13 @@ package the.bytecode.club.bytecodeviewer.compilers; -import org.apache.commons.io.FileUtils; -import org.zeroturnaround.zip.ZipUtil; +import java.io.File; + +import me.konloch.kontainer.io.DiskWriter; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Dex2Jar; import the.bytecode.club.bytecodeviewer.Enjarify; import the.bytecode.club.bytecodeviewer.MiscUtils; - -import java.io.File; +import the.bytecode.club.bytecodeviewer.ZipUtils; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -38,7 +38,7 @@ public class SmaliAssembler extends Compiler { @Override public byte[] compile(String contents, String name) { - String fileStart = BytecodeViewer.tempDir.getAbsoluteFile() + BytecodeViewer.fs + "temp"; + String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp"; int fileNumber = MiscUtils.getClassNumber(fileStart, ".dex"); final File tempSmaliFolder = new File(fileStart + fileNumber + "-smalifolder"+BytecodeViewer.fs); @@ -50,7 +50,7 @@ public class SmaliAssembler extends Compiler { File tempJarFolder = new File(fileStart + fileNumber + "-jar"+BytecodeViewer.fs); try { - FileUtils.write(tempSmali, contents, "UTF-8", false); + DiskWriter.replaceFile(tempSmali.getAbsolutePath(), contents, false); } catch (final Exception e) { new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); } @@ -68,7 +68,7 @@ public class SmaliAssembler extends Compiler { Enjarify.apk2Jar(tempDex, tempJar); try { - ZipUtil.unpack(tempJar, tempJarFolder); + ZipUtils.unzipFilesToPath(tempJar.getAbsolutePath(), tempJarFolder.getAbsolutePath()); File outputClass = null; boolean found = false; diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/CFRDecompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/CFRDecompiler.java new file mode 100644 index 00000000..ba63629a --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/CFRDecompiler.java @@ -0,0 +1,330 @@ +package the.bytecode.club.bytecodeviewer.decompilers; + +import java.io.Closeable; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Deque; +import java.util.LinkedList; +import java.util.Random; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import me.konloch.kontainer.io.DiskReader; + +import org.apache.commons.lang3.ArrayUtils; +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.JarUtils; +import the.bytecode.club.bytecodeviewer.MiscUtils; +import the.bytecode.club.bytecodeviewer.Resources; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * CFR Java Wrapper + * + * @author Konloch + * + */ + +public class CFRDecompiler extends Decompiler { + + @Override + public String decompileClassNode(ClassNode cn, byte[] b) { + String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs; + + final File tempClass = new File(MiscUtils.getUniqueName(fileStart, ".class") + ".class"); + + try { + final FileOutputStream fos = new FileOutputStream(tempClass); + + fos.write(b); + + fos.close(); + } catch (final IOException e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + + String fuckery = fuckery(fileStart); + if(!BytecodeViewer.fatJar) { + try { + ProcessBuilder pb = new ProcessBuilder(ArrayUtils.addAll( + new String[]{BytecodeViewer.getJavaCommand(),"-jar",Resources.findLibrary("cfr")}, + generateMainMethod(tempClass.getAbsolutePath(), fuckery) + )); + BytecodeViewer.sm.stopBlocking(); + Process p = pb.start(); + BytecodeViewer.createdProcesses.add(p); + p.waitFor(); + } catch(Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } finally { + BytecodeViewer.sm.setBlocking(); + } + } else { + org.benf.cfr.reader.Main.main(generateMainMethod(tempClass.getAbsolutePath(), fuckery)); + } + + tempClass.delete(); + + return findFile(new File(fuckery).listFiles()); + + } + + Random r = new Random(); + File f; + + public String fuckery(String start) { + boolean b = false; + while (!b) { + f = new File(start + r.nextInt(Integer.MAX_VALUE)); + if (!f.exists()) + return f.toString(); + } + + return null; + } + + public String findFile(File[] fA) { + for (File f : fA) { + if (f.isDirectory()) + return findFile(f.listFiles()); + else { + String s = ""; + try { + s = DiskReader.loadAsString(f.getAbsolutePath()); + } catch (Exception e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + e.printStackTrace(); + + String exception = "Bytecode Viewer Version: " + BytecodeViewer.version + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString(); + return "CFR error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com"+BytecodeViewer.nl+BytecodeViewer.nl+"Suggested Fix: Click refresh class, if it fails again try another decompiler."+BytecodeViewer.nl+BytecodeViewer.nl+exception; + } + return s; + } + } + return "CFR error!"+BytecodeViewer.nl+BytecodeViewer.nl+"Suggested Fix: Click refresh class, if it fails again try another decompiler."; + } + + public String[] generateMainMethod(String filePath, String outputPath) { + return new String[] { + filePath, + "--outputdir", + outputPath, + "--decodeenumswitch", + String.valueOf(BytecodeViewer.viewer.decodeenumswitch + .isSelected()), + "--sugarenums", + String.valueOf(BytecodeViewer.viewer.sugarenums.isSelected()), + "--decodestringswitch", + String.valueOf(BytecodeViewer.viewer.decodestringswitch + .isSelected()), + "--arrayiter", + String.valueOf(BytecodeViewer.viewer.arrayiter.isSelected()), + "--collectioniter", + String.valueOf(BytecodeViewer.viewer.collectioniter + .isSelected()), + "--innerclasses", + String.valueOf(BytecodeViewer.viewer.innerclasses.isSelected()), + "--removeboilerplate", + String.valueOf(BytecodeViewer.viewer.removeboilerplate + .isSelected()), + "--removeinnerclasssynthetics", + String.valueOf(BytecodeViewer.viewer.removeinnerclasssynthetics + .isSelected()), + "--decodelambdas", + String.valueOf(BytecodeViewer.viewer.decodelambdas.isSelected()), + "--hidebridgemethods", + String.valueOf(BytecodeViewer.viewer.hidebridgemethods + .isSelected()), + "--liftconstructorinit", + String.valueOf(BytecodeViewer.viewer.liftconstructorinit + .isSelected()), + "--removedeadmethods", + String.valueOf(BytecodeViewer.viewer.removedeadmethods + .isSelected()), + "--removebadgenerics", + String.valueOf(BytecodeViewer.viewer.removebadgenerics + .isSelected()), + "--sugarasserts", + String.valueOf(BytecodeViewer.viewer.sugarasserts.isSelected()), + "--sugarboxing", + String.valueOf(BytecodeViewer.viewer.sugarboxing.isSelected()), + "--showversion", + String.valueOf(BytecodeViewer.viewer.showversion.isSelected()), + "--decodefinally", + String.valueOf(BytecodeViewer.viewer.decodefinally.isSelected()), + "--tidymonitors", + String.valueOf(BytecodeViewer.viewer.tidymonitors.isSelected()), + "--lenient", + String.valueOf(BytecodeViewer.viewer.lenient.isSelected()), + "--dumpclasspath", + String.valueOf(BytecodeViewer.viewer.dumpclasspath.isSelected()), + "--comments", + String.valueOf(BytecodeViewer.viewer.comments.isSelected()), + "--forcetopsort", + String.valueOf(BytecodeViewer.viewer.forcetopsort.isSelected()), + "--forcetopsortaggress", + String.valueOf(BytecodeViewer.viewer.forcetopsortaggress + .isSelected()), + "--stringbuffer", + String.valueOf(BytecodeViewer.viewer.stringbuffer.isSelected()), + "--stringbuilder", + String.valueOf(BytecodeViewer.viewer.stringbuilder.isSelected()), + "--silent", + String.valueOf(BytecodeViewer.viewer.silent.isSelected()), + "--recover", + String.valueOf(BytecodeViewer.viewer.recover.isSelected()), + "--eclipse", + String.valueOf(BytecodeViewer.viewer.eclipse.isSelected()), + "--override", + String.valueOf(BytecodeViewer.viewer.override.isSelected()), + "--showinferrable", + String.valueOf(BytecodeViewer.viewer.showinferrable + .isSelected()), + "--aexagg", + String.valueOf(BytecodeViewer.viewer.aexagg.isSelected()), + "--forcecondpropagate", + String.valueOf(BytecodeViewer.viewer.forcecondpropagate + .isSelected()), + "--hideutf", + String.valueOf(BytecodeViewer.viewer.hideutf.isSelected()), + "--hidelongstrings", + String.valueOf(BytecodeViewer.viewer.hidelongstrings + .isSelected()), + "--commentmonitors", + String.valueOf(BytecodeViewer.viewer.commentmonitor + .isSelected()), + "--allowcorrecting", + String.valueOf(BytecodeViewer.viewer.allowcorrecting + .isSelected()), + "--labelledblocks", + String.valueOf(BytecodeViewer.viewer.labelledblocks + .isSelected()), + "--j14classobj", + String.valueOf(BytecodeViewer.viewer.j14classobj.isSelected()), + "--hidelangimports", + String.valueOf(BytecodeViewer.viewer.hidelangimports + .isSelected()), + "--recovertypeclash", + String.valueOf(BytecodeViewer.viewer.recoverytypeclash + .isSelected()), + "--recovertypehints", + String.valueOf(BytecodeViewer.viewer.recoverytypehints + .isSelected()), + "--forcereturningifs", + String.valueOf(BytecodeViewer.viewer.forceturningifs + .isSelected()), + "--forloopaggcapture", + String.valueOf(BytecodeViewer.viewer.forloopaggcapture + .isSelected()), }; + } + + byte[] buffer = new byte[1024]; + + @Override + public void decompileToZip(String zipName) { + File tempZip = new File(BytecodeViewer.tempDirectory + + BytecodeViewer.fs + "temp.jar"); + if (tempZip.exists()) + tempZip.delete(); + + JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), + tempZip.getAbsolutePath()); + + String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs; + + String fuckery = fuckery(fileStart); + + org.benf.cfr.reader.Main.main(generateMainMethod( + tempZip.getAbsolutePath(), fuckery)); + + tempZip.delete(); + File fuck = new File(fuckery); + + try { + zip(fuck, new File(zipName)); + } catch (IOException e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + + fuck.delete(); + } + + @SuppressWarnings("resource") + public void zip(File directory, File zipfile) throws IOException { + java.net.URI base = directory.toURI(); + Deque queue = new LinkedList(); + queue.push(directory); + OutputStream out = new FileOutputStream(zipfile); + Closeable res = out; + try { + ZipOutputStream zout = new ZipOutputStream(out); + res = zout; + while (!queue.isEmpty()) { + directory = queue.pop(); + for (File kid : directory.listFiles()) { + String name = base.relativize(kid.toURI()).getPath(); + if (kid.isDirectory()) { + queue.push(kid); + name = name.endsWith("/") ? name : name + "/"; + zout.putNextEntry(new ZipEntry(name)); + } else { + zout.putNextEntry(new ZipEntry(name)); + copy(kid, zout); + zout.closeEntry(); + } + } + } + } finally { + res.close(); + out.close(); + } + } + + private static void copy(InputStream in, OutputStream out) + throws IOException { + byte[] buffer = new byte[1024]; + while (true) { + int readCount = in.read(buffer); + if (readCount < 0) { + break; + } + out.write(buffer, 0, readCount); + } + } + + private static void copy(File file, OutputStream out) throws IOException { + InputStream in = new FileInputStream(file); + try { + copy(in, out); + } finally { + in.close(); + } + } + +} diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/Decompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/Decompiler.java new file mode 100644 index 00000000..e000e30d --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/Decompiler.java @@ -0,0 +1,48 @@ +package the.bytecode.club.bytecodeviewer.decompilers; + +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.decompilers.bytecode.ClassNodeDecompiler; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * Used to represent all of the decompilers/disassemblers BCV contains. + * + * @author Konloch + * + */ + +public abstract class Decompiler { + + public final static Decompiler bytecode = new ClassNodeDecompiler(); + public final static Decompiler fernflower = new FernFlowerDecompiler(); + public final static Decompiler procyon = new ProcyonDecompiler(); + public final static Decompiler cfr = new CFRDecompiler(); + public final static Decompiler krakatau = new KrakatauDecompiler(); + public final static Decompiler krakatauDA = new KrakatauDisassembler(); + public final static Decompiler smali = new SmaliDisassembler(); + public final static Decompiler jdgui = new JDGUIDecompiler(); + + public abstract String decompileClassNode(ClassNode cn, byte[] b); + + public abstract void decompileToZip(String zipName); + + +} diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.java new file mode 100644 index 00000000..f8b398ff --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.java @@ -0,0 +1,168 @@ +package the.bytecode.club.bytecodeviewer.decompilers; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; + +import me.konloch.kontainer.io.DiskReader; + +import org.apache.commons.lang3.ArrayUtils; +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.JarUtils; +import the.bytecode.club.bytecodeviewer.MiscUtils; +import the.bytecode.club.bytecodeviewer.Resources; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * A FernFlower wrapper with all the options (except 2) + * + * @author Konloch + * @author WaterWolf + * + */ + +public class FernFlowerDecompiler extends Decompiler { + + @Override + public void decompileToZip(String zipName) { + File tempZip = new File(BytecodeViewer.tempDirectory + "temp.zip"); + if (tempZip.exists()) + tempZip.delete(); + + File f = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + + "temp" + BytecodeViewer.fs); + f.mkdir(); + + JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), + tempZip.getAbsolutePath()); + + org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main(generateMainMethod(tempZip.getAbsolutePath(), BytecodeViewer.tempDirectory + "./temp/")); + + File tempZip2 = new File(BytecodeViewer.tempDirectory + + BytecodeViewer.fs + "temp" + BytecodeViewer.fs + + tempZip.getName()); + if (tempZip2.exists()) + tempZip2.renameTo(new File(zipName)); + + tempZip.delete(); + new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp") + .delete(); + } + + @Override + public String decompileClassNode(final ClassNode cn, byte[] b) { + String start = MiscUtils.getUniqueName("", ".class"); + + final File tempClass = new File(start + ".class"); + + String exception = ""; + try { + final FileOutputStream fos = new FileOutputStream(tempClass); + + fos.write(b); + + fos.close(); + } catch (final IOException e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + e.printStackTrace(); + + exception = "Bytecode Viewer Version: " + BytecodeViewer.version + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString(); + } + + + + if(!BytecodeViewer.fatJar) { + try { + ProcessBuilder pb = new ProcessBuilder(ArrayUtils.addAll( + new String[]{BytecodeViewer.getJavaCommand(),"-jar",Resources.findLibrary("fernflower")}, + generateMainMethod(tempClass.getAbsolutePath(), ".") + )); + BytecodeViewer.sm.stopBlocking(); + Process p = pb.start(); + BytecodeViewer.createdProcesses.add(p); + p.waitFor(); + } catch(Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } finally { + BytecodeViewer.sm.setBlocking(); + } + } else + org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main( + generateMainMethod(tempClass.getAbsolutePath(), ".")); + + tempClass.delete(); + + final File outputJava = new File(start + ".java"); + if (outputJava.exists()) { + String s; + try { + s = DiskReader.loadAsString(outputJava.getAbsolutePath()); + + outputJava.delete(); + + return s; + } catch (Exception e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + e.printStackTrace(); + + exception += BytecodeViewer.nl + BytecodeViewer.nl + sw.toString(); + } + } + return "FernFlower error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com"+BytecodeViewer.nl+BytecodeViewer.nl+"Suggested Fix: Click refresh class, if it fails again try another decompiler."+BytecodeViewer.nl+BytecodeViewer.nl+exception; + } + + private String[] generateMainMethod(String className, String folder) { + return new String[] { + "-rbr=" + r(BytecodeViewer.viewer.rbr.isSelected()), + "-rsy=" + r(BytecodeViewer.viewer.rsy.isSelected()), + "-din=" + r(BytecodeViewer.viewer.din.isSelected()), + "-dc4=" + r(BytecodeViewer.viewer.dc4.isSelected()), + "-das=" + r(BytecodeViewer.viewer.das.isSelected()), + "-hes=" + r(BytecodeViewer.viewer.hes.isSelected()), + "-hdc=" + r(BytecodeViewer.viewer.hdc.isSelected()), + "-dgs=" + r(BytecodeViewer.viewer.dgs.isSelected()), + "-ner=" + r(BytecodeViewer.viewer.ner.isSelected()), + "-den=" + r(BytecodeViewer.viewer.den.isSelected()), + "-rgn=" + r(BytecodeViewer.viewer.rgn.isSelected()), + "-bto=" + r(BytecodeViewer.viewer.bto.isSelected()), + "-nns=" + r(BytecodeViewer.viewer.nns.isSelected()), + "-uto=" + r(BytecodeViewer.viewer.uto.isSelected()), + "-udv=" + r(BytecodeViewer.viewer.udv.isSelected()), + "-rer=" + r(BytecodeViewer.viewer.rer.isSelected()), + "-fdi=" + r(BytecodeViewer.viewer.fdi.isSelected()), + "-asc=" + r(BytecodeViewer.viewer.asc.isSelected()), className, + folder }; + } + + private String r(boolean b) { + if (b) { + return "1"; + } else { + return "0"; + } + } + +} diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.java new file mode 100644 index 00000000..aecbc412 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.java @@ -0,0 +1,123 @@ +package the.bytecode.club.bytecodeviewer.decompilers; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; + +import jd.cli.loader.DirectoryLoader; +import jd.cli.preferences.CommonPreferences; +import jd.cli.util.ClassFileUtil; +import jd.core.process.DecompilerImpl; +import me.konloch.kontainer.io.DiskReader; + +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.MiscUtils; +import jd.cli.printer.text.PlainTextPrinter; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * JD-Core Decompiler Wrapper + * + * @author Konloch + * @author JD-Core developers + * + */ + +public class JDGUIDecompiler extends Decompiler { + + @Override + public String decompileClassNode(ClassNode cn, byte[] b) { + String exception = ""; + try { + final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs); + tempDirectory.mkdir(); + final File tempClass = new File(tempDirectory.getAbsolutePath() + BytecodeViewer.fs + cn.name + ".class"); + final File tempJava = new File(tempDirectory.getAbsolutePath() + BytecodeViewer.fs + cn.name + ".java"); + + if(cn.name.contains("/")) { + String[] raw = cn.name.split("/"); + String path = tempDirectory.getAbsolutePath() + BytecodeViewer.fs; + for(int i = 0; i < raw.length-1; i++) { + path += raw[i] + BytecodeViewer.fs; + File f = new File(path); + f.mkdir(); + } + } + + try { + final FileOutputStream fos = new FileOutputStream(tempClass); + + fos.write(b); + + fos.close(); + } catch (final IOException e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + + + String pathToClass = tempClass.getAbsolutePath().replace('/', File.separatorChar).replace('\\', File.separatorChar); + String directoryPath = ClassFileUtil.ExtractDirectoryPath(pathToClass); + + String internalPath = ClassFileUtil.ExtractInternalPath(directoryPath, pathToClass); + + CommonPreferences preferences = new CommonPreferences() { + @Override + public boolean isShowLineNumbers() { + return false; + } + @Override + public boolean isMergeEmptyLines() { + return true; + } + }; + + DirectoryLoader loader = new DirectoryLoader(new File(directoryPath)); + + //PrintStream ps = new PrintStream("test.html"); + //HtmlPrinter printer = new HtmlPrinter(ps); + PrintStream ps = new PrintStream(tempJava.getAbsolutePath()); + PlainTextPrinter printer = new PlainTextPrinter(preferences, ps); + + jd.core.Decompiler decompiler = new DecompilerImpl(); + decompiler.decompile(preferences, loader, printer, internalPath); + + String decompiledSource = "Error with decompilation."; + decompiledSource = DiskReader.loadAsString(tempJava.getAbsolutePath()); + + return decompiledSource; + } catch (Exception e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + e.printStackTrace(); + + exception = "Bytecode Viewer Version: " + BytecodeViewer.version + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString(); + } + return "JD-GUI error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com"+BytecodeViewer.nl+BytecodeViewer.nl+"Suggested Fix: Click refresh class, if it fails again try another decompiler."+BytecodeViewer.nl+BytecodeViewer.nl+exception; + } + + @Override + public void decompileToZip(String zipName) { + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.java new file mode 100644 index 00000000..19f0d645 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.java @@ -0,0 +1,187 @@ +package the.bytecode.club.bytecodeviewer.decompilers; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.StringWriter; + +import me.konloch.kontainer.io.DiskReader; + +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.JarUtils; +import the.bytecode.club.bytecodeviewer.MiscUtils; +import the.bytecode.club.bytecodeviewer.ZipUtils; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * Krakatau Java Decompiler Wrapper, requires Python 2.7 + * + * @author Konloch + * + */ + +public class KrakatauDecompiler extends Decompiler { + + public String quick() { + if(BytecodeViewer.library.isEmpty()) + return ""; + else + return ";"+BytecodeViewer.library; + } + + public String decompileClassNode(ClassNode cn, byte[] b) { + + if(BytecodeViewer.python.equals("")) { + BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path."); + BytecodeViewer.viewer.pythonC(); + } + if(BytecodeViewer.rt.equals("")) { + BytecodeViewer.showMessage("You need to set your JRE RT Library.\r\n(C:\\Program Files (x86)\\Java\\jre7\\lib\\rt.jar)"); + BytecodeViewer.viewer.rtC(); + } + + if(BytecodeViewer.python.equals("")) { + BytecodeViewer.showMessage("You need to set Python!"); + return "Set your paths"; + } + + if(BytecodeViewer.rt.equals("")) { + BytecodeViewer.showMessage("You need to set RT.jar!"); + return "Set your paths"; + } + + String s = "Bytecode Viewer Version: " + BytecodeViewer.version + BytecodeViewer.nl + BytecodeViewer.nl + "Please send this to konloch@gmail.com. " + BytecodeViewer.nl + BytecodeViewer.nl; + + final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs); + tempDirectory.mkdir(); + final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp"+MiscUtils.randomString(32)+".jar"); + JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); + + BytecodeViewer.sm.stopBlocking(); + try { + ProcessBuilder pb = new ProcessBuilder( + BytecodeViewer.python, + "-O", //love you storyyeller <3 + BytecodeViewer.krakatauWorkingDirectory + BytecodeViewer.fs + "decompile.py", + "-skip", //love you storyyeller <3 + "-nauto", + "-path", + BytecodeViewer.rt+";"+tempJar.getAbsolutePath()+quick(), + "-out", + tempDirectory.getAbsolutePath(), + cn.name+".class" + ); + + Process process = pb.start(); + BytecodeViewer.createdProcesses.add(process); + + //Read out dir output + InputStream is = process.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + String log = "Process:"+BytecodeViewer.nl+BytecodeViewer.nl; + String line; + while ((line = br.readLine()) != null) { + log += BytecodeViewer.nl + line; + } + br.close(); + + log += BytecodeViewer.nl+BytecodeViewer.nl+"Error:"+BytecodeViewer.nl+BytecodeViewer.nl; + is = process.getErrorStream(); + isr = new InputStreamReader(is); + br = new BufferedReader(isr); + while ((line = br.readLine()) != null) { + log += BytecodeViewer.nl + line; + } + br.close(); + + int exitValue = process.waitFor(); + log += BytecodeViewer.nl+BytecodeViewer.nl+"Exit Value is " + exitValue; + s = log; + + //if the motherfucker failed this'll fail, aka wont set. + s = DiskReader.loadAsString(tempDirectory.getAbsolutePath() + BytecodeViewer.fs + cn.name + ".java"); + tempDirectory.delete(); + tempJar.delete(); + } catch(Exception e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + e.printStackTrace(); + s += BytecodeViewer.nl+"Bytecode Viewer Version: " + BytecodeViewer.version + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString(); + } finally { + BytecodeViewer.sm.setBlocking(); + } + + return s; + } + + public void decompileToZip(String zipName) { + if(BytecodeViewer.python.equals("")) { + BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path."); + BytecodeViewer.viewer.pythonC(); + } + if(BytecodeViewer.rt.equals("")) { + BytecodeViewer.showMessage("You need to set your JRE RT Library.\r\n(C:\\Program Files (x86)\\Java\\jre7\\lib\\rt.jar)"); + BytecodeViewer.viewer.rtC(); + } + + String ran = MiscUtils.randomString(32); + final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + ran + BytecodeViewer.fs); + tempDirectory.mkdir(); + final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp.jar"); + JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); + + BytecodeViewer.sm.stopBlocking(); + try { + ProcessBuilder pb = new ProcessBuilder( + BytecodeViewer.python, + "-O", //love you storyyeller <3 + BytecodeViewer.krakatauWorkingDirectory + BytecodeViewer.fs + "decompile.py", + "-skip", //love you storyyeller <3 + "-nauto", + "-path", + BytecodeViewer.rt+";"+tempJar.getAbsolutePath(), + "-out", + tempDirectory.getAbsolutePath(), + tempJar.getAbsolutePath() + ); + + Process process = pb.start(); + BytecodeViewer.createdProcesses.add(process); + process.waitFor(); + MiscUtils.printProcess(process); + + // ZipUtils.zipDirectory(tempDirectory, new File(zipName)); + ZipUtils.zipFolder(tempDirectory.getAbsolutePath(), zipName, ran); + + //tempDirectory.delete(); + tempJar.delete(); + } catch(Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } finally { + BytecodeViewer.sm.setBlocking(); + } + } + +} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.java similarity index 69% rename from src/main/java/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.java rename to src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.java index 06532e2b..5d1c32a0 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.java +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.java @@ -1,19 +1,20 @@ package the.bytecode.club.bytecodeviewer.decompilers; -import org.apache.commons.io.IOUtils; +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.StringWriter; + +import me.konloch.kontainer.io.DiskReader; + import org.objectweb.asm.tree.ClassNode; -import org.zeroturnaround.zip.ZipUtil; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.JarUtils; import the.bytecode.club.bytecodeviewer.MiscUtils; -import the.bytecode.club.bytecodeviewer.Settings; - -import java.io.*; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; +import the.bytecode.club.bytecodeviewer.ZipUtils; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -35,49 +36,47 @@ import java.util.zip.ZipFile; /** * Krakatau Java Disassembler Wrapper, requires Python 2.7 - * + * * @author Konloch * */ public class KrakatauDisassembler extends Decompiler { - @Override - public String getName() { - return "Krakatau Disassembler"; - } public String decompileClassNode(ClassNode cn, byte[] b) { - if(Settings.PYTHON2_LOCATION.isEmpty()) { + if(BytecodeViewer.python.equals("")) { BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path."); BytecodeViewer.viewer.pythonC(); } - - if(Settings.PYTHON2_LOCATION.isEmpty()) { + + if(BytecodeViewer.python.equals("")) { BytecodeViewer.showMessage("You need to set Python!"); return "Set your paths"; } - + String s = "Bytecode Viewer Version: " + BytecodeViewer.version + BytecodeViewer.nl + BytecodeViewer.nl + "Please send this to konloch@gmail.com. " + BytecodeViewer.nl + BytecodeViewer.nl; + + final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs); + tempDirectory.mkdir(); + final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp"+MiscUtils.randomString(32)+".jar"); + JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); + + BytecodeViewer.sm.stopBlocking(); try { - final Path outputJar = Files.createTempFile("kdisout", ".zip"); - final Path inputJar = Files.createTempFile("kdisin", ".jar"); - JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedBytes(), inputJar.toAbsolutePath().toString()); - - BytecodeViewer.sm.stopBlocking(); ProcessBuilder pb = new ProcessBuilder( - Settings.PYTHON2_LOCATION.get(), + BytecodeViewer.python, "-O", //love you storyyeller <3 - BytecodeViewer.krakatauDirectory.getAbsolutePath() + BytecodeViewer.fs + "disassemble.py", + BytecodeViewer.krakatauWorkingDirectory + BytecodeViewer.fs + "disassemble.py", "-path", - inputJar.toAbsolutePath().toString(), + tempJar.getAbsolutePath(), "-out", - outputJar.toAbsolutePath().toString(), + tempDirectory.getAbsolutePath(), cn.name+".class" ); Process process = pb.start(); BytecodeViewer.createdProcesses.add(process); - + //Read out dir output InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); @@ -97,24 +96,15 @@ public class KrakatauDisassembler extends Decompiler { log += BytecodeViewer.nl + line; } br.close(); - + int exitValue = process.waitFor(); log += BytecodeViewer.nl+BytecodeViewer.nl+"Exit Value is " + exitValue; s = log; - - ZipFile zipFile= new ZipFile(outputJar.toFile()); - Enumeration entries = zipFile.entries(); - byte[] data = null; - while (entries.hasMoreElements()) { - ZipEntry next = entries.nextElement(); - if (next.getName().equals(cn.name + ".j")) { - data = IOUtils.toByteArray(zipFile.getInputStream(next)); - } - } - zipFile.close(); - Files.delete(inputJar); - Files.delete(outputJar); - return new String(data, "UTF-8"); + + //if the motherfucker failed this'll fail, aka wont set. + s = DiskReader.loadAsString(tempDirectory.getAbsolutePath() + BytecodeViewer.fs + cn.name + ".j"); + tempDirectory.delete(); + tempJar.delete(); } catch(Exception e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); @@ -127,25 +117,25 @@ public class KrakatauDisassembler extends Decompiler { } @Override public void decompileToZip(String zipName) { - if(Settings.PYTHON2_LOCATION.isEmpty()) { + if(BytecodeViewer.python.equals("")) { BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path."); BytecodeViewer.viewer.pythonC(); } - + String ran = MiscUtils.randomString(32); - final File tempDirectory = new File(BytecodeViewer.tempDir, ran + BytecodeViewer.fs); + final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + ran + BytecodeViewer.fs); tempDirectory.mkdir(); - final File tempJar = new File(BytecodeViewer.tempDir, "temp.jar"); - JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedBytes(), tempJar.getAbsolutePath()); - + final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp.jar"); + JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); + BytecodeViewer.sm.stopBlocking(); try { ProcessBuilder pb = new ProcessBuilder( - Settings.PYTHON2_LOCATION.get(), + BytecodeViewer.python, "-O", //love you storyyeller <3 - BytecodeViewer.krakatauDirectory.getAbsolutePath() + BytecodeViewer.fs + "disassemble.py", + BytecodeViewer.krakatauWorkingDirectory + BytecodeViewer.fs + "disassemble.py", "-path", - Settings.RT_LOCATION.get()+";"+tempJar.getAbsolutePath(), + BytecodeViewer.rt+";"+tempJar.getAbsolutePath(), "-out", tempDirectory.getAbsolutePath(), tempJar.getAbsolutePath() @@ -154,9 +144,10 @@ public class KrakatauDisassembler extends Decompiler { Process process = pb.start(); BytecodeViewer.createdProcesses.add(process); process.waitFor(); - - ZipUtil.pack(tempDirectory, new File(zipName)); - + + // ZipUtils.zipDirectory(tempDirectory, new File(zipName)); + ZipUtils.zipFolder(tempDirectory.getAbsolutePath(), zipName, ran); + //tempDirectory.delete(); tempJar.delete(); } catch(Exception e) { diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/ProcyonDecompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/ProcyonDecompiler.java new file mode 100644 index 00000000..e96b3cea --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/ProcyonDecompiler.java @@ -0,0 +1,286 @@ +package the.bytecode.club.bytecodeviewer.decompilers; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.zip.ZipException; +import java.util.zip.ZipOutputStream; + +import org.objectweb.asm.tree.ClassNode; + +import com.strobel.core.StringUtilities; +import com.strobel.decompiler.DecompilationOptions; +import com.strobel.decompiler.DecompilerSettings; +import com.strobel.decompiler.PlainTextOutput; +import com.strobel.decompiler.languages.java.JavaFormattingOptions; +import com.strobel.assembler.InputTypeLoader; +import com.strobel.assembler.metadata.Buffer; +import com.strobel.assembler.metadata.ITypeLoader; +import com.strobel.assembler.metadata.JarTypeLoader; +import com.strobel.assembler.metadata.MetadataSystem; +import com.strobel.assembler.metadata.TypeDefinition; +import com.strobel.assembler.metadata.TypeReference; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.JarUtils; +import the.bytecode.club.bytecodeviewer.MiscUtils; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * Procyon Java Decompiler Wrapper + * + * @author Konloch + * @author DeathMarine + * + */ + +public class ProcyonDecompiler extends Decompiler { + + public DecompilerSettings getDecompilerSettings() { + DecompilerSettings settings = new DecompilerSettings(); + settings.setAlwaysGenerateExceptionVariableForCatchBlocks(BytecodeViewer.viewer.chckbxmntmNewCheckItem_6 + .isSelected()); + settings.setExcludeNestedTypes(BytecodeViewer.viewer.chckbxmntmNewCheckItem_11 + .isSelected()); + settings.setShowDebugLineNumbers(BytecodeViewer.viewer.chckbxmntmShowDebugLine + .isSelected()); + settings.setIncludeLineNumbersInBytecode(BytecodeViewer.viewer.chckbxmntmNewCheckItem_3 + .isSelected()); + settings.setIncludeErrorDiagnostics(BytecodeViewer.viewer.chckbxmntmNewCheckItem_4 + .isSelected()); + settings.setShowSyntheticMembers(BytecodeViewer.viewer.chckbxmntmNewCheckItem_7 + .isSelected()); + settings.setSimplifyMemberReferences(BytecodeViewer.viewer.chckbxmntmSimplifyMemberReferences + .isSelected()); + settings.setMergeVariables(BytecodeViewer.viewer.mnMergeVariables + .isSelected()); + settings.setForceExplicitTypeArguments(BytecodeViewer.viewer.chckbxmntmNewCheckItem_8 + .isSelected()); + settings.setForceExplicitImports(BytecodeViewer.viewer.chckbxmntmNewCheckItem_9 + .isSelected()); + settings.setFlattenSwitchBlocks(BytecodeViewer.viewer.chckbxmntmNewCheckItem_10 + .isSelected()); + settings.setRetainPointlessSwitches(BytecodeViewer.viewer.chckbxmntmNewCheckItem_2 + .isSelected()); + settings.setRetainRedundantCasts(BytecodeViewer.viewer.chckbxmntmNewCheckItem_5 + .isSelected()); + settings.setUnicodeOutputEnabled(BytecodeViewer.viewer.chckbxmntmNewCheckItem_1 + .isSelected()); + settings.setFormattingOptions(JavaFormattingOptions.createDefault()); + return settings; + } + + @Override + public String decompileClassNode(ClassNode cn, byte[] b) { + String exception = ""; + try { + String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs + + "temp"; + + final File tempClass = new File(MiscUtils.getUniqueName(fileStart, ".class") + ".class"); + + try { + final FileOutputStream fos = new FileOutputStream(tempClass); + + fos.write(b); + + fos.close(); + } catch (final IOException e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + + DecompilerSettings settings = getDecompilerSettings(); + + LuytenTypeLoader typeLoader = new LuytenTypeLoader(); + MetadataSystem metadataSystem = new MetadataSystem(typeLoader); + TypeReference type = metadataSystem.lookupType(tempClass + .getCanonicalPath()); + + DecompilationOptions decompilationOptions = new DecompilationOptions(); + decompilationOptions.setSettings(DecompilerSettings.javaDefaults()); + decompilationOptions.setFullDecompilation(true); + + TypeDefinition resolvedType = null; + if (type == null || ((resolvedType = type.resolve()) == null)) { + throw new Exception("Unable to resolve type."); + } + StringWriter stringwriter = new StringWriter(); + settings.getLanguage().decompileType(resolvedType, + new PlainTextOutput(stringwriter), decompilationOptions); + String decompiledSource = stringwriter.toString(); + + return decompiledSource; + } catch (Exception e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + e.printStackTrace(); + + exception = "Bytecode Viewer Version: " + BytecodeViewer.version + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString(); + } + return "Procyon error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com"+BytecodeViewer.nl+BytecodeViewer.nl+"Suggested Fix: Click refresh class, if it fails again try another decompiler."+BytecodeViewer.nl+BytecodeViewer.nl+exception; + } + + @Override + public void decompileToZip(String zipName) { + File tempZip = new File(BytecodeViewer.tempDirectory + + BytecodeViewer.fs + "temp.jar"); + if (tempZip.exists()) + tempZip.delete(); + + JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), + tempZip.getAbsolutePath()); + + try { + doSaveJarDecompiled(tempZip, new File(zipName)); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + + /** + * + * @author DeathMarine + * + */ + private void doSaveJarDecompiled(File inFile, File outFile) + throws Exception { + try (JarFile jfile = new JarFile(inFile); + FileOutputStream dest = new FileOutputStream(outFile); + BufferedOutputStream buffDest = new BufferedOutputStream(dest); + ZipOutputStream out = new ZipOutputStream(buffDest);) { + byte data[] = new byte[1024]; + DecompilerSettings settings = getDecompilerSettings(); + LuytenTypeLoader typeLoader = new LuytenTypeLoader(); + MetadataSystem metadataSystem = new MetadataSystem(typeLoader); + ITypeLoader jarLoader = new JarTypeLoader(jfile); + typeLoader.getTypeLoaders().add(jarLoader); + + DecompilationOptions decompilationOptions = new DecompilationOptions(); + decompilationOptions.setSettings(settings); + decompilationOptions.setFullDecompilation(true); + + Enumeration ent = jfile.entries(); + Set history = new HashSet(); + while (ent.hasMoreElements()) { + JarEntry entry = ent.nextElement(); + if (entry.getName().endsWith(".class")) { + JarEntry etn = new JarEntry(entry.getName().replace( + ".class", ".java")); + if (history.add(etn)) { + out.putNextEntry(etn); + try { + String internalName = StringUtilities.removeRight( + entry.getName(), ".class"); + TypeReference type = metadataSystem + .lookupType(internalName); + TypeDefinition resolvedType = null; + if ((type == null) + || ((resolvedType = type.resolve()) == null)) { + throw new Exception("Unable to resolve type."); + } + Writer writer = new OutputStreamWriter(out); + settings.getLanguage().decompileType(resolvedType, + new PlainTextOutput(writer), + decompilationOptions); + writer.flush(); + } finally { + out.closeEntry(); + } + } + } else { + try { + JarEntry etn = new JarEntry(entry.getName()); + if (history.add(etn)) + continue; + history.add(etn); + out.putNextEntry(etn); + try { + InputStream in = jfile.getInputStream(entry); + if (in != null) { + try { + int count; + while ((count = in.read(data, 0, 1024)) != -1) { + out.write(data, 0, count); + } + } finally { + in.close(); + } + } + } finally { + out.closeEntry(); + } + } catch (ZipException ze) { + // some jar-s contain duplicate pom.xml entries: ignore + // it + if (!ze.getMessage().contains("duplicate")) { + throw ze; + } + } + } + } + } + } + + /** + * + * @author DeathMarine + * + */ + public final class LuytenTypeLoader implements ITypeLoader { + private final List _typeLoaders; + + public LuytenTypeLoader() { + _typeLoaders = new ArrayList(); + _typeLoaders.add(new InputTypeLoader()); + } + + public final List getTypeLoaders() { + return _typeLoaders; + } + + @Override + public boolean tryLoadType(final String internalName, + final Buffer buffer) { + for (final ITypeLoader typeLoader : _typeLoaders) { + if (typeLoader.tryLoadType(internalName, buffer)) { + return true; + } + + buffer.reset(); + } + + return false; + } + } + +} diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/SmaliDisassembler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/SmaliDisassembler.java new file mode 100644 index 00000000..dd3f86ed --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/SmaliDisassembler.java @@ -0,0 +1,100 @@ +package the.bytecode.club.bytecodeviewer.decompilers; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; + +import me.konloch.kontainer.io.DiskReader; + +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.Dex2Jar; +import the.bytecode.club.bytecodeviewer.MiscUtils; +import the.bytecode.club.bytecodeviewer.ZipUtils; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * Smali Disassembler Wrapper + * + * @author Konloch + * + */ + +public class SmaliDisassembler extends Decompiler { + + public String decompileClassNode(ClassNode cn, byte[] b) { + String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs + + "temp"; + + String start = MiscUtils.getUniqueName(fileStart, ".class"); + + final File tempClass = new File(start + ".class"); + final File tempZip = new File(start + ".jar"); + final File tempDex = new File(start + ".dex"); + final File tempSmali = new File(start + "-smali"); //output directory + + try { + final FileOutputStream fos = new FileOutputStream(tempClass); + + fos.write(b); + + fos.close(); + } catch (final IOException e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + + ZipUtils.zipFile(tempClass, tempZip); + + Dex2Jar.saveAsDex(tempZip, tempDex); + + try { + org.jf.baksmali.main.main(new String[]{"-o", tempSmali.getAbsolutePath(), "-x", tempDex.getAbsolutePath()}); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + + File outputSmali = null; + + boolean found = false; + File current = tempSmali; + while(!found) { + File f = current.listFiles()[0]; + if(f.isDirectory()) + current = f; + else { + outputSmali = f; + found = true; + } + + } + try { + return DiskReader.loadAsString(outputSmali.getAbsolutePath()); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + + return null; + } + + @Override public void decompileToZip(String zipName) { + + } +} diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java new file mode 100644 index 00000000..4d476963 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java @@ -0,0 +1,159 @@ +package the.bytecode.club.bytecodeviewer.decompilers.bytecode; + +import java.util.ArrayList; +import java.util.List; + +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldNode; +import org.objectweb.asm.tree.InnerClassNode; +import org.objectweb.asm.tree.MethodNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * + * @author Konloch + * @author Bibl + * + */ + +public class ClassNodeDecompiler extends Decompiler { + + public String decompileClassNode(ClassNode cn, byte[] b) { + return decompile(new PrefixedStringBuilder(), + new ArrayList(), cn).toString(); + } + + protected static PrefixedStringBuilder decompile( + PrefixedStringBuilder sb, ArrayList decompiledClasses, + ClassNode cn) { + ArrayList unableToDecompile = new ArrayList(); + decompiledClasses.add(cn.name); + sb.append(getAccessString(cn.access)); + sb.append(" "); + sb.append(cn.name); + if (cn.superName != null && !cn.superName.equals("java/lang/Object")) { + sb.append(" extends "); + sb.append(cn.superName); + } + + int amountOfInterfaces = cn.interfaces.size(); + if (amountOfInterfaces > 0) { + sb.append(" implements "); + sb.append(cn.interfaces.get(0)); + if (amountOfInterfaces > 1) { + // sb.append(","); + } + for (int i = 1; i < amountOfInterfaces; i++) { + sb.append(", "); + sb.append(cn.interfaces.get(i)); + } + } + sb.append(" {"); + sb.append(BytecodeViewer.nl); + for (FieldNode fn : (List) cn.fields) { + sb.append(BytecodeViewer.nl); + sb.append(" "); + FieldNodeDecompiler.decompile(sb, fn); + } + if (cn.fields.size() > 0) { + sb.append(BytecodeViewer.nl); + } + for (MethodNode mn : (List) cn.methods) { + sb.append(BytecodeViewer.nl); + MethodNodeDecompiler.decompile(sb, mn, cn); + } + + for (Object o : cn.innerClasses) { + InnerClassNode innerClassNode = (InnerClassNode) o; + String innerClassName = innerClassNode.name; + if ((innerClassName != null) + && !decompiledClasses.contains(innerClassName)) { + decompiledClasses.add(innerClassName); + ClassNode cn1 = BytecodeViewer.getClassNode(innerClassName); + if (cn1 != null) { + sb.appendPrefix(" "); + sb.append(BytecodeViewer.nl + BytecodeViewer.nl); + sb = decompile(sb, decompiledClasses, cn1); + sb.trimPrefix(5); + sb.append(BytecodeViewer.nl); + } else { + unableToDecompile.add(innerClassName); + } + } + } + + if (!unableToDecompile.isEmpty()) { + sb.append("//the following inner classes couldn't be decompiled: "); + for (String s : unableToDecompile) { + sb.append(s); + sb.append(" "); + } + sb.append(BytecodeViewer.nl); + } + + sb.append("}"); + // System.out.println("Wrote end for " + cn.name + + // " with prefix length: " + sb.prefix.length()); + return sb; + } + + public static String getAccessString(int access) { + List tokens = new ArrayList(); + if ((access & Opcodes.ACC_PUBLIC) != 0) + tokens.add("public"); + if ((access & Opcodes.ACC_PRIVATE) != 0) + tokens.add("private"); + if ((access & Opcodes.ACC_PROTECTED) != 0) + tokens.add("protected"); + if ((access & Opcodes.ACC_FINAL) != 0) + tokens.add("final"); + if ((access & Opcodes.ACC_SYNTHETIC) != 0) + tokens.add("synthetic"); + // if ((access & Opcodes.ACC_SUPER) != 0) + // tokens.add("super"); implied by invokespecial insn + if ((access & Opcodes.ACC_ABSTRACT) != 0) + tokens.add("abstract"); + if ((access & Opcodes.ACC_INTERFACE) != 0) + tokens.add("interface"); + if ((access & Opcodes.ACC_ENUM) != 0) + tokens.add("enum"); + if ((access & Opcodes.ACC_ANNOTATION) != 0) + tokens.add("annotation"); + if (!tokens.contains("interface") && !tokens.contains("enum") + && !tokens.contains("annotation")) + tokens.add("class"); + if (tokens.size() == 0) + return "[Error parsing]"; + + // hackery delimeters + StringBuilder sb = new StringBuilder(tokens.get(0)); + for (int i = 1; i < tokens.size(); i++) { + sb.append(" "); + sb.append(tokens.get(i)); + } + return sb.toString(); + } + + @Override public void decompileToZip(String zipName) { } +} \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/FieldNodeDecompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/FieldNodeDecompiler.java similarity index 97% rename from src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/FieldNodeDecompiler.java rename to src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/FieldNodeDecompiler.java index 1f1bf75b..f54eaba7 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/FieldNodeDecompiler.java +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/FieldNodeDecompiler.java @@ -1,12 +1,12 @@ package the.bytecode.club.bytecodeviewer.decompilers.bytecode; +import java.util.ArrayList; +import java.util.List; + import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; import org.objectweb.asm.tree.FieldNode; -import java.util.ArrayList; -import java.util.List; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -34,11 +34,8 @@ import java.util.List; public class FieldNodeDecompiler { - private FieldNodeDecompiler() { - } - public static PrefixedStringBuilder decompile(PrefixedStringBuilder sb, - FieldNode f) { + FieldNode f) { String s = getAccessString(f.access); sb.append(s); if (s.length() > 0) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPattern.java b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPattern.java similarity index 86% rename from src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPattern.java rename to src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPattern.java index 5a6b8149..851ef670 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPattern.java +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPattern.java @@ -1,12 +1,31 @@ package the.bytecode.club.bytecodeviewer.decompilers.bytecode; +import java.util.Arrays; + +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.FieldInsnNode; +import org.objectweb.asm.tree.IincInsnNode; +import org.objectweb.asm.tree.InsnNode; +import org.objectweb.asm.tree.JumpInsnNode; +import org.objectweb.asm.tree.LabelNode; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MultiANewArrayInsnNode; +import org.objectweb.asm.tree.TypeInsnNode; +import org.objectweb.asm.tree.VarInsnNode; + import eu.bibl.banalysis.filter.InstructionFilter; import eu.bibl.banalysis.filter.OpcodeFilter; -import eu.bibl.banalysis.filter.insn.*; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.*; - -import java.util.Arrays; +import eu.bibl.banalysis.filter.insn.FieldInstructionFilter; +import eu.bibl.banalysis.filter.insn.IincInstructionFilter; +import eu.bibl.banalysis.filter.insn.InsnInstructionFilter; +import eu.bibl.banalysis.filter.insn.JumpInstructionFilter; +import eu.bibl.banalysis.filter.insn.LdcInstructionFilter; +import eu.bibl.banalysis.filter.insn.MethodInstructionFilter; +import eu.bibl.banalysis.filter.insn.MultiANewArrayInstructionFilter; +import eu.bibl.banalysis.filter.insn.TypeInstructionFilter; +import eu.bibl.banalysis.filter.insn.VarInstructionFilter; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.java b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.java new file mode 100644 index 00000000..b607152e --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.java @@ -0,0 +1,354 @@ +package the.bytecode.club.bytecodeviewer.decompilers.bytecode; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; + +import org.apache.commons.lang3.StringEscapeUtils; +import org.objectweb.asm.Type; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.FieldInsnNode; +import org.objectweb.asm.tree.FrameNode; +import org.objectweb.asm.tree.IincInsnNode; +import org.objectweb.asm.tree.InsnNode; +import org.objectweb.asm.tree.IntInsnNode; +import org.objectweb.asm.tree.InvokeDynamicInsnNode; +import org.objectweb.asm.tree.JumpInsnNode; +import org.objectweb.asm.tree.LabelNode; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.LineNumberNode; +import org.objectweb.asm.tree.LookupSwitchInsnNode; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MethodNode; +import org.objectweb.asm.tree.TableSwitchInsnNode; +import org.objectweb.asm.tree.TypeInsnNode; +import org.objectweb.asm.tree.VarInsnNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import eu.bibl.banalysis.asm.desc.OpcodeInfo; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * + * @author Konloch + * @author Bibl + * + */ +public class InstructionPrinter { + + /** The MethodNode to print **/ + protected MethodNode mNode; + private TypeAndName[] args; + + protected int[] pattern; + protected boolean match; + protected InstructionSearcher searcher; + + protected List matchedInsns; + protected Map labels; + + public InstructionPrinter(MethodNode m, TypeAndName[] args) { + this.args = args; + mNode = m; + labels = new HashMap(); + // matchedInsns = new ArrayList(); // ingnored because + // match = false + match = false; + } + + public InstructionPrinter(MethodNode m, InstructionPattern pattern, + TypeAndName[] args) { + this.args = args; + mNode = m; + labels = new HashMap(); + searcher = new InstructionSearcher(m.instructions, pattern); + match = searcher.search(); + if (match) { + for (AbstractInsnNode[] ains : searcher.getMatches()) { + for (AbstractInsnNode ain : ains) { + matchedInsns.add(ain); + } + } + } + } + + /** + * Creates the print + * + * @return The print as an ArrayList + */ + public ArrayList createPrint() { + ArrayList info = new ArrayList(); + ListIterator it = mNode.instructions.iterator(); + boolean firstLabel = false; + while (it.hasNext()) { + AbstractInsnNode ain = (AbstractInsnNode) it.next(); + String line = ""; + if (ain instanceof VarInsnNode) { + line = printVarInsnNode((VarInsnNode) ain, it); + } else if (ain instanceof IntInsnNode) { + line = printIntInsnNode((IntInsnNode) ain, it); + } else if (ain instanceof FieldInsnNode) { + line = printFieldInsnNode((FieldInsnNode) ain, it); + } else if (ain instanceof MethodInsnNode) { + line = printMethodInsnNode((MethodInsnNode) ain, it); + } else if (ain instanceof LdcInsnNode) { + line = printLdcInsnNode((LdcInsnNode) ain, it); + } else if (ain instanceof InsnNode) { + line = printInsnNode((InsnNode) ain, it); + } else if (ain instanceof JumpInsnNode) { + line = printJumpInsnNode((JumpInsnNode) ain, it); + } else if (ain instanceof LineNumberNode) { + line = printLineNumberNode((LineNumberNode) ain, it); + } else if (ain instanceof LabelNode) { + if (firstLabel + && BytecodeViewer.viewer.chckbxmntmAppendBrackets + .isSelected()) + info.add("}"); + + line = printLabelnode((LabelNode) ain); + + if (BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected()) { + if (!firstLabel) + firstLabel = true; + line += " {"; + } + } else if (ain instanceof TypeInsnNode) { + line = printTypeInsnNode((TypeInsnNode) ain); + } else if (ain instanceof FrameNode) { + line = ""; + } else if (ain instanceof IincInsnNode) { + line = printIincInsnNode((IincInsnNode) ain); + } else if (ain instanceof TableSwitchInsnNode) { + line = printTableSwitchInsnNode((TableSwitchInsnNode) ain); + } else if (ain instanceof LookupSwitchInsnNode) { + line = printLookupSwitchInsnNode((LookupSwitchInsnNode) ain); + } else if (ain instanceof InvokeDynamicInsnNode) { + line = printInvokeDynamicInsNode((InvokeDynamicInsnNode) ain); + } else { + line += "UNADDED OPCODE: " + nameOpcode(ain.opcode()) + " " + + ain.toString(); + } + if (!line.equals("")) { + if (match) + if (matchedInsns.contains(ain)) + line = " -> " + line; + + info.add(line); + } + } + if (firstLabel + && BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected()) + info.add("}"); + return info; + } + + protected String printVarInsnNode(VarInsnNode vin, ListIterator it) { + StringBuilder sb = new StringBuilder(); + sb.append(nameOpcode(vin.opcode())); + sb.append(vin.var); + if (BytecodeViewer.viewer.debugHelpers.isSelected()) { + if (vin.var == 0 && !Modifier.isStatic(mNode.access)) { + sb.append(" // reference to self"); + } else { + final int refIndex = vin.var + - (Modifier.isStatic(mNode.access) ? 0 : 1); + if (refIndex >= 0 && refIndex < args.length - 1) { + sb.append(" // reference to " + args[refIndex].name); + } + } + } + + return sb.toString(); + } + + protected String printIntInsnNode(IntInsnNode iin, ListIterator it) { + return nameOpcode(iin.opcode()) + " " + iin.operand; + } + + protected String printFieldInsnNode(FieldInsnNode fin, ListIterator it) { + String desc = Type.getType(fin.desc).getClassName(); + if (desc == null || desc.equals("null")) + desc = fin.desc; + return nameOpcode(fin.opcode()) + " " + fin.owner + "." + fin.name + + ":" + desc; + } + + protected String printMethodInsnNode(MethodInsnNode min, ListIterator it) { + StringBuilder sb = new StringBuilder(); + sb.append(nameOpcode(min.opcode()) + " " + min.owner + " " + + min.name + "("); + + String desc = min.desc; + try { + if(Type.getType(min.desc) != null) + desc = Type.getType(min.desc).getClassName(); + + if (desc == null || desc.equals("null")) + desc = min.desc; + } catch(java.lang.ArrayIndexOutOfBoundsException e) { + + } + + sb.append(desc); + + sb.append(");"); + + return sb.toString(); + } + + protected String printLdcInsnNode(LdcInsnNode ldc, ListIterator it) { + if (ldc.cst instanceof String) + return nameOpcode(ldc.opcode()) + " \"" + + StringEscapeUtils.escapeJava(ldc.cst.toString()) + "\" (" + + ldc.cst.getClass().getCanonicalName() + ")"; + + return nameOpcode(ldc.opcode()) + " " + + StringEscapeUtils.escapeJava(ldc.cst.toString()) + " (" + + ldc.cst.getClass().getCanonicalName() + ")"; + } + + protected String printInsnNode(InsnNode in, ListIterator it) { + return nameOpcode(in.opcode()); + } + + protected String printJumpInsnNode(JumpInsnNode jin, ListIterator it) { + String line = nameOpcode(jin.opcode()) + " L" + + resolveLabel(jin.label); + return line; + } + + protected String printLineNumberNode(LineNumberNode lin, ListIterator it) { + return ""; + } + + protected String printLabelnode(LabelNode label) { + return "L" + resolveLabel(label); + } + + protected String printTypeInsnNode(TypeInsnNode tin) { + try { + String desc = tin.desc; + try { + if(Type.getType(tin.desc) != null) + desc = Type.getType(tin.desc).getClassName(); + + if (desc == null || desc.equals("null")) + desc = tin.desc; + } catch(java.lang.ArrayIndexOutOfBoundsException e) { + + } + return nameOpcode(tin.opcode()) + " " + desc; + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + return "//error"; + } + + protected String printIincInsnNode(IincInsnNode iin) { + return nameOpcode(iin.opcode()) + " " + iin.var + " " + iin.incr; + } + + protected String printTableSwitchInsnNode(TableSwitchInsnNode tin) { + String line = nameOpcode(tin.opcode()) + " \n"; + List labels = tin.labels; + int count = 0; + for (int i = tin.min; i < tin.max+1; i++) { + line += " val: " + i + " -> " + "L" + + resolveLabel((LabelNode) labels.get(count++)) + "\n"; + } + line += " default" + " -> L" + resolveLabel(tin.dflt) + + ""; + return line; + } + + protected String printLookupSwitchInsnNode(LookupSwitchInsnNode lin) { + String line = nameOpcode(lin.opcode()) + ": \n"; + List keys = lin.keys; + List labels = lin.labels; + + for (int i = 0; i < keys.size(); i++) { + int key = (Integer) keys.get(i); + LabelNode label = (LabelNode) labels.get(i); + line += " val: " + key + " -> " + "L" + + resolveLabel(label) + "\n"; + } + line += " default" + " -> L" + resolveLabel(lin.dflt) + + ""; + return line; + } + + protected String printInvokeDynamicInsNode(InvokeDynamicInsnNode idin) { + StringBuilder sb = new StringBuilder(); + sb.append(nameOpcode(idin.opcode()) + " " + idin.name + "("); + + String desc = idin.desc; + String partedDesc = idin.desc.substring(2); + try { + if(Type.getType(partedDesc) != null) + desc = Type.getType(partedDesc).getClassName(); + + if (desc == null || desc.equals("null")) + desc = idin.desc; + } catch(java.lang.ArrayIndexOutOfBoundsException e) { + + } + + sb.append(desc); + + sb.append(");"); + + return sb.toString(); + } + + protected String nameOpcode(int opcode) { + return " " + OpcodeInfo.OPCODES.get(opcode).toLowerCase(); + } + + protected int resolveLabel(LabelNode label) { + if (labels.containsKey(label)) { + return labels.get(label); + } else { + int newLabelIndex = labels.size() + 1; + labels.put(label, newLabelIndex); + return newLabelIndex; + } + } + + public static void saveTo(File file, InstructionPrinter printer) { + try { + BufferedWriter bw = new BufferedWriter(new FileWriter(file)); + for (String s : printer.createPrint()) { + bw.write(s); + bw.newLine(); + } + bw.close(); + } catch (IOException e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } +} \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionSearcher.java b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionSearcher.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionSearcher.java rename to src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionSearcher.java index e13bb714..3c562b60 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionSearcher.java +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionSearcher.java @@ -1,14 +1,14 @@ package the.bytecode.club.bytecodeviewer.decompilers.bytecode; +import java.util.ArrayList; +import java.util.List; + import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.FrameNode; import org.objectweb.asm.tree.InsnList; import org.objectweb.asm.tree.LineNumberNode; -import java.util.ArrayList; -import java.util.List; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/MethodNodeDecompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/MethodNodeDecompiler.java similarity index 95% rename from src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/MethodNodeDecompiler.java rename to src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/MethodNodeDecompiler.java index afe52510..94e72202 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/MethodNodeDecompiler.java +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/MethodNodeDecompiler.java @@ -1,15 +1,20 @@ package the.bytecode.club.bytecodeviewer.decompilers.bytecode; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.*; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.tree.AnnotationNode; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.LocalVariableNode; +import org.objectweb.asm.tree.MethodNode; +import org.objectweb.asm.tree.TryCatchBlockNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.decompilers.bytecode.TypeAndName; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -107,7 +112,7 @@ public class MethodNodeDecompiler { sb.append(" {"); - if (Decompiler.BYTECODE.getSettings().isSelected(ClassNodeDecompiler.Settings.DEBUG_HELPERS)) { + if (BytecodeViewer.viewer.debugHelpers.isSelected()) { if (m.name.equals("")) sb.append(" // "); else if (m.name.equals("")) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/PrefixedStringBuilder.java b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/PrefixedStringBuilder.java similarity index 100% rename from src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/PrefixedStringBuilder.java rename to src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/PrefixedStringBuilder.java diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/TypeAndName.java b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/TypeAndName.java similarity index 100% rename from src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/TypeAndName.java rename to src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/TypeAndName.java diff --git a/src/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java b/src/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java new file mode 100644 index 00000000..6dd5dcc0 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java @@ -0,0 +1,100 @@ +package the.bytecode.club.bytecodeviewer.gui; + +import javax.swing.JFrame; + +import java.awt.CardLayout; +import java.awt.Font; +import java.awt.Toolkit; + +import javax.swing.JTextArea; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.Resources; + +import java.awt.Color; +import javax.swing.JScrollPane; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * The about frame. + * + * @author Konloch + * + */ + +public class AboutWindow extends JFrame { + JTextArea textArea = new JTextArea(); + public AboutWindow() { + this.setIconImages(Resources.iconList); + setSize(Toolkit.getDefaultToolkit().getScreenSize()); + setType(Type.UTILITY); + setTitle("Bytecode Viewer - About - https://bytecodeviewer.com | https://the.bytecode.club"); + getContentPane().setLayout(new CardLayout(0, 0)); +JScrollPane scrollPane = new JScrollPane(); +getContentPane().add(scrollPane, "name_322439757638784"); +textArea.setWrapStyleWord(true); +textArea.setEnabled(false); +textArea.setDisabledTextColor(Color.BLACK); +scrollPane.setViewportView(textArea); + this.setResizable(false); + this.setLocationRelativeTo(null); + } + + @Override + public void setVisible(boolean b) { + super.setVisible(b); + textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + textArea.setText("Bytecode Viewer "+BytecodeViewer.version+" is an open source program developed and maintained by Konloch (konloch@gmail.com) 100% free and open sourced licensed under GPL v3 CopyLeft\r\n\r\n"+ + "Settings:"+BytecodeViewer.nl+ + " Preview Copy: "+BytecodeViewer.previewCopy+BytecodeViewer.nl+ + " Fat Jar: "+BytecodeViewer.fatJar+BytecodeViewer.nl+ + " Java: " + BytecodeViewer.java+BytecodeViewer.nl+ + " Javac: " + BytecodeViewer.javac+BytecodeViewer.nl+ + " BCV Dir: " + BytecodeViewer.getBCVDirectory()+BytecodeViewer.nl+ + " Python 2.7 (or PyPy): " + BytecodeViewer.python+BytecodeViewer.nl+ + " Python 3.X (or PyPy): " + BytecodeViewer.python3+BytecodeViewer.nl+ + " RT.jar:" + BytecodeViewer.rt+BytecodeViewer.nl+ + " Optional Lib: " + BytecodeViewer.library+BytecodeViewer.nl+ + " BCV Krakatau: v" + BytecodeViewer.krakatauVersion+BytecodeViewer.nl+ + " Krakatau Dir: " + BytecodeViewer.krakatauWorkingDirectory+BytecodeViewer.nl+ + " BCV Enjarify: v" + BytecodeViewer.enjarifyVersion+BytecodeViewer.nl+ + " Enjarify Dir: " + BytecodeViewer.enjarifyWorkingDirectory+BytecodeViewer.nl+BytecodeViewer.nl+ + "Command Line Input:"+BytecodeViewer.nl+ + " -help Displays the help menu"+BytecodeViewer.nl+ + " -list Displays the available decompilers"+BytecodeViewer.nl+ + " -decompiler Selects the decompiler, procyon by default"+BytecodeViewer.nl+ + " -i Selects the input file (Jar, Class, APK, ZIP, DEX all work automatically)"+BytecodeViewer.nl+ + " -o Selects the output file (Java or Java-Bytecode)"+BytecodeViewer.nl+ + " -t Must either be the fully qualified classname or \"all\" to decompile all as zip"+BytecodeViewer.nl+ + " -nowait Doesn't wait for the user to read the CLI messages"+BytecodeViewer.nl+BytecodeViewer.nl+ + "Keybinds:"+BytecodeViewer.nl+ + " CTRL + O: Open/add new jar/class/apk"+BytecodeViewer.nl+ + " CTLR + N: Reset the workspace"+BytecodeViewer.nl+ + " CTRL + W: Closes the currently opened tab"+BytecodeViewer.nl+ + " CTRL + T: Compile"+BytecodeViewer.nl+ + " CTRL + S: Save classes as zip"+BytecodeViewer.nl+ + " CTRL + R: Run (EZ-Inject) - dynamically load the classes and invoke a main class"+ + "\r\n\r\nCode from various projects has been used, including but not limited to:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n RSynaxPane by Robert Futrell\r\n Commons IO by Apache\r\n ASM by OW2\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n CFIDE by Bibl\r\n Smali by JesusFreke\r\n Dex2Jar by pxb1..?\r\n Krakatau by Storyyeller\r\n JD-GUI + JD-Core by The Java-Decompiler Team\r\n Enjarify by Storyyeller\r\n\r\nIf you're interested in Java Reverse Engineering, join The Bytecode Club - https://the.bytecode.club"); + + } + + private static final long serialVersionUID = -8230501978224923296L; + +} diff --git a/src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java b/src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java new file mode 100644 index 00000000..700f31b7 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java @@ -0,0 +1,1633 @@ +package the.bytecode.club.bytecodeviewer.gui; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.HierarchyEvent; +import java.awt.event.HierarchyListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.ArrayList; + +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.JTextField; +import javax.swing.SwingUtilities; +import javax.swing.text.AbstractDocument; +import javax.swing.text.BoxView; +import javax.swing.text.ComponentView; +import javax.swing.text.DefaultHighlighter; +import javax.swing.text.Element; +import javax.swing.text.Highlighter; +import javax.swing.text.IconView; +import javax.swing.text.JTextComponent; +import javax.swing.text.LabelView; +import javax.swing.text.StyleConstants; +import javax.swing.text.StyledEditorKit; +import javax.swing.text.View; +import javax.swing.text.ViewFactory; +import javax.swing.text.html.ParagraphView; + +import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; +import org.fife.ui.rsyntaxtextarea.SyntaxConstants; +import org.fife.ui.rtextarea.RTextScrollPane; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Type; +import org.objectweb.asm.tree.ClassNode; + +import com.jhe.hexed.JHexEditor; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.Resources; +import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * This represents the opened classfile. + * + * @author Konloch + * @author WaterWolf + * + */ + +public class ClassViewer extends Viewer { + + public void setPanes() { + if (BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1None.getModel())) + pane1 = 0; + else if (BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Proc.getModel())) + pane1 = 1; + else if (BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1CFR.getModel())) + pane1 = 2; + else if (BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Fern.getModel())) + pane1 = 3; + else if (BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Bytecode.getModel())) + pane1 = 4; + else if (BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Hexcode.getModel())) + pane1 = 5; + else if (BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Smali.getModel())) + pane1 = 6; + else if (BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Krakatau.getModel())) + pane1 = 7; + else if (BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1KrakatauBytecode.getModel())) + pane1 = 8; + else if (BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1JDGUI.getModel())) + pane1 = 9; + + if (BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2None.getModel())) + pane2 = 0; + else if (BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2Proc.getModel())) + pane2 = 1; + else if (BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2CFR.getModel())) + pane2 = 2; + else if (BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2Fern.getModel())) + pane2 = 3; + else if (BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2Bytecode.getModel())) + pane2 = 4; + else if (BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2Hexcode.getModel())) + pane2 = 5; + else if (BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2Smali.getModel())) + pane2 = 6; + else if (BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2Krakatau.getModel())) + pane2 = 7; + else if (BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2KrakatauBytecode.getModel())) + pane2 = 8; + else if (BytecodeViewer.viewer.panelGroup2.isSelected(BytecodeViewer.viewer.panel2JDGUI.getModel())) + pane2 = 9; + + if (BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3None.getModel())) + pane3 = 0; + else if (BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3Proc.getModel())) + pane3 = 1; + else if (BytecodeViewer.viewer.panelGroup3 .isSelected(BytecodeViewer.viewer.panel3CFR.getModel())) + pane3 = 2; + else if (BytecodeViewer.viewer.panelGroup3 .isSelected(BytecodeViewer.viewer.panel3Fern.getModel())) + pane3 = 3; + else if (BytecodeViewer.viewer.panelGroup3 .isSelected(BytecodeViewer.viewer.panel3Bytecode.getModel())) + pane3 = 4; + else if (BytecodeViewer.viewer.panelGroup3 .isSelected(BytecodeViewer.viewer.panel3Hexcode.getModel())) + pane3 = 5; + else if (BytecodeViewer.viewer.panelGroup3 .isSelected(BytecodeViewer.viewer.panel3Smali.getModel())) + pane3 = 6; + else if (BytecodeViewer.viewer.panelGroup3 .isSelected(BytecodeViewer.viewer.panel3Krakatau.getModel())) + pane3 = 7; + else if (BytecodeViewer.viewer.panelGroup3 .isSelected(BytecodeViewer.viewer.panel3KrakatauBytecode.getModel())) + pane3 = 8; + else if (BytecodeViewer.viewer.panelGroup3 .isSelected(BytecodeViewer.viewer.panel3JDGUI.getModel())) + pane3 = 9; + } + + public boolean isPanel1Editable() { + setPanes(); + + if(pane1 == 1 && BytecodeViewer.viewer.panel1Proc_E.isSelected()) + return true; + if(pane1 == 2 && BytecodeViewer.viewer.panel1CFR_E.isSelected()) + return true; + if(pane1 == 3 && BytecodeViewer.viewer.panel1Fern_E.isSelected()) + return true; + if(pane1 == 6 && BytecodeViewer.viewer.panel1Smali_E.isSelected()) + return true; + if(pane1 == 9 && BytecodeViewer.viewer.panel1JDGUI_E.isSelected()) + return true; + if((pane1 == 7 || pane1 == 8) && BytecodeViewer.viewer.panel1Krakatau_E.isSelected()) + return true; + + + return false; + } + + public boolean isPanel2Editable() { + setPanes(); + + if(pane2 == 1 && BytecodeViewer.viewer.panel2Proc_E.isSelected()) + return true; + if(pane2 == 2 && BytecodeViewer.viewer.panel2CFR_E.isSelected()) + return true; + if(pane2 == 3 && BytecodeViewer.viewer.panel2Fern_E.isSelected()) + return true; + if(pane2 == 6 && BytecodeViewer.viewer.panel2Smali_E.isSelected()) + return true; + if(pane2 == 9 && BytecodeViewer.viewer.panel2JDGUI_E.isSelected()) + return true; + if((pane2 == 7 || pane2 == 8) && BytecodeViewer.viewer.panel2Krakatau_E.isSelected()) + return true; + + + return false; + } + + public boolean isPanel3Editable() { + setPanes(); + + if(pane3 == 1 && BytecodeViewer.viewer.panel3Proc_E.isSelected()) + return true; + if(pane3 == 2 && BytecodeViewer.viewer.panel3CFR_E.isSelected()) + return true; + if(pane3 == 3 && BytecodeViewer.viewer.panel3Fern_E.isSelected()) + return true; + if(pane3 == 6 && BytecodeViewer.viewer.panel3Smali_E.isSelected()) + return true; + if(pane3 == 9 && BytecodeViewer.viewer.panel3JDGUI_E.isSelected()) + return true; + if((pane3 == 7 || pane3 == 8) && BytecodeViewer.viewer.panel3Krakatau_E.isSelected()) + return true; + + + return false; + } + + /** + * Whoever wrote this function, THANK YOU! + * + * @param splitter + * @param proportion + * @return + */ + public static JSplitPane setDividerLocation(final JSplitPane splitter, + final double proportion) { + if (splitter.isShowing()) { + if (splitter.getWidth() > 0 && splitter.getHeight() > 0) { + splitter.setDividerLocation(proportion); + } else { + splitter.addComponentListener(new ComponentAdapter() { + @Override + public void componentResized(ComponentEvent ce) { + splitter.removeComponentListener(this); + setDividerLocation(splitter, proportion); + } + }); + } + } else { + splitter.addHierarchyListener(new HierarchyListener() { + @Override + public void hierarchyChanged(HierarchyEvent e) { + if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 + && splitter.isShowing()) { + splitter.removeHierarchyListener(this); + setDividerLocation(splitter, proportion); + } + } + }); + } + return splitter; + } + + private static final long serialVersionUID = -8650495368920680024L; + ArrayList lnData = new ArrayList(); + String name; + JSplitPane sp; + JSplitPane sp2; + public JPanel panel1Search = new JPanel(new BorderLayout()); + public JPanel panel2Search = new JPanel(new BorderLayout()); + public JPanel panel3Search = new JPanel(new BorderLayout()); + public JCheckBox check1 = new JCheckBox("Exact"); + public JCheckBox check2 = new JCheckBox("Exact"); + public JCheckBox check3 = new JCheckBox("Exact"); + public JPanel panel1 = new JPanel(new BorderLayout()); + public JPanel panel2 = new JPanel(new BorderLayout()); + public JPanel panel3 = new JPanel(new BorderLayout()); + int pane1 = -1; + int pane2 = -1; + int pane3 = -1; + public RSyntaxTextArea smali1 = null; + public RSyntaxTextArea smali2 = null; + public RSyntaxTextArea smali3 = null; + public RSyntaxTextArea krakatau1 = null; + public RSyntaxTextArea krakatau2 = null; + public RSyntaxTextArea krakatau3 = null; + public RSyntaxTextArea java1 = null; + public RSyntaxTextArea java2 = null; + public RSyntaxTextArea java3 = null; + + /** + * This was really interesting to write. + * + * @author Konloch + * + */ + public void search(int pane, String search, boolean next) { + try { + Component[] com = null; + if (pane == 0) // bytecode + com = panel1.getComponents(); + else if (pane == 1) + com = panel2.getComponents(); + else if (pane == 2) + com = panel3.getComponents(); + + if (com == null) // someone fucked up, lets prevent a nullpointer. + return; + + for (Component c : com) { + if (c instanceof RTextScrollPane) { + RSyntaxTextArea area = (RSyntaxTextArea) ((RTextScrollPane) c) + .getViewport().getComponent(0); + + if (search.isEmpty()) { + highlight(pane, area, ""); + return; + } + + int startLine = area.getDocument().getDefaultRootElement() + .getElementIndex(area.getCaretPosition()) + 1; + int currentLine = 1; + boolean canSearch = false; + String[] test = null; + if (area.getText().split("\n").length >= 2) + test = area.getText().split("\n"); + else + test = area.getText().split("\r"); + int lastGoodLine = -1; + int firstPos = -1; + boolean found = false; + + if (next) { + for (String s : test) { + if (pane == 0 && !check1.isSelected() || pane == 1 + && !check2.isSelected()) { + s = s.toLowerCase(); + search = search.toLowerCase(); + } + + if (currentLine == startLine) { + canSearch = true; + } else if (s.contains(search)) { + if (canSearch) { + area.setCaretPosition(area.getDocument() + .getDefaultRootElement() + .getElement(currentLine - 1) + .getStartOffset()); + canSearch = false; + found = true; + } + + if (firstPos == -1) + firstPos = currentLine; + } + + currentLine++; + } + + if (!found && firstPos != -1) { + area.setCaretPosition(area.getDocument() + .getDefaultRootElement() + .getElement(firstPos - 1).getStartOffset()); + } + } else { + canSearch = true; + for (String s : test) { + if (pane == 0 && !check1.isSelected() || pane == 1 + && !check2.isSelected() || pane == 2 + && !check3.isSelected()) { + s = s.toLowerCase(); + search = search.toLowerCase(); + } + + if (s.contains(search)) { + if (lastGoodLine != -1 && canSearch) + area.setCaretPosition(area.getDocument() + .getDefaultRootElement() + .getElement(lastGoodLine - 1) + .getStartOffset()); + + lastGoodLine = currentLine; + + if (currentLine >= startLine) + canSearch = false; + } + currentLine++; + } + + if (lastGoodLine != -1 + && area.getDocument() + .getDefaultRootElement() + .getElementIndex( + area.getCaretPosition()) + 1 == startLine) { + area.setCaretPosition(area.getDocument() + .getDefaultRootElement() + .getElement(lastGoodLine - 1) + .getStartOffset()); + } + } + highlight(pane, area, search); + } + } + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + + private DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter( + new Color(255, 62, 150)); + + public void highlight(int pane, JTextComponent textComp, String pattern) { + if (pattern.isEmpty()) { + textComp.getHighlighter().removeAllHighlights(); + return; + } + + try { + Highlighter hilite = textComp.getHighlighter(); + hilite.removeAllHighlights(); + javax.swing.text.Document doc = textComp.getDocument(); + String text = doc.getText(0, doc.getLength()); + int pos = 0; + + if ((pane == 0 && !check1.isSelected()) || pane == 1 + && !check2.isSelected() || pane == 2 + && !check3.isSelected()) { + pattern = pattern.toLowerCase(); + text = text.toLowerCase(); + } + + // Search for pattern + while ((pos = text.indexOf(pattern, pos)) >= 0) { + // Create highlighter using private painter and apply around + // pattern + hilite.addHighlight(pos, pos + pattern.length(), painter); + pos += pattern.length(); + } + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + + final JTextField field1 = new JTextField(); + final JTextField field2 = new JTextField(); + final JTextField field3 = new JTextField(); + public ClassViewer(final String name, final ClassNode cn) { + JButton byteSearchNext = new JButton(); + JButton byteSearchPrev = new JButton(); + JPanel byteButtonPane = new JPanel(new BorderLayout()); + byteButtonPane.add(byteSearchNext, BorderLayout.WEST); + byteButtonPane.add(byteSearchPrev, BorderLayout.EAST); + byteSearchNext.setIcon(Resources.nextIcon); + byteSearchPrev.setIcon(Resources.prevIcon); + panel1Search.add(byteButtonPane, BorderLayout.WEST); + panel1Search.add(field1, BorderLayout.CENTER); + panel1Search.add(check1, BorderLayout.EAST); + byteSearchNext.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent arg0) { + search(0, field1.getText(), true); + } + }); + byteSearchPrev.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent arg0) { + search(0, field1.getText(), false); + } + }); + field1.addKeyListener(new KeyListener() { + @Override + public void keyReleased(KeyEvent arg0) { + if (arg0.getKeyCode() == KeyEvent.VK_ENTER) + search(0, field1.getText(), true); + } + + @Override + public void keyPressed(KeyEvent arg0) { + } + + @Override + public void keyTyped(KeyEvent arg0) { + } + }); + + JButton searchNext2 = new JButton(); + JButton searchPrev2 = new JButton(); + JPanel buttonPane2 = new JPanel(new BorderLayout()); + buttonPane2.add(searchNext2, BorderLayout.WEST); + buttonPane2.add(searchPrev2, BorderLayout.EAST); + searchNext2.setIcon(Resources.nextIcon); + searchPrev2.setIcon(Resources.prevIcon); + panel2Search.add(buttonPane2, BorderLayout.WEST); + panel2Search.add(field2, BorderLayout.CENTER); + panel2Search.add(check2, BorderLayout.EAST); + searchNext2.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent arg0) { + search(1, field2.getText(), true); + } + }); + searchPrev2.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent arg0) { + search(1, field2.getText(), false); + } + }); + field2.addKeyListener(new KeyListener() { + @Override + public void keyReleased(KeyEvent arg0) { + if (arg0.getKeyCode() == KeyEvent.VK_ENTER) + search(1, field2.getText(), true); + } + + @Override + public void keyPressed(KeyEvent arg0) { + } + + @Override + public void keyTyped(KeyEvent arg0) { + } + }); + + JButton searchNext3 = new JButton(); + JButton searchPrev3 = new JButton(); + JPanel buttonPane3 = new JPanel(new BorderLayout()); + buttonPane3.add(searchNext3, BorderLayout.WEST); + buttonPane3.add(searchPrev3, BorderLayout.EAST); + searchNext3.setIcon(Resources.nextIcon); + searchPrev3.setIcon(Resources.prevIcon); + panel3Search.add(buttonPane3, BorderLayout.WEST); + panel3Search.add(field3, BorderLayout.CENTER); + panel3Search.add(check3, BorderLayout.EAST); + searchNext3.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent arg0) { + search(2, field3.getText(), true); + } + }); + searchPrev3.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent arg0) { + search(2, field3.getText(), false); + } + }); + field3.addKeyListener(new KeyListener() { + @Override + public void keyReleased(KeyEvent arg0) { + if (arg0.getKeyCode() == KeyEvent.VK_ENTER) + search(2, field3.getText(), true); + } + + @Override + public void keyPressed(KeyEvent arg0) { + } + + @Override + public void keyTyped(KeyEvent arg0) { + } + }); + + this.name = name; + this.cn = cn; + this.setName(name); + this.setLayout(new BorderLayout()); + + this.sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel1, panel2); + final ClassWriter cw = new ClassWriter(0); + cn.accept(cw); + JHexEditor hex = new JHexEditor(cw.toByteArray()); + this.sp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, panel3); + this.add(sp2, BorderLayout.CENTER); + + hex.setMaximumSize(new Dimension(0, Integer.MAX_VALUE)); + hex.setSize(0, Integer.MAX_VALUE); + + BytecodeViewer.viewer.setIcon(true); + startPaneUpdater(null); + this.addComponentListener(new ComponentAdapter() { + public void componentResized(ComponentEvent e) { + resetDivider(); + } + }); + } + + public void resetDivider() { + sp.setResizeWeight(0.5); + if (pane2 != 0 && pane1 != 0) + sp = setDividerLocation(sp, 0.5); + else if (pane1 != 0) + sp = setDividerLocation(sp, 1); + else if(pane2 != 0) { + sp.setResizeWeight(1); + sp = setDividerLocation(sp, 0); + } else + sp = setDividerLocation(sp, 0); + if (pane3 != 0) { + sp2.setResizeWeight(0.7); + sp2 = setDividerLocation(sp2, 0.7); + if ((pane2 == 0 && pane1 != 0) || (pane1 == 0 && pane2 != 0)) + sp2 = setDividerLocation(sp2, 0.5); + else if (pane1 == 0 && pane2 == 0) + sp2 = setDividerLocation(sp2, 0); + } else { + sp.setResizeWeight(1); + sp2.setResizeWeight(0); + sp2 = setDividerLocation(sp2, 1); + } + } + + PaneUpdaterThread t1; + PaneUpdaterThread t2; + PaneUpdaterThread t3; + + public void startPaneUpdater(final JButton button) { + this.cn = BytecodeViewer.getClassNode(cn.name); //update the classnode + setPanes(); + + panel1.removeAll(); + panel2.removeAll(); + panel3.removeAll(); + smali1 = null; + smali2 = null; + smali3 = null; + java1 = null; + java2 = null; + java3 = null; + + if(this.cn == null) { + panel1.add(new JLabel("This file has been removed from the reload.")); + panel2.add(new JLabel("This file has been removed from the reload.")); + panel3.add(new JLabel("This file has been removed from the reload.")); + return; + } + + if (pane1 != 0 && pane1 != 5) + panel1.add(panel1Search, BorderLayout.NORTH); + if (pane2 != 0 && pane2 != 5) + panel2.add(panel2Search, BorderLayout.NORTH); + if (pane3 != 0 && pane3 != 5) + panel3.add(panel3Search, BorderLayout.NORTH); + + final ClassWriter cw = new ClassWriter(0); + try { + cn.accept(cw); + } catch(Exception e) { + e.printStackTrace(); + try { + Thread.sleep(200); + cn.accept(cw); + } catch (InterruptedException e1) { } + } + final byte[] b = cw.toByteArray(); + Thread t1 = new PaneUpdaterThread() { + @Override + public void doShit() { + try { + if (pane1 == 1) { // procyon + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.procyon.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel1Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field1.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Procyon Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel1.add(scrollPane); + } + }); + + java1 = panelArea; + } + + if (pane1 == 2) {// cfr + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.cfr.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel1Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field1.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("CFR Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel1.add(scrollPane); + } + }); + + java1 = panelArea; + } + + if (pane1 == 3) {// fern + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.fernflower.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel1Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field1.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("FernFlower Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel1.add(scrollPane); + } + }); + + java1 = panelArea; + } + + if (pane1 == 4) {// bytecode + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane( + panelArea); + panelArea.setText(Decompiler.bytecode.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(false); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field1.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Bytecode Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel1.add(scrollPane); + } + }); + + } + + if (pane1 == 5) {// hex + final ClassWriter cw = new ClassWriter(0); + cn.accept(cw); + final JHexEditor hex = new JHexEditor(cw.toByteArray()); + hex.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel1.add(hex); + } + }); + } + + if (pane1 == 6) {//smali bytecode + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane( + panelArea); + panelArea.setText(Decompiler.smali.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel1Editable()); + smali1 = panelArea; + smali1.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field1.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Smali Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel1.add(scrollPane); + } + }); + + } + + if (pane1 == 7) {// krakatau + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane( + panelArea); + panelArea.setText(Decompiler.krakatau.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel1Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field1.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Krakatau Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel1.add(scrollPane); + } + }); + + java1 = panelArea; + } + + + + if (pane1 == 8) {// kraktau bytecode + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane( + panelArea); + panelArea.setText(Decompiler.krakatauDA.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel1Editable()); + krakatau1 = panelArea; + krakatau1.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field1.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Krakatau Disassembler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel1.add(scrollPane); + } + }); + + } + + if (pane1 == 9) {// JD-GUI + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane( + panelArea); + panelArea.setText(Decompiler.jdgui.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel1Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field1.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("JD-GUI Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel1.add(scrollPane); + } + }); + + java1 = panelArea; + } + } catch(java.lang.IndexOutOfBoundsException | java.lang.NullPointerException e) { + //ignore + } catch(Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } finally { + resetDivider(); + BytecodeViewer.viewer.setIcon(false); + if(button != null) + button.setEnabled(true); + } + } + }; + + + Thread t2 = new PaneUpdaterThread() { + @Override + public void doShit() { + try { + if (pane2 == 1) { + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.procyon.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel2Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field2.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Procyon Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel2.add(scrollPane); + } + }); + + java2 = panelArea; + } + + if (pane2 == 2) { + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.cfr.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel2Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field2.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("CFR Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel2.add(scrollPane); + } + }); + + java2 = panelArea; + } + + if (pane2 == 3) { + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.fernflower.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel2Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field2.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("FernFlower Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel2.add(scrollPane); + } + }); + + java2 = panelArea; + } + + if (pane2 == 4) { + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.bytecode.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(false); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field2.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Bytecode Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel2.add(scrollPane); + } + }); + + } + + if (pane2 == 5) { + final ClassWriter cw = new ClassWriter(0); + cn.accept(cw); + final JHexEditor hex = new JHexEditor(cw.toByteArray()); + hex.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel2.add(hex); + } + }); + } + + if (pane2 == 6) { + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.smali.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel2Editable()); + smali2 = panelArea; + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field2.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Smali Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel2.add(scrollPane); + } + }); + + } + + if (pane2 == 7) {// krakatau + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane( + panelArea); + panelArea.setText(Decompiler.krakatau.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel2Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field2.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Krakatau Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel2.add(scrollPane); + } + }); + + java2 = panelArea; + } + + if (pane2 == 8) {// kraktau bytecode + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane( + panelArea); + panelArea.setText(Decompiler.krakatauDA.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel2Editable()); + krakatau2 = panelArea; + krakatau2.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field2.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Krakatau Disassembler")); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel2.add(scrollPane); + } + }); + + } + + if (pane2 == 9) {// JD-GUI + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane( + panelArea); + panelArea.setText(Decompiler.jdgui.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel2Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field2.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("JD-GUI Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel2.add(scrollPane); + } + }); + + java2 = panelArea; + } + } catch(java.lang.IndexOutOfBoundsException | java.lang.NullPointerException e) { + //ignore + } catch(Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } finally { + resetDivider(); + BytecodeViewer.viewer.setIcon(false); + if(button != null) + button.setEnabled(true); + } + } + }; + + + + Thread t3 = new PaneUpdaterThread() { + @Override + public void doShit() { + try { + if (pane3 == 1) { + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.procyon.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel3Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field3.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Procyon Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel3.add(scrollPane); + } + }); + + java3 = panelArea; + } + + if (pane3 == 2) { + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.cfr.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel3Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field3.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("CFR Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel3.add(scrollPane); + } + }); + + java3 = panelArea; + } + + if (pane3 == 3) { + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.fernflower.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel3Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field3.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("FernFlower Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel3.add(scrollPane); + } + }); + + java3 = panelArea; + } + + if (pane3 == 4) { + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.bytecode.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(false); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field3.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Bytecode Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel3.add(scrollPane); + } + }); + } + + if (pane3 == 5) { + final ClassWriter cw = new ClassWriter(0); + cn.accept(cw); + final JHexEditor hex = new JHexEditor(cw.toByteArray()); + hex.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel3.add(hex); + } + }); + + } + + if (pane3 == 6) { + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane(panelArea); + panelArea.setText(Decompiler.smali.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel3Editable()); + smali3 = panelArea; + smali3.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field3.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Smali Decompiler - Editable: " + panelArea.isEditable())); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel3.add(scrollPane); + } + }); + + } + + if (pane3 == 7) {// krakatau + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane( + panelArea); + panelArea.setText(Decompiler.krakatau.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel3Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field3.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Krakatau Decompiler - Editable: " + panelArea.isEditable())); + java3 = panelArea; + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel3.add(scrollPane); + } + }); + } + + if (pane3 == 8) {// kraktau bytecode + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane( + panelArea); + panelArea.setText(Decompiler.krakatauDA.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel3Editable()); + krakatau3 = panelArea; + krakatau3.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field3.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("Krakatau Disassembler")); + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel3.add(scrollPane); + } + }); + + } + + if (pane3 == 9) {// JD-GUI + RSyntaxTextArea panelArea = new RSyntaxTextArea(); + panelArea + .setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); + panelArea.setCodeFoldingEnabled(true); + panelArea.setAntiAliasingEnabled(true); + final RTextScrollPane scrollPane = new RTextScrollPane( + panelArea); + panelArea.setText(Decompiler.jdgui.decompileClassNode(cn,b)); + panelArea.setCaretPosition(0); + panelArea.setEditable(isPanel3Editable()); + panelArea.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + field3.requestFocus(); + } + + BytecodeViewer.checkHotKey(e); + } + @Override public void keyReleased(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } + }); + scrollPane.setColumnHeaderView(new JLabel("JD-GUI Decompiler - Editable: " + panelArea.isEditable())); + java3 = panelArea; + panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int)BytecodeViewer.viewer.fontSpinner.getValue())); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + panel3.add(scrollPane); + } + }); + } + } catch(java.lang.IndexOutOfBoundsException | java.lang.NullPointerException e) { + //ignore + } catch(Exception e) { + //new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } finally { + resetDivider(); + BytecodeViewer.viewer.setIcon(false); + if(button != null) + button.setEnabled(true); + } + } + }; + + if(pane1 > 0) + t1.start(); + if(pane2 > 0) + t2.start(); + if(pane3 > 0) + t3.start(); + } + + public Object[] getSmali() { + if(smali1 != null) + return new Object[]{cn, smali1.getText()}; + if(smali2 != null) + return new Object[]{cn, smali2.getText()}; + if(smali3 != null) + return new Object[]{cn, smali3.getText()}; + + return null; + } + + public Object[] getKrakatau() { + if(krakatau1 != null) + return new Object[]{cn, krakatau1.getText()}; + if(krakatau2 != null) + return new Object[]{cn, krakatau2.getText()}; + if(krakatau3 != null) + return new Object[]{cn, krakatau3.getText()}; + + return null; + } + + public Object[] getJava() { + if(java1 != null) + return new Object[]{cn, java1.getText()}; + if(java2 != null) + return new Object[]{cn, java2.getText()}; + if(java3 != null) + return new Object[]{cn, java3.getText()}; + + return null; + } + + public static class MethodData { + public String name, desc; + public int srcLN, bytecodeLN; + + @Override + public boolean equals(final Object o) { + return equals((MethodData) o); + } + + public boolean equals(final MethodData md) { + return this.name.equals(md.name) && this.desc.equals(md.desc); + } + + public String constructPattern() { + final StringBuffer pattern = new StringBuffer(); + pattern.append(name + " *\\("); + final org.objectweb.asm.Type[] types = org.objectweb.asm.Type + .getArgumentTypes(desc); + pattern.append("(.*)"); + for (int i = 0; i < types.length; i++) { + final Type type = types[i]; + final String clazzName = type.getClassName(); + pattern.append(clazzName.substring(clazzName.lastIndexOf(".") + 1) + + "(.*)"); + } + pattern.append("\\) *\\{"); + return pattern.toString(); + } + } + + class WrapEditorKit extends StyledEditorKit { + private static final long serialVersionUID = 1719109651258205346L; + ViewFactory defaultFactory = new WrapColumnFactory(); + + @Override + public ViewFactory getViewFactory() { + return defaultFactory; + } + } + + class WrapColumnFactory implements ViewFactory { + public View create(final Element elem) { + final String kind = elem.getName(); + if (kind != null) { + if (kind.equals(AbstractDocument.ParagraphElementName)) + return new NoWrapParagraphView(elem); + else if (kind.equals(AbstractDocument.SectionElementName)) + return new BoxView(elem, View.Y_AXIS); + else if (kind.equals(StyleConstants.ComponentElementName)) + return new ComponentView(elem); + else if (kind.equals(StyleConstants.IconElementName)) + return new IconView(elem); + } + + return new LabelView(elem); + } + } + + public class NoWrapParagraphView extends ParagraphView { + public NoWrapParagraphView(final Element elem) { + super(elem); + } + + @Override + public void layout(final int width, final int height) { + super.layout(Short.MAX_VALUE, height); + } + + @Override + public float getMinimumSpan(final int axis) { + return super.getPreferredSpan(axis); + } + } + +} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/ExportJar.java b/src/the/bytecode/club/bytecodeviewer/gui/ExportJar.java similarity index 93% rename from src/main/java/the/bytecode/club/bytecodeviewer/gui/ExportJar.java rename to src/the/bytecode/club/bytecodeviewer/gui/ExportJar.java index 0f70dee4..7749d23b 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/ExportJar.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/ExportJar.java @@ -1,12 +1,19 @@ package the.bytecode.club.bytecodeviewer.gui; +import javax.swing.JFrame; +import java.awt.Dimension; +import javax.swing.JButton; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.JarUtils; -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +import javax.swing.BoxLayout; +import javax.swing.JScrollPane; +import javax.swing.JLabel; +import javax.swing.JTextArea; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * diff --git a/src/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.java b/src/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.java new file mode 100644 index 00000000..8c9be22d --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.java @@ -0,0 +1,653 @@ +package the.bytecode.club.bytecodeviewer.gui; + +import java.awt.BorderLayout; +import java.awt.font.FontRenderContext; +import java.awt.geom.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.Map.Entry; + +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.JTree; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.MutableTreeNode; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; + +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.*; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * The file navigation pane. + * + * @author Konloch + * @author WaterWolf + * @author afffsdd + * + */ + +@SuppressWarnings("serial") +public class FileNavigationPane extends VisibleComponent implements + FileDrop.Listener { + + FileChangeNotifier fcn; + JCheckBox exact = new JCheckBox("Exact"); + JButton open = new JButton("+"); + JButton close = new JButton("-"); + + MyTreeNode treeRoot = new MyTreeNode("Loaded Files:"); + MyTree tree = new MyTree(treeRoot); + final String quickSearchText = "Quick file search (no file extension)"; + final JTextField quickSearch = new JTextField(quickSearchText); + boolean cancel = false; + + public KeyAdapter search = new KeyAdapter() { + @Override + public void keyPressed(final KeyEvent ke) { + if (ke.getKeyCode() == KeyEvent.VK_ENTER) { + + final String qt = quickSearch.getText(); + quickSearch.setText(""); + + + String[] path = null; + + if (qt.contains(".")) { + path = qt.split("\\."); + String[] path2 = new String[path.length]; + for(int i = 0; i < path.length; i++) { + path2[i] = path[i]; + if(i+2 == path.length) { + path2[i+1] = "." + path[i+1]; + } + } + } else { + path = new String[] { qt }; + } + + MyTreeNode curNode = treeRoot; + if (exact.isSelected()) { + pathLoop: for (int i = 0; i < path.length; i++) { + final String pathName = path[i]; + final boolean isLast = i == path.length - 1; + + for (int c = 0; c < curNode.getChildCount(); c++) { + final MyTreeNode child = (MyTreeNode) curNode.getChildAt(c); + System.out.println(pathName +":"+((String) child.getUserObject())); + + if (((String) child.getUserObject()).equals(pathName)) { + curNode = child; + if (isLast) { + final TreePath pathn = new TreePath(curNode.getPath()); + tree.setSelectionPath(pathn); + tree.makeVisible(pathn); + tree.scrollPathToVisible(pathn); + openPath(pathn); //auto open + System.out.println("Found! " + curNode); + break pathLoop; + } + continue pathLoop; + } + } + + System.out.println("Could not find " + pathName); + break; + } + } else { + { + @SuppressWarnings("unchecked") + Enumeration enums = curNode.depthFirstEnumeration(); + while (enums != null && enums.hasMoreElements()) { + + MyTreeNode node = enums.nextElement(); + if (node.isLeaf()) { + if (((String) (node.getUserObject())).toLowerCase().contains(path[path.length - 1].toLowerCase())) { + TreeNode pathArray[] = node.getPath(); + int k = 0; + StringBuffer fullPath = new StringBuffer(); + while (pathArray != null + && k < pathArray.length) { + MyTreeNode n = (MyTreeNode) pathArray[k]; + String s = (String) (n.getUserObject()); + fullPath.append(s); + if (k++ != pathArray.length - 1) { + fullPath.append("."); + } + } + String fullPathString = fullPath.toString(); + if (fullPathString != null && fullPathString.toLowerCase().contains(qt.toLowerCase())) { + System.out.println("Found! " + node); + final TreePath pathn = new TreePath(node.getPath()); + tree.setSelectionPath(pathn.getParentPath()); + tree.setSelectionPath(pathn); + tree.makeVisible(pathn); + tree.scrollPathToVisible(pathn); + } + } + } + } + } + } + } + } + }; + + public FileNavigationPane(final FileChangeNotifier fcn) { + super("ClassNavigation"); + this.fcn = fcn; + tree.setRootVisible(false); + tree.setShowsRootHandles(true); + quickSearch.setForeground(Color.gray); + setTitle("Files"); + + this.open.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + final TreeNode root = (TreeNode) tree.getModel().getRoot(); + expandAll(tree, new TreePath(root), true); + } + }); + + this.close.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + final TreeNode root = (TreeNode) tree.getModel().getRoot(); + expandAll(tree, new TreePath(root), false); + tree.expandPath(new TreePath(root)); + } + }); + + this.tree.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + openPath(tree.getPathForLocation(e.getX(), e.getY())); + } + }); + + this.tree.addTreeSelectionListener(new TreeSelectionListener() { + @Override + public void valueChanged(final TreeSelectionEvent arg0) { + if (cancel) { + cancel = false; + return; + } + openPath(arg0.getPath()); + } + }); + + this.tree.addKeyListener(new KeyListener() { + @Override + public void keyReleased(KeyEvent arg0) { + if(arg0.getKeyCode() == KeyEvent.VK_ENTER) { + if(arg0.getSource() instanceof MyTree) { + MyTree tree = (MyTree) arg0.getSource(); + openPath(tree.getSelectionPath()); + } + } else { + cancel = true; + } + } + + @Override + public void keyTyped(KeyEvent e) { + quickSearch.grabFocus(); + quickSearch.setText("" + e.getKeyChar()); // fuck + cancel = true; + } + + @Override + public void keyPressed(KeyEvent e) { + quickSearch.grabFocus(); + quickSearch.setText("" + e.getKeyChar()); // fuck + cancel = true; + } + }); + + quickSearch.addKeyListener(search); + + quickSearch.addFocusListener(new FocusListener() { + @Override + public void focusGained(final FocusEvent arg0) { + if (quickSearch.getText().equals(quickSearchText)) { + quickSearch.setText(""); + quickSearch.setForeground(Color.black); + } + } + + @Override + public void focusLost(final FocusEvent arg0) { + if (quickSearch.getText().isEmpty()) { + quickSearch.setText(quickSearchText); + quickSearch.setForeground(Color.gray); + } + } + }); + + getContentPane().setLayout(new BorderLayout()); + getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER); + + JPanel p2 = new JPanel(); + p2.setLayout(new BorderLayout()); + p2.add(quickSearch, BorderLayout.NORTH); + JPanel p3 = new JPanel(new BorderLayout()); + p3.add(exact, BorderLayout.WEST); + JPanel p4 = new JPanel(new BorderLayout()); + p4.add(open, BorderLayout.EAST); + p4.add(close, BorderLayout.WEST); + p3.add(p4, BorderLayout.EAST); + p2.add(p3, BorderLayout.SOUTH); + + getContentPane().add(p2, BorderLayout.SOUTH); + + this.setVisible(true); + new FileDrop(this, this); + } + + public void openClassFileToWorkSpace(final String name, final ClassNode node) { + fcn.openClassFile(name, node); + } + + public void openFileToWorkSpace(String name, byte[] contents) { + fcn.openFile(name, contents); + } + + @Override + public void filesDropped(final File[] files) { + if (files.length < 1) + return; + BytecodeViewer.openFiles(files, true); + } + + public void updateTree() { + try { + treeRoot.removeAllChildren(); + for (FileContainer container : BytecodeViewer.files) { + MyTreeNode root = new MyTreeNode(container.name); + treeRoot.add(root); + ImageRenderer renderer = new ImageRenderer(); + tree.setCellRenderer(renderer); + + if(!container.classes.isEmpty()) { + for(ClassNode c : container.classes) { + String name = c.name; + final String[] spl = name.split("/"); + if (spl.length < 2) { + root.add(new MyTreeNode(name+".class")); + } else { + MyTreeNode parent = root; + for (int i1 = 0; i1 < spl.length; i1++) { + String s = spl[i1]; + MyTreeNode child = null; + for (int i = 0; i < parent.getChildCount(); i++) { + if (((MyTreeNode) parent.getChildAt(i)).getUserObject() + .equals(s)) { + child = (MyTreeNode) parent.getChildAt(i); + break; + } + } + if (child == null) { + if(i1 == spl.length-1) + child = new MyTreeNode(s+".class"); + else + child = new MyTreeNode(s); + parent.add(child); + } + parent = child; + } + } + } + } + + if(!container.files.isEmpty()) { + for (final Entry entry : container.files.entrySet()) { + String name = entry.getKey(); + final String[] spl = name.split("/"); + if (spl.length < 2) { + root.add(new MyTreeNode(name)); + } else { + MyTreeNode parent = root; + for (final String s : spl) { + MyTreeNode child = null; + for (int i = 0; i < parent.getChildCount(); i++) { + if (((MyTreeNode) parent.getChildAt(i)).getUserObject() + .equals(s)) { + child = (MyTreeNode) parent.getChildAt(i); + break; + } + } + if (child == null) { + child = new MyTreeNode(s); + parent.add(child); + } + parent = child; + } + } + } + } + + } + + treeRoot.sort(); + tree.expandPath(new TreePath(tree.getModel().getRoot())); + tree.updateUI(); + } catch(java.util.ConcurrentModificationException e) { + //ignore, the last file will reset everything + } + // expandAll(tree, true); + } + + @SuppressWarnings("rawtypes") + private void expandAll(final JTree tree, final TreePath parent, + final boolean expand) { + // Traverse children + final TreeNode node = (TreeNode) parent.getLastPathComponent(); + if (node.getChildCount() >= 0) { + for (final Enumeration e = node.children(); e.hasMoreElements();) { + final TreeNode n = (TreeNode) e.nextElement(); + final TreePath path = parent.pathByAddingChild(n); + expandAll(tree, path, expand); + } + } + + // Expansion or collapse must be done bottom-up + if (expand) { + tree.expandPath(parent); + } else { + tree.collapsePath(parent); + } + } + + public class MyTree extends JTree { + + private static final long serialVersionUID = -2355167326094772096L; + DefaultMutableTreeNode treeRoot; + + public MyTree(final DefaultMutableTreeNode treeRoot) { + super(treeRoot); + this.treeRoot = treeRoot; + } + + StringMetrics m = null; + + @Override + public void paint(final Graphics g) { + try { + super.paint(g); + if (m == null) { + m = new StringMetrics((Graphics2D) g); + } + if (treeRoot.getChildCount() < 1) { + g.setColor(new Color(0, 0, 0, 100)); + g.fillRect(0, 0, getWidth(), getHeight()); + g.setColor(Color.white); + String s = "Drag class/jar/zip/APK/DEX here"; + g.drawString(s, + ((int) ((getWidth() / 2) - (m.getWidth(s) / 2))), + getHeight() / 2); + } + } catch(java.lang.InternalError | java.lang.NullPointerException e) { + + } + } + } + + public class MyTreeNode extends DefaultMutableTreeNode { + + private static final long serialVersionUID = -8817777566176729571L; + + public MyTreeNode(final Object o) { + super(o); + } + + @Override + public void insert(final MutableTreeNode newChild, final int childIndex) { + super.insert(newChild, childIndex); + } + + public void sort() { + recursiveSort(this); + } + + @SuppressWarnings("unchecked") + private void recursiveSort(final MyTreeNode node) { + Collections.sort(node.children, nodeComparator); + final Iterator it = node.children.iterator(); + while (it.hasNext()) { + final MyTreeNode nextNode = it.next(); + if (nextNode.getChildCount() > 0) { + recursiveSort(nextNode); + } + } + } + + protected Comparator nodeComparator = new Comparator() { + @Override + public int compare(final MyTreeNode o1, final MyTreeNode o2) { + // To make sure nodes with children are always on top + final int firstOffset = o1.getChildCount() > 0 ? -1000 : 0; + final int secondOffset = o2.getChildCount() > 0 ? 1000 : 0; + return o1.toString().compareToIgnoreCase(o2.toString()) + + firstOffset + secondOffset; + } + + @Override + public boolean equals(final Object obj) { + return false; + } + + @Override + public int hashCode() { + final int hash = 7; + return hash; + } + }; + } + + /** + * + * @author http://stackoverflow.com/a/18450804 + * + */ + class StringMetrics { + + Font font; + FontRenderContext context; + + public StringMetrics(Graphics2D g2) { + + font = g2.getFont(); + context = g2.getFontRenderContext(); + } + + Rectangle2D getBounds(String message) { + + return font.getStringBounds(message, context); + } + + double getWidth(String message) { + + Rectangle2D bounds = getBounds(message); + return bounds.getWidth(); + } + + double getHeight(String message) { + + Rectangle2D bounds = getBounds(message); + return bounds.getHeight(); + } + + } + + public void resetWorkspace() { + treeRoot.removeAllChildren(); + tree.repaint(); + tree.updateUI(); + } + + public void openPath(TreePath path) { + if (path == null) + return; + final StringBuffer nameBuffer = new StringBuffer(); + for (int i = 2; i < path.getPathCount(); i++) { + nameBuffer.append(path.getPathComponent(i)); + if (i < path.getPathCount() - 1) { + nameBuffer.append("/"); + } + } + + String name = nameBuffer.toString(); + if(name.endsWith(".class")) { + final ClassNode cn = BytecodeViewer.getClassNode(name.substring(0, name.length() - ".class".length())); + if (cn != null) { + openClassFileToWorkSpace(nameBuffer.toString(), cn); + } + } else { + openFileToWorkSpace(nameBuffer.toString(), BytecodeViewer.getFileContents(nameBuffer.toString())); + } + } + + /** + * + * @author http://stackoverflow.com/questions/14968005 + * @author Konloch + * + */ + public class ImageRenderer extends DefaultTreeCellRenderer { + + public Component getTreeCellRendererComponent( + JTree tree, + Object value, + boolean sel, + boolean expanded, + boolean leaf, + int row, + boolean hasFocus) + { //called every time there is a pane update, I.E. whenever you expand a folder + + Component ret = super.getTreeCellRendererComponent(tree, value, + selected, expanded, leaf, row, hasFocus); + + if(value != null && value instanceof the.bytecode.club.bytecodeviewer.gui.FileNavigationPane.MyTreeNode) { + the.bytecode.club.bytecodeviewer.gui.FileNavigationPane.MyTreeNode node = (the.bytecode.club.bytecodeviewer.gui.FileNavigationPane.MyTreeNode) value; + String name = node.toString().toLowerCase(); + + if(name.endsWith(".jar")) { + setIcon(Resources.jarIcon); + } else if(name.endsWith(".zip")) { + setIcon(Resources.zipIcon); + } else if(name.endsWith(".bat")) { + setIcon(Resources.batIcon); + } else if(name.endsWith(".sh")) { + setIcon(Resources.shIcon); + } else if(name.endsWith(".cs")) { + setIcon(Resources.csharpIcon); + } else if(name.endsWith(".c") ||name.endsWith(".cpp") ||name.endsWith(".h")) { + setIcon(Resources.cplusplusIcon); + } else if(name.endsWith(".apk") || name.endsWith(".dex")) { + setIcon(Resources.androidIcon); + } else if(name.endsWith(".png") || name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(".bmp") || name.endsWith(".gif")) { + setIcon(Resources.imageIcon); + } else if(name.endsWith(".class")) { + setIcon(Resources.classIcon); + } else if(name.endsWith(".java")) { + setIcon(Resources.javaIcon); + } else if(name.endsWith(".txt") || name.endsWith(".md")) { + setIcon(Resources.textIcon); + } else if(name.equals("decoded resources")) { + setIcon(Resources.decodedIcon); + } else if(name.endsWith(".properties") || name.endsWith(".xml") || name.endsWith(".mf") || name.endsWith(".config") || name.endsWith(".cfg")) { + setIcon(Resources.configIcon); + } else if(node.getChildCount() <= 0) { //random file + setIcon(Resources.fileIcon); + } else { //folder + ArrayList nodes = new ArrayList(); + ArrayList totalNodes = new ArrayList(); + + nodes.add(node); + totalNodes.add(node); + + boolean isJava = false; + boolean finished = false; + + while(!finished) { //may cause a clusterfuck with huge files + if(nodes.isEmpty()) + finished = true; + else { + TreeNode treeNode = nodes.get(0); + nodes.remove(treeNode); + int children = treeNode.getChildCount(); + if(children >= 1) + for(int i = 0; i < children; i++) { + TreeNode child = treeNode.getChildAt(i); + + if(!totalNodes.contains(child)) { + nodes.add(child); + totalNodes.add(child); + } + + if(child.toString().endsWith(".class")) + isJava = true; + } + + if(isJava) + nodes.clear(); + } + } + + if(isJava) + setIcon(Resources.packagesIcon); + else { + setIcon(Resources.folderIcon); + } + } + } + + return ret; + } + } + +} \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/FileViewer.java b/src/the/bytecode/club/bytecodeviewer/gui/FileViewer.java similarity index 95% rename from src/main/java/the/bytecode/club/bytecodeviewer/gui/FileViewer.java rename to src/the/bytecode/club/bytecodeviewer/gui/FileViewer.java index 1e0aeaaa..d1082ed2 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/FileViewer.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/FileViewer.java @@ -1,26 +1,41 @@ package the.bytecode.club.bytecodeviewer.gui; -import com.jhe.hexed.JHexEditor; -import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; -import org.fife.ui.rsyntaxtextarea.SyntaxConstants; -import org.fife.ui.rtextarea.RTextScrollPane; -import org.imgscalr.Scalr; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.Resources; - -import javax.imageio.ImageIO; -import javax.swing.*; -import javax.swing.text.DefaultHighlighter; -import javax.swing.text.Highlighter; -import javax.swing.text.JTextComponent; -import java.awt.*; -import java.awt.event.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; +import javax.imageio.ImageIO; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.text.DefaultHighlighter; +import javax.swing.text.Highlighter; +import javax.swing.text.JTextComponent; + +import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; +import org.fife.ui.rsyntaxtextarea.SyntaxConstants; +import org.fife.ui.rtextarea.RTextScrollPane; +import org.imgscalr.Scalr; + +import com.jhe.hexed.JHexEditor; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.Resources; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -50,6 +65,7 @@ public class FileViewer extends Viewer { private static final long serialVersionUID = 6103372882168257164L; + String name; private byte[] contents; RSyntaxTextArea panelArea = new RSyntaxTextArea(); JPanel panel = new JPanel(new BorderLayout()); @@ -188,11 +204,10 @@ public class FileViewer extends Viewer { return asciiEncoder.canEncode(v); } - public FileViewer(final String name, final String container, final byte[] contents) { + public FileViewer(final String name, final byte[] contents) { this.name = name; - this.container = container; this.contents = contents; - updateName(); + this.setName(name); this.setLayout(new BorderLayout()); this.add(panel2, BorderLayout.CENTER); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/GraphicialReflectionKit.java b/src/the/bytecode/club/bytecodeviewer/gui/GraphicialReflectionKit.java similarity index 93% rename from src/main/java/the/bytecode/club/bytecodeviewer/gui/GraphicialReflectionKit.java rename to src/the/bytecode/club/bytecodeviewer/gui/GraphicialReflectionKit.java index f1b66a38..6ca41e87 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/GraphicialReflectionKit.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/GraphicialReflectionKit.java @@ -1,9 +1,12 @@ package the.bytecode.club.bytecodeviewer.gui; -import the.bytecode.club.bytecodeviewer.Resources; +import javax.swing.JFrame; +import java.awt.Dimension; +import javax.swing.JTabbedPane; +import java.awt.BorderLayout; +import javax.swing.JPanel; -import javax.swing.*; -import java.awt.*; +import the.bytecode.club.bytecodeviewer.Resources; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * diff --git a/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java b/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java new file mode 100644 index 00000000..e5a5559a --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java @@ -0,0 +1,2166 @@ +package the.bytecode.club.bytecodeviewer.gui; + +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.KeyEventDispatcher; +import java.awt.KeyboardFocusManager; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.File; +import java.util.ArrayList; + +import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.JSeparator; +import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; +import javax.swing.filechooser.FileFilter; + +import me.konloch.kontainer.io.DiskWriter; + +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.Dex2Jar; +import the.bytecode.club.bytecodeviewer.FileChangeNotifier; +import the.bytecode.club.bytecodeviewer.FileContainer; +import the.bytecode.club.bytecodeviewer.JarUtils; +import the.bytecode.club.bytecodeviewer.MiscUtils; +import the.bytecode.club.bytecodeviewer.Resources; +import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; +import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameClasses; +import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameFields; +import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameMethods; +import the.bytecode.club.bytecodeviewer.plugin.PluginManager; +import the.bytecode.club.bytecodeviewer.plugin.preinstalled.CodeSequenceDiagram; +import the.bytecode.club.bytecodeviewer.plugin.preinstalled.AllatoriStringDecrypter; +import the.bytecode.club.bytecodeviewer.plugin.preinstalled.ShowAllStrings; +import the.bytecode.club.bytecodeviewer.plugin.preinstalled.ShowMainMethods; +import the.bytecode.club.bytecodeviewer.plugin.preinstalled.ZKMStringDecrypter; +import the.bytecode.club.bytecodeviewer.plugin.preinstalled.ZStringArrayDecrypter; + +import javax.swing.JSpinner; +import javax.swing.SpinnerNumberModel; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * The main file for the GUI.n + * + * @author Konloch + * + */ +public class MainViewerGUI extends JFrame implements FileChangeNotifier { + + public void pythonC() { + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return true; + } + + @Override + public String getDescription() { + return "Python (Or PyPy for speed) 2.7 Executable"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); + + if (returnVal == JFileChooser.APPROVE_OPTION) + try { + BytecodeViewer.python = fc.getSelectedFile().getAbsolutePath(); + } catch (Exception e1) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); + } + } + + public void javac() { + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return true; + } + + @Override + public String getDescription() { + return "Javac Executable (Requires JDK 'C:/programfiles/Java/JRE_xx/bin/javac.exe)"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); + + if (returnVal == JFileChooser.APPROVE_OPTION) + try { + BytecodeViewer.javac = fc.getSelectedFile().getAbsolutePath(); + } catch (Exception e1) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); + } + } + + public void java() { + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return true; + } + + @Override + public String getDescription() { + return "Java Executable (Inside Of JRE/JDK 'C:/programfiles/Java/JRE_xx/bin/java.exe')"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); + + if (returnVal == JFileChooser.APPROVE_OPTION) + try { + BytecodeViewer.java = fc.getSelectedFile().getAbsolutePath(); + } catch (Exception e1) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); + } + } + + public void pythonC3() { + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return true; + } + + @Override + public String getDescription() { + return "Python (Or PyPy for speed) 3.x Executable"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); + + if (returnVal == JFileChooser.APPROVE_OPTION) + try { + BytecodeViewer.python3 = fc.getSelectedFile().getAbsolutePath(); + } catch (Exception e1) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); + } + } + + public void library() { + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return f.isDirectory(); + } + + @Override + public String getDescription() { + return "Optional Library Folder"; + } + }); + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); + + if (returnVal == JFileChooser.APPROVE_OPTION) + try { + BytecodeViewer.library = fc.getSelectedFile().getAbsolutePath(); + } catch (Exception e1) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); + } + } + + + public void rtC() { + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return true; + } + + @Override + public String getDescription() { + return "JRE RT Library"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); + + if (returnVal == JFileChooser.APPROVE_OPTION) + try { + BytecodeViewer.rt = fc.getSelectedFile().getAbsolutePath(); + } catch (Exception e1) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); + } + } + + public static final long serialVersionUID = 1851409230530948543L; + public JCheckBoxMenuItem debugHelpers = new JCheckBoxMenuItem("Debug Helpers"); + public JSplitPane sp1; + public JSplitPane sp2; + static ArrayList rfComps = new ArrayList(); + public JCheckBoxMenuItem rbr = new JCheckBoxMenuItem("Hide bridge methods"); + public JCheckBoxMenuItem rsy = new JCheckBoxMenuItem( + "Hide synthetic class members"); + public JCheckBoxMenuItem din = new JCheckBoxMenuItem( + "Decompile inner classes"); + public JCheckBoxMenuItem dc4 = new JCheckBoxMenuItem( + "Collapse 1.4 class references"); + public JCheckBoxMenuItem das = new JCheckBoxMenuItem("Decompile assertions"); + public JCheckBoxMenuItem hes = new JCheckBoxMenuItem( + "Hide empty super invocation"); + public JCheckBoxMenuItem hdc = new JCheckBoxMenuItem( + "Hide empty default constructor"); + public JCheckBoxMenuItem dgs = new JCheckBoxMenuItem( + "Decompile generic signatures"); + public JCheckBoxMenuItem ner = new JCheckBoxMenuItem( + "Assume return not throwing exceptions"); + public JCheckBoxMenuItem den = new JCheckBoxMenuItem( + "Decompile enumerations"); + public JCheckBoxMenuItem rgn = new JCheckBoxMenuItem( + "Remove getClass() invocation"); + public JCheckBoxMenuItem bto = new JCheckBoxMenuItem( + "Interpret int 1 as boolean true"); + public JCheckBoxMenuItem nns = new JCheckBoxMenuItem( + "Allow for not set synthetic attribute"); + public JCheckBoxMenuItem uto = new JCheckBoxMenuItem( + "Consider nameless types as java.lang.Object"); + public JCheckBoxMenuItem udv = new JCheckBoxMenuItem( + "Reconstruct variable names from debug info"); + public JCheckBoxMenuItem rer = new JCheckBoxMenuItem( + "Remove empty exception ranges"); + public JCheckBoxMenuItem fdi = new JCheckBoxMenuItem( + "Deinline finally structures"); + public JCheckBoxMenuItem asc = new JCheckBoxMenuItem( + "Allow only ASCII characters in strings"); + public final JMenuItem mntmNewWorkspace = new JMenuItem("New Workspace"); + public JMenu mnRecentFiles = new JMenu("Recent Files"); + public final JMenuItem mntmNewMenuItem = new JMenuItem( + "Decompile & Save All Classes.."); + public final JMenuItem mntmAbout = new JMenuItem("About"); + public final JSeparator separator_3 = new JSeparator(); + public final JMenu mnNewMenu_1 = new JMenu("Plugins"); + public final JMenuItem mntmStartExternalPlugin = new JMenuItem( + "Open Plugin.."); + public final JSeparator separator_4 = new JSeparator(); + public JMenu mnRecentPlugins = new JMenu("Recent Plugins"); + public final JSeparator separator_5 = new JSeparator(); + public final JMenuItem mntmStartZkmString = new JMenuItem( + "ZKM String Decrypter"); + public final JMenuItem mntmNewMenuItem_1 = new JMenuItem( + "Malicious Code Scanner"); + public final JMenuItem mntmNewMenuItem_2 = new JMenuItem( + "Allatori String Decrypter"); + public final JMenuItem mntmShowAllStrings = new JMenuItem( + "Show All Strings"); + public final JMenuItem mntmShowMainMethods = new JMenuItem( + "Show Main Methods"); + public final JMenuItem mntmNewMenuItem_3 = new JMenuItem("Save As Runnable Jar.."); + public JMenuBar menuBar = new JMenuBar(); + public final JMenuItem mntmReplaceStrings = new JMenuItem( + "Replace Strings"); + public final JMenuItem mntmNewMenuItem_4 = new JMenuItem(""); + public final JMenu mnNewMenu_3 = new JMenu("CFR"); + public final JMenu mnNewMenu_4 = new JMenu("Procyon"); + public final JCheckBoxMenuItem decodeenumswitch = new JCheckBoxMenuItem( + "Decode Enum Switch"); + public final JCheckBoxMenuItem sugarenums = new JCheckBoxMenuItem( + "SugarEnums"); + public final JCheckBoxMenuItem decodestringswitch = new JCheckBoxMenuItem( + "Decode String Switch"); + public final JCheckBoxMenuItem arrayiter = new JCheckBoxMenuItem( + "Arrayiter"); + public final JCheckBoxMenuItem collectioniter = new JCheckBoxMenuItem( + "Collectioniter"); + public final JCheckBoxMenuItem innerclasses = new JCheckBoxMenuItem( + "Inner Classes"); + public final JCheckBoxMenuItem removeboilerplate = new JCheckBoxMenuItem( + "Remove Boiler Plate"); + public final JCheckBoxMenuItem removeinnerclasssynthetics = new JCheckBoxMenuItem( + "Remove Inner Class Synthetics"); + public final JCheckBoxMenuItem decodelambdas = new JCheckBoxMenuItem( + "Decode Lambdas"); + public final JCheckBoxMenuItem hidebridgemethods = new JCheckBoxMenuItem( + "Hide Bridge Methods"); + public final JCheckBoxMenuItem liftconstructorinit = new JCheckBoxMenuItem( + "Lift Constructor Init"); + public final JCheckBoxMenuItem removedeadmethods = new JCheckBoxMenuItem( + "Remove Dead Methods"); + public final JCheckBoxMenuItem removebadgenerics = new JCheckBoxMenuItem( + "Remove Bad Generics"); + public final JCheckBoxMenuItem sugarasserts = new JCheckBoxMenuItem( + "Sugar Asserts"); + public final JCheckBoxMenuItem sugarboxing = new JCheckBoxMenuItem( + "Sugar Boxing"); + public final JCheckBoxMenuItem showversion = new JCheckBoxMenuItem( + "Show Version"); + public final JCheckBoxMenuItem decodefinally = new JCheckBoxMenuItem( + "Decode Finally"); + public final JCheckBoxMenuItem tidymonitors = new JCheckBoxMenuItem( + "Tidy Monitors"); + public final JCheckBoxMenuItem lenient = new JCheckBoxMenuItem("Lenient"); + public final JCheckBoxMenuItem dumpclasspath = new JCheckBoxMenuItem( + "Dump Classpath"); + public final JCheckBoxMenuItem comments = new JCheckBoxMenuItem("Comments"); + public final JCheckBoxMenuItem forcetopsort = new JCheckBoxMenuItem( + "Force Top Sort"); + public final JCheckBoxMenuItem forcetopsortaggress = new JCheckBoxMenuItem( + "Force Top Sort Aggress"); + public final JCheckBoxMenuItem stringbuffer = new JCheckBoxMenuItem( + "String Buffer"); + public final JCheckBoxMenuItem stringbuilder = new JCheckBoxMenuItem( + "String Builder"); + public final JCheckBoxMenuItem silent = new JCheckBoxMenuItem("Silent"); + public final JCheckBoxMenuItem recover = new JCheckBoxMenuItem("Recover"); + public final JCheckBoxMenuItem eclipse = new JCheckBoxMenuItem("Eclipse"); + public final JCheckBoxMenuItem override = new JCheckBoxMenuItem("Override"); + public final JCheckBoxMenuItem showinferrable = new JCheckBoxMenuItem( + "Show Inferrable"); + public final JCheckBoxMenuItem aexagg = new JCheckBoxMenuItem("Aexagg"); + public final JCheckBoxMenuItem forcecondpropagate = new JCheckBoxMenuItem( + "Force Cond Propagate"); + public final JCheckBoxMenuItem hideutf = new JCheckBoxMenuItem("Hide UTF"); + public final JCheckBoxMenuItem hidelongstrings = new JCheckBoxMenuItem( + "Hide Long Strings"); + public final JCheckBoxMenuItem commentmonitor = new JCheckBoxMenuItem( + "Comment Monitors"); + public final JCheckBoxMenuItem allowcorrecting = new JCheckBoxMenuItem( + "Allow Correcting"); + public final JCheckBoxMenuItem labelledblocks = new JCheckBoxMenuItem( + "Labelled Blocks"); + public final JCheckBoxMenuItem j14classobj = new JCheckBoxMenuItem( + "J14ClassOBJ"); + public final JCheckBoxMenuItem hidelangimports = new JCheckBoxMenuItem( + "Hide Lang Imports"); + public final JCheckBoxMenuItem recoverytypeclash = new JCheckBoxMenuItem( + "Recover Type Clash"); + public final JCheckBoxMenuItem recoverytypehints = new JCheckBoxMenuItem( + "Recover Type Hints"); + public final JCheckBoxMenuItem forceturningifs = new JCheckBoxMenuItem( + "Force Returning IFs"); + public final JCheckBoxMenuItem forloopaggcapture = new JCheckBoxMenuItem( + "For Loop AGG Capture"); + public final JCheckBoxMenuItem forceexceptionprune = new JCheckBoxMenuItem( + "Force Exception Prune"); + public final JCheckBoxMenuItem chckbxmntmShowDebugLine = new JCheckBoxMenuItem( + "Show Debug Line Numbers"); + public final JCheckBoxMenuItem chckbxmntmSimplifyMemberReferences = new JCheckBoxMenuItem( + "Simplify Member References"); + public final JCheckBoxMenuItem mnMergeVariables = new JCheckBoxMenuItem( + "Merge Variables"); + public final JCheckBoxMenuItem chckbxmntmNewCheckItem_1 = new JCheckBoxMenuItem( + "Unicode Output Enabled"); + public final JCheckBoxMenuItem chckbxmntmNewCheckItem_2 = new JCheckBoxMenuItem( + "Retain Pointless Switches"); + public final JCheckBoxMenuItem chckbxmntmNewCheckItem_3 = new JCheckBoxMenuItem( + "Include Line Numbers In Bytecode"); + public final JCheckBoxMenuItem chckbxmntmNewCheckItem_4 = new JCheckBoxMenuItem( + "Include Error Diagnostics"); + public final JCheckBoxMenuItem chckbxmntmNewCheckItem_5 = new JCheckBoxMenuItem( + "Retain Redundant Casts"); + public final JCheckBoxMenuItem chckbxmntmNewCheckItem_6 = new JCheckBoxMenuItem( + "Always Generate Exception Variable For Catch Blocks"); + public final JCheckBoxMenuItem chckbxmntmNewCheckItem_7 = new JCheckBoxMenuItem( + "Show Synthetic Members"); + public final JCheckBoxMenuItem chckbxmntmNewCheckItem_8 = new JCheckBoxMenuItem( + "Force Explicit Type Arguments"); + public final JCheckBoxMenuItem chckbxmntmNewCheckItem_9 = new JCheckBoxMenuItem( + "Force Explicit Imports"); + public final JCheckBoxMenuItem chckbxmntmNewCheckItem_10 = new JCheckBoxMenuItem( + "Flatten Switch Blocks"); + public final JCheckBoxMenuItem chckbxmntmNewCheckItem_11 = new JCheckBoxMenuItem( + "Exclude Nested Types"); + public final JCheckBoxMenuItem chckbxmntmAppendBrackets = new JCheckBoxMenuItem( + "Append Brackets To Labels"); + public final JCheckBoxMenuItem chckbxmntmNewCheckItem_12 = new JCheckBoxMenuItem( + "Update Check"); + public final JMenu mnNewMenu_5 = new JMenu("Obfuscate"); + public final JMenuItem mntmNewMenuItem_6 = new JMenuItem("Rename Fields"); + public final JMenuItem mntmNewMenuItem_7 = new JMenuItem("Rename Methods"); + public final JMenuItem mntmNewMenuItem_8 = new JMenuItem( + "Move All Classes Into Root Package"); + public final JMenuItem mntmNewMenuItem_9 = new JMenuItem("Control Flow"); + public final JMenuItem mntmNewMenuItem_10 = new JMenuItem("Junk Code"); + public final ButtonGroup obfuscatorGroup = new ButtonGroup(); + public final JRadioButtonMenuItem strongObf = new JRadioButtonMenuItem( + "Strong Obfuscation"); + public final JRadioButtonMenuItem lightObf = new JRadioButtonMenuItem( + "Light Obfuscation"); + public final JMenuItem mntmNewMenuItem_11 = new JMenuItem("Rename Classes"); + public final JSeparator separator_2 = new JSeparator(); + public final JMenu mnNewMenu_6 = new JMenu("View"); + public final JMenu mnNewMenu_7 = new JMenu("Pane 1"); + public final JRadioButtonMenuItem panel1None = new JRadioButtonMenuItem( + "None"); + public final JRadioButtonMenuItem panel1Hexcode = new JRadioButtonMenuItem( + "Hexcode"); + public final JRadioButtonMenuItem panel1Bytecode = new JRadioButtonMenuItem( + "Bytecode"); + public final JRadioButtonMenuItem panel1Fern = new JRadioButtonMenuItem( + "Java"); + public final JRadioButtonMenuItem panel1CFR = new JRadioButtonMenuItem( + "Java"); + public final JRadioButtonMenuItem panel1Proc = new JRadioButtonMenuItem( + "Java"); + public final JMenuItem mntmNewMenuItem_12 = new JMenuItem("Decompile & Save Opened Class.."); + public WorkPane workPane = new WorkPane(this); + public final JMenu mnSettings = new JMenu("Settings"); + public final JSeparator separator_6 = new JSeparator(); + public final JCheckBoxMenuItem refreshOnChange = new JCheckBoxMenuItem("Refresh On View Change"); + public AboutWindow aboutWindow = new AboutWindow(); + + public FileNavigationPane cn = new FileNavigationPane(this); + + public boolean isMaximized = false; + + public void removed(boolean busy) { + if (busy) { + this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + for (Component c : this.getComponents()) + c.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + sp1.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + sp2.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + for (VisibleComponent c : rfComps) { + c.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + if (c instanceof WorkPane) { + WorkPane w = (WorkPane) c; + for (Component c2 : w.tabs.getComponents()) + c2.setCursor(Cursor + .getPredefinedCursor(Cursor.WAIT_CURSOR)); + } + } + } else { + this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + for (Component c : this.getComponents()) + c.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + + sp1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + sp2.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + + for (VisibleComponent c : rfComps) { + c.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + if (c instanceof WorkPane) { + WorkPane w = (WorkPane) c; + for (Component c2 : w.tabs.getComponents()) + c2.setCursor(Cursor + .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + } + } + } + + public class Test implements KeyEventDispatcher { + @Override + public boolean dispatchKeyEvent(KeyEvent e) { + BytecodeViewer.checkHotKey(e); + return false; + } + } + + public final JMenuItem mntmSaveAsApk = new JMenuItem("Save As DEX.."); + public final JMenuItem mntmCodeSequenceDiagram = new JMenuItem("Code Sequence Diagram"); + public final JSeparator separator_7 = new JSeparator(); + public final JSeparator separator_8 = new JSeparator(); + public final JRadioButtonMenuItem panel1Smali = new JRadioButtonMenuItem("Smali/DEX"); + public final JCheckBoxMenuItem autoCompileSmali = new JCheckBoxMenuItem("Compile On Save"); + public final JMenuItem mntmNewMenuItem_13 = new JMenuItem("Compile"); + public final JCheckBoxMenuItem autoCompileOnRefresh = new JCheckBoxMenuItem("Compile On Refresh"); + public final JMenuItem mntmSetPythonDirectory = new JMenuItem("Set Python 2.7 Executable"); + public final JSeparator separator_13 = new JSeparator(); + public final JRadioButtonMenuItem panel1Krakatau = new JRadioButtonMenuItem("Java"); + public final JRadioButtonMenuItem panel1KrakatauBytecode = new JRadioButtonMenuItem("Bytecode"); + public final JMenuItem mntmSetJreRt = new JMenuItem("Set JRE RT Library"); + public final JMenuItem mntmZstringarrayDecrypter = new JMenuItem("ZStringArray Decrypter"); + public final JSeparator separator_15 = new JSeparator(); + public final JMenuItem mntmRun = new JMenuItem("Run"); + public final JSeparator separator_18 = new JSeparator(); + public final JCheckBoxMenuItem decodeAPKResources = new JCheckBoxMenuItem("Decode APK Resources"); + public final JMenu mnProcyon = new JMenu("Procyon"); + public final JCheckBoxMenuItem panel1Proc_E = new JCheckBoxMenuItem("Editable"); + public final JSeparator separator_14 = new JSeparator(); + public final JMenu mnCfr = new JMenu("CFR"); + public final JSeparator separator_19 = new JSeparator(); + public final JCheckBoxMenuItem panel1CFR_E = new JCheckBoxMenuItem("Editable"); + public final JMenu mnFernflower = new JMenu("FernFlower"); + public final JSeparator separator_20 = new JSeparator(); + public final JCheckBoxMenuItem panel1Fern_E = new JCheckBoxMenuItem("Editable"); + public final JMenu mnKrakatau = new JMenu("Krakatau"); + public final JSeparator separator_21 = new JSeparator(); + public final JCheckBoxMenuItem panel1Krakatau_E = new JCheckBoxMenuItem("Editable"); + public final JMenu mnSmalidex = new JMenu("Smali/DEX"); + public final JSeparator separator_22 = new JSeparator(); + public final JCheckBoxMenuItem panel1Smali_E = new JCheckBoxMenuItem("Editable"); + public final JMenu mnPane = new JMenu("Pane 2"); + public final JRadioButtonMenuItem panel2None = new JRadioButtonMenuItem("None"); + public final JSeparator separator_9 = new JSeparator(); + public final JMenu menu_1 = new JMenu("Procyon"); + public final JRadioButtonMenuItem panel2Proc = new JRadioButtonMenuItem("Java"); + public final JSeparator separator_10 = new JSeparator(); + public final JCheckBoxMenuItem panel2Proc_E = new JCheckBoxMenuItem("Editable"); + public final JMenu menu_2 = new JMenu("CFR"); + public final JRadioButtonMenuItem panel2CFR = new JRadioButtonMenuItem("Java"); + public final JSeparator separator_11 = new JSeparator(); + public final JCheckBoxMenuItem panel2CFR_E = new JCheckBoxMenuItem("Editable"); + public final JMenu menu_3 = new JMenu("FernFlower"); + public final JRadioButtonMenuItem panel2Fern = new JRadioButtonMenuItem("Java"); + public final JSeparator separator_12 = new JSeparator(); + public final JCheckBoxMenuItem panel2Fern_E = new JCheckBoxMenuItem("Editable"); + public final JMenu menu_4 = new JMenu("Krakatau"); + public final JRadioButtonMenuItem panel2Krakatau = new JRadioButtonMenuItem("Java"); + public final JRadioButtonMenuItem panel2KrakatauBytecode = new JRadioButtonMenuItem("Bytecode"); + public final JSeparator separator_16 = new JSeparator(); + public final JCheckBoxMenuItem panel2Krakatau_E = new JCheckBoxMenuItem("Editable"); + public final JSeparator separator_17 = new JSeparator(); + public final JMenu menu_5 = new JMenu("Smali/DEX"); + public final JRadioButtonMenuItem panel2Smali = new JRadioButtonMenuItem("Smali/DEX"); + public final JSeparator separator_23 = new JSeparator(); + public final JCheckBoxMenuItem panel2Smali_E = new JCheckBoxMenuItem("Editable"); + public final JSeparator separator_24 = new JSeparator(); + public final JRadioButtonMenuItem panel2Bytecode = new JRadioButtonMenuItem("Bytecode"); + public final JRadioButtonMenuItem panel2Hexcode = new JRadioButtonMenuItem("Hexcode"); + public final JMenu mnPane_1 = new JMenu("Pane 3"); + public final JRadioButtonMenuItem panel3None = new JRadioButtonMenuItem("None"); + public final JSeparator separator_25 = new JSeparator(); + public final JMenu menu_7 = new JMenu("Procyon"); + public final JRadioButtonMenuItem panel3Proc = new JRadioButtonMenuItem("Java"); + public final JSeparator separator_26 = new JSeparator(); + public final JCheckBoxMenuItem panel3Proc_E = new JCheckBoxMenuItem("Editable"); + public final JMenu menu_8 = new JMenu("CFR"); + public final JRadioButtonMenuItem panel3CFR = new JRadioButtonMenuItem("Java"); + public final JSeparator separator_27 = new JSeparator(); + public final JCheckBoxMenuItem panel3CFR_E = new JCheckBoxMenuItem("Editable"); + public final JMenu menu_9 = new JMenu("FernFlower"); + public final JRadioButtonMenuItem panel3Fern = new JRadioButtonMenuItem("Java"); + public final JSeparator separator_28 = new JSeparator(); + public final JCheckBoxMenuItem panel3Fern_E = new JCheckBoxMenuItem("Editable"); + public final JMenu menu_10 = new JMenu("Krakatau"); + public final JRadioButtonMenuItem panel3Krakatau = new JRadioButtonMenuItem("Java"); + public final JRadioButtonMenuItem panel3KrakatauBytecode = new JRadioButtonMenuItem("Bytecode"); + public final JSeparator separator_29 = new JSeparator(); + public final JCheckBoxMenuItem panel3Krakatau_E = new JCheckBoxMenuItem("Editable"); + public final JSeparator separator_30 = new JSeparator(); + public final JMenu menu_11 = new JMenu("Smali/DEX"); + public final JRadioButtonMenuItem panel3Smali = new JRadioButtonMenuItem("Smali/DEX"); + public final JSeparator separator_31 = new JSeparator(); + public final JCheckBoxMenuItem panel3Smali_E = new JCheckBoxMenuItem("Editable"); + public final JSeparator separator_32 = new JSeparator(); + public final JRadioButtonMenuItem panel3Bytecode = new JRadioButtonMenuItem("Bytecode"); + public final JRadioButtonMenuItem panel3Hexcode = new JRadioButtonMenuItem("Hexcode"); + public void setIcon(final boolean busy) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + if (busy) { + try { + mntmNewMenuItem_4.setIcon(Resources.busyIcon); + } catch (NullPointerException e) { + mntmNewMenuItem_4.setIcon(Resources.busyB64Icon); + } + } else + mntmNewMenuItem_4.setIcon(null); + mntmNewMenuItem_4.updateUI(); + } + }); + } + + public final ButtonGroup panelGroup1 = new ButtonGroup(); + public final ButtonGroup panelGroup2 = new ButtonGroup(); + public final ButtonGroup panelGroup3 = new ButtonGroup(); + private final JMenuItem mntmSetOpitonalLibrary = new JMenuItem("Set Optional Library Folder"); + private final JMenuItem mntmPingback = new JMenuItem("Pingback"); + private final JMenu mnJdgui = new JMenu("JD-GUI"); + public final JRadioButtonMenuItem panel3JDGUI = new JRadioButtonMenuItem("Java"); + private final JSeparator separator_33 = new JSeparator(); + public final JCheckBoxMenuItem panel3JDGUI_E = new JCheckBoxMenuItem("Editable"); + private final JMenu menu = new JMenu("JD-GUI"); + public final JRadioButtonMenuItem panel2JDGUI = new JRadioButtonMenuItem("Java"); + private final JSeparator separator_34 = new JSeparator(); + public final JCheckBoxMenuItem panel2JDGUI_E = new JCheckBoxMenuItem("Editable"); + private final JMenu menu_6 = new JMenu("JD-GUI"); + public final JRadioButtonMenuItem panel1JDGUI = new JRadioButtonMenuItem("Java"); + private final JSeparator separator_35 = new JSeparator(); + public final JCheckBoxMenuItem panel1JDGUI_E = new JCheckBoxMenuItem("Editable"); + private final JMenu mnFontSize = new JMenu("Font Size"); + public final JSpinner fontSpinner = new JSpinner(); + private final JSeparator separator_36 = new JSeparator(); + private final JCheckBoxMenuItem chckbxmntmDeleteForiegnoutdatedLibs = new JCheckBoxMenuItem("Delete Foriegn/Outdated Libs"); + private final JSeparator separator_37 = new JSeparator(); + private final JSeparator separator_38 = new JSeparator(); + private final JMenu mnApkConversion = new JMenu("APK Conversion"); + public final ButtonGroup apkConversionGroup = new ButtonGroup(); + public final JRadioButtonMenuItem apkConversionDex = new JRadioButtonMenuItem("Dex2Jar"); + public final JRadioButtonMenuItem apkConversionEnjarify = new JRadioButtonMenuItem("Enjarify"); + private final JMenuItem mntmSetPythonx = new JMenuItem("Set Python 3.X Executable"); + private final JMenuItem mntmReloadResources = new JMenuItem("Reload Resources"); + private final JSeparator separator_39 = new JSeparator(); + private final JSeparator separator_40 = new JSeparator(); + private final JMenuItem mntmSetJavacExecutable = new JMenuItem("Set Javac Executable"); + + public void calledAfterLoad() { + chckbxmntmDeleteForiegnoutdatedLibs.setSelected(BytecodeViewer.deleteForiegnLibraries); + } + + public MainViewerGUI() { + mnNewMenu_5.setVisible(false); + KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new Test()); + this.addWindowStateListener(new WindowAdapter() { + @Override + public void windowStateChanged(WindowEvent evt) { + int oldState = evt.getOldState(); + int newState = evt.getNewState(); + + if ((oldState & Frame.ICONIFIED) == 0 && (newState & Frame.ICONIFIED) != 0) { + //System.out.println("Frame was iconized"); + } else if ((oldState & Frame.ICONIFIED) != 0 && (newState & Frame.ICONIFIED) == 0) { + //System.out.println("Frame was deiconized"); + } + + if ((oldState & Frame.MAXIMIZED_BOTH) == 0 && (newState & Frame.MAXIMIZED_BOTH) != 0) { + isMaximized = true; + } else if ((oldState & Frame.MAXIMIZED_BOTH) != 0 && (newState & Frame.MAXIMIZED_BOTH) == 0) { + isMaximized = false; + } + } + }); + this.setIconImages(Resources.iconList); + ActionListener listener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + if(refreshOnChange.isSelected()) { + if(workPane.getCurrentViewer() == null) + return; + + workPane.refreshClass.doClick(); + } + } + + }; + + panel1None.addActionListener(listener); + panel1Hexcode.addActionListener(listener); + obfuscatorGroup.add(strongObf); + obfuscatorGroup.add(lightObf); + obfuscatorGroup.setSelected(strongObf.getModel(), true); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + // procyon + /* none */ + + setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("File"); + menuBar.add(mnNewMenu); + + mntmNewWorkspace.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + BytecodeViewer.resetWorkSpace(true); + } + }); + + JMenuItem mntmLoadJar = new JMenuItem("Add.."); + mntmLoadJar.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFileChooser fc = new JFileChooser(); + try { + File f = new File(BytecodeViewer.lastDirectory); + if(f.exists()) + fc.setSelectedFile(f); + } catch(Exception e2) { + + } + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + if (f.isDirectory()) + return true; + + String extension = MiscUtils.extension(f.getAbsolutePath()); + if (extension != null) + if (extension.equals("jar") || extension.equals("zip") + || extension.equals("class") || extension.equals("apk") + || extension.equals("dex")) + return true; + + return false; + } + + @Override + public String getDescription() { + return "APKs, DEX, Class Files or Zip/Jar Archives"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); + + if (returnVal == JFileChooser.APPROVE_OPTION) { + BytecodeViewer.lastDirectory = fc.getSelectedFile().getAbsolutePath(); + try { + BytecodeViewer.viewer.setIcon(true); + BytecodeViewer.openFiles(new File[] { fc + .getSelectedFile() }, true); + BytecodeViewer.viewer.setIcon(false); + } catch (Exception e1) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); + } + } + } + }); + mnNewMenu.add(mntmLoadJar); + + mnNewMenu.add(separator_40); + + mnNewMenu.add(mntmNewWorkspace); + + JMenuItem mntmSave = new JMenuItem("Save As Zip.."); + mntmSave.setActionCommand(""); + mntmSave.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + if(BytecodeViewer.getLoadedClasses().isEmpty()) { + BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); + return; + } + Thread t = new Thread() { + public void run() { + if(autoCompileSmali.isSelected() && !BytecodeViewer.compile(false)) + return; + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("zip"); + } + + @Override + public String getDescription() { + return "Zip Archives"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showSaveDialog(MainViewerGUI.this); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + if(!file.getAbsolutePath().endsWith(".zip")) + file = new File(file.getAbsolutePath()+".zip"); + + if(file.exists()) { + JOptionPane pane = new JOptionPane( + "Are you sure you wish to overwrite this existing file?"); + Object[] options = new String[] { "Yes", "No" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, + "Bytecode Viewer - Overwrite File"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + file.delete(); + } else { + return; + } + } + + final File file2 = file; + + BytecodeViewer.viewer.setIcon(true); + Thread t = new Thread() { + @Override + public void run() { + JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), + file2.getAbsolutePath()); + BytecodeViewer.viewer.setIcon(false); + } + }; + t.start(); + } + } + }; + t.start(); + } + }); + + mnNewMenu.add(separator_39); + mntmReloadResources.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + JOptionPane pane = new JOptionPane("Are you sure you wish to reload the resources?"); + Object[] options = new String[] { "Yes", "No" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Reload Resources"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + ArrayList reopen = new ArrayList(); + for(FileContainer container : BytecodeViewer.files) + reopen.add(container.file); + + BytecodeViewer.files.clear(); + BytecodeViewer.openFiles(reopen.toArray(new File[reopen.size()]), false); + + //refresh panes + } + } + }); + + mnNewMenu.add(mntmReloadResources); + + mnNewMenu.add(separator_3); + mntmNewMenuItem_3.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if(BytecodeViewer.getLoadedClasses().isEmpty()) { + BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); + return; + } + Thread t = new Thread() { + public void run() { + if(autoCompileSmali.isSelected() && !BytecodeViewer.compile(false)) + return; + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("zip"); + } + + @Override + public String getDescription() { + return "Zip Archives"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showSaveDialog(MainViewerGUI.this); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + String path = file.getAbsolutePath(); + if (!path.endsWith(".jar")) + path = path + ".jar"; + + if(new File(path).exists()) { + JOptionPane pane = new JOptionPane( + "Are you sure you wish to overwrite this existing file?"); + Object[] options = new String[] { "Yes", "No" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, + "Bytecode Viewer - Overwrite File"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + file.delete(); + } else { + return; + } + } + + new ExportJar(path).setVisible(true); + } + } + }; + t.start(); + } + }); + mntmNewMenuItem_13.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + Thread t = new Thread() { + public void run() { + BytecodeViewer.compile(true); + } + }; + t.start(); + } + }); + mntmRun.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if(BytecodeViewer.getLoadedClasses().isEmpty()) { + BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); + return; + } + new RunOptions().setVisible(true); + } + }); + + mnNewMenu.add(mntmRun); + + mnNewMenu.add(mntmNewMenuItem_13); + + mnNewMenu.add(separator_18); + + mnNewMenu.add(mntmNewMenuItem_3); + mntmSaveAsApk.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + if(BytecodeViewer.getLoadedClasses().isEmpty()) { + BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); + return; + } + + Thread t = new Thread() { + public void run() { + if(autoCompileSmali.isSelected() && !BytecodeViewer.compile(false)) + return; + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("dex"); + } + + @Override + public String getDescription() { + return "Android DEX Files"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showSaveDialog(MainViewerGUI.this); + if (returnVal == JFileChooser.APPROVE_OPTION) { + final File file = fc.getSelectedFile(); + String output = file.getAbsolutePath(); + if (!output.endsWith(".dex")) + output = output + ".dex"; + + final File file2 = new File(output); + + if(file2.exists()) { + JOptionPane pane = new JOptionPane( + "Are you sure you wish to overwrite this existing file?"); + Object[] options = new String[] { "Yes", "No" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, + "Bytecode Viewer - Overwrite File"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + file.delete(); + } else { + return; + } + } + + Thread t = new Thread() { + @Override + public void run() { + BytecodeViewer.viewer.setIcon(true); + final String input = BytecodeViewer.tempDirectory+BytecodeViewer.fs+BytecodeViewer.getRandomizedName()+".jar"; + JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), input); + + Thread t = new Thread() { + @Override + public void run() { + Dex2Jar.saveAsDex(new File(input), file2); + + BytecodeViewer.viewer.setIcon(false); + } + }; + t.start(); + } + }; + t.start(); + } + } + }; + t.start(); + } + }); + + mnNewMenu.add(mntmSaveAsApk); + mnNewMenu.add(mntmSave); + mntmNewMenuItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + if(BytecodeViewer.getLoadedClasses().isEmpty()) { + BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); + return; + } + + Thread t = new Thread() { + public void run() { + if(autoCompileSmali.isSelected() && !BytecodeViewer.compile(false)) + return; + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("zip"); + } + + @Override + public String getDescription() { + return "Zip Archives"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showSaveDialog(MainViewerGUI.this); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + if(!file.getAbsolutePath().endsWith(".zip")) + file = new File(file.getAbsolutePath()+".zip"); + + if(file.exists()) { + JOptionPane pane = new JOptionPane( + "Are you sure you wish to overwrite this existing file?"); + Object[] options = new String[] { "Yes", "No" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, + "Bytecode Viewer - Overwrite File"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + file.delete(); + } else { + return; + } + } + + BytecodeViewer.viewer.setIcon(true); + final String path = MiscUtils.append(file, ".zip"); // cheap hax cause + // string is final + + JOptionPane pane = new JOptionPane( + "What decompiler will you use?"); + Object[] options = new String[] { "Procyon", "CFR", + "Fernflower", "Krakatau", "Cancel" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, + "Bytecode Viewer - Select Decompiler"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + Thread t = new Thread() { + @Override + public void run() { + try { + Decompiler.procyon.decompileToZip(path); + BytecodeViewer.viewer.setIcon(false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + }; + t.start(); + } + if (result == 1) { + Thread t = new Thread() { + @Override + public void run() { + try { + Decompiler.cfr.decompileToZip(path); + BytecodeViewer.viewer.setIcon(false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + }; + t.start(); + } + if (result == 2) { + Thread t = new Thread() { + @Override + public void run() { + try { + Decompiler.fernflower.decompileToZip(path); + BytecodeViewer.viewer.setIcon(false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + }; + t.start(); + } + + if (result == 3) { + Thread t = new Thread() { + @Override + public void run() { + try { + Decompiler.krakatau.decompileToZip(path); + BytecodeViewer.viewer.setIcon(false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + }; + t.start(); + } + + if(result == 4) { + BytecodeViewer.viewer.setIcon(false); + } + } + } + }; + t.start(); + } + }); + mntmNewMenuItem_12.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + if(workPane.getCurrentViewer() == null) { + BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); + return; + } + + Thread t = new Thread() { + public void run() { + if(autoCompileSmali.isSelected() && !BytecodeViewer.compile(false)) + return; + final String s = workPane.getCurrentViewer().name; + + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return f.isDirectory() || MiscUtils.extension(f.getAbsolutePath()).equals("java"); + } + + @Override + public String getDescription() { + return "Java Source Files"; + } + }); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showSaveDialog(MainViewerGUI.this); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + + BytecodeViewer.viewer.setIcon(true); + final String path = MiscUtils.append(file, ".java"); // cheap hax cause + // string is final + + if(new File(path).exists()) { + JOptionPane pane = new JOptionPane( + "Are you sure you wish to overwrite this existing file?"); + Object[] options = new String[] { "Yes", "No" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, + "Bytecode Viewer - Overwrite File"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + file.delete(); + } else { + return; + } + } + + JOptionPane pane = new JOptionPane( + "What decompiler will you use?"); + Object[] options = new String[] { "Procyon", "CFR", + "Fernflower", "Krakatau", "Cancel" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, + "Bytecode Viewer - Select Decompiler"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + Thread t = new Thread() { + @Override + public void run() { + try { + ClassNode cn = BytecodeViewer.getClassNode(s); + final ClassWriter cw = new ClassWriter(0); + try { + cn.accept(cw); + } catch(Exception e) { + e.printStackTrace(); + try { + Thread.sleep(200); + cn.accept(cw); + } catch (InterruptedException e1) { } + } + String contents = Decompiler.procyon.decompileClassNode(cn, cw.toByteArray()); + DiskWriter.replaceFile(path, contents, false); + BytecodeViewer.viewer.setIcon(false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI( + e); + } + } + }; + t.start(); + } + if (result == 1) { + Thread t = new Thread() { + @Override + public void run() { + try { + ClassNode cn = BytecodeViewer.getClassNode(s); + final ClassWriter cw = new ClassWriter(0); + try { + cn.accept(cw); + } catch(Exception e) { + e.printStackTrace(); + try { + Thread.sleep(200); + cn.accept(cw); + } catch (InterruptedException e1) { } + } + String contents = Decompiler.cfr.decompileClassNode(cn, cw.toByteArray()); + DiskWriter.replaceFile(path, contents, false); + BytecodeViewer.viewer.setIcon(false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI( + e); + } + } + }; + t.start(); + } + if (result == 2) { + Thread t = new Thread() { + @Override + public void run() { + try { + + ClassNode cn = BytecodeViewer.getClassNode(s); + final ClassWriter cw = new ClassWriter(0); + try { + cn.accept(cw); + } catch(Exception e) { + e.printStackTrace(); + try { + Thread.sleep(200); + cn.accept(cw); + } catch (InterruptedException e1) { } + } + String contents = Decompiler.fernflower.decompileClassNode(cn, cw.toByteArray()); + DiskWriter.replaceFile(path, contents, false); + BytecodeViewer.viewer.setIcon(false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI( + e); + } + } + }; + t.start(); + } + if (result == 3) { + Thread t = new Thread() { + @Override + public void run() { + try { + ClassNode cn = BytecodeViewer.getClassNode(s); + final ClassWriter cw = new ClassWriter(0); + try { + cn.accept(cw); + } catch(Exception e) { + e.printStackTrace(); + try { + Thread.sleep(200); + cn.accept(cw); + } catch (InterruptedException e1) { } + } + String contents = Decompiler.krakatau.decompileClassNode(cn, cw.toByteArray()); + DiskWriter.replaceFile(path, contents, false); + BytecodeViewer.viewer.setIcon(false); + } catch (Exception e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI( + e); + } + } + }; + t.start(); + } + if(result == 4) { + BytecodeViewer.viewer.setIcon(false); + } + } + } + }; + t.start(); + } + }); + + mnNewMenu.add(mntmNewMenuItem_12); + + mnNewMenu.add(mntmNewMenuItem); + + JSeparator separator = new JSeparator(); + mnNewMenu.add(separator); + + mnNewMenu.add(mnRecentFiles); + + JSeparator separator_1 = new JSeparator(); + mnNewMenu.add(separator_1); + mntmAbout.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + aboutWindow.setVisible(true); + } + }); + + mnNewMenu.add(mntmAbout); + + JMenuItem mntmExit = new JMenuItem("Exit"); + mntmExit.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + JOptionPane pane = new JOptionPane( + "Are you sure you want to exit?"); + Object[] options = new String[] { "Yes", "No" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, + "Bytecode Viewer - Exit"); + dialog.setVisible(true); + Object obj = pane.getValue(); + int result = -1; + for (int k = 0; k < options.length; k++) + if (options[k].equals(obj)) + result = k; + + if (result == 0) { + System.exit(0); + } + } + }); + mntmPingback.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + BytecodeViewer.pingback(); + } + }); + + mnNewMenu.add(mntmPingback); + mnNewMenu.add(mntmExit); + + menuBar.add(mnNewMenu_6); + + mnNewMenu_6.add(mnNewMenu_7); + + mnNewMenu_7.add(panel1None); + + mnNewMenu_7.add(separator_7); + + mnNewMenu_7.add(mnProcyon); + mnProcyon.add(panel1Proc); + + mnProcyon.add(separator_14); + + mnProcyon.add(panel1Proc_E); + panel1Proc.addActionListener(listener); + + mnNewMenu_7.add(mnCfr); + mnCfr.add(panel1CFR); + panel1CFR.addActionListener(listener); + + mnCfr.add(separator_19); + + mnCfr.add(panel1CFR_E); + + mnNewMenu_7.add(menu_6); + + menu_6.add(panel1JDGUI); + + menu_6.add(separator_35); + + menu_6.add(panel1JDGUI_E); + + mnNewMenu_7.add(mnFernflower); + mnFernflower.add(panel1Fern); + panel1Fern.addActionListener(listener); + + mnFernflower.add(separator_20); + + mnFernflower.add(panel1Fern_E); + + mnNewMenu_7.add(mnKrakatau); + mnKrakatau.add(panel1Krakatau); + panel1Krakatau.addActionListener(listener); + mnKrakatau.add(panel1KrakatauBytecode); + panel1KrakatauBytecode.addActionListener(listener); + + mnKrakatau.add(separator_21); + + mnKrakatau.add(panel1Krakatau_E); + + mnNewMenu_7.add(separator_8); + + mnNewMenu_7.add(mnSmalidex); + mnSmalidex.add(panel1Smali); + panel1Smali.addActionListener(listener); + + mnSmalidex.add(separator_22); + + mnSmalidex.add(panel1Smali_E); + panel1Bytecode.addActionListener(listener); + + mnNewMenu_7.add(separator_15); + + mnNewMenu_7.add(panel1Bytecode); + + mnNewMenu_7.add(panel1Hexcode); + + mnNewMenu_6.add(mnPane); + + mnPane.add(panel2None); + + mnPane.add(separator_9); + + mnPane.add(menu_1); + + menu_1.add(panel2Proc); + + menu_1.add(separator_10); + + menu_1.add(panel2Proc_E); + + mnPane.add(menu_2); + + menu_2.add(panel2CFR); + + menu_2.add(separator_11); + + menu_2.add(panel2CFR_E); + + mnPane.add(menu); + + menu.add(panel2JDGUI); + + menu.add(separator_34); + + menu.add(panel2JDGUI_E); + + mnPane.add(menu_3); + + menu_3.add(panel2Fern); + + menu_3.add(separator_12); + + menu_3.add(panel2Fern_E); + + mnPane.add(menu_4); + + menu_4.add(panel2Krakatau); + + menu_4.add(panel2KrakatauBytecode); + + menu_4.add(separator_16); + + menu_4.add(panel2Krakatau_E); + + mnPane.add(separator_17); + + mnPane.add(menu_5); + + menu_5.add(panel2Smali); + + menu_5.add(separator_23); + + menu_5.add(panel2Smali_E); + + mnPane.add(separator_24); + + mnPane.add(panel2Bytecode); + + mnPane.add(panel2Hexcode); + + mnNewMenu_6.add(mnPane_1); + + mnPane_1.add(panel3None); + + mnPane_1.add(separator_25); + + mnPane_1.add(menu_7); + + menu_7.add(panel3Proc); + + menu_7.add(separator_26); + + menu_7.add(panel3Proc_E); + + mnPane_1.add(menu_8); + + menu_8.add(panel3CFR); + + menu_8.add(separator_27); + + menu_8.add(panel3CFR_E); + + mnPane_1.add(mnJdgui); + + mnJdgui.add(panel3JDGUI); + + mnJdgui.add(separator_33); + + mnJdgui.add(panel3JDGUI_E); + + mnPane_1.add(menu_9); + + menu_9.add(panel3Fern); + + menu_9.add(separator_28); + + menu_9.add(panel3Fern_E); + + mnPane_1.add(menu_10); + + menu_10.add(panel3Krakatau); + + menu_10.add(panel3KrakatauBytecode); + + menu_10.add(separator_29); + + menu_10.add(panel3Krakatau_E); + + mnPane_1.add(separator_30); + + mnPane_1.add(menu_11); + + menu_11.add(panel3Smali); + + menu_11.add(separator_31); + + menu_11.add(panel3Smali_E); + + mnPane_1.add(separator_32); + + mnPane_1.add(panel3Bytecode); + + mnPane_1.add(panel3Hexcode); + + menuBar.add(mnSettings); + autoCompileSmali.setSelected(true); + + mnSettings.add(autoCompileSmali); + autoCompileOnRefresh.setSelected(true); + + mnSettings.add(autoCompileOnRefresh); + + mnSettings.add(refreshOnChange); + + mnSettings.add(separator_38); + decodeAPKResources.setSelected(true); + + mnSettings.add(decodeAPKResources); + + mnSettings.add(mnApkConversion); + + mnApkConversion.add(apkConversionDex); + + mnApkConversion.add(apkConversionEnjarify); + + mnSettings.add(separator_37); + chckbxmntmNewCheckItem_12.setSelected(true); + mnSettings.add(chckbxmntmNewCheckItem_12); + chckbxmntmDeleteForiegnoutdatedLibs.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + if(!chckbxmntmDeleteForiegnoutdatedLibs.isSelected()) { + BytecodeViewer.showMessage("WARNING: With this being toggled off outdated libraries will NOT be removed. It's also a security issue. ONLY TURN IT OFF IF YOU KNOW WHAT YOU'RE DOING."); + } + BytecodeViewer.deleteForiegnLibraries = chckbxmntmDeleteForiegnoutdatedLibs.isSelected(); + } + }); + chckbxmntmDeleteForiegnoutdatedLibs.setSelected(true); + + mnSettings.add(chckbxmntmDeleteForiegnoutdatedLibs); + + mnSettings.add(separator_36); + mntmSetPythonDirectory.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + pythonC(); + } + }); + + mnSettings.add(mntmSetPythonDirectory); + mntmSetJreRt.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + rtC(); + } + }); + mntmSetPythonx.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + pythonC3(); + } + }); + + mnSettings.add(mntmSetPythonx); + + mnSettings.add(mntmSetJreRt); + mntmSetOpitonalLibrary.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + library(); + } + }); + + mnSettings.add(mntmSetOpitonalLibrary); + mntmSetJavacExecutable.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + javac(); + } + }); + + mnSettings.add(mntmSetJavacExecutable); + + mnSettings.add(separator_6); + mnSettings.add(mnNewMenu_4); + + mnNewMenu_4.add(chckbxmntmNewCheckItem_6); + + mnNewMenu_4.add(chckbxmntmNewCheckItem_11); + + mnNewMenu_4.add(chckbxmntmShowDebugLine); + + mnNewMenu_4.add(chckbxmntmNewCheckItem_3); + + mnNewMenu_4.add(chckbxmntmNewCheckItem_4); + + mnNewMenu_4.add(chckbxmntmNewCheckItem_7); + + mnNewMenu_4.add(chckbxmntmSimplifyMemberReferences); + + mnNewMenu_4.add(mnMergeVariables); + + mnNewMenu_4.add(chckbxmntmNewCheckItem_8); + + mnNewMenu_4.add(chckbxmntmNewCheckItem_9); + + mnNewMenu_4.add(chckbxmntmNewCheckItem_10); + + mnNewMenu_4.add(chckbxmntmNewCheckItem_2); + + mnNewMenu_4.add(chckbxmntmNewCheckItem_5); + + mnNewMenu_4.add(chckbxmntmNewCheckItem_1); + // cfr + decodeenumswitch.setSelected(true); + sugarenums.setSelected(true); + decodestringswitch.setSelected(true); + arrayiter.setSelected(true); + collectioniter.setSelected(true); + innerclasses.setSelected(true); + removeboilerplate.setSelected(true); + removeinnerclasssynthetics.setSelected(true); + decodelambdas.setSelected(true); + hidebridgemethods.setSelected(true); + liftconstructorinit.setSelected(true); + removedeadmethods.setSelected(true); + removebadgenerics.setSelected(true); + sugarasserts.setSelected(true); + sugarboxing.setSelected(true); + showversion.setSelected(true); + decodefinally.setSelected(true); + tidymonitors.setSelected(true); + lenient.setSelected(false); + dumpclasspath.setSelected(false); + comments.setSelected(true); + forcetopsort.setSelected(true); + forcetopsortaggress.setSelected(true); + forceexceptionprune.setSelected(true); + stringbuffer.setSelected(false); + stringbuilder.setSelected(true); + silent.setSelected(true); + recover.setSelected(true); + eclipse.setSelected(true); + override.setSelected(true); + showinferrable.setSelected(true); + aexagg.setSelected(true); + forcecondpropagate.setSelected(true); + hideutf.setSelected(true); + hidelongstrings.setSelected(false); + commentmonitor.setSelected(false); + allowcorrecting.setSelected(true); + labelledblocks.setSelected(true); + j14classobj.setSelected(false); + hidelangimports.setSelected(true); + recoverytypeclash.setSelected(true); + recoverytypehints.setSelected(true); + forceturningifs.setSelected(true); + forloopaggcapture.setSelected(true); + mnSettings.add(mnNewMenu_3); + + mnNewMenu_3.add(decodeenumswitch); + + mnNewMenu_3.add(sugarenums); + + mnNewMenu_3.add(decodestringswitch); + + mnNewMenu_3.add(arrayiter); + + mnNewMenu_3.add(collectioniter); + + mnNewMenu_3.add(innerclasses); + + mnNewMenu_3.add(removeboilerplate); + + mnNewMenu_3.add(removeinnerclasssynthetics); + + mnNewMenu_3.add(decodelambdas); + + mnNewMenu_3.add(hidebridgemethods); + + mnNewMenu_3.add(liftconstructorinit); + + mnNewMenu_3.add(removedeadmethods); + + mnNewMenu_3.add(removebadgenerics); + + mnNewMenu_3.add(sugarasserts); + + mnNewMenu_3.add(sugarboxing); + + mnNewMenu_3.add(showversion); + + mnNewMenu_3.add(decodefinally); + + mnNewMenu_3.add(tidymonitors); + + mnNewMenu_3.add(lenient); + + mnNewMenu_3.add(dumpclasspath); + + mnNewMenu_3.add(comments); + + mnNewMenu_3.add(forcetopsort); + + mnNewMenu_3.add(forcetopsortaggress); + + mnNewMenu_3.add(forceexceptionprune); + + mnNewMenu_3.add(stringbuffer); + + mnNewMenu_3.add(stringbuilder); + + mnNewMenu_3.add(silent); + + mnNewMenu_3.add(recover); + + mnNewMenu_3.add(eclipse); + + mnNewMenu_3.add(override); + + mnNewMenu_3.add(showinferrable); + + mnNewMenu_3.add(aexagg); + + mnNewMenu_3.add(forcecondpropagate); + + mnNewMenu_3.add(hideutf); + + mnNewMenu_3.add(hidelongstrings); + + mnNewMenu_3.add(commentmonitor); + + mnNewMenu_3.add(allowcorrecting); + + mnNewMenu_3.add(labelledblocks); + + mnNewMenu_3.add(j14classobj); + + mnNewMenu_3.add(hidelangimports); + + mnNewMenu_3.add(recoverytypeclash); + + mnNewMenu_3.add(recoverytypehints); + + mnNewMenu_3.add(forceturningifs); + + mnNewMenu_3.add(forloopaggcapture); + // fernflower + rbr.setSelected(true); + rsy.setSelected(false); + din.setSelected(true); + das.setSelected(true); + dgs.setSelected(false); + den.setSelected(true); + uto.setSelected(true); + udv.setSelected(true); + fdi.setSelected(true); + asc.setSelected(false); + + JMenu mnDecompilerSettings = new JMenu("FernFlower"); + mnSettings.add(mnDecompilerSettings); + dc4.setSelected(true); + mnDecompilerSettings.add(dc4); + nns.setSelected(true); + mnDecompilerSettings.add(nns); + ner.setSelected(true); + mnDecompilerSettings.add(ner); + bto.setSelected(true); + mnDecompilerSettings.add(bto); + rgn.setSelected(true); + mnDecompilerSettings.add(rgn); + rer.setSelected(true); + mnDecompilerSettings.add(rer); + mnDecompilerSettings.add(rbr); + mnDecompilerSettings.add(rsy); + hes.setSelected(true); + mnDecompilerSettings.add(hes); + hdc.setSelected(true); + mnDecompilerSettings.add(hdc); + mnDecompilerSettings.add(din); + mnDecompilerSettings.add(das); + mnDecompilerSettings.add(dgs); + mnDecompilerSettings.add(den); + mnDecompilerSettings.add(uto); + mnDecompilerSettings.add(udv); + mnDecompilerSettings.add(fdi); + mnDecompilerSettings.add(asc); + debugHelpers.setSelected(true); + // other + chckbxmntmAppendBrackets.setSelected(true); + + JMenu mnBytecodeDecompilerSettings = new JMenu("Bytecode Decompiler"); + mnSettings.add(mnBytecodeDecompilerSettings); + + mnBytecodeDecompilerSettings.add(debugHelpers); + + mnBytecodeDecompilerSettings.add(chckbxmntmAppendBrackets); + + menuBar.add(mnNewMenu_5); + mntmNewMenuItem_6.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + if (BytecodeViewer.runningObfuscation) { + BytecodeViewer.showMessage("You're currently running an obfuscation task, wait for this to finish."); + return; + } + new RenameFields().start(); + workPane.refreshClass.doClick(); + cn.tree.updateUI(); + } + }); + + mnNewMenu_5.add(strongObf); + + mnNewMenu_5.add(lightObf); + + mnNewMenu_5.add(separator_2); + mntmNewMenuItem_8.setEnabled(false); + + mnNewMenu_5.add(mntmNewMenuItem_8); + + mnNewMenu_5.add(mntmNewMenuItem_6); + mntmNewMenuItem_7.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + if (BytecodeViewer.runningObfuscation) { + BytecodeViewer.showMessage("You're currently running an obfuscation task, wait for this to finish."); + return; + } + new RenameMethods().start(); + workPane.refreshClass.doClick(); + cn.tree.updateUI(); + } + }); + + mnNewMenu_5.add(mntmNewMenuItem_7); + mntmNewMenuItem_11.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + if (BytecodeViewer.runningObfuscation) { + BytecodeViewer.showMessage("You're currently running an obfuscation task, wait for this to finish."); + return; + } + new RenameClasses().start(); + workPane.refreshClass.doClick(); + cn.tree.updateUI(); + } + }); + + mnNewMenu_5.add(mntmNewMenuItem_11); + mntmNewMenuItem_9.setEnabled(false); + + mnNewMenu_5.add(mntmNewMenuItem_9); + mntmNewMenuItem_10.setEnabled(false); + + mnNewMenu_5.add(mntmNewMenuItem_10); + + menuBar.add(mnNewMenu_1); + mnNewMenu_1.add(mntmStartExternalPlugin); + mnNewMenu_1.add(separator_4); + mnNewMenu_1.add(mnRecentPlugins); + mnNewMenu_1.add(separator_5); + mntmCodeSequenceDiagram.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + if(BytecodeViewer.getLoadedClasses().isEmpty()) { + BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); + return; + } + PluginManager.runPlugin(new CodeSequenceDiagram()); + } + }); + + mnNewMenu_1.add(mntmCodeSequenceDiagram); + mnNewMenu_1.add(mntmNewMenuItem_1); + mnNewMenu_1.add(mntmShowMainMethods); + mnNewMenu_1.add(mntmShowAllStrings); + mntmReplaceStrings.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + if(BytecodeViewer.getLoadedClasses().isEmpty()) { + BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); + return; + } + new ReplaceStringsOptions().setVisible(true); + } + }); + + mnNewMenu_1.add(mntmReplaceStrings); + mnNewMenu_1.add(mntmNewMenuItem_2); + mnNewMenu_1.add(mntmStartZkmString); + mntmZstringarrayDecrypter.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + PluginManager.runPlugin(new ZStringArrayDecrypter()); + } + }); + + mnNewMenu_1.add(mntmZstringarrayDecrypter); + + menuBar.add(mntmNewMenuItem_4); + + mntmStartExternalPlugin.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(PluginManager.fileFilter()); + fc.setFileHidingEnabled(false); + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); + + if (returnVal == JFileChooser.APPROVE_OPTION) + try { + BytecodeViewer.viewer.setIcon(true); + BytecodeViewer.startPlugin(fc.getSelectedFile()); + BytecodeViewer.viewer.setIcon(false); + } catch (Exception e1) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); + } + } + }); + mntmStartZkmString.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + PluginManager.runPlugin(new ZKMStringDecrypter()); + } + }); + mntmNewMenuItem_2.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + PluginManager.runPlugin(new AllatoriStringDecrypter()); + } + }); + mntmNewMenuItem_1.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if(BytecodeViewer.getLoadedClasses().isEmpty()) { + BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); + return; + } + new MaliciousCodeScannerOptions().setVisible(true); + } + }); + mntmShowAllStrings.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + PluginManager.runPlugin(new ShowAllStrings()); + } + }); + + mntmShowMainMethods.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + PluginManager.runPlugin(new ShowMainMethods()); + } + }); + + setSize(new Dimension(800, 400)); + if(BytecodeViewer.previewCopy) + setTitle("Bytecode Viewer "+BytecodeViewer.version+" Preview - https://bytecodeviewer.com | https://the.bytecode.club - @Konloch"); + else + setTitle("Bytecode Viewer "+BytecodeViewer.version+" - https://bytecodeviewer.com | https://the.bytecode.club - @Konloch"); + + getContentPane().setLayout( + new BoxLayout(getContentPane(), BoxLayout.X_AXIS)); + + // scrollPane.setViewportView(tree); + cn.setMinimumSize(new Dimension(200, 50)); + // panel.add(cn); + SearchingPane s = new SearchingPane(this); + s.setPreferredSize(new Dimension(200, 50)); + s.setMinimumSize(new Dimension(200, 50)); + s.setMaximumSize(new Dimension(200, 2147483647)); + // panel.add(s); + sp1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cn, s); + // panel.add(sp1); + cn.setPreferredSize(new Dimension(200, 50)); + cn.setMaximumSize(new Dimension(200, 2147483647)); + sp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp1, workPane); + getContentPane().add(sp2); + sp2.setResizeWeight(0.05); + sp1.setResizeWeight(0.5); + rfComps.add(cn); + + rfComps.add(s); + rfComps.add(workPane); + + apkConversionGroup.add(apkConversionDex); + apkConversionGroup.add(apkConversionEnjarify); + apkConversionGroup.setSelected(apkConversionDex.getModel(), true); + + + panelGroup1.add(panel1None); + panelGroup1.add(panel1Proc); + panelGroup1.add(panel1CFR); + panelGroup1.add(panel1JDGUI); + panelGroup1.add(panel1Fern); + panelGroup1.add(panel1Krakatau); + panelGroup1.add(panel1KrakatauBytecode); + panelGroup1.add(panel1Smali); + panelGroup1.add(panel1Bytecode); + panelGroup1.add(panel1Hexcode); + + panelGroup2.add(panel2None); + panelGroup2.add(panel2Proc); + panelGroup2.add(panel2CFR); + panelGroup2.add(panel2JDGUI); + panelGroup2.add(panel2Fern); + panelGroup2.add(panel2Krakatau); + panelGroup2.add(panel2KrakatauBytecode); + panelGroup2.add(panel2Smali); + panelGroup2.add(panel2Bytecode); + panelGroup2.add(panel2Hexcode); + + panelGroup3.add(panel3None); + panelGroup3.add(panel3Proc); + panelGroup3.add(panel3CFR); + panelGroup3.add(panel3JDGUI); + panelGroup3.add(panel3Fern); + panelGroup3.add(panel3Krakatau); + panelGroup3.add(panel3KrakatauBytecode); + panelGroup3.add(panel3Smali); + panelGroup3.add(panel3Bytecode); + panelGroup3.add(panel3Hexcode); + mnNewMenu_6.add(separator_13); + fontSpinner.setPreferredSize(new Dimension(42, 20)); + fontSpinner.setSize(new Dimension(42, 20)); + fontSpinner.setModel(new SpinnerNumberModel(new Integer(12), new Integer(1), null, new Integer(1))); + mnNewMenu_6.add(mnFontSize); + + mnFontSize.add(fontSpinner); + + + panelGroup1.setSelected(panel1JDGUI.getModel(), true); + panelGroup2.setSelected(panel2Bytecode.getModel(), true); + panelGroup3.setSelected(panel3None.getModel(), true); + + this.setLocationRelativeTo(null); + } + + + @Override + public void openClassFile(final String name, final ClassNode cn) { + for (final VisibleComponent vc : rfComps) { + vc.openClassFile(name, cn); + } + } + + @Override + public void openFile(final String name, byte[] content) { + for (final VisibleComponent vc : rfComps) { + vc.openFile(name, content); + } + } + + @SuppressWarnings("unchecked") + public static T getComponent(final Class clazz) { + for (final VisibleComponent vc : rfComps) { + if (vc.getClass() == clazz) + return (T) vc; + } + return null; + } +} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/MaliciousCodeScannerOptions.java b/src/the/bytecode/club/bytecodeviewer/gui/MaliciousCodeScannerOptions.java similarity index 97% rename from src/main/java/the/bytecode/club/bytecodeviewer/gui/MaliciousCodeScannerOptions.java rename to src/the/bytecode/club/bytecodeviewer/gui/MaliciousCodeScannerOptions.java index a2d8a1af..3d4f0cfa 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/MaliciousCodeScannerOptions.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/MaliciousCodeScannerOptions.java @@ -1,13 +1,18 @@ package the.bytecode.club.bytecodeviewer.gui; +import javax.swing.JFrame; + +import java.awt.Dimension; + +import javax.swing.JCheckBox; +import javax.swing.JButton; + import the.bytecode.club.bytecodeviewer.Resources; import the.bytecode.club.bytecodeviewer.plugin.PluginManager; import the.bytecode.club.bytecodeviewer.plugin.preinstalled.MaliciousCodeScanner; -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * diff --git a/src/the/bytecode/club/bytecodeviewer/gui/PaneUpdaterThread.java b/src/the/bytecode/club/bytecodeviewer/gui/PaneUpdaterThread.java new file mode 100644 index 00000000..599b5437 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/gui/PaneUpdaterThread.java @@ -0,0 +1,37 @@ +package the.bytecode.club.bytecodeviewer.gui; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * Allows us to run a background thread + * + * @author Konloch + * + */ + +public abstract class PaneUpdaterThread extends Thread { + + public abstract void doShit(); + + @Override + public void run() { + doShit(); + } + +} \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/ReplaceStringsOptions.java b/src/the/bytecode/club/bytecodeviewer/gui/ReplaceStringsOptions.java similarity index 95% rename from src/main/java/the/bytecode/club/bytecodeviewer/gui/ReplaceStringsOptions.java rename to src/the/bytecode/club/bytecodeviewer/gui/ReplaceStringsOptions.java index af9498cc..7ff27eab 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/ReplaceStringsOptions.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/ReplaceStringsOptions.java @@ -1,13 +1,20 @@ package the.bytecode.club.bytecodeviewer.gui; +import java.awt.Dimension; + +import javax.swing.JFrame; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JTextField; + import the.bytecode.club.bytecodeviewer.Resources; import the.bytecode.club.bytecodeviewer.plugin.PluginManager; import the.bytecode.club.bytecodeviewer.plugin.preinstalled.ReplaceStrings; -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +import javax.swing.JCheckBox; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/RunOptions.java b/src/the/bytecode/club/bytecodeviewer/gui/RunOptions.java similarity index 97% rename from src/main/java/the/bytecode/club/bytecodeviewer/gui/RunOptions.java rename to src/the/bytecode/club/bytecodeviewer/gui/RunOptions.java index a866076f..39f41a26 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/RunOptions.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/RunOptions.java @@ -1,16 +1,26 @@ package the.bytecode.club.bytecodeviewer.gui; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.MethodNode; +import javax.swing.JFrame; + +import java.awt.Dimension; + +import javax.swing.JCheckBox; +import javax.swing.JButton; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Resources; import the.bytecode.club.bytecodeviewer.plugin.PluginManager; import the.bytecode.club.bytecodeviewer.plugin.preinstalled.EZInjection; -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +import javax.swing.JTextField; + +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.MethodNode; + +import javax.swing.JLabel; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * diff --git a/src/the/bytecode/club/bytecodeviewer/gui/SearchingPane.java b/src/the/bytecode/club/bytecodeviewer/gui/SearchingPane.java new file mode 100644 index 00000000..802c8e08 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/gui/SearchingPane.java @@ -0,0 +1,249 @@ +package the.bytecode.club.bytecodeviewer.gui; + +import java.awt.BorderLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreePath; + +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.*; +import the.bytecode.club.bytecodeviewer.searching.*; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * A pane dedicating to searching the loaded files. + * + * @author Konloch + * @author WaterWolf + * + */ + +@SuppressWarnings("rawtypes") +public class SearchingPane extends VisibleComponent { + + private static final long serialVersionUID = -1098524689236993932L; + + FileChangeNotifier fcn; + + JCheckBox exact = new JCheckBox("Exact"); + DefaultMutableTreeNode treeRoot = new DefaultMutableTreeNode("Root"); + JTree tree; + + SearchType searchType = null; + JComboBox searchRadiusBox; + + public JButton search = new JButton("Search"); + BackgroundSearchThread t = new BackgroundSearchThread(true) { + @Override + public void doSearch() { + // empty + } + + }; + + @SuppressWarnings("unchecked") + public SearchingPane(final FileChangeNotifier fcn) { + super("Search"); + + this.fcn = fcn; + + final JPanel optionPanel = new JPanel(new BorderLayout()); + + final JPanel searchRadiusOpt = new JPanel(new BorderLayout()); + + final JPanel searchOpts = new JPanel(new GridLayout(2, 1)); + + searchRadiusOpt.add(new JLabel("Search from "), BorderLayout.WEST); + + DefaultComboBoxModel model = new DefaultComboBoxModel(); + for (final SearchRadius st : SearchRadius.values()) { + model.addElement(st); + } + + searchRadiusBox = new JComboBox(model); + + searchRadiusOpt.add(searchRadiusBox, BorderLayout.CENTER); + + searchOpts.add(searchRadiusOpt); + + model = new DefaultComboBoxModel(); + for (final SearchType st : SearchType.values()) { + model.addElement(st); + } + + final JComboBox typeBox = new JComboBox(model); + final JPanel searchOptPanel = new JPanel(); + + final ItemListener il = new ItemListener() { + @Override + public void itemStateChanged(final ItemEvent arg0) { + searchOptPanel.removeAll(); + searchType = (SearchType) typeBox.getSelectedItem(); + searchOptPanel.add(searchType.details.getPanel()); + + searchOptPanel.revalidate(); + searchOptPanel.repaint(); + } + }; + + typeBox.addItemListener(il); + + typeBox.setSelectedItem(SearchType.LDC); + il.itemStateChanged(null); + + searchOpts.add(typeBox); + + optionPanel.add(searchOpts, BorderLayout.NORTH); + + JPanel p2 = new JPanel(); + p2.setLayout(new BorderLayout()); + p2.add(searchOptPanel, BorderLayout.NORTH); + p2.add(exact, BorderLayout.SOUTH); + + optionPanel.add(p2, BorderLayout.CENTER); + + search.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent arg0) { + treeRoot.removeAllChildren(); + searchType = (SearchType) typeBox.getSelectedItem(); + final SearchRadius radius = (SearchRadius) searchRadiusBox + .getSelectedItem(); + final SearchResultNotifier srn = new SearchResultNotifier() { + @Override + public void notifyOfResult(String debug) { + treeRoot.add(new DefaultMutableTreeNode(debug)); + } + }; + if (radius == SearchRadius.All_Classes) { + if (t.finished) { + t = new BackgroundSearchThread() { + @Override + public void doSearch() { + + try { + Pattern.compile(RegexInsnFinder.processRegex(RegexSearch.searchText.getText()), Pattern.MULTILINE); + } catch (PatternSyntaxException ex) { + BytecodeViewer.showMessage("You have an error in your regex syntax."); + } + + for (ClassNode cln : BytecodeViewer.getLoadedClasses()) + searchType.details.search(cln, srn, exact.isSelected()); + + MainViewerGUI.getComponent(SearchingPane.class).search.setEnabled(true); + MainViewerGUI.getComponent(SearchingPane.class).search.setText("Search"); + tree.expandPath(new TreePath(tree.getModel().getRoot())); + tree.updateUI(); + } + + }; + MainViewerGUI.getComponent(SearchingPane.class).search + .setEnabled(false); + MainViewerGUI.getComponent(SearchingPane.class).search + .setText("Searching, please wait.."); + t.start(); + } else { // this should really never be called. + BytecodeViewer + .showMessage("You currently have a search performing in the background, please wait for that to finish."); + } + } else if (radius == SearchRadius.Current_Class) { + final Viewer cv = MainViewerGUI.getComponent(WorkPane.class).getCurrentViewer(); + if (cv != null) { + searchType.details.search(cv.cn, srn, + exact.isSelected()); + } + } + } + }); + + optionPanel.add(search, BorderLayout.SOUTH); + + this.tree = new JTree(treeRoot); + + getContentPane().setLayout(new BorderLayout()); + + getContentPane().add(new JScrollPane(optionPanel), BorderLayout.NORTH); + getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER); + + this.tree.addTreeSelectionListener(new TreeSelectionListener() { + @Override + public void valueChanged(final TreeSelectionEvent arg0) { + String path = arg0.getPath().toString(); + + String className = path.split(", ")[1].split("\\.")[0]; + final ClassNode fN = BytecodeViewer.getClassNode(className); + if (fN != null) { + MainViewerGUI.getComponent(FileNavigationPane.class) + .openClassFileToWorkSpace(className+".class", fN); + } + + System.out.println(className); + } + }); + + this.setVisible(true); + + } + + public enum SearchType { + LDC(new LDCSearch()), Regex(new RegexSearch()), MethodCall( + new MethodCallSearch()), FieldCall(new FieldCallSearch()); + + public final SearchTypeDetails details; + + SearchType(final SearchTypeDetails details) { + this.details = details; + } + } + + public enum SearchRadius { + All_Classes, Current_Class; + } + + public void resetWorkspace() { + treeRoot.removeAllChildren(); + tree.updateUI(); + } + + @Override + public void openFile(String name, byte[] contents) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole.java b/src/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole.java similarity index 96% rename from src/main/java/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole.java rename to src/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole.java index f420880f..2f056f73 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/SystemErrConsole.java @@ -1,13 +1,16 @@ package the.bytecode.club.bytecodeviewer.gui; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.Resources; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JTextField; -import javax.swing.*; -import javax.swing.text.DefaultHighlighter; -import javax.swing.text.Highlighter; -import javax.swing.text.JTextComponent; -import java.awt.*; +import java.awt.Color; +import java.awt.Dimension; + +import javax.swing.JScrollPane; + +import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; @@ -16,6 +19,16 @@ import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; +import javax.swing.JTextArea; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.Resources; + +import javax.swing.JPanel; +import javax.swing.text.DefaultHighlighter; +import javax.swing.text.Highlighter; +import javax.swing.text.JTextComponent; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/TabbedPane.java b/src/the/bytecode/club/bytecodeviewer/gui/TabbedPane.java similarity index 91% rename from src/main/java/the/bytecode/club/bytecodeviewer/gui/TabbedPane.java rename to src/the/bytecode/club/bytecodeviewer/gui/TabbedPane.java index e1ca2261..acf87130 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/TabbedPane.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/TabbedPane.java @@ -1,9 +1,27 @@ package the.bytecode.club.bytecodeviewer.gui; -import javax.swing.*; +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.AbstractButton; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JTabbedPane; import javax.swing.plaf.basic.BasicButtonUI; -import java.awt.*; -import java.awt.event.*; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/Viewer.java b/src/the/bytecode/club/bytecodeviewer/gui/Viewer.java similarity index 86% rename from src/main/java/the/bytecode/club/bytecodeviewer/gui/Viewer.java rename to src/the/bytecode/club/bytecodeviewer/gui/Viewer.java index 783ca30c..f0263065 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/Viewer.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/Viewer.java @@ -1,9 +1,7 @@ package the.bytecode.club.bytecodeviewer.gui; +import javax.swing.JPanel; import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; - -import javax.swing.*; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -27,11 +25,7 @@ public abstract class Viewer extends JPanel { public ClassNode cn; public String name; - public String container; private static final long serialVersionUID = -2965538493489119191L; - public void updateName() { - this.setName(name + (BytecodeViewer.viewer.mnShowContainer.isSelected() ? "(" + container + ")" : "")); - } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/VisibleComponent.java b/src/the/bytecode/club/bytecodeviewer/gui/VisibleComponent.java similarity index 91% rename from src/main/java/the/bytecode/club/bytecodeviewer/gui/VisibleComponent.java rename to src/the/bytecode/club/bytecodeviewer/gui/VisibleComponent.java index c60c043f..2ec8e322 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/VisibleComponent.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/VisibleComponent.java @@ -1,9 +1,10 @@ package the.bytecode.club.bytecodeviewer.gui; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.FileChangeNotifier; +import javax.swing.JInternalFrame; -import javax.swing.*; +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.FileChangeNotifier; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -49,10 +50,10 @@ public abstract class VisibleComponent extends JInternalFrame implements } @Override - public void openClassFile(final String name, String container, final ClassNode cn) { + public void openClassFile(final String name, final ClassNode cn) { } @Override - public void openFile(final String name, String container, byte[] contents) { + public void openFile(final String name, byte[] contents) { } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/WorkPane.java b/src/the/bytecode/club/bytecodeviewer/gui/WorkPane.java similarity index 78% rename from src/main/java/the/bytecode/club/bytecodeviewer/gui/WorkPane.java rename to src/the/bytecode/club/bytecodeviewer/gui/WorkPane.java index 48c4dce8..f4ac4880 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/WorkPane.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/WorkPane.java @@ -1,19 +1,25 @@ package the.bytecode.club.bytecodeviewer.gui; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.FileChangeNotifier; - -import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import java.util.HashMap; +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.FileChangeNotifier; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -85,12 +91,10 @@ public class WorkPane extends VisibleComponent implements ActionListener { public void componentRemoved(final ContainerEvent e) { final Component c = e.getChild(); if (c instanceof ClassViewer) { - ClassViewer cv = (ClassViewer) c; - workingOn.remove(cv.container + "$" + cv.name); + workingOn.remove(((ClassViewer) c).name); } if (c instanceof FileViewer) { - FileViewer fv = (FileViewer) c; - workingOn.remove(fv.container + "$" + fv.name); + workingOn.remove(((FileViewer) c).name); } } @@ -108,45 +112,43 @@ public class WorkPane extends VisibleComponent implements ActionListener { int tabCount = 0; - public void addWorkingFile(final String name, String container, final ClassNode cn) { - String key = container + "$" + name; - if (!workingOn.containsKey(key)) { - final JPanel tabComp = new ClassViewer(name, container, cn); + public void addWorkingFile(final String name, final ClassNode cn) { + if (!workingOn.containsKey(name)) { + final JPanel tabComp = new ClassViewer(name, cn); tabs.add(tabComp); final int tabCount = tabs.indexOfComponent(tabComp); - workingOn.put(key, tabCount); - tabs.setTabComponentAt(tabCount, new TabbedPane(name, tabs)); + workingOn.put(name, tabCount); + tabs.setTabComponentAt(tabCount, new TabbedPane(name,tabs)); tabs.setSelectedIndex(tabCount); } else { - tabs.setSelectedIndex(workingOn.get(key)); + tabs.setSelectedIndex(workingOn.get(name)); } } - public void addFile(final String name, String container, byte[] contents) { + public void addFile(final String name, byte[] contents) { if(contents == null) //a directory return; - - String key = container + "$" + name; - if (!workingOn.containsKey(key)) { - final Component tabComp = new FileViewer(name, container, contents); + + if (!workingOn.containsKey(name)) { + final Component tabComp = new FileViewer(name, contents); tabs.add(tabComp); final int tabCount = tabs.indexOfComponent(tabComp); - workingOn.put(key, tabCount); - tabs.setTabComponentAt(tabCount, new TabbedPane(name, tabs)); + workingOn.put(name, tabCount); + tabs.setTabComponentAt(tabCount, new TabbedPane(name,tabs)); tabs.setSelectedIndex(tabCount); } else { - tabs.setSelectedIndex(workingOn.get(key)); + tabs.setSelectedIndex(workingOn.get(name)); } } @Override - public void openClassFile(final String name, String container, final ClassNode cn) { - addWorkingFile(name, container, cn); + public void openClassFile(final String name, final ClassNode cn) { + addWorkingFile(name, cn); } @Override - public void openFile(final String name, String container, byte[] content) { - addFile(name, container, content); + public void openFile(final String name, byte[] content) { + addFile(name, content); } public Viewer getCurrentViewer() { @@ -154,7 +156,7 @@ public class WorkPane extends VisibleComponent implements ActionListener { } public java.awt.Component[] getLoadedViewers() { - return tabs.getComponents(); + return (java.awt.Component[])tabs.getComponents(); } @Override @@ -191,9 +193,6 @@ public class WorkPane extends VisibleComponent implements ActionListener { } public void resetWorkspace() { - for (Component component : tabs.getComponents()) { - ((ClassViewer) component).reset(); - } tabs.removeAll(); tabs.updateUI(); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.java similarity index 100% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.java index 20ca5642..17c86d66 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.java +++ b/src/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.java @@ -1,10 +1,10 @@ package the.bytecode.club.bytecodeviewer.obfuscators; +import java.util.ArrayList; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.MiscUtils; -import java.util.ArrayList; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/RenameClasses.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/RenameClasses.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/RenameClasses.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/RenameClasses.java index 8727fa7b..f2968467 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/RenameClasses.java +++ b/src/the/bytecode/club/bytecodeviewer/obfuscators/RenameClasses.java @@ -1,6 +1,7 @@ package the.bytecode.club.bytecodeviewer.obfuscators; import org.objectweb.asm.tree.ClassNode; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.api.ASMUtil_OLD; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/RenameFields.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/RenameFields.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/RenameFields.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/RenameFields.java index 12303acb..42471d54 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/RenameFields.java +++ b/src/the/bytecode/club/bytecodeviewer/obfuscators/RenameFields.java @@ -2,6 +2,7 @@ package the.bytecode.club.bytecodeviewer.obfuscators; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.FieldNode; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.api.ASMUtil_OLD; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/RenameMethods.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/RenameMethods.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/RenameMethods.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/RenameMethods.java index 2718de8e..c81a056d 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/RenameMethods.java +++ b/src/the/bytecode/club/bytecodeviewer/obfuscators/RenameMethods.java @@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.obfuscators; import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodNode; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.api.ASMUtil_OLD; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/HookMap.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/HookMap.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/HookMap.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/HookMap.java index f1c347c7..91e35b04 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/HookMap.java +++ b/src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/HookMap.java @@ -1,12 +1,12 @@ package the.bytecode.club.bytecodeviewer.obfuscators.mapping; +import java.util.ArrayList; +import java.util.List; + import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.FieldMappingData; import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MappingData; import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MethodMappingData; -import java.util.ArrayList; -import java.util.List; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RefactorMapper.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RefactorMapper.java similarity index 92% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RefactorMapper.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RefactorMapper.java index deee50f3..b929185e 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RefactorMapper.java +++ b/src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RefactorMapper.java @@ -1,15 +1,16 @@ package the.bytecode.club.bytecodeviewer.obfuscators.mapping; -import org.objectweb.asm.commons.Remapper; -import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.FieldMappingData; -import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MappingData; -import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MethodMappingData; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.objectweb.asm.commons.Remapper; + +import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.FieldMappingData; +import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MappingData; +import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MethodMappingData; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -71,7 +72,7 @@ public class RefactorMapper extends Remapper { @Override public String map(String type) { if (sortedClasses.containsKey(type)) { - String map = type + " --> " + sortedClasses.get(type).getRefactoredName() + "\n"; + String map = new String(type + " --> " + sortedClasses.get(type).getRefactoredName() + "\n"); if (!mappingList.contains(map)) mappingList.add(map); @@ -84,7 +85,7 @@ public class RefactorMapper extends Remapper { public String mapFieldName(String owner, String name, String desc) { String obfKey = owner + "$$$$" + name + "$$$$" + desc; if (sortedFields.containsKey(obfKey)) { - String map = owner + "." + name + " --> " + owner + sortedFields.get(obfKey).getName().getRefactoredName() + "\n"; + String map = new String(owner + "." + name + " --> " + owner + sortedFields.get(obfKey).getName().getRefactoredName() + "\n"); if (!mappingList.contains(map)) mappingList.add(map); name = sortedFields.get(obfKey).getName().getRefactoredName(); @@ -96,7 +97,7 @@ public class RefactorMapper extends Remapper { public String mapMethodName(String owner, String name, String desc) { String obfKey = owner + "$$$$" + name + "$$$$" + desc; if (sortedMethods.containsKey(obfKey)) { - String map = owner + "." + name + " --> " + owner + sortedMethods.get(obfKey).getMethodName().getRefactoredName() + "\n"; + String map = new String(owner + "." + name + " --> " + owner + sortedMethods.get(obfKey).getMethodName().getRefactoredName() + "\n"); if (!mappingList.contains(map)) mappingList.add(map); name = sortedMethods.get(obfKey).getMethodName().getRefactoredName(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/Refactorer.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/Refactorer.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/Refactorer.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/Refactorer.java index 3dce375e..19659659 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/Refactorer.java +++ b/src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/Refactorer.java @@ -1,13 +1,14 @@ package the.bytecode.club.bytecodeviewer.obfuscators.mapping; +import java.util.HashMap; +import java.util.Map; + import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.commons.RemappingClassAdapter; import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import java.util.HashMap; -import java.util.Map; +import the.bytecode.club.bytecodeviewer.BytecodeViewer; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/FieldMappingData.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/FieldMappingData.java similarity index 100% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/FieldMappingData.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/FieldMappingData.java diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MappingData.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MappingData.java similarity index 100% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MappingData.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MappingData.java diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MethodMappingData.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MethodMappingData.java similarity index 100% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MethodMappingData.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/mapping/data/MethodMappingData.java diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameClasses.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameClasses.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameClasses.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameClasses.java index 3c3e0b73..97cc20f4 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameClasses.java +++ b/src/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameClasses.java @@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.obfuscators.rename; import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodNode; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.obfuscators.JavaObfuscator; import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MappingData; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameFields.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameFields.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameFields.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameFields.java index d79c286d..e3de6858 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameFields.java +++ b/src/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameFields.java @@ -2,6 +2,7 @@ package the.bytecode.club.bytecodeviewer.obfuscators.rename; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.FieldNode; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.obfuscators.JavaObfuscator; import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.FieldMappingData; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameMethods.java b/src/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameMethods.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameMethods.java rename to src/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameMethods.java index 6e8d6869..c2655360 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameMethods.java +++ b/src/the/bytecode/club/bytecodeviewer/obfuscators/rename/RenameMethods.java @@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.obfuscators.rename; import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodNode; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.obfuscators.JavaObfuscator; import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MappingData; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginLaunchStrategy.java b/src/the/bytecode/club/bytecodeviewer/plugin/PluginLaunchStrategy.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginLaunchStrategy.java rename to src/the/bytecode/club/bytecodeviewer/plugin/PluginLaunchStrategy.java index e607fa9d..277e44a3 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginLaunchStrategy.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/PluginLaunchStrategy.java @@ -1,9 +1,9 @@ package the.bytecode.club.bytecodeviewer.plugin; -import the.bytecode.club.bytecodeviewer.api.Plugin; - import java.io.File; +import the.bytecode.club.bytecodeviewer.api.Plugin; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginManager.java b/src/the/bytecode/club/bytecodeviewer/plugin/PluginManager.java similarity index 90% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginManager.java rename to src/the/bytecode/club/bytecodeviewer/plugin/PluginManager.java index 6e5e22ef..2e9bfd81 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginManager.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/PluginManager.java @@ -1,16 +1,21 @@ package the.bytecode.club.bytecodeviewer.plugin; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.MiscUtils; -import the.bytecode.club.bytecodeviewer.api.Plugin; -import the.bytecode.club.bytecodeviewer.plugin.strategies.*; - -import javax.swing.filechooser.FileFilter; import java.io.File; import java.util.HashMap; import java.util.Map; import java.util.Set; +import javax.swing.filechooser.FileFilter; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.MiscUtils; +import the.bytecode.club.bytecodeviewer.api.Plugin; +import the.bytecode.club.bytecodeviewer.plugin.strategies.CompiledJavaPluginLaunchStrategy; +import the.bytecode.club.bytecodeviewer.plugin.strategies.GroovyPluginLaunchStrategy; +import the.bytecode.club.bytecodeviewer.plugin.strategies.JavaPluginLaunchStrategy; +import the.bytecode.club.bytecodeviewer.plugin.strategies.PythonPluginLaunchStrategy; +import the.bytecode.club.bytecodeviewer.plugin.strategies.RubyPluginLaunchStrategy; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -61,10 +66,7 @@ public final class PluginManager { launchStrategies.put("rb", ruby); launchStrategies.put("ruby", ruby); } - - private PluginManager() { - } - + /** * Runs a new plugin instance * @param newPluginInstance the new plugin instance diff --git a/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java new file mode 100644 index 00000000..a2dbed53 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java @@ -0,0 +1,42 @@ +package the.bytecode.club.bytecodeviewer.plugin.preinstalled; + +import java.util.ArrayList; + +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.api.Plugin; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * Coming soon. + * + * @author Konloch + * + */ + +public class AllatoriStringDecrypter extends Plugin { + + @Override + public void execute(ArrayList classNodeList) { + BytecodeViewer.showMessage("This is a planned feature."); + } + +} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java similarity index 98% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java rename to src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java index 73f66eeb..442219eb 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java @@ -1,22 +1,26 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; -import com.mxgraph.swing.mxGraphComponent; -import com.mxgraph.view.mxGraph; +import java.awt.Font; +import java.awt.font.FontRenderContext; +import java.awt.geom.AffineTransform; +import java.util.ArrayList; + +import javax.swing.JFrame; +import javax.swing.UIManager; + import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodInsnNode; import org.objectweb.asm.tree.MethodNode; + +import com.mxgraph.swing.mxGraphComponent; +import com.mxgraph.view.mxGraph; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Resources; import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.gui.ClassViewer; -import javax.swing.*; -import java.awt.*; -import java.awt.font.FontRenderContext; -import java.awt.geom.AffineTransform; -import java.util.ArrayList; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java similarity index 97% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java rename to src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java index 559df832..3262fbc8 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java @@ -1,18 +1,23 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.*; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.api.BytecodeHook; -import the.bytecode.club.bytecodeviewer.api.Plugin; -import the.bytecode.club.bytecodeviewer.api.PluginConsole; -import the.bytecode.club.bytecodeviewer.gui.GraphicialReflectionKit; - import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.Method; import java.util.ArrayList; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldNode; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MethodNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.api.BytecodeHook; +import the.bytecode.club.bytecodeviewer.api.Plugin; +import the.bytecode.club.bytecodeviewer.api.PluginConsole; +import the.bytecode.club.bytecodeviewer.gui.GraphicialReflectionKit; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java similarity index 94% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java rename to src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java index 0bc76a7d..ab8d4a9d 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java @@ -1,13 +1,21 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; +import java.util.ArrayList; + import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.*; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldNode; +import org.objectweb.asm.tree.InsnList; +import org.objectweb.asm.tree.InsnNode; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MethodNode; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.api.PluginConsole; -import java.util.ArrayList; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java similarity index 95% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java rename to src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java index 634c85b9..de016c56 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java @@ -1,11 +1,17 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; -import org.objectweb.asm.tree.*; +import java.util.ArrayList; + +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldNode; +import org.objectweb.asm.tree.InsnList; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.MethodNode; + import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.api.PluginConsole; -import java.util.ArrayList; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java new file mode 100644 index 00000000..098aba90 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java @@ -0,0 +1,111 @@ +package the.bytecode.club.bytecodeviewer.plugin.preinstalled; + +import java.util.ArrayList; + +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldNode; +import org.objectweb.asm.tree.InsnList; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.MethodNode; + +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.api.Plugin; +import the.bytecode.club.bytecodeviewer.api.PluginConsole; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * Simply shows all the non-empty strings in every single class + * + * @author Konloch + * + */ + +public class ShowAllStrings extends Plugin { + + @Override + public void execute(ArrayList classNodeList) { + PluginConsole frame = new PluginConsole("Show All Strings"); + StringBuilder sb = new StringBuilder(); + for (ClassNode classNode : classNodeList) { + for (Object o : classNode.fields.toArray()) { + FieldNode f = (FieldNode) o; + Object v = f.value; + if (v instanceof String) { + String s = (String) v; + if (!s.isEmpty()) + sb.append(classNode.name + + "." + + f.name + + "" + + f.desc + + " -> \"" + + s.replaceAll("\\n", "\\\\n").replaceAll( + "\\r", "\\\\r") + "\"" + + BytecodeViewer.nl); + } + if (v instanceof String[]) { + for (int i = 0; i < ((String[]) v).length; i++) { + String s = ((String[]) v)[i]; + if (!s.isEmpty()) + sb.append(classNode.name + + "." + + f.name + + "" + + f.desc + + "[" + + i + + "] -> \"" + + s.replaceAll("\\n", "\\\\n").replaceAll( + "\\r", "\\\\r") + "\"" + + BytecodeViewer.nl); + } + } + } + + for (Object o : classNode.methods.toArray()) { + MethodNode m = (MethodNode) o; + + InsnList iList = m.instructions; + for (AbstractInsnNode a : iList.toArray()) { + if (a instanceof LdcInsnNode) { + if (((LdcInsnNode) a).cst instanceof String) { + final String s = (String) ((LdcInsnNode) a).cst; + if (!s.isEmpty()) + sb.append(classNode.name + + "." + + m.name + + "" + + m.desc + + " -> \"" + + s.replaceAll("\\n", "\\\\n") + .replaceAll("\\r", "\\\\r") + + "\"" + BytecodeViewer.nl); + } + } + } + } + } + + frame.appendText(sb.toString()); + frame.setVisible(true); + } + +} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java rename to src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java index b3d03d1f..744358bf 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java @@ -1,12 +1,13 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; +import java.util.ArrayList; + import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodNode; + import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.api.PluginConsole; -import java.util.ArrayList; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.java b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.java rename to src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.java index 86b74343..10c2baca 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.java @@ -1,6 +1,7 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; import org.objectweb.asm.tree.ClassNode; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.api.Plugin; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java similarity index 69% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java rename to src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java index 0383fcd1..e30cd6ed 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java @@ -1,16 +1,18 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; import org.objectweb.asm.tree.ClassNode; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.api.ExceptionUI; import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.api.PluginConsole; -import javax.swing.*; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; +import javax.swing.JDialog; +import javax.swing.JOptionPane; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -61,31 +63,28 @@ public class ZStringArrayDecrypter extends Plugin { if (result == 0) { boolean needsWarning = false; - try { - for (Class debug : the.bytecode.club.bytecodeviewer.api.BytecodeViewer.loadAllClassesIntoClassLoader()) { - try { - Field[] fields = debug.getDeclaredFields(); - for ( Field field : fields ) { - if ( field.getName().equals("z") ) { - out.append(debug.getName() + ":" + BytecodeViewer.nl); - field.setAccessible(true); - if(field.get(null) != null && field.get(null) instanceof String[] && Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers())) { - String[] fieldVal = (String[]) field.get(null); - for ( int i = 0; i < fieldVal.length; i++ ) { - out.append(" z[" + i + "] = " + fieldVal[i] + BytecodeViewer.nl); - } + for (Class debug : the.bytecode.club.bytecodeviewer.api.BytecodeViewer.loadClassesIntoClassLoader()) { + try { + Field[] fields = debug.getDeclaredFields(); + for ( Field field : fields ) { + if ( field.getName().equals("z") ) { + out.append(debug.getName() + ":" + BytecodeViewer.nl); + field.setAccessible(true); + if(field.get(null) != null && field.get(null) instanceof String[] && Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers())) { + String[] fieldVal = (String[]) field.get(null); + for ( int i = 0; i < fieldVal.length; i++ ) { + out.append(" z[" + i + "] = " + fieldVal[i] + BytecodeViewer.nl); } - } - } - } catch(NoClassDefFoundError | Exception e) { - System.err.println("Failed loading class " + debug.getName()); - e.printStackTrace(); - needsWarning = true; - } - } - } catch (Exception e){ - new ExceptionUI(e); - } + } + } + } + } catch(NoClassDefFoundError | Exception e) { + System.err.println("Failed loading class " + debug.getName()); + e.printStackTrace(); + needsWarning = true; + } + } + if(needsWarning) { BytecodeViewer.showMessage("Some classes failed to decrypt, if you'd like to decrypt all of them"+BytecodeViewer.nl+"makes sure you include ALL the libraries it requires."); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java rename to src/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java index 7b7cfd58..f1588a73 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java @@ -1,11 +1,5 @@ package the.bytecode.club.bytecodeviewer.plugin.strategies; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.JarUtils; -import the.bytecode.club.bytecodeviewer.api.Plugin; -import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; - import java.io.File; import java.io.FileInputStream; import java.util.HashMap; @@ -15,6 +9,13 @@ import java.util.Set; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.tree.ClassNode; + +import the.bytecode.club.bytecodeviewer.JarUtils; +import the.bytecode.club.bytecodeviewer.api.Plugin; +import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.java b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.java rename to src/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.java index c763c300..908306f6 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.java @@ -1,14 +1,15 @@ package the.bytecode.club.bytecodeviewer.plugin.strategies; -import the.bytecode.club.bytecodeviewer.api.Plugin; -import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; - -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; import java.io.File; import java.io.FileReader; import java.io.Reader; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; + +import the.bytecode.club.bytecodeviewer.api.Plugin; +import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java similarity index 95% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java rename to src/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java index 40642b7c..c82f7846 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java @@ -1,12 +1,14 @@ package the.bytecode.club.bytecodeviewer.plugin.strategies; -import org.apache.commons.io.FileUtils; +import java.io.File; + +import me.konloch.kontainer.io.DiskReader; + import org.codehaus.janino.SimpleCompiler; + import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; -import java.io.File; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -36,7 +38,7 @@ public class JavaPluginLaunchStrategy implements PluginLaunchStrategy { @Override public Plugin run(File file) throws Throwable { - compiler.cook(FileUtils.readFileToString(file, "UTF-8")); + compiler.cook(DiskReader.loadAsString(file.getAbsolutePath())); System.out.println(file.getName().substring(0,(int)(file.getName().length()-(".java".length())))); Class clazz = (Class) Class.forName( diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.java b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.java rename to src/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.java index 6e07e1c4..faf70d96 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.java @@ -1,14 +1,15 @@ package the.bytecode.club.bytecodeviewer.plugin.strategies; -import the.bytecode.club.bytecodeviewer.api.Plugin; -import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; - -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; import java.io.File; import java.io.FileReader; import java.io.Reader; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; + +import the.bytecode.club.bytecodeviewer.api.Plugin; +import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java similarity index 99% rename from src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java rename to src/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java index 125a7135..274076e6 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java @@ -1,14 +1,15 @@ package the.bytecode.club.bytecodeviewer.plugin.strategies; -import the.bytecode.club.bytecodeviewer.api.Plugin; -import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; - -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; import java.io.File; import java.io.FileReader; import java.io.Reader; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; + +import the.bytecode.club.bytecodeviewer.api.Plugin; +import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/BackgroundSearchThread.java b/src/the/bytecode/club/bytecodeviewer/searching/BackgroundSearchThread.java similarity index 100% rename from src/main/java/the/bytecode/club/bytecodeviewer/searching/BackgroundSearchThread.java rename to src/the/bytecode/club/bytecodeviewer/searching/BackgroundSearchThread.java diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.java b/src/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.java similarity index 92% rename from src/main/java/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.java rename to src/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.java index 7444bd44..46256346 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.java +++ b/src/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.java @@ -1,14 +1,22 @@ package the.bytecode.club.bytecodeviewer.searching; -import eu.bibl.banalysis.asm.desc.OpcodeInfo; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.*; - -import javax.swing.*; -import java.awt.*; +import java.awt.GridLayout; import java.util.Iterator; import java.util.ListIterator; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import org.objectweb.asm.Type; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldInsnNode; +import org.objectweb.asm.tree.InsnList; +import org.objectweb.asm.tree.MethodNode; + +import eu.bibl.banalysis.asm.desc.OpcodeInfo; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/LDCSearch.java b/src/the/bytecode/club/bytecodeviewer/searching/LDCSearch.java similarity index 90% rename from src/main/java/the/bytecode/club/bytecodeviewer/searching/LDCSearch.java rename to src/the/bytecode/club/bytecodeviewer/searching/LDCSearch.java index 2ce410ca..9d0c6123 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/searching/LDCSearch.java +++ b/src/the/bytecode/club/bytecodeviewer/searching/LDCSearch.java @@ -1,13 +1,21 @@ package the.bytecode.club.bytecodeviewer.searching; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.*; - -import javax.swing.*; -import java.awt.*; +import java.awt.GridLayout; import java.util.Iterator; import java.util.ListIterator; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import org.objectweb.asm.Type; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldNode; +import org.objectweb.asm.tree.InsnList; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.MethodNode; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.java b/src/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.java similarity index 92% rename from src/main/java/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.java rename to src/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.java index ce303bcd..ad80b671 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.java +++ b/src/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.java @@ -1,14 +1,22 @@ package the.bytecode.club.bytecodeviewer.searching; -import eu.bibl.banalysis.asm.desc.OpcodeInfo; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.*; - -import javax.swing.*; -import java.awt.*; +import java.awt.GridLayout; import java.util.Iterator; import java.util.ListIterator; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import org.objectweb.asm.Type; +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.InsnList; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MethodNode; + +import eu.bibl.banalysis.asm.desc.OpcodeInfo; + /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.java b/src/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.java new file mode 100644 index 00000000..4f32b671 --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.java @@ -0,0 +1,423 @@ +package the.bytecode.club.bytecodeviewer.searching; + +import java.rmi.UnexpectedException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; + +import org.objectweb.asm.tree.AbstractInsnNode; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldInsnNode; +import org.objectweb.asm.tree.IincInsnNode; +import org.objectweb.asm.tree.InsnList; +import org.objectweb.asm.tree.IntInsnNode; +import org.objectweb.asm.tree.LdcInsnNode; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MethodNode; +import org.objectweb.asm.tree.MultiANewArrayInsnNode; +import org.objectweb.asm.tree.TypeInsnNode; +import org.objectweb.asm.tree.VarInsnNode; + +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +/** + * An instruction finder that finds regex patterns in a method's instruction + * list and returns an array with the found instructions. + * + * @author Frédéric Hannes + * + */ + +public class RegexInsnFinder { + + private static String[] opcodes = new String[] { "NOP", "ACONST_NULL", + "ICONST_M1", "ICONST_0", "ICONST_1", "ICONST_2", "ICONST_3", + "ICONST_4", "ICONST_5", "LCONST_0", "LCONST_1", "FCONST_0", + "FCONST_1", "FCONST_2", "DCONST_0", "DCONST_1", "BIPUSH", "SIPUSH", + "LDC", "LDC_W", "LDC2_W", "ILOAD", "LLOAD", "FLOAD", "DLOAD", + "ALOAD", "ILOAD_0", "ILOAD_1", "ILOAD_2", "ILOAD_3", "LLOAD_0", + "LLOAD_1", "LLOAD_2", "LLOAD_3", "FLOAD_0", "FLOAD_1", "FLOAD_2", + "FLOAD_3", "DLOAD_0", "DLOAD_1", "DLOAD_2", "DLOAD_3", "ALOAD_0", + "ALOAD_1", "ALOAD_2", "ALOAD_3", "IALOAD", "LALOAD", "FALOAD", + "DALOAD", "AALOAD", "BALOAD", "CALOAD", "SALOAD", "ISTORE", + "LSTORE", "FSTORE", "DSTORE", "ASTORE", "ISTORE_0", "ISTORE_1", + "ISTORE_2", "ISTORE_3", "LSTORE_0", "LSTORE_1", "LSTORE_2", + "LSTORE_3", "FSTORE_0", "FSTORE_1", "FSTORE_2", "FSTORE_3", + "DSTORE_0", "DSTORE_1", "DSTORE_2", "DSTORE_3", "ASTORE_0", + "ASTORE_1", "ASTORE_2", "ASTORE_3", "IASTORE", "LASTORE", + "FASTORE", "DASTORE", "AASTORE", "BASTORE", "CASTORE", "SASTORE", + "POP", "POP2", "DUP", "DUP_X1", "DUP_X2", "DUP2", "DUP2_X1", + "DUP2_X2", "SWAP", "IADD", "LADD", "FADD", "DADD", "ISUB", "LSUB", + "FSUB", "DSUB", "IMUL", "LMUL", "FMUL", "DMUL", "IDIV", "LDIV", + "FDIV", "DDIV", "IREM", "LREM", "FREM", "DREM", "INEG", "LNEG", + "FNEG", "DNEG", "ISHL", "LSHL", "ISHR", "LSHR", "IUSHR", "LUSHR", + "IAND", "LAND", "IOR", "LOR", "IXOR", "LXOR", "IINC", "I2L", "I2F", + "I2D", "L2I", "L2F", "L2D", "F2I", "F2L", "F2D", "D2I", "D2L", + "D2F", "I2B", "I2C", "I2S", "LCMP", "FCMPL", "FCMPG", "DCMPL", + "DCMPG", "IFEQ", "IFNE", "IFLT", "IFGE", "IFGT", "IFLE", + "IF_ICMPEQ", "IF_ICMPNE", "IF_ICMPLT", "IF_ICMPGE", "IF_ICMPGT", + "IF_ICMPLE", "IF_ACMPEQ", "IF_ACMPNE", "GOTO", "JSR", "RET", + "TABLESWITCH", "LOOKUPSWITCH", "IRETURN", "LRETURN", "FRETURN", + "DRETURN", "ARETURN", "RETURN", "GETSTATIC", "PUTSTATIC", + "GETFIELD", "PUTFIELD", "INVOKEVIRTUAL", "INVOKESPECIAL", + "INVOKESTATIC", "INVOKEINTERFACE", "INVOKEDYNAMIC", "NEW", + "NEWARRAY", "ANEWARRAY", "ARRAYLENGTH", "ATHROW", "CHECKCAST", + "INSTANCEOF", "MONITORENTER", "MONITOREXIT", "WIDE", + "MULTIANEWARRAY", "IFNULL", "IFNONNULL", "GOTO_W", "JSR_W" }; + + private static String[] opcodesVar = new String[] { "ILOAD", "LLOAD", + "FLOAD", "DLOAD", "ALOAD", "ISTORE", "LSTORE", "FSTORE", "DSTORE", + "ASTORE", "RET" }; + private static String opcodeVars = buildRegexItems(opcodesVar); + + private static String[] opcodesInt = new String[] { "BIPUSH", "SIPUSH", + "NEWARRAY" }; + private static String opcodesInts = buildRegexItems(opcodesInt); + + private static String[] opcodesField = new String[] { "GETSTATIC", + "PUTSTATIC", "GETFIELD", "PUTFIELD" }; + private static String opcodesFields = buildRegexItems(opcodesField); + + private static String[] opcodesMethod = new String[] { "INVOKEVIRTUAL", + "INVOKESPECIAL", "INVOKESTATIC", "INVOKEINTERFACE", "INVOKEDYNAMIC" }; + private static String opcodesMethods = buildRegexItems(opcodesMethod); + + private static String[] opcodesType = new String[] { "NEW", "ANEWARRAY", + "ARRAYLENGTH", "CHECKCAST", "INSTANCEOF" }; + private static String opcodesTypes = buildRegexItems(opcodesType); + + private static String[] opcodesIf = new String[] { "IFEQ", "IFNE", "IFLT", + "IFGE", "IFGT", "IFLE", "IF_ICMPEQ", "IF_ICMPNE", "IF_ICMPLT", + "IF_ICMPGE", "IF_ICMPGT", "IF_ICMPLE", "IF_ACMPEQ", "IF_ACMPNE" }; + private static String opcodesIfs = buildRegexItems(opcodesIf, false, false); + + private static String[] opcodesAny = new String[] { "NOP", "ACONST_NULL", + "ICONST_M1", "ICONST_0", "ICONST_1", "ICONST_2", "ICONST_3", + "ICONST_4", "ICONST_5", "LCONST_0", "LCONST_1", "FCONST_0", + "FCONST_1", "FCONST_2", "DCONST_0", "DCONST_1", "BIPUSH", "SIPUSH", + "LDC", "LDC_W", "LDC2_W", "ILOAD", "LLOAD", "FLOAD", "DLOAD", + "ALOAD", "IALOAD", "LALOAD", "FALOAD", "DALOAD", "AALOAD", + "BALOAD", "CALOAD", "SALOAD", "ISTORE", "LSTORE", "FSTORE", + "DSTORE", "ASTORE", "IASTORE", "LASTORE", "FASTORE", "DASTORE", + "AASTORE", "BASTORE", "CASTORE", "SASTORE", "POP", "POP2", "DUP", + "DUP_X1", "DUP_X2", "DUP2", "DUP2_X1", "DUP2_X2", "SWAP", "IADD", + "LADD", "FADD", "DADD", "ISUB", "LSUB", "FSUB", "DSUB", "IMUL", + "LMUL", "FMUL", "DMUL", "IDIV", "LDIV", "FDIV", "DDIV", "IREM", + "LREM", "FREM", "DREM", "INEG", "LNEG", "FNEG", "DNEG", "ISHL", + "LSHL", "ISHR", "LSHR", "IUSHR", "LUSHR", "IAND", "LAND", "IOR", + "LOR", "IXOR", "LXOR", "IINC", "I2L", "I2F", "I2D", "L2I", "L2F", + "L2D", "F2I", "F2L", "F2D", "D2I", "D2L", "D2F", "I2B", "I2C", + "I2S", "LCMP", "FCMPL", "FCMPG", "DCMPL", "DCMPG", "IFEQ", "IFNE", + "IFLT", "IFGE", "IFGT", "IFLE", "IF_ICMPEQ", "IF_ICMPNE", + "IF_ICMPLT", "IF_ICMPGE", "IF_ICMPGT", "IF_ICMPLE", "IF_ACMPEQ", + "IF_ACMPNE", "GOTO", "JSR", "RET", "TABLESWITCH", "LOOKUPSWITCH", + "IRETURN", "LRETURN", "FRETURN", "DRETURN", "ARETURN", "RETURN", + "GETSTATIC", "PUTSTATIC", "GETFIELD", "PUTFIELD", "INVOKEVIRTUAL", + "INVOKESPECIAL", "INVOKESTATIC", "INVOKEINTERFACE", + "INVOKEDYNAMIC", "NEW", "NEWARRAY", "ANEWARRAY", "ARRAYLENGTH", + "ATHROW", "CHECKCAST", "INSTANCEOF", "MONITORENTER", "MONITOREXIT", + "MULTIANEWARRAY", "IFNULL", "IFNONNULL" }; + private static String opcodesAnys = buildRegexItems(opcodesAny, false, + false); + + private static String buildRegexItems(final String[] items, + final boolean capture, final boolean stdRepl) { + if (items.length == 0) + return "()"; + String result = (stdRepl ? "\\b" : "") + "(" + (capture ? "" : "?:") + + items[0]; + for (int i = 1; i < items.length; i++) { + result += "|" + items[i]; + } + result += ")"; + return result; + } + + private static String buildRegexItems(final String[] items) { + return buildRegexItems(items, true, true); + } + + public static String processRegex(final String regex) { + String result = regex.trim(); + result = result.replaceAll("\\bANYINSN *", opcodesAnys); + result = result.replaceAll(opcodesInts + + "\\\\\\{\\s*(\\d+)\\s*\\\\\\} *", "$1\\\\{$2\\\\} "); + result = result.replaceAll(opcodesInts + " *", "$1\\\\{\\\\d+\\\\} "); + result = result.replaceAll( + "\\bLDC\\\\\\{(.*?)\\\\\\}(? il = new ArrayList(); + + final Iterator iIt = insnList.iterator(); + while (iIt.hasNext()) { + final AbstractInsnNode node = iIt.next(); + if (node.opcode() >= 0) { + il.add(node); + } + } + return il.toArray(new AbstractInsnNode[il.size()]); + } + + /** + * Refreshes the internal instruction list when you have made changes to the + * method. + */ + public void refresh() { + origInstructions = cleanInsn(mn.instructions); + final List il = new ArrayList(); + for (final AbstractInsnNode ain : mn.instructions.toArray()) + if (ain.opcode() >= 0) { + il.add(ain); + } + instructions = il.toArray(new AbstractInsnNode[il.size()]); + offsets = new int[instructions.length]; + insnString = ""; + for (int i = 0; i < instructions.length; i++) { + offsets[i] = -1; + final AbstractInsnNode ain = instructions[i]; + if (ain.opcode() >= 0) { + if (ain.opcode() >= opcodes.length) { + try { + throw new UnexpectedException( + "Unknown opcode encountered: " + + ain.opcode()); + } catch (final UnexpectedException e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + offsets[i] = insnString.length(); + insnString += opcodes[ain.opcode()]; + switch (ain.type()) { + case AbstractInsnNode.INT_INSN: + final IntInsnNode iin = (IntInsnNode) ain; + insnString += "{" + iin.operand + "}"; + break; + case AbstractInsnNode.LDC_INSN: + final LdcInsnNode lin = (LdcInsnNode) ain; + insnString += "{" + lin.cst.toString().replace("}", "\\}") + + "}"; + break; + case AbstractInsnNode.VAR_INSN: + final VarInsnNode vin = (VarInsnNode) ain; + insnString += "_" + vin.var; + break; + case AbstractInsnNode.IINC_INSN: + final IincInsnNode iiin = (IincInsnNode) ain; + insnString += "{" + iiin.var + "," + iiin.incr + "}"; + break; + case AbstractInsnNode.FIELD_INSN: + final FieldInsnNode fin = (FieldInsnNode) ain; + insnString += "{" + fin.desc + "," + fin.owner + "," + + fin.name + "}"; + break; + case AbstractInsnNode.METHOD_INSN: + final MethodInsnNode min = (MethodInsnNode) ain; + insnString += "{" + min.desc + "," + min.owner + "," + + min.name + "}"; + break; + case AbstractInsnNode.TYPE_INSN: + final TypeInsnNode tin = (TypeInsnNode) ain; + insnString += "{" + tin.desc + "}"; + break; + case AbstractInsnNode.MULTIANEWARRAY_INSN: + final MultiANewArrayInsnNode manain = (MultiANewArrayInsnNode) ain; + insnString += "{" + manain.dims + "," + manain.desc + "}"; + break; + } + insnString += " "; + } + } + } + + public void setMethod(final ClassNode ci, final MethodNode mi) { + this.mn = mi; + refresh(); + } + + private AbstractInsnNode[] makeResult(final int start, final int end) { + int startIndex = 0; + int endIndex = -1; + for (int i = 0; i < offsets.length - 1; i++) { + final int offset = offsets[i]; + if (offset == start) { + startIndex = i; + } + if ((offset < end) && (offsets[i + 1] >= end)) { + endIndex = i; + break; + } + } + if (endIndex == -1) { + endIndex = offsets.length - 1; + } + final int length = endIndex - startIndex + 1; + final AbstractInsnNode[] result = new AbstractInsnNode[length]; + System.arraycopy(origInstructions, startIndex, result, 0, length); + return result; + } + + /** + * Searches for a regex in the instruction list and returns the first match. + * + * @param regex + * the regular expression + * @return the matching instructions + */ + public AbstractInsnNode[] find(final String regex) { + try { + final Matcher regexMatcher = Pattern.compile(processRegex(regex), + Pattern.MULTILINE).matcher(insnString); + if (regexMatcher.find()) + return makeResult(regexMatcher.start(), regexMatcher.end()); + } catch (final PatternSyntaxException ex) { + //ignore, they fucked up regex + } + return new AbstractInsnNode[0]; + } + + /** + * Searches a regex in an instruction list and returns all matches. + * + * @param regex + * the regular expression + * @return a list with all sets of matching instructions + */ + public List findAll(final String regex) { + final List results = new ArrayList(); + try { + final Matcher regexMatcher = Pattern.compile(processRegex(regex), + Pattern.MULTILINE).matcher(insnString); + while (regexMatcher.find()) { + results.add(makeResult(regexMatcher.start(), regexMatcher.end())); + } + } catch (final PatternSyntaxException ex) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex); + } + return results; + } + + /** + * Searches for a regex in the instruction list and returns all groups for + * the first match. + * + * @param regex + * the regular expression + * @return the groups with matching instructions + */ + public AbstractInsnNode[][] findGroups(final String regex) { + try { + final Matcher regexMatcher = Pattern.compile(processRegex(regex), + Pattern.MULTILINE).matcher(insnString); + if (regexMatcher.find()) { + final AbstractInsnNode[][] result = new AbstractInsnNode[regexMatcher + .groupCount() + 1][0]; + for (int i = 0; i <= regexMatcher.groupCount(); i++) { + result[i] = makeResult(regexMatcher.start(i), + regexMatcher.end(i)); + } + return result; + } + } catch (final PatternSyntaxException ex) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex); + } + return new AbstractInsnNode[0][0]; + } + + /** + * Searches for a regex in the instruction list and returns all groups for + * all matches. + * + * @param regex + * the regular expression + * @return a list with all sets of groups with matching instructions + */ + public List findAllGroups(final String regex) { + final List results = new ArrayList(); + try { + final Matcher regexMatcher = Pattern.compile(processRegex(regex), + Pattern.MULTILINE).matcher(insnString); + if (regexMatcher.find()) { + final AbstractInsnNode[][] result = new AbstractInsnNode[regexMatcher + .groupCount() + 1][0]; + for (int i = 0; i <= regexMatcher.groupCount(); i++) { + result[i] = makeResult(regexMatcher.start(i), + regexMatcher.end(i)); + } + results.add(result); + } + } catch (final PatternSyntaxException ex) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex); + } + return results; + } + +} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/RegexSearch.java b/src/the/bytecode/club/bytecodeviewer/searching/RegexSearch.java similarity index 96% rename from src/main/java/the/bytecode/club/bytecodeviewer/searching/RegexSearch.java rename to src/the/bytecode/club/bytecodeviewer/searching/RegexSearch.java index bb07f009..366cab77 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/searching/RegexSearch.java +++ b/src/the/bytecode/club/bytecodeviewer/searching/RegexSearch.java @@ -1,13 +1,16 @@ package the.bytecode.club.bytecodeviewer.searching; +import java.awt.GridLayout; +import java.util.Iterator; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + import org.objectweb.asm.Type; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodNode; -import javax.swing.*; -import java.awt.*; -import java.util.Iterator; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/SearchResultNotifier.java b/src/the/bytecode/club/bytecodeviewer/searching/SearchResultNotifier.java similarity index 100% rename from src/main/java/the/bytecode/club/bytecodeviewer/searching/SearchResultNotifier.java rename to src/the/bytecode/club/bytecodeviewer/searching/SearchResultNotifier.java diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/SearchTypeDetails.java b/src/the/bytecode/club/bytecodeviewer/searching/SearchTypeDetails.java similarity index 98% rename from src/main/java/the/bytecode/club/bytecodeviewer/searching/SearchTypeDetails.java rename to src/the/bytecode/club/bytecodeviewer/searching/SearchTypeDetails.java index bda74a15..b9e95acc 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/searching/SearchTypeDetails.java +++ b/src/the/bytecode/club/bytecodeviewer/searching/SearchTypeDetails.java @@ -1,8 +1,8 @@ package the.bytecode.club.bytecodeviewer.searching; -import org.objectweb.asm.tree.ClassNode; +import javax.swing.JPanel; -import javax.swing.*; +import org.objectweb.asm.tree.ClassNode; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *