summaryrefslogtreecommitdiffhomepage
path: root/demos/demo_keygen.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_keygen.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_keygen.py')
-rwxr-xr-xdemos/demo_keygen.py7
1 files changed, 5 insertions, 2 deletions
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(),
)