mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
@@ -23,7 +23,9 @@ import ghidra.app.util.bin.ByteProvider;
|
|||||||
import ghidra.app.util.bin.MemoryByteProvider;
|
import ghidra.app.util.bin.MemoryByteProvider;
|
||||||
import ghidra.app.util.bin.format.coff.*;
|
import ghidra.app.util.bin.format.coff.*;
|
||||||
import ghidra.app.util.importer.MessageLog;
|
import ghidra.app.util.importer.MessageLog;
|
||||||
|
import ghidra.app.util.opinion.BinaryLoader;
|
||||||
import ghidra.framework.cmd.BinaryAnalysisCommand;
|
import ghidra.framework.cmd.BinaryAnalysisCommand;
|
||||||
|
import ghidra.framework.options.Options;
|
||||||
import ghidra.program.flatapi.FlatProgramAPI;
|
import ghidra.program.flatapi.FlatProgramAPI;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
@@ -45,6 +47,11 @@ public class CoffBinaryAnalysisCommand extends FlatProgramAPI
|
|||||||
@Override
|
@Override
|
||||||
public boolean canApply(Program program) {
|
public boolean canApply(Program program) {
|
||||||
try {
|
try {
|
||||||
|
Options options = program.getOptions(Program.PROGRAM_INFO);
|
||||||
|
String format = options.getString("Executable Format", null);
|
||||||
|
if (!BinaryLoader.BINARY_NAME.equals(format)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Memory memory = program.getMemory();
|
Memory memory = program.getMemory();
|
||||||
short magic =
|
short magic =
|
||||||
memory.getShort(program.getAddressFactory().getDefaultAddressSpace().getAddress(0));
|
memory.getShort(program.getAddressFactory().getDefaultAddressSpace().getAddress(0));
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class ElfBinaryAnalysisCommand extends FlatProgramAPI
|
|||||||
@Override
|
@Override
|
||||||
public boolean canApply(Program program) {
|
public boolean canApply(Program program) {
|
||||||
try {
|
try {
|
||||||
Options options = program.getOptions("Program Information");
|
Options options = program.getOptions(Program.PROGRAM_INFO);
|
||||||
String format = options.getString("Executable Format", null);
|
String format = options.getString("Executable Format", null);
|
||||||
if (!BinaryLoader.BINARY_NAME.equals(format)) {
|
if (!BinaryLoader.BINARY_NAME.equals(format)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class MachoBinaryAnalysisCommand extends FlatProgramAPI
|
|||||||
@Override
|
@Override
|
||||||
public boolean canApply(Program program) {
|
public boolean canApply(Program program) {
|
||||||
try {
|
try {
|
||||||
Options options = program.getOptions("Program Information");
|
Options options = program.getOptions(Program.PROGRAM_INFO);
|
||||||
String format = options.getString("Executable Format", null);
|
String format = options.getString("Executable Format", null);
|
||||||
if (!BinaryLoader.BINARY_NAME.equals(format)) {
|
if (!BinaryLoader.BINARY_NAME.equals(format)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user