Gallopsled/pwntools — pull request #42 by zachriggle (2014-08-01 07:05:24+00:00)
Title: Python Implementation of ELF

Complete reimplementation. Adds `pyelftools` as a requirement. There are no longer any requirements on `objdump`, `readelf`, or `ldd`.

Where possible, API compatibility is maintained. However, some small stylistic changes were made.

`elf.symbols` is now a dictionary of `{name: address}` versus what it was before. Additionally, `elf.got` and `elf.plt` now exist, rather than being implemented in a `ROP` class.

I'm not 100% on the formatting of the Sphinx comments, but I did add doctests where they're possible to add reproducibly.

One small issue with `pyelftools` is that `__hash__` and `__eq__` are not implemented for `Segment`, which makes it impossible to do `segment in elf.executable_segments` (it will always return `False`). This only affects the simplicity with which we can do composition of on `Segment`s (e.g. `set(executable) & set(writable)`).

I've also added support for using the `SSH.run(...)` transport as well as the `process(...)` tube to gather information from the `ldd` equivalent. This should make looking up offsets on a remote machine easier.

Finally, I can't figure out how to silence the `process(...)` output. `log_level=pwnlib.log_levels.SILENCE` did nothing.