autoPwn icon indicating copy to clipboard operation
autoPwn copied to clipboard

Use lief instead of patchkit for modifying entrypoint arguments

Open bannsec opened this issue 5 years ago • 0 comments

patchkit is still stuck on python2, which is both obsolete and actively being pushed out of major distros like ubuntu. Better path forward is to use lief to update the binary the way i want.

ls = lief.parse("./ls")

section = Section(".injected.entry", lief.ELF.SECTION_TYPES.PROGBITS)
section += lief.ELF.SECTION_FLAGS.EXECINSTR
section += lief.ELF.SECTION_FLAGS.WRITE
section.content   =  [] # int array of bytes goes here
section = ls.add(section, loaded=True)
ls.header.entrypoint = section.virtual_address + STUB.header.entrypoint

ls.write(output)

bannsec avatar Oct 19 '20 02:10 bannsec