diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..82fe233b6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +*/target/* +target/* +*/build +build +*/.project +*/.classpath +*/.* + +.* +*.bak +*.orig +*/nb-configuration.xml +*.iml +*.ipr +*.iws +*~ +*.class + +!.gitignore diff --git a/.hgignore b/.hgignore index 7c02fcce5..cbf0f46d2 100644 --- a/.hgignore +++ b/.hgignore @@ -16,3 +16,4 @@ build *.iws *~ +!.gitignore diff --git a/README.md b/README.md index 4efe17a79..160ea63cd 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,32 @@ # dex2jar +

+ +

+ This is [Nico Mexis'](https://github.com/ThexXTURBOXx) fork of the dex2jar project which aims to fix most issues. # Downloads -**To download latest builds, head to the [Releases](https://github.com/ThexXTURBOXx/dex2jar/releases).** - -**Note: the builds in [Releases](https://github.com/ThexXTURBOXx/dex2jar/releases) are automatically built by GitHub Actions.** - -**Project moved to [SourceForge](https://sourceforge.net/p/dex2jar) and [Bitbucket](https://bitbucket.org/pxb1988/dex2jar) and [Github](https://github.com/pxb1988/dex2jar)** -| _ | Mirror | Wiki | Downloads | Issues | -|--:|:-----|:----:|:---------:|:------:| -| sf | https://sourceforge.net/p/dex2jar | [Wiki](https://sourceforge.net/p/dex2jar/wiki) | [Downloads](https://sourceforge.net/projects/dex2jar/files/) | [Tickets](https://sourceforge.net/p/dex2jar/tickets/) | -| bb | https://bitbucket.org/pxb1988/dex2jar | [Wiki](https://bitbucket.org/pxb1988/dex2jar/wiki) | [Downloads](https://bitbucket.org/pxb1988/dex2jar/downloads) | [Issues](https://bitbucket.org/pxb1988/dex2jar/issues) | -| gh | https://github.com/pxb1988/dex2jar | [Wiki](https://github.com/pxb1988/dex2jar/wiki) | [Releases](https://github.com/pxb1988/dex2jar/releases) | [Issues](https://github.com/pxb1988/dex2jar/issues) | -| gc | https://code.google.com/p/dex2jar | [old](http://code.google.com/p/dex2jar/w/list) | [old](http://code.google.com/p/dex2jar/downloads/list) | [old](http://code.google.com/p/dex2jar/issues/list)| +**To download the latest builds, head to the [Releases](https://github.com/ThexXTURBOXx/dex2jar/releases).** +**Note: the builds in [Releases](https://github.com/ThexXTURBOXx/dex2jar/releases) are automatically built by GitHub +Actions.** -[![Build Status](https://travis-ci.org/ThexXTURBOXx/dex2jar.svg?branch=2.x)](https://travis-ci.org/ThexXTURBOXx/dex2jar) Tools to work with android .dex and java .class files 1. dex-reader/writer: - Read/write the Dalvik Executable (.dex) file. It has a [light weight API similar with ASM](https://sourceforge.net/p/dex2jar/wiki/Faq#markdown-header-want-to-read-dex-file-using-dex2jar). + Read/write the Dalvik Executable (.dex) file. It has + a [light weight API similar with ASM](https://sourceforge.net/p/dex2jar/wiki/Faq#markdown-header-want-to-read-dex-file-using-dex2jar) + . 2. d2j-dex2jar: - Convert .dex file to .class files (zipped as jar) + Convert .dex file to .class files (zipped as jar) 3. smali/baksmali: - disassemble dex to smali files and assemble dex from smali files. different implementation to [smali/baksmali](http://code.google.com/p/smali), same syntax, but we support escape in type desc "Lcom/dex2jar\t\u1234;" + disassemble dex to smali files and assemble dex from smali files. different implementation + to [smali/baksmali](http://code.google.com/p/smali), same syntax, but we support escape in type desc " + Lcom/dex2jar\t\u1234;" 4. other tools: - [d2j-decrypt-string](https://sourceforge.net/p/dex2jar/wiki/DecryptStrings) + [d2j-decrypt-string](https://sourceforge.net/p/dex2jar/wiki/DecryptStrings) ## Usage @@ -38,15 +37,19 @@ Tools to work with android .dex and java .class files ### Example usage: -> sh d2j-dex2jar.sh -f ~/path/to/apk_to_decompile.apk +```shell +sh d2j-dex2jar.sh -f ~/path/to/apk_to_decompile.apk +``` And the output file will be `apk_to_decompile-dex2jar.jar`. ## Need help ? -send email to dex2jar@googlegroups.com + +send email to dex2jar@googlegroups.com or post on issue trackers list above. ## License + [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) diff --git a/build.gradle b/build.gradle index 60d01377d..3de86c5bf 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,7 @@ subprojects { compileJava.options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" dependencies { - testImplementation group: 'junit', name: 'junit', version: '4.11' + testImplementation group: 'junit', name: 'junit', version: '4.13.2' implementation fileTree(dir: 'libs', include: '*.jar') } diff --git a/d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/BaseCmd.java b/d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/BaseCmd.java index 8c99ebd60..e2788bb5e 100644 --- a/d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/BaseCmd.java +++ b/d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/BaseCmd.java @@ -1,13 +1,13 @@ /* * dex2jar - Tools to work with android .dex and java .class files * Copyright (c) 2009-2012 Panxiaobo - * + * * 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. @@ -27,10 +27,20 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.nio.charset.StandardCharsets; -import java.nio.file.*; +import java.nio.file.FileSystem; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.spi.FileSystemProvider; -import java.util.*; +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 java.util.TreeSet; public abstract class BaseCmd { public static String getBaseName(String fn) { @@ -96,7 +106,7 @@ public static FileSystem openZip(Path in) throws IOException { for (FileSystemProvider p : FileSystemProvider.installedProviders()) { String s = p.getScheme(); if ("jar".equals(s) || "zip".equalsIgnoreCase(s)) { - return p.newFileSystem(in, new HashMap()); + return p.newFileSystem(in, new HashMap<>()); } } throw new IOException("cant find zipfs support"); @@ -115,7 +125,7 @@ public HelpException(String message) { } @Retention(value = RetentionPolicy.RUNTIME) - @Target(value = { ElementType.FIELD }) + @Target(value = {ElementType.FIELD}) public @interface Opt { String argName() default ""; @@ -170,13 +180,13 @@ public String getOptAndLongOpt() { StringBuilder sb = new StringBuilder(); boolean havePrev = false; if (opt != null && opt.length() > 0) { - sb.append("-").append(opt); + sb.append("-").append(opt); havePrev = true; } if (longOpt != null && longOpt.length() > 0) { if (havePrev) { - sb.append(","); - } + sb.append(","); + } sb.append("--").append(longOpt); } return sb.toString(); @@ -185,7 +195,7 @@ public String getOptAndLongOpt() { } @Retention(value = RetentionPolicy.RUNTIME) - @Target(value = { ElementType.TYPE }) + @Target(value = {ElementType.TYPE}) public @interface Syntax { String cmd(); @@ -203,7 +213,7 @@ public String getOptAndLongOpt() { private String desc; private String onlineHelp; - protected Map optMap = new HashMap(); + protected Map optMap = new HashMap<>(); @Opt(opt = "h", longOpt = "help", hasArg = false, description = "Print this help message") private boolean printHelp = false; @@ -242,7 +252,7 @@ private Set