Ghidra: Only reset image base to zero for ELF binaries

This commit is contained in:
Katy Coe
2020-08-04 05:44:08 +02:00
parent eb55e5b527
commit beb859128c

View File

@@ -47,8 +47,10 @@ def SetHeaderComment(addr, text):
setPlateComment(toAddr(addr), text)
def CustomInitializer():
# Do we need this for PE/MachO?
currentProgram.setImageBase(toAddr(0), True)
# Ghidra sets the image base for ELF to 0x100000 for some reason
# https://github.com/NationalSecurityAgency/ghidra/issues/1020
if currentProgram.getExecutableFormat().endswith('(ELF)'):
currentProgram.setImageBase(toAddr(0), True)
def GetScriptDirectory():
# Ghidra doesn't define __file__ so we have to iterate all the scripts