mirror of
https://github.com/cemu-project/GhidraRPXLoader.git
synced 2024-11-22 01:09:17 +01:00
Zero the data in imports and exports section to prevent analysis marking strings.
This commit is contained in:
parent
3275fe9c7f
commit
55e72815e3
@ -135,20 +135,30 @@ public class Cafe_ElfExtension extends ElfExtension {
|
||||
processRplCrcs(elfLoadHelper, sectionHeader);
|
||||
} else if (headertype == SHT_RPL_FILEINFO.value) {
|
||||
processRplFileInfo(elfLoadHelper, sectionHeader);
|
||||
} else if (headertype == SHT_RPL_IMPORTS.value) {
|
||||
processRplImports(elfLoadHelper, sectionHeader);
|
||||
} else if (headertype == SHT_RPL_EXPORTS.value) {
|
||||
processRplExports(elfLoadHelper, sectionHeader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processRplExports(ElfLoadHelper elfLoadHelper, ElfSectionHeader sectionHeader) {
|
||||
String sectionName = sectionHeader.getNameAsString();
|
||||
boolean isDataExports = sectionName.contentEquals(".dexports");
|
||||
if (!isDataExports) {
|
||||
// Function exports are already in symbol table
|
||||
return;
|
||||
private void processRplImports(ElfLoadHelper elfLoadHelper, ElfSectionHeader sectionHeader) {
|
||||
// Clear the section data otherwise analysis will identify strings in it.
|
||||
Address sectionAddress = elfLoadHelper.findLoadAddress(sectionHeader, 0);
|
||||
int sectionSize = (int) sectionHeader.getSize();
|
||||
elfLoadHelper.createUndefinedData(sectionAddress, sectionSize);
|
||||
|
||||
byte[] zeroes = new byte[sectionSize];
|
||||
try {
|
||||
elfLoadHelper.getProgram().getMemory().setBytes(sectionAddress, zeroes);
|
||||
} catch (MemoryAccessException e) {
|
||||
}
|
||||
}
|
||||
|
||||
private void processRplExports(ElfLoadHelper elfLoadHelper, ElfSectionHeader sectionHeader) {
|
||||
String sectionName = sectionHeader.getNameAsString();
|
||||
if (sectionName.contentEquals(".dexports")) {
|
||||
// Create symbols for data exports
|
||||
BinaryReader reader = elfLoadHelper.getElfHeader().getReader();
|
||||
reader.setPointerIndex(sectionHeader.getOffset());
|
||||
@ -170,6 +180,18 @@ public class Cafe_ElfExtension extends ElfExtension {
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the section data otherwise analysis will identify strings in it.
|
||||
Address sectionAddress = elfLoadHelper.findLoadAddress(sectionHeader, 0);
|
||||
int sectionSize = (int) sectionHeader.getSize();
|
||||
elfLoadHelper.createUndefinedData(sectionAddress, sectionSize);
|
||||
|
||||
byte[] zeroes = new byte[sectionSize];
|
||||
try {
|
||||
elfLoadHelper.getProgram().getMemory().setBytes(sectionAddress, zeroes);
|
||||
} catch (MemoryAccessException e) {
|
||||
}
|
||||
}
|
||||
|
||||
private void processRplCrcs(ElfLoadHelper elfLoadHelper, ElfSectionHeader sectionHeader) {
|
||||
Address address = elfLoadHelper.findLoadAddress(sectionHeader, 0);
|
||||
if (address == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user