mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
Merge remote-tracking branch 'origin/Ghidra_9.2'
This commit is contained in:
commit
027ba3884a
11 changed files with 114 additions and 33 deletions
|
@ -754,7 +754,9 @@ public class GhidraJarBuilder implements GhidraLaunchable {
|
||||||
long modifiedTime = file.lastModified();
|
long modifiedTime = file.lastModified();
|
||||||
addToModuleTree(jarPath, module);
|
addToModuleTree(jarPath, module);
|
||||||
if (extensionPointSuffixPattern.matcher(jarPath).matches()) {
|
if (extensionPointSuffixPattern.matcher(jarPath).matches()) {
|
||||||
checkExtensionPointClass(jarPath, new FileInputStream(file));
|
try (FileInputStream inStream = new FileInputStream(file)) {
|
||||||
|
checkExtensionPointClass(jarPath, inStream);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefix != null) {
|
if (prefix != null) {
|
||||||
|
@ -775,16 +777,16 @@ public class GhidraJarBuilder implements GhidraLaunchable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream in = new FileInputStream(file);
|
try (InputStream in = new FileInputStream(file)) {
|
||||||
|
|
||||||
byte[] bytes = new byte[4096];
|
byte[] bytes = new byte[4096];
|
||||||
int numRead;
|
int numRead;
|
||||||
|
|
||||||
while ((numRead = in.read(bytes)) != -1) {
|
while ((numRead = in.read(bytes)) != -1) {
|
||||||
monitor.checkCanceled();
|
monitor.checkCanceled();
|
||||||
jarOut.write(bytes, 0, numRead);
|
jarOut.write(bytes, 0, numRead);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
in.close();
|
|
||||||
|
|
||||||
jarOut.closeEntry();
|
jarOut.closeEntry();
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import ghidra.program.database.ProgramBuilder;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.program.model.address.AddressSpace;
|
import ghidra.program.model.address.AddressSpace;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
|
import ghidra.program.model.data.DataUtilities.ClearDataMode;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.*;
|
||||||
import ghidra.program.model.symbol.RefType;
|
import ghidra.program.model.symbol.RefType;
|
||||||
import ghidra.program.model.symbol.SourceType;
|
import ghidra.program.model.symbol.SourceType;
|
||||||
|
@ -130,7 +131,7 @@ public class CreateDataCmdTest extends AbstractGenericTest {
|
||||||
assertTrue(d.getDataType() instanceof ByteDataType);
|
assertTrue(d.getDataType() instanceof ByteDataType);
|
||||||
|
|
||||||
// Byte becomes Word and consumes next Default data byte
|
// Byte becomes Word and consumes next Default data byte
|
||||||
cmd = new CreateDataCmd(addr, new WordDataType());
|
cmd = new CreateDataCmd(addr, new WordDataType(), false, ClearDataMode.CLEAR_SINGLE_DATA);
|
||||||
cmd.applyTo(program);
|
cmd.applyTo(program);
|
||||||
|
|
||||||
d = listing.getDataAt(addr);
|
d = listing.getDataAt(addr);
|
||||||
|
@ -161,7 +162,7 @@ public class CreateDataCmdTest extends AbstractGenericTest {
|
||||||
assertTrue(d.getDataType() instanceof WordDataType);
|
assertTrue(d.getDataType() instanceof WordDataType);
|
||||||
|
|
||||||
// Word becomes Byte immediately followed by Default data
|
// Word becomes Byte immediately followed by Default data
|
||||||
cmd = new CreateDataCmd(addr, new ByteDataType());
|
cmd = new CreateDataCmd(addr, new ByteDataType(), false, ClearDataMode.CLEAR_SINGLE_DATA);
|
||||||
cmd.applyTo(program);
|
cmd.applyTo(program);
|
||||||
|
|
||||||
d = listing.getDataAt(addr);
|
d = listing.getDataAt(addr);
|
||||||
|
@ -376,6 +377,36 @@ public class CreateDataCmdTest extends AbstractGenericTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreatePointerOnMultipleUndefined1Data() {
|
||||||
|
|
||||||
|
Address addr = addr(UNDEFINED_AREA);
|
||||||
|
CreateDataCmd cmd = new CreateDataCmd(addr, new Undefined1DataType());
|
||||||
|
cmd.applyTo(program);
|
||||||
|
cmd = new CreateDataCmd(addr.next(), new Undefined1DataType());
|
||||||
|
cmd.applyTo(program);
|
||||||
|
|
||||||
|
// two Undefined1 data becomes Pointer
|
||||||
|
cmd = new CreateDataCmd(addr, false, true, new PointerDataType());
|
||||||
|
cmd.applyTo(program);
|
||||||
|
|
||||||
|
Data d = listing.getDataAt(addr);
|
||||||
|
assertNotNull(d);
|
||||||
|
assertTrue(d.isDefined());
|
||||||
|
assertEquals(4, d.getLength());
|
||||||
|
DataType dt = d.getDataType();
|
||||||
|
assertTrue(dt instanceof Pointer);
|
||||||
|
assertEquals(addr.getPointerSize(), dt.getLength());
|
||||||
|
Pointer pdt = (Pointer) dt;
|
||||||
|
assertNull(pdt.getDataType());
|
||||||
|
|
||||||
|
d = listing.getDataAfter(addr);
|
||||||
|
assertNotNull(d);
|
||||||
|
assertTrue(!d.isDefined());
|
||||||
|
assertEquals(4, d.getMinAddress().getOffset() - UNDEFINED_AREA);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreatePointerOnPointer() {
|
public void testCreatePointerOnPointer() {
|
||||||
|
|
||||||
|
@ -693,7 +724,7 @@ public class CreateDataCmdTest extends AbstractGenericTest {
|
||||||
assertEquals(10, dt.getLength());
|
assertEquals(10, dt.getLength());
|
||||||
|
|
||||||
// Byte[] becomes Byte
|
// Byte[] becomes Byte
|
||||||
CreateDataCmd cmd = new CreateDataCmd(addr, new ByteDataType());
|
CreateDataCmd cmd = new CreateDataCmd(addr, new ByteDataType(), false, ClearDataMode.CLEAR_SINGLE_DATA);
|
||||||
cmd.applyTo(program);
|
cmd.applyTo(program);
|
||||||
|
|
||||||
d = listing.getDataAt(addr);
|
d = listing.getDataAt(addr);
|
||||||
|
@ -761,7 +792,7 @@ public class CreateDataCmdTest extends AbstractGenericTest {
|
||||||
assertEquals(10, dt.getLength());
|
assertEquals(10, dt.getLength());
|
||||||
|
|
||||||
// struct becomes Byte
|
// struct becomes Byte
|
||||||
CreateDataCmd cmd = new CreateDataCmd(addr, new ByteDataType());
|
CreateDataCmd cmd = new CreateDataCmd(addr, new ByteDataType(), false, ClearDataMode.CLEAR_SINGLE_DATA);
|
||||||
cmd.applyTo(program);
|
cmd.applyTo(program);
|
||||||
|
|
||||||
d = listing.getDataAt(addr);
|
d = listing.getDataAt(addr);
|
||||||
|
|
|
@ -3,9 +3,9 @@ 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-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-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/dex-translator-2.0.jar Apache License 2.0
|
||||||
MODULE FILE LICENSE: lib/asm-debug-all-4.1.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 Apache License 2.0
|
MODULE FILE LICENSE: lib/baksmali-1.4.0.jar BSD
|
||||||
MODULE FILE LICENSE: lib/sevenzipjbinding-9.20-2.00beta.jar Apache License 2.0
|
MODULE FILE LICENSE: lib/sevenzipjbinding-16.02-2.01.jar LGPL 2.1
|
||||||
MODULE FILE LICENSE: lib/sevenzipjbinding-all-platforms-9.20-2.00beta.jar Apache License 2.0
|
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/AXMLPrinter2.jar Apache License 2.0
|
||||||
MODULE FILE LICENSE: lib/util-1.4.0.jar BSD
|
MODULE FILE LICENSE: lib/util-1.4.0.jar BSD
|
||||||
|
|
|
@ -5,9 +5,6 @@ apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle"
|
||||||
apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle"
|
apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle"
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
eclipse.project.name = 'Features FileFormats'
|
eclipse.project.name = 'Features FileFormats'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -26,10 +23,10 @@ dependencies {
|
||||||
compile 'org.smali:dexlib:1.4.0'
|
compile 'org.smali:dexlib:1.4.0'
|
||||||
compile 'org.smali:util:1.4.0'
|
compile 'org.smali:util:1.4.0'
|
||||||
|
|
||||||
compile 'net.sf.sevenzipjbinding:sevenzipjbinding:9.20-2.00beta'
|
compile 'net.sf.sevenzipjbinding:sevenzipjbinding:16.02-2.01'
|
||||||
compile ':AXMLPrinter2'
|
compile ':AXMLPrinter2'
|
||||||
|
|
||||||
runtime 'net.sf.sevenzipjbinding:sevenzipjbinding-all-platforms:9.20-2.00beta'
|
runtime 'net.sf.sevenzipjbinding:sevenzipjbinding-all-platforms:16.02-2.01'
|
||||||
|
|
||||||
helpPath project(path: ":Base", configuration: 'helpPath')
|
helpPath project(path: ":Base", configuration: 'helpPath')
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
##MODULE IP: BSD
|
##MODULE IP: BSD
|
||||||
##MODULE IP: Copyright Distribution Permitted
|
##MODULE IP: Copyright Distribution Permitted
|
||||||
##MODULE IP: Creative Commons Attribution 2.5
|
##MODULE IP: Creative Commons Attribution 2.5
|
||||||
|
##MODULE IP: INRIA License
|
||||||
##MODULE IP: Jython License
|
##MODULE IP: Jython License
|
||||||
##MODULE IP: LGPL 2.1
|
##MODULE IP: LGPL 2.1
|
||||||
##MODULE IP: Public Domain
|
##MODULE IP: Public Domain
|
||||||
|
|
|
@ -18,6 +18,8 @@ package ghidra.file.formats.sevenzip;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
|
||||||
import ghidra.formats.gfilesystem.*;
|
import ghidra.formats.gfilesystem.*;
|
||||||
import ghidra.formats.gfilesystem.annotations.FileSystemInfo;
|
import ghidra.formats.gfilesystem.annotations.FileSystemInfo;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
|
@ -70,7 +72,13 @@ public class SevenZipFileSystem implements GFileSystem {
|
||||||
throw new CancelledException();
|
throw new CancelledException();
|
||||||
}
|
}
|
||||||
|
|
||||||
fsIndexHelper.storeFile(item.getPath(), item.getItemIndex(), item.isFolder(),
|
String itemPath = item.getPath();
|
||||||
|
if (items.length == 1 && itemPath.isBlank()) {
|
||||||
|
// special case when there is a single unnamed file.
|
||||||
|
// use the name of the 7zip file itself, minus the extension
|
||||||
|
itemPath = FilenameUtils.getBaseName(fsrl.getContainer().getName());
|
||||||
|
}
|
||||||
|
fsIndexHelper.storeFile(itemPath, item.getItemIndex(), item.isFolder(),
|
||||||
getSize(item), item);
|
getSize(item), item);
|
||||||
}
|
}
|
||||||
preCacheAll(monitor);
|
preCacheAll(monitor);
|
||||||
|
|
|
@ -11,6 +11,8 @@ eclipse.project.name = 'Features Graph Services'
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(":Base")
|
compile project(":Base")
|
||||||
|
|
||||||
|
// compile "com.github.tomnelson:jungrapht-visualization:1.0-SNAPSHOT"
|
||||||
|
// compile "com.github.tomnelson:jungrapht-layout:1.0-SNAPSHOT"
|
||||||
compile "com.github.tomnelson:jungrapht-visualization:1.0-RC9"
|
compile "com.github.tomnelson:jungrapht-visualization:1.0-RC9"
|
||||||
compile "com.github.tomnelson:jungrapht-layout:1.0-RC9"
|
compile "com.github.tomnelson:jungrapht-layout:1.0-RC9"
|
||||||
compile "org.jgrapht:jgrapht-core:1.5.0"
|
compile "org.jgrapht:jgrapht-core:1.5.0"
|
||||||
|
|
|
@ -42,7 +42,7 @@ jungrapht.mincross.verticalOffset=5
|
||||||
|
|
||||||
# how many times to run the full all-level cross count
|
# how many times to run the full all-level cross count
|
||||||
jungrapht.mincross.maxLevelCross=10
|
jungrapht.mincross.maxLevelCross=10
|
||||||
|
pass
|
||||||
# how many times to iterate over the layers while swapping node positions (mincross)
|
# how many times to iterate over the layers while swapping node positions (mincross)
|
||||||
jungrapht.mincrossTransposeLimit=5
|
jungrapht.mincrossTransposeLimit=5
|
||||||
|
|
||||||
|
@ -59,3 +59,6 @@ jungrapht.circle.reduceEdgeCrossingMaxEdges=200
|
||||||
# for layout algorithms that attempt to make the area optimal for the number
|
# for layout algorithms that attempt to make the area optimal for the number
|
||||||
# of graph vertices, this sets how dense the space is.
|
# of graph vertices, this sets how dense the space is.
|
||||||
jungrapht.initialDimensionVertexDensity=0.3f
|
jungrapht.initialDimensionVertexDensity=0.3f
|
||||||
|
|
||||||
|
jungrapht.minScale=0.001
|
||||||
|
jungrapht.maxScale=1.0
|
||||||
|
|
|
@ -129,13 +129,14 @@ public final class DataUtilities {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clearMode == ClearDataMode.CLEAR_ALL_UNDEFINED_CONFLICT_DATA &&
|
if (!stackPointers && clearMode == ClearDataMode.CLEAR_ALL_UNDEFINED_CONFLICT_DATA &&
|
||||||
!Undefined.isUndefined(existingDT)) {
|
!Undefined.isUndefined(existingDT)) {
|
||||||
throw new CodeUnitInsertionException("Could not create Data at address " + addr);
|
throw new CodeUnitInsertionException("Could not create Data at address " + addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for external reference on pointer
|
// Check for external reference on pointer
|
||||||
if (existingDT instanceof Pointer) {
|
if ((stackPointers || newDataType instanceof Pointer) &&
|
||||||
|
existingDT instanceof Pointer) {
|
||||||
// TODO: This can probably be eliminated
|
// TODO: This can probably be eliminated
|
||||||
Reference[] refs = refMgr.getReferencesFrom(addr);
|
Reference[] refs = refMgr.getReferencesFrom(addr);
|
||||||
for (Reference ref : refs) {
|
for (Reference ref : refs) {
|
||||||
|
@ -174,19 +175,26 @@ public final class DataUtilities {
|
||||||
throw new CodeUnitInsertionException(
|
throw new CodeUnitInsertionException(
|
||||||
"Could not create DataType " + newDataType.getDisplayName());
|
"Could not create DataType " + newDataType.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stackPointers && existingDT instanceof Pointer && newDataType instanceof Pointer) {
|
||||||
|
listing.clearCodeUnits(addr, addr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
Data newData;
|
||||||
try {
|
try {
|
||||||
return listing.createData(addr, dti.getDataType(), dti.getLength());
|
newData = listing.createData(addr, dti.getDataType(), dti.getLength());
|
||||||
}
|
}
|
||||||
catch (CodeUnitInsertionException e) {
|
catch (CodeUnitInsertionException e) {
|
||||||
// ok lets see if we need to clear some code units
|
// ok lets see if we need to clear some code units
|
||||||
|
if (clearMode == ClearDataMode.CLEAR_SINGLE_DATA) {
|
||||||
|
listing.clearCodeUnits(addr, addr, false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
checkEnoughSpace(program, addr, existingDataLen, dti, clearMode);
|
||||||
|
}
|
||||||
|
newData = listing.createData(addr, dti.getDataType(), dti.getLength());
|
||||||
}
|
}
|
||||||
if (clearMode == ClearDataMode.CLEAR_SINGLE_DATA) {
|
|
||||||
listing.clearCodeUnits(addr, addr, false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
checkEnoughSpace(program, addr, existingDataLen, dti, clearMode);
|
|
||||||
}
|
|
||||||
Data newData = listing.createData(addr, dti.getDataType(), dti.getLength());
|
|
||||||
// if this was a pointer and had an external reference, put it back!
|
// if this was a pointer and had an external reference, put it back!
|
||||||
if ((newDataType instanceof Pointer) && extRef != null) {
|
if ((newDataType instanceof Pointer) && extRef != null) {
|
||||||
ExternalLocation extLoc = ((ExternalReference) extRef).getExternalLocation();
|
ExternalLocation extLoc = ((ExternalReference) extRef).getExternalLocation();
|
||||||
|
@ -203,6 +211,7 @@ public final class DataUtilities {
|
||||||
|
|
||||||
private static void checkEnoughSpace(Program program, Address addr, int existingDataLen,
|
private static void checkEnoughSpace(Program program, Address addr, int existingDataLen,
|
||||||
DataTypeInstance dti, ClearDataMode mode) throws CodeUnitInsertionException {
|
DataTypeInstance dti, ClearDataMode mode) throws CodeUnitInsertionException {
|
||||||
|
// NOTE: method not invoked when clearMode == ClearDataMode.CLEAR_SINGLE_DATA
|
||||||
Listing listing = program.getListing();
|
Listing listing = program.getListing();
|
||||||
try {
|
try {
|
||||||
Address end = addr.addNoWrap(existingDataLen - 1);
|
Address end = addr.addNoWrap(existingDataLen - 1);
|
||||||
|
|
27
licenses/INRIA_License.txt
Normal file
27
licenses/INRIA_License.txt
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
ASM: a very small and fast Java bytecode manipulation framework
|
||||||
|
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.
|
|
@ -7,6 +7,7 @@ Crystal_Clear_Icons_-_LGPL_2.1.txt||LICENSE||||END|
|
||||||
FAMFAMFAM_Icons_-_CC_2.5.txt||LICENSE||||END|
|
FAMFAMFAM_Icons_-_CC_2.5.txt||LICENSE||||END|
|
||||||
FAMFAMFAM_Mini_Icons_-_Public_Domain.txt||LICENSE||||END|
|
FAMFAMFAM_Mini_Icons_-_Public_Domain.txt||LICENSE||||END|
|
||||||
GPL_2_With_Classpath_Exception.txt||LICENSE||||END|
|
GPL_2_With_Classpath_Exception.txt||LICENSE||||END|
|
||||||
|
INRIA_License.txt||LICENSE||||END|
|
||||||
JDOM_License.txt||LICENSE||||END|
|
JDOM_License.txt||LICENSE||||END|
|
||||||
Jython_License.txt||LICENSE||||END|
|
Jython_License.txt||LICENSE||||END|
|
||||||
LGPL_2.1.txt||LICENSE||||END|
|
LGPL_2.1.txt||LICENSE||||END|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue