Skip to content

Commit

Permalink
Fix extremely verbosel logging of environment when no changes were ma…
Browse files Browse the repository at this point in the history
…de (#1592)

* Fix extremely verbosel logging of environment when no changes were made

* [changelog] Update changelog for #1592

Fixes #1448
  • Loading branch information
heapcrash authored Jun 23, 2020
1 parent 1b130cf commit a1b0ff6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ To be released on Jun 30, 2020.

- [#1576][1576] Add `executable=` argument to `ELF.search`
- [#1584][1584] Add `jmp_esp`/`jmp_rsp` attribute to `ROP`
- [#1592][1592] Fix over-verbose logging of process() environment
- [#1593][1593] Colorize output of `pwn template`
- [#1601][1601] Add `pwn version` command line tool

[1576]: https://github.com/Gallopsled/pwntools/pull/1576
[1584]: https://github.com/Gallopsled/pwntools/pull/1584
[1592]: https://github.com/Gallopsled/pwntools/pull/1592
[1593]: https://github.com/Gallopsled/pwntools/pull/1593
[1601]: https://github.com/Gallopsled/pwntools/pull/1601

Expand Down
5 changes: 4 additions & 1 deletion pwnlib/tubes/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ def __init__(self, argv = None,
#: :class:`subprocess.Popen` object that backs this process
self.proc = None

# We need to keep a copy of the un-_validated environment for printing
original_env = env

if shell:
executable_val, argv_val, env_val = executable, argv, env
else:
Expand Down Expand Up @@ -298,7 +301,7 @@ def __init__(self, argv = None,

if self.isEnabledFor(logging.DEBUG):
if argv != [self.executable]: message += ' argv=%r ' % self.argv
if env not in (os.environ, None): message += ' env=%r ' % self.env
if original_env not in (os.environ, None): message += ' env=%r ' % self.env

with self.progress(message) as p:

Expand Down

0 comments on commit a1b0ff6

Please sign in to comment.