Permalink
Browse files

Greatly enhance and update the pwnlib.elf module documentation.

  • Loading branch information...
1 parent 12f1bb9 commit bd88c92991e08bc6d7e17be93b34691f90c91c41 @zachriggle zachriggle committed Jan 7, 2017
Showing with 602 additions and 134 deletions.
  1. +12 −2 docs/source/conf.py
  2. +10 −3 docs/source/elf.rst
  3. +15 −0 docs/source/elf/corefile.rst
  4. +27 −0 docs/source/elf/elf.rst
  5. +1 −1 docs/source/globals.rst
  6. +2 −3 pwn/toplevel.py
  7. +6 −0 pwnlib/elf/__init__.py
  8. +189 −24 pwnlib/elf/corefile.py
  9. +340 −101 pwnlib/elf/elf.py
View
@@ -44,6 +44,10 @@
'sphinxcontrib.napoleon'
]
+# Napoleon settings
+napoleon_use_ivar = True
+napoleon_use_rtype = False
+
doctest_global_setup = '''
import sys, os
os.environ['PWNLIB_NOTERM'] = '1'
@@ -67,7 +71,7 @@ def __setattr__(self, name, value):
pwnlib.context.ContextType.defaults['log_console'] = stdout()
'''
-autodoc_member_order = 'alphabetical'
+autodoc_member_order = 'groupwise' # 'alphabetical'
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -231,7 +235,7 @@ def __setattr__(self, name, value):
]
intersphinx_mapping = {'python': ('https://docs.python.org/2.7', None),
- 'paramiko': ('https://paramiko-docs.readthedocs.org/en/1.15/', None)}
+ 'paramiko': ('https://paramiko-docs.readthedocs.org/en/2.1/', None)}
# The name of an image file (relative to this directory) to place at the top of
# the title page.
@@ -347,3 +351,9 @@ def linkcode_resolve(domain, info):
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# otherwise, readthedocs.org uses their theme by default, so no need to specify it
+
+
+# -- Customization to Sphinx autodoc generation --------------------------------------------
+import sphinx.ext.autodoc
+
+sphinx.ext.autodoc
View
@@ -3,8 +3,15 @@
from pwnlib.elf import *
from pwnlib.util.misc import which
-:mod:`pwnlib.elf` --- Working with ELF binaries
-===============================================
+:mod:`pwnlib.elf` --- ELF Executables and Libraries
+===================================================
.. automodule:: pwnlib.elf
- :members:
+
+
+ELF Modules
+-------------------
+
+.. toctree::
+ elf/elf
+ elf/corefile
@@ -0,0 +1,15 @@
+.. testsetup:: *
+
+ from pwn import *
+
+:mod:`pwnlib.elf.corefile` --- Core Files
+===========================================================
+
+.. automodule:: pwnlib.elf.corefile
+
+ .. autoclass:: pwnlib.elf.corefile.Corefile
+ :members:
+ :show-inheritance:
+
+ .. autoclass:: pwnlib.elf.corefile.Mapping
+ :members:
@@ -0,0 +1,27 @@
+.. testsetup:: *
+
+ from pwn import *
+
+:mod:`pwnlib.elf.elf` --- ELF Files
+===========================================================
+
+.. automodule:: pwnlib.elf.elf
+
+ .. autoclass:: pwnlib.elf.elf.ELF
+ :members:
+ :show-inheritance:
+ :inherited-members:
+ :exclude-members: address_offsets,
+ get_data,
+ get_dwarf_info,
+ get_section,
+ get_segment,
+ has_dwarf_info,
+ iter_sections,
+ iter_segments
+
+ .. autoclass:: pwnlib.elf.elf.Function
+ :members:
+
+ .. autoclass:: pwnlib.elf.elf.dotdict
+ :members:
@@ -13,7 +13,7 @@ Which imports a bazillion things into the global namespace to make your life eas
This is a quick list of most of the objects and routines imported, in rough order of importance and frequency of use.
-- ``context``
+- :obj:`.context`
- :data:`pwnlib.context.context`
- Responsible for most of the pwntools convenience settings
- Set `context.log_level = 'debug'` when troubleshooting your exploit
View
@@ -24,9 +24,8 @@
from pwnlib.context import context
from pwnlib.dynelf import DynELF
from pwnlib.encoders import *
-from pwnlib.elf import Core
-from pwnlib.elf import ELF
-from pwnlib.elf import load
+from pwnlib.elf.corefile import Core, Corefile
+from pwnlib.elf.elf import ELF, load
from pwnlib.encoders import *
from pwnlib.exception import PwnlibException
from pwnlib.gdb import attach, debug, debug_assembly, debug_shellcode
@@ -1,3 +1,9 @@
+"""
+Most exploitable CTF challenges are provided in the Executable and Linkable
+Format (``ELF``). Generally, it is very useful to be able to interact with
+these files to extract data such as function addresses, ROP gadgets, and
+writable page addresses.
+"""
from __future__ import absolute_import
from pwnlib.elf.corefile import Core
Oops, something went wrong.

0 comments on commit bd88c92

Please sign in to comment.