summaryrefslogtreecommitdiffhomepage
path: root/demos/demo_simple.py
diff options
context:
space:
mode:
authorSebastian LaVine <mail@smlavine.com>2024-06-19 11:05:58 -0400
committerSebastian LaVine <mail@smlavine.com>2024-06-19 11:05:58 -0400
commit5e850d743c4d754f191332f0c4d9d1d9713702e6 (patch)
tree77126303f2c4722aa06d3bfe27aeeef386f8f63b /demos/demo_simple.py
parent51eb55debf2ebfe56f38378005439a029a48225f (diff)
Fix and improve demo programs
This commit does a few things that make the demos more usable. Imports from paramiko.py3compat have been removed as that module was removed in commit 5c4b311b (2023-01-09), making it possible to run these demos with modern versions of the library. GSS support was made system-conditional in all demo files, as it was previously in demo_simple.py. Unused imports were removed. Docstrings were added to files that did not have them.
Diffstat (limited to 'demos/demo_simple.py')
-rwxr-xr-x[-rw-r--r--]demos/demo_simple.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/demos/demo_simple.py b/demos/demo_simple.py
index bd932c3e..1550e1bc 100644..100755
--- a/demos/demo_simple.py
+++ b/demos/demo_simple.py
@@ -18,14 +18,14 @@
# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+Demonstrates how to open a shell at an SSH server, using basic password
+authentication or GSSAPI.
+"""
-import base64
import getpass
-import os
-import socket
import sys
import traceback
-from paramiko.py3compat import input
import paramiko
@@ -44,8 +44,6 @@ UseGSSAPI = (
DoGSSAPIKeyExchange = (
paramiko.GSS_AUTH_AVAILABLE
) # enable "gssapi-kex" key exchange, if supported by your python installation
-# UseGSSAPI = False
-# DoGSSAPIKeyExchange = False
port = 22
# get hostname
@@ -93,7 +91,7 @@ try:
gss_kex=DoGSSAPIKeyExchange,
)
except Exception:
- # traceback.print_exc()
+ traceback.print_exc()
password = getpass.getpass(
"Password for %s@%s: " % (username, hostname)
)