Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lief instead of patchkit for modifying entrypoint arguments #37

Open
bannsec opened this issue Oct 19, 2020 · 0 comments
Open

Use lief instead of patchkit for modifying entrypoint arguments #37

bannsec opened this issue Oct 19, 2020 · 0 comments

Comments

@bannsec
Copy link
Owner

bannsec commented Oct 19, 2020

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant