mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-12 23:23:17 +00:00
Merge remote-tracking branch 'origin/GP-3154_ryanmkurtz_guava'
This commit is contained in:
commit
f3e06e89d6
@ -36,7 +36,7 @@ public class BundleHostTest extends AbstractGhidraHeadlessIntegrationTest {
|
||||
private static final String TEMP_NAME_PREFIX = "sourcebundle";
|
||||
|
||||
// the version of Guava Ghidra is currently using.
|
||||
private static final int GUAVA_MAJOR_VERSION = 19;
|
||||
private static final int GUAVA_MAJOR_VERSION = 31;
|
||||
|
||||
private BundleHost bundleHost;
|
||||
private CapturingBundleHostListener capturingBundleHostListener;
|
||||
|
@ -1,12 +1,12 @@
|
||||
MODULE FILE LICENSE: lib/dex-ir-2.0.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/dexlib-1.4.0.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/dex-reader-2.0.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/dex-reader-api-2.0.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/dex-translator-2.0.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/asm-debug-all-4.1.jar INRIA License
|
||||
MODULE FILE LICENSE: lib/baksmali-1.4.0.jar BSD-3-GRUVER
|
||||
MODULE FILE LICENSE: lib/dex-ir-2.1.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/dex-reader-2.1.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/dex-reader-api-2.1.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/dex-translator-2.1.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/asm-debug-all-5.0.3.jar INRIA License
|
||||
MODULE FILE LICENSE: lib/baksmali-2.5.2.jar BSD-3-GRUVER
|
||||
MODULE FILE LICENSE: lib/dexlib2-2.5.2.jar BSD-3-GRUVER
|
||||
MODULE FILE LICENSE: lib/util-2.5.2.jar BSD-3-GRUVER
|
||||
MODULE FILE LICENSE: lib/sevenzipjbinding-16.02-2.01.jar LGPL 2.1
|
||||
MODULE FILE LICENSE: lib/sevenzipjbinding-all-platforms-16.02-2.01.jar LGPL 2.1
|
||||
MODULE FILE LICENSE: lib/AXMLPrinter2.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/util-1.4.0.jar BSD-3-GRUVER
|
||||
|
||||
|
@ -28,20 +28,23 @@ dependencies {
|
||||
api project(':Recognizers')
|
||||
api project(':PDB')
|
||||
|
||||
api ':dex-ir:2.0'
|
||||
api ':dex-reader:2.0'
|
||||
api ':dex-reader-api:2.0'
|
||||
api ':dex-translator:2.0'
|
||||
// Used by "Android DEX to JAR" file system
|
||||
api ':dex-ir:2.1'
|
||||
api ':dex-reader:2.1'
|
||||
api ':dex-reader-api:2.1'
|
||||
api ':dex-translator:2.1'
|
||||
api 'org.ow2.asm:asm-debug-all:5.0.3'
|
||||
|
||||
api 'org.ow2.asm:asm-debug-all:4.1'
|
||||
// Used by "Android DEX to SMALI" file system
|
||||
api 'org.smali:baksmali:2.5.2' // requires guava-27.1-android or later
|
||||
api 'org.smali:dexlib2:2.5.2' // requires guava-27.1-android or later
|
||||
api 'org.smali:util:2.5.2' // requires guava-27.1-android or later
|
||||
|
||||
api 'org.smali:baksmali:1.4.0' // TODO: upgrade to 2.2.6
|
||||
api 'org.smali:dexlib:1.4.0'
|
||||
api 'org.smali:util:1.4.0'
|
||||
|
||||
api 'net.sf.sevenzipjbinding:sevenzipjbinding:16.02-2.01'
|
||||
// Used by "Android XML" file system
|
||||
api ':AXMLPrinter2'
|
||||
|
||||
|
||||
// Used by "ZIP" and "7zip" file systems
|
||||
api 'net.sf.sevenzipjbinding:sevenzipjbinding:16.02-2.01'
|
||||
runtimeOnly 'net.sf.sevenzipjbinding:sevenzipjbinding-all-platforms:16.02-2.01'
|
||||
|
||||
helpPath project(path: ":Base", configuration: 'helpPath')
|
||||
|
@ -22,8 +22,11 @@ import java.util.*;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.filefilter.TrueFileFilter;
|
||||
import org.jf.baksmali.baksmali;
|
||||
import org.jf.dexlib.DexFile;
|
||||
import org.jf.baksmali.Baksmali;
|
||||
import org.jf.baksmali.BaksmaliOptions;
|
||||
import org.jf.dexlib2.Opcodes;
|
||||
import org.jf.dexlib2.dexbacked.DexBackedDexFile;
|
||||
import org.jf.dexlib2.iface.DexFile;
|
||||
|
||||
import ghidra.app.util.bin.ByteProvider;
|
||||
import ghidra.app.util.bin.FileByteProvider;
|
||||
@ -31,6 +34,7 @@ import ghidra.file.formats.android.dex.format.DexConstants;
|
||||
import ghidra.formats.gfilesystem.*;
|
||||
import ghidra.formats.gfilesystem.annotations.FileSystemInfo;
|
||||
import ghidra.formats.gfilesystem.factory.GFileSystemBaseFactory;
|
||||
import ghidra.framework.Application;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.exception.CryptoException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
@ -85,48 +89,31 @@ public class DexToSmaliFileSystem extends GFileSystemBase {
|
||||
public void open(TaskMonitor monitor) throws IOException, CryptoException, CancelledException {
|
||||
monitor.setMessage("Converting DEX to SMALI...");
|
||||
|
||||
File dexFileFile = provider.getFile();
|
||||
boolean isFixRegisters = false;
|
||||
boolean isNoParameterRegisters = false;
|
||||
boolean isUseLocalsDirective = false;
|
||||
boolean isUseSequentialLabels = false;
|
||||
boolean isOutputDebugInfo = true;
|
||||
boolean isAddCodeOffsets = false;
|
||||
boolean isDeOdex = false;//TODO DexConstants.isODEX( provider );
|
||||
boolean isVerify = false;
|
||||
boolean isIgnoreErrors = false;
|
||||
int registerInfo = 0;
|
||||
boolean isNoAccessorComments = false;//TODO
|
||||
String inlineTable = null;//TODO
|
||||
boolean isCheckPackagePrivateAccess = false;
|
||||
|
||||
final String baseTempPath = System.getProperty("java.io.tmpdir");
|
||||
int rand = new Random().nextInt() & 0xffff;
|
||||
File tempOutputDirectory =
|
||||
new File(baseTempPath + File.separator + "ghidra_file_system_" + rand);
|
||||
File outputDir = new File(Application.getUserTempDirectory(), "ghidra_file_system_" + rand);
|
||||
|
||||
String bootClassPath = "core.jar:ext.jar:framework.jar:android.policy.jar:services.jar";
|
||||
StringBuffer extraBootClassPathEntries = new StringBuffer();
|
||||
DexFile dexFile =
|
||||
DexBackedDexFile.fromInputStream(Opcodes.getDefault(), provider.getInputStream(0));
|
||||
|
||||
List<String> bootClassPathDirs = new ArrayList<>();
|
||||
bootClassPathDirs.add(".");
|
||||
//TODO bootClassPathDirs.add( "~/Android/smali/required-libs/" );
|
||||
BaksmaliOptions options = new BaksmaliOptions();
|
||||
options.apiLevel = 15;
|
||||
options.parameterRegisters = true;
|
||||
options.localsDirective = false;
|
||||
options.sequentialLabels = false;
|
||||
options.debugInfo = true;
|
||||
options.codeOffsets = false;
|
||||
options.accessorComments = true;
|
||||
options.allowOdex = false;
|
||||
options.deodex = false;
|
||||
options.implicitReferences = false;
|
||||
options.normalizeVirtualMethods = false;
|
||||
options.registerInfo = 0;
|
||||
|
||||
DexFile dexFile = new DexFile(dexFileFile, !isFixRegisters, false);
|
||||
|
||||
String[] bootClassPathDirsArray = new String[bootClassPathDirs.size()];
|
||||
for (int i = 0; i < bootClassPathDirsArray.length; i++) {
|
||||
bootClassPathDirsArray[i] = bootClassPathDirs.get(i);
|
||||
if (!Baksmali.disassembleDexFile(dexFile, outputDir, 1, options)) {
|
||||
throw new IOException("Failed to disassemble DEX file: " + provider.getName());
|
||||
}
|
||||
|
||||
baksmali.disassembleDexFile(dexFileFile.getPath(), dexFile, isDeOdex,
|
||||
tempOutputDirectory.getPath(), bootClassPathDirsArray, bootClassPath,
|
||||
extraBootClassPathEntries.toString(), isNoParameterRegisters, isUseLocalsDirective,
|
||||
isUseSequentialLabels, isOutputDebugInfo, isAddCodeOffsets, isNoAccessorComments,
|
||||
registerInfo, isVerify, isIgnoreErrors, inlineTable, isCheckPackagePrivateAccess);
|
||||
|
||||
getFileListing(tempOutputDirectory, root, monitor);
|
||||
|
||||
getFileListing(outputDir, root, monitor);
|
||||
}
|
||||
|
||||
private void getFileListing(File startingDirectory, GFileImpl currentRoot,
|
||||
|
@ -1,4 +1,5 @@
|
||||
MODULE FILE LICENSE: lib/guava-19.0.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/guava-31.1-jre.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/failureaccess-1.0.1.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/jdom-legacy-1.1.3.jar JDOM License
|
||||
MODULE FILE LICENSE: lib/log4j-api-2.17.1.jar Apache License 2.0
|
||||
MODULE FILE LICENSE: lib/log4j-core-2.17.1.jar Apache License 2.0
|
||||
|
@ -26,7 +26,8 @@ eclipse.project.name = 'Framework Generic'
|
||||
|
||||
dependencies {
|
||||
api project(':Utility')
|
||||
api "com.google.guava:guava:19.0"
|
||||
api "com.google.guava:guava:31.1-jre"
|
||||
api 'com.google.guava:failureaccess:1.0.1'
|
||||
api "org.jdom:jdom-legacy:1.1.3"
|
||||
api "org.apache.logging.log4j:log4j-api:2.17.1"
|
||||
api "org.apache.logging.log4j:log4j-core:2.17.1"
|
||||
|
@ -13,82 +13,15 @@
|
||||
.gitignore||GHIDRA||||END|
|
||||
Module.manifest||GHIDRA||||END|
|
||||
data/ExtensionPoint.manifest||GHIDRA||||END|
|
||||
data/generic.theme.properties||GHIDRA||||END|
|
||||
src/main/java/ghidra/framework/options/package.html||GHIDRA||||END|
|
||||
src/main/java/ghidra/util/datastruct/package.html||GHIDRA||||END|
|
||||
src/main/java/ghidra/util/graph/attributes/package.html||GHIDRA||||END|
|
||||
src/main/java/ghidra/util/graph/package.html||GHIDRA||||END|
|
||||
src/main/java/ghidra/util/layout/package.html||GHIDRA||||END|
|
||||
src/main/java/ghidra/util/map/package.html||GHIDRA||||END|
|
||||
src/main/java/ghidra/util/xml/package.html||GHIDRA||||END|
|
||||
src/main/resources/generic.log4j.xml||GHIDRA||||END|
|
||||
src/main/resources/generic.log4jdev.xml||GHIDRA||||END|
|
||||
src/main/resources/generic.log4jfile.xml||GHIDRA||||END|
|
||||
src/main/resources/generic.log4jtest.xml||GHIDRA||||END|
|
||||
src/main/resources/images/EmptyIcon.gif||GHIDRA||||END|
|
||||
src/main/resources/images/EmptyIcon16.gif||GHIDRA||||END|
|
||||
src/main/resources/images/GhidraIcon128.png||GHIDRA||||END|
|
||||
src/main/resources/images/GhidraIcon16.png||GHIDRA||||END|
|
||||
src/main/resources/images/GhidraIcon24.png||GHIDRA||||END|
|
||||
src/main/resources/images/GhidraIcon256.png||GHIDRA||||END|
|
||||
src/main/resources/images/GhidraIcon32.png||GHIDRA||||END|
|
||||
src/main/resources/images/GhidraIcon40.png||GHIDRA||||END|
|
||||
src/main/resources/images/GhidraIcon48.png||GHIDRA||||END|
|
||||
src/main/resources/images/GhidraIcon64.png||GHIDRA||||END|
|
||||
src/main/resources/images/Plus2.png||GHIDRA||||END|
|
||||
src/main/resources/images/applications-multimedia16.png||Tango Icons - Public Domain|||tango|END|
|
||||
src/main/resources/images/checkmark_green.gif||GHIDRA||||END|
|
||||
src/main/resources/images/closedSmallFolder.png||Modified Nuvola Icons - LGPL 2.1||||END|
|
||||
src/main/resources/images/collapse_all.png||GHIDRA||||END|
|
||||
src/main/resources/images/core.png||Nuvola Icons - LGPL 2.1|||Nuvola icon set|END|
|
||||
src/main/resources/images/core24.png||Nuvola Icons - LGPL 2.1|||Nuvola icon set|END|
|
||||
src/main/resources/images/dialog-cancel.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END|
|
||||
src/main/resources/images/disk.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/resources/images/disk_save_as.png||FAMFAMFAM Icons - CC 2.5||||END|
|
||||
src/main/resources/images/down.png||GHIDRA||||END|
|
||||
src/main/resources/images/dragon16.gif||GHIDRA||||END|
|
||||
src/main/resources/images/edit-cut.png||Tango Icons - Public Domain|||tango icon set|END|
|
||||
src/main/resources/images/edit-cut22.png||Tango Icons - Public Domain|||tango icon set|END|
|
||||
src/main/resources/images/edit-delete.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END|
|
||||
src/main/resources/images/emblem-important.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END|
|
||||
src/main/resources/images/erase16.png||GHIDRA||||END|
|
||||
src/main/resources/images/error.png||Nuvola Icons - LGPL 2.1|||Nuvola icon set|END|
|
||||
src/main/resources/images/exec.png||Crystal Clear Icons - LGPL 2.1||||END|
|
||||
src/main/resources/images/expand_all.png||GHIDRA||||END|
|
||||
src/main/resources/images/flag.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END|
|
||||
src/main/resources/images/go-home.png||Tango Icons - Public Domain|||tango icon set|END|
|
||||
src/main/resources/images/greenDragon16.png||GHIDRA||||END|
|
||||
src/main/resources/images/greenDragon24.png||GHIDRA||||END|
|
||||
src/main/resources/images/help-browser.png||Tango Icons - Public Domain|||tango icon set|END|
|
||||
src/main/resources/images/information.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/resources/images/internet-web-browser16.png||Tango Icons - Public Domain|||originally internet-web-browser.png from tango|END|
|
||||
src/main/resources/images/kgpg.png||Nuvola Icons - LGPL 2.1|||Nuvola icon set|END|
|
||||
src/main/resources/images/left.alternate.png||GHIDRA||||END|
|
||||
src/main/resources/images/left.png||GHIDRA||||END|
|
||||
src/main/resources/images/locationIn.gif||GHIDRA||||END|
|
||||
src/main/resources/images/locationOut.gif||GHIDRA||||END|
|
||||
src/main/resources/images/mergemgr16.gif||GHIDRA||||END|
|
||||
src/main/resources/images/network-receive16.png||Tango Icons - Public Domain|||originally network-receive.png from tango|END|
|
||||
src/main/resources/images/openFolder.png||Modified Nuvola Icons - LGPL 2.1||||END|
|
||||
src/main/resources/images/openSmallFolder.png||Modified Nuvola Icons - LGPL 2.1||||END|
|
||||
src/main/resources/images/page_paste.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/resources/images/page_white_copy.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/resources/images/process-stop.png||Tango Icons - Public Domain|||Theirs: Oxygen icon theme (dual license; LGPL or CC-SA-3.0)tango icon set|END|
|
||||
src/main/resources/images/program_obj.png||GHIDRA|||Custom Icon|END|
|
||||
src/main/resources/images/redDragon16.png||GHIDRA|||Renamed GIF version of redDragon16.png|END|
|
||||
src/main/resources/images/redDragon24.png||GHIDRA||||END|
|
||||
src/main/resources/images/redDragon32.png||GHIDRA||||END|
|
||||
src/main/resources/images/reload3.png||Crystal Clear Icons - LGPL 2.1||||END|
|
||||
src/main/resources/images/right.alternate.png||GHIDRA||||END|
|
||||
src/main/resources/images/right.png||GHIDRA||||END|
|
||||
src/main/resources/images/software-update-urgent.png||Tango Icons - Public Domain|||tango icon set|END|
|
||||
src/main/resources/images/sortascending.png||GHIDRA||||END|
|
||||
src/main/resources/images/sortdescending.png||GHIDRA||||END|
|
||||
src/main/resources/images/text_align_justify.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/resources/images/up.png||GHIDRA||||END|
|
||||
src/main/resources/images/video-x-generic16.png||Tango Icons - Public Domain|||tango|END|
|
||||
src/main/resources/images/viewmagfit.png||Nuvola Icons - LGPL 2.1|||Nuvola icon set|END|
|
||||
src/main/resources/images/warning.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/resources/log4j-appender-console-with-links.xml||GHIDRA||||END|
|
||||
src/main/resources/log4j-appender-console.xml||GHIDRA||||END|
|
||||
src/main/resources/log4j-appender-logpanel.xml||GHIDRA||||END|
|
||||
|
@ -238,6 +238,10 @@ public class GhidraLauncher {
|
||||
String path = line.trim();
|
||||
if (!path.startsWith("Module:") && path.endsWith(".jar")) {
|
||||
ResourceFile jarFile = new ResourceFile(path);
|
||||
if (path.startsWith("#") || path.startsWith("//")) {
|
||||
System.err.println("Skipping jar file: " + jarFile);
|
||||
continue;
|
||||
}
|
||||
if (!jarFile.isFile()) {
|
||||
System.err.println("Failed to find required jar file: " + jarFile);
|
||||
continue;
|
||||
|
@ -59,12 +59,12 @@ file("${REPO_DIR}/Ghidra/application.properties").withReader { reader ->
|
||||
|
||||
ext.deps = [
|
||||
[
|
||||
name: "dex-tools-2.0.zip",
|
||||
url: "https://github.com/pxb1988/dex2jar/releases/download/2.0/dex-tools-2.0.zip",
|
||||
sha256: "7907eb4d6e9280b6e17ddce7ee0507eae2ef161ee29f70a10dbc6944fdca75bc",
|
||||
name: "dex2jar-2.1.zip",
|
||||
url: "https://github.com/pxb1988/dex2jar/releases/download/v2.1/dex2jar-2.1.zip",
|
||||
sha256: "7a9bdf843d43de4d1e94ec2e7b6f55825017b0c4a7ee39ff82660e2493a46f08",
|
||||
destination: {
|
||||
unzip(DOWNLOADS_DIR, DOWNLOADS_DIR, "dex-tools-2.0.zip")
|
||||
FileUtils.copyDirectory(new File(DOWNLOADS_DIR, "dex2jar-2.0/lib/"), FLAT_REPO_DIR, new WildcardFileFilter("dex-*"));
|
||||
unzip(DOWNLOADS_DIR, DOWNLOADS_DIR, "dex2jar-2.1.zip")
|
||||
FileUtils.copyDirectory(new File(DOWNLOADS_DIR, "dex-tools-2.1/lib/"), FLAT_REPO_DIR, new WildcardFileFilter("dex-*"));
|
||||
}
|
||||
],
|
||||
[
|
||||
|
Loading…
Reference in New Issue
Block a user