diff --git a/CHANGELOG.md b/CHANGELOG.md index e6adf05f..7b99a39e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,7 @@ The table below shows which release corresponds to each branch, and what date th ## 5.0.0 (`dev`) +- [#2753][2753] docs(args): clarify reserved args (DEBUG/NOASLR) map to context, not args - [#2740][2740] setup: install docs to FHS-compliant share/doc/pwntools - [#2739][2739] shellcraft: migrate lazy importer to find_spec for Python 3.12+ - [#2725][2725] feat(libcdb): add extra_mirrors arg + PWNLIB_EXTRA_LIBC_MIRRORS env to download_libraries @@ -209,6 +210,7 @@ The table below shows which release corresponds to each branch, and what date th [2746]: https://github.com/Gallopsled/pwntools/pull/2746 [2734]: https://github.com/Gallopsled/pwntools/pull/2734 [2735]: https://github.com/Gallopsled/pwntools/pull/2735 +[2753]: https://github.com/Gallopsled/pwntools/pull/2753 ## 4.15.1 diff --git a/pwnlib/args.py b/pwnlib/args.py index 5b593961..f9a6eb51 100644 --- a/pwnlib/args.py +++ b/pwnlib/args.py @@ -17,7 +17,10 @@ The easiest example is to enable more verbose debugging. Just set ``DEBUG``. These arguments are automatically extracted, regardless of their name, and exposed via :mod:`pwnlib.args.args`, which is exposed as the global variable :data:`args`. Arguments which ``pwntools`` reserves internally are not exposed -this way. +this way. These reserved arguments (such as ``DEBUG`` and ``NOASLR``) instead +adjust :data:`pwnlib.context.context`, so their effect is read from ``context`` +(e.g. ``context.log_level``, ``context.aslr``) rather than from ``args`` -- +``args.NOASLR`` is always the empty string. .. code-block:: bash diff --git a/pwnlib/data/templates/pwnup.mako b/pwnlib/data/templates/pwnup.mako index 6d7e03c5..95603001 100644 --- a/pwnlib/data/templates/pwnup.mako +++ b/pwnlib/data/templates/pwnup.mako @@ -53,9 +53,12 @@ exe = ${binary_repr} %endif %if not quiet: -# Many built-in settings can be controlled on the command-line and show up -# in "args". For example, to dump all data sent/received, and disable ASLR -# for all created processes... +# Many built-in settings can be controlled on the command-line. Reserved +# "magic arguments" such as DEBUG and NOASLR adjust pwntools' behavior via +# "context" (e.g. context.log_level, context.aslr) and are NOT stored in +# "args"; other arguments (HOST, PORT, EXE, ...) show up in "args". For +# example, to dump all data sent/received, and disable ASLR for all created +# processes... # ./exploit.py DEBUG NOASLR %if host or port or user: # ./exploit.py GDB HOST=example.com PORT=4141 EXE=/tmp/executable