Created
July 29, 2020 17:49
-
-
Save ploxiln/86dbd713dc959d87130e2066a0124a5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import paramiko | |
print("paramiko version=%s" % (paramiko.__version__,)) | |
print("python version=%d.%d.%d" % sys.version_info[:3]) | |
if len(sys.argv) != 5: | |
print("USAGE: %s ip port user password" % __file__) | |
sys.exit(1) | |
ip = sys.argv[1] | |
port = sys.argv[2] | |
usr = sys.argv[3] | |
passwd = sys.argv[4] | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
ssh.connect(hostname=ip, port=port, | |
username=usr, password=passwd) | |
for i in range(2500): | |
sys.stdout.write('.') | |
if i & 63 == 0: | |
sys.stdout.write(" %d\n" % i) | |
sys.stdout.flush() | |
ret = ssh.exec_command("echo haha") | |
_in, _out, _err = ret | |
o = _out.read() | |
e = _err.read() | |
# this line triggers the bug | |
del o, e, _in, _out, _err, ret | |
# ... or replace by _in.close() | |
sys.stdout.write("\n") | |
ssh.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment