1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Mon, 11 Apr 2022 14:06:33 +0200
Subject: Use python3 in doctests
---
pwnlib/tubes/process.py | 8 ++++----
pwnlib/tubes/ssh.py | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/pwnlib/tubes/process.py b/pwnlib/tubes/process.py
index 3b2ec16..9beb733 100644
--- a/pwnlib/tubes/process.py
+++ b/pwnlib/tubes/process.py
@@ -125,7 +125,7 @@ class process(tube):
Examples:
- >>> p = process('python')
+ >>> p = process('python3')
>>> p.sendline(b"print('Hello world')")
>>> p.sendline(b"print('Wow, such data')")
>>> b'' == p.recv(timeout=0.01)
@@ -166,20 +166,20 @@ class process(tube):
>>> p.recv()
b'\x00\x00\x00\x00\x00\x00\x00\x00'
- >>> p = process(['python','-c','import os; print(os.read(2,1024).decode())'],
+ >>> p = process(['python3','-c','import os; print(os.read(2,1024).decode())'],
... preexec_fn = lambda: os.dup2(0,2))
>>> p.sendline(b'hello')
>>> p.recvline()
b'hello\n'
- >>> stack_smashing = ['python','-c','open("/dev/tty","wb").write(b"stack smashing detected")']
+ >>> stack_smashing = ['python3','-c','open("/dev/tty","wb").write(b"stack smashing detected")']
>>> process(stack_smashing).recvall()
b'stack smashing detected'
>>> process(stack_smashing, stdout=PIPE).recvall()
b''
- >>> getpass = ['python','-c','import getpass; print(getpass.getpass("XXX"))']
+ >>> getpass = ['python3','-c','import getpass; print(getpass.getpass("XXX"))']
>>> p = process(getpass, stdin=PTY)
>>> p.recv()
b'XXX'
diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py
index 8f19b57..88a6b9b 100644
--- a/pwnlib/tubes/ssh.py
+++ b/pwnlib/tubes/ssh.py
@@ -386,7 +386,7 @@ class ssh_process(ssh_channel):
Examples:
>>> s = ssh(host='example.pwnme')
- >>> p = s.process(['python', '-c', 'import time; time.sleep(10)'])
+ >>> p = s.process(['python3', '-c', 'import time; time.sleep(10)'])
>>> hex(p.getenv('PATH')) # doctest: +ELLIPSIS
'0x...'
"""
@@ -876,7 +876,7 @@ class ssh(Timeout, Logger):
b'/tmp\n'
>>> io.cwd
'/tmp'
- >>> p = s.process(['python','-c','import os; os.write(1, os.read(2, 1024))'], stderr=0)
+ >>> p = s.process(['python3','-c','import os; os.write(1, os.read(2, 1024))'], stderr=0)
>>> p.send(b'hello')
>>> p.recv()
b'hello'
|