What is the way to get the program base address in Ghidra
?
1 Answer
You can use currentProgram.getImageBase()
to obtain the base address. This returns an Address
object.
Example
>>> currentProgram.getImageBase()
00400000
>>> type(currentProgram.getImageBase())
<type 'ghidra.program.model.address.GenericAddress'>
>>> currentProgram.getImageBase().getOffset()
4194304L
>>> hex(currentProgram.getImageBase().getOffset())
'0x400000L'