Let's say that I have a simple executable and I want to find the address of the main. Usually, I take the address from the objdump
output, and then I use it in my pwn
script. I want to make my script more generic without using any of the hardcoded values from objdump
. Is there any way to do this with pwn?
I found that I can use ELF object and print addresses for all symbols. You can find more information here, but a simple example would be:
Find the address for main:
elf = ELF('./path_to_your_executable')
addr_main = elf.symbols['main']