From 5e850d743c4d754f191332f0c4d9d1d9713702e6 Mon Sep 17 00:00:00 2001 From: Sebastian LaVine Date: Wed, 19 Jun 2024 11:05:58 -0400 Subject: 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. --- demos/demo_keygen.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'demos/demo_keygen.py') diff --git a/demos/demo_keygen.py b/demos/demo_keygen.py index 12637ed0..f9286f6a 100755 --- a/demos/demo_keygen.py +++ b/demos/demo_keygen.py @@ -18,6 +18,9 @@ # along with Paramiko; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +""" +Demonstrates Paramiko's native keygen capabilities. +""" import sys from binascii import hexlify @@ -26,7 +29,7 @@ from optparse import OptionParser from paramiko import DSSKey from paramiko import RSAKey from paramiko.ssh_exception import SSHException -from paramiko.py3compat import u +from paramiko.util import u usage = """ %prog [-v] [-b bits] -t type [-N new_passphrase] [-f output_keyfile]""" @@ -167,7 +170,7 @@ if __name__ == "__main__": "Fingerprint: %d %s %s.pub (%s)" % ( bits, - ":".join([hash[i : 2 + i] for i in range(0, len(hash), 2)]), + ":".join([hash[i: 2 + i] for i in range(0, len(hash), 2)]), filename, ktype.upper(), ) -- cgit v1.2.3