Skip to content

Commit ec262d8

Browse files
authored
Update sphinx for Python 3.13 support (#2503)
* Fix sphinx warnings in docstrings * Update sphinx for Python 3.13 support Could not import extension sphinx.builders.epub3 (exception: No module named 'imghdr') `imghdr` was removed in Python 3.13.
1 parent 55ac6e1 commit ec262d8

File tree

9 files changed

+46
-33
lines changed

9 files changed

+46
-33
lines changed

docs/requirements.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ capstone
22
coverage[toml]
33
python-dateutil
44
doc2dash
5-
docutils<0.18
5+
docutils<0.18; python_version<'3'
6+
docutils>=0.18; python_version>='3'
67
intervaltree
78
isort
89
mako>=1.0.0
@@ -18,6 +19,6 @@ psutil
1819
requests>=2.5.1
1920
ropgadget>=5.3
2021
sphinx==1.8.6; python_version<'3'
21-
sphinx>=4.5.0; python_version>='3'
22+
sphinx>=7.0.0; python_version>='3'
2223
sphinx_rtd_theme
2324
sphinxcontrib-autoprogram<=0.1.5

docs/source/protocols.rst

+9
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1+
.. testsetup:: *
12

3+
from pwn import *
4+
5+
6+
:mod:`pwnlib.protocols.adb` --- Protocol implementations
7+
========================================================
8+
9+
.. automodule:: pwnlib.protocols.adb
10+
:members:

docs/source/shellcraft/riscv64.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
context.clear(arch='riscv64')
55

66
:mod:`pwnlib.shellcraft.riscv64` --- Shellcode for RISCV64
7-
===========================================================
7+
==========================================================
88

99
:mod:`pwnlib.shellcraft.riscv64`
10-
-------------------------------
10+
--------------------------------
1111

1212
.. automodule:: pwnlib.shellcraft.riscv64
1313
:members:
1414

1515
:mod:`pwnlib.shellcraft.riscv64.linux`
16-
---------------------------------------
16+
--------------------------------------
1717

1818
.. automodule:: pwnlib.shellcraft.riscv64.linux
1919
:members:

docs/source/windbg.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pwn import *
44

55
:mod:`pwnlib.windbg` --- Working with WinDbg
6-
======================================
6+
============================================
77

88
.. automodule:: pwnlib.windbg
99
:members:

pwnlib/elf/corefile.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ class Corefile(ELF):
238238
Registers can be accessed directly, e.g. via ``core_obj.eax`` and enumerated
239239
via :data:`Corefile.registers`.
240240
241-
Memory can be accessed directly via :meth:`.read` or :meth:`.write`, and also
242-
via :meth:`.pack` or :meth:`.unpack` or even :meth:`.string`.
241+
Memory can be accessed directly via :meth:`pwnlib.elf.elf.ELF.read` or :meth:`pwnlib.elf.elf.ELF.write`, and also
242+
via :meth:`pwnlib.elf.elf.ELF.pack` or :meth:`pwnlib.elf.elf.ELF.unpack` or even :meth:`.string`.
243243
244244
Arguments:
245245
core: Path to the core file. Alternately, may be a :class:`.process` instance,
@@ -376,8 +376,8 @@ class Corefile(ELF):
376376
>>> core.exe.data[0:4]
377377
b'\x7fELF'
378378
379-
It also supports all of the features of :class:`ELF`, so you can :meth:`.read`
380-
or :meth:`.write` or even the helpers like :meth:`.pack` or :meth:`.unpack`.
379+
It also supports all of the features of :class:`ELF`, so you can :meth:`pwnlib.elf.elf.ELF.read`
380+
or :meth:`pwnlib.elf.elf.ELF.write` or even the helpers like :meth:`pwnlib.elf.elf.ELF.pack` or :meth:`pwnlib.elf.elf.ELF.unpack`.
381381
382382
Don't forget to call :meth:`.ELF.save` to save the changes to disk.
383383

pwnlib/elf/elf.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2350,7 +2350,7 @@ def disable_nx(self):
23502350

23512351
@staticmethod
23522352
def set_runpath(exepath, runpath):
2353-
r"""set_runpath(str, str) -> ELF
2353+
r"""set_runpath(exepath, runpath) -> ELF
23542354
23552355
Patches the RUNPATH of the ELF to the given path using the `patchelf utility <https://github.com/NixOS/patchelf>`_.
23562356
@@ -2385,7 +2385,7 @@ def set_runpath(exepath, runpath):
23852385

23862386
@staticmethod
23872387
def set_interpreter(exepath, interpreter_path):
2388-
r"""set_interpreter(str, str) -> ELF
2388+
r"""set_interpreter(exepath, interpreter_path) -> ELF
23892389
23902390
Patches the interpreter of the ELF to the given binary using the `patchelf utility <https://github.com/NixOS/patchelf>`_.
23912391
@@ -2419,7 +2419,7 @@ def set_interpreter(exepath, interpreter_path):
24192419

24202420
@staticmethod
24212421
def patch_custom_libraries(exe_path, custom_library_path, create_copy=True, suffix='_remotelibc'):
2422-
r"""patch_custom_libraries(str, str, bool, str) -> ELF
2422+
r"""patch_custom_libraries(exe_path, custom_library_path, create_copy=True, suffix='_remotelibc') -> ELF
24232423
24242424
Looks for the interpreter binary in the given path and patches the binary to use
24252425
it if available. Also patches the RUNPATH to the given path using the `patchelf utility <https://github.com/NixOS/patchelf>`_.

pwnlib/libcdb.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -766,12 +766,12 @@ def search_by_libs_id(libs_id, unstrip=True, offline_only=False):
766766
767767
Arguments:
768768
libs_id(str):
769-
Libs ID (e.g. 'libc6_...') of the library
769+
Libs ID (e.g. ``'libc6_...'``) of the library
770770
unstrip(bool):
771771
Try to fetch debug info for the libc and apply it to the downloaded file.
772772
offline_only(bool):
773-
When pass `offline_only=True`, restricts search mode to offline sources only,
774-
disable online lookup. Defaults to `False`, and enable both offline and online providers.
773+
When pass ``offline_only=True``, restricts search mode to offline sources only,
774+
disable online lookup. Defaults to :const:`False`, and enable both offline and online providers.
775775
776776
Returns:
777777
Path to the downloaded library on disk, or :const:`None`.

pwnlib/tubes/process.py

+14-11
Original file line numberDiff line numberDiff line change
@@ -888,8 +888,10 @@ def maps(self):
888888
"""maps() -> [mapping]
889889
890890
Returns a list of process mappings.
891+
891892
A mapping object has the following fields:
892893
addr, address (addr alias), start (addr alias), end, size, perms, path, rss, pss, shared_clean, shared_dirty, private_clean, private_dirty, referenced, anonymous, swap
894+
893895
perms is a permissions object, with the following fields:
894896
read, write, execute, private, shared, string
895897
@@ -917,24 +919,25 @@ def maps(self):
917919
>>> checker_arr == [True] * len(proc_maps) * 5
918920
True
919921
920-
"""
921-
922-
"""
923922
Useful information about this can be found at: https://man7.org/linux/man-pages/man5/proc.5.html
924923
specifically the /proc/pid/maps section.
925924
926-
memory_maps() returns a list of pmmap_ext objects
925+
memory_maps() returns a list of pmmap_ext objects. The definition (from psutil/_pslinux.py) is:
926+
927+
.. code-block:: python
927928
928-
The definition (from psutil/_pslinux.py) is:
929-
pmmap_grouped = namedtuple(
930-
'pmmap_grouped',
931-
['path', 'rss', 'size', 'pss', 'shared_clean', 'shared_dirty',
932-
'private_clean', 'private_dirty', 'referenced', 'anonymous', 'swap'])
933-
pmmap_ext = namedtuple(
934-
'pmmap_ext', 'addr perms ' + ' '.join(pmmap_grouped._fields))
929+
pmmap_grouped = namedtuple(
930+
'pmmap_grouped',
931+
['path', 'rss', 'size', 'pss', 'shared_clean', 'shared_dirty',
932+
'private_clean', 'private_dirty', 'referenced', 'anonymous', 'swap'])
933+
pmmap_ext = namedtuple(
934+
'pmmap_ext', 'addr perms ' + ' '.join(pmmap_grouped._fields))
935935
936936
937937
Here is an example of a pmmap_ext entry:
938+
939+
.. code-block:: python
940+
938941
pmmap_ext(addr='15555551c000-155555520000', perms='r--p', path='[vvar]', rss=0, size=16384, pss=0, shared_clean=0, shared_dirty=0, private_clean=0, private_dirty=0, referenced=0, anonymous=0, swap=0)
939942
"""
940943

pwnlib/tubes/tube.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1088,12 +1088,12 @@ def upload_manually(self, data, target_path = './payload', prompt = b'$', chunk_
10881088
The file is uploaded in base64-encoded chunks by appending to a file
10891089
and then decompressing it:
10901090
1091-
```
1092-
loop:
1093-
echo <chunk> | base64 -d >> <target_path>.<compression>
1094-
<compression> -d -f <target_path>.<compression>
1095-
chmod <chmod_flags> <target_path>
1096-
```
1091+
.. code-block::
1092+
1093+
loop:
1094+
echo <chunk> | base64 -d >> <target_path>.<compression>
1095+
<compression> -d -f <target_path>.<compression>
1096+
chmod <chmod_flags> <target_path>
10971097
10981098
It is assumed that a `base64` command is available on the target system.
10991099
When ``compression`` is ``auto`` the best compression utility available

0 commit comments

Comments
 (0)