Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extremely verbosel logging of environment when no changes were made #1592

Merged
merged 3 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ 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

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

## 4.2.0 (`beta`)

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