Skip to content

Commit

Permalink
Merge branch 'stable' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
heapcrash committed Jun 23, 2020
2 parents 6c0017e + 47c9cfe commit 871afd1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ To be released on Jun 5, 2020.

- [#1590][1590] Fix `gdb.attach()` for `remote`, `listen`, `ssh` tubes
- Also fix `run_in_new_terminal` for Py2 unicode strings
- [#1595][1595] Fix ssh.process(timeout=)

[1590]: https://github.com/Gallopsled/pwntools/pull/1590
[1595]: https://github.com/Gallopsled/pwntools/pull/1595

## 4.1.2

Expand Down
9 changes: 8 additions & 1 deletion pwnlib/tubes/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,10 @@ def process(self, argv=None, executable=None, tty=True, cwd=None, env=None, time
>>> s.process('echo hello', shell=True).recvall()
b'hello\n'
>>> io = s.process(['cat'], timeout=5)
>>> io.recvline()
b''
"""
if not argv and not executable:
self.error("Must specify argv or executable")
Expand Down Expand Up @@ -1049,11 +1053,14 @@ def is_exe(path):

msg = 'Starting remote process %s on %s' % (execve_repr, self.host)

if timeout == Timeout.default:
timeout = self.timeout

with self.progress(msg) as h:

script = 'for py in python2.7 python2 python; do test -x "$(which $py 2>&1)" && exec $py -c %s check; done; echo 2' % sh_string(script)
with context.quiet:
python = ssh_process(self, script, tty=True, raw=True, level=self.level, timeout=self.timeout)
python = ssh_process(self, script, tty=True, raw=True, level=self.level, timeout=timeout)

try:
result = safeeval.const(python.recvline())
Expand Down

0 comments on commit 871afd1

Please sign in to comment.