Gallopsled / pwntools

CTF framework and exploit development library
http://pwntools.com
Other
11.74k stars 1.67k forks source link

Cache output of `asm()` #2358

Open peace-maker opened 5 months ago

peace-maker commented 5 months ago

To speed up repeated runs of an exploit, cache the assembled output.

Use a sha1 hash of the shellcode as well as relevant context values like context.arch and context.bits to see if the exact same shellcode was assembled for the same context before.

Fixes #2312

Arusekk commented 2 months ago

I think we should use the preprocessed assembly and full assembler command in order to avoid stale bugs on pwntools updates

peace-maker commented 2 months ago

Yeah, that's fine too. I wanted to avoid running any processes. But one instead of several is still an improvement if it prevents subtle bugs in the future.

"The assembler command" is tricky though due to the multi step approach. Building the command line arguments calls which too to find the binutils tools.