From 2d47f42414733f2aa298829ec330dd2c9545c64c Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Tue, 18 Oct 2022 14:54:10 -0400 Subject: [PATCH] Fixed string_gen complex generating unprintable strings Former-commit-id: beec4dc72264edf0a2818a5088c849a310d5f7d0 [formerly 9d990eb9f65df196d49ff2736c9be5b0e919d97e] Former-commit-id: 09895d9c665ece34d74c5c68ce6657952c19ca59 --- lib/sshyp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sshyp.py b/lib/sshyp.py index 6b33311..5b6cf4d 100755 --- a/lib/sshyp.py +++ b/lib/sshyp.py @@ -103,7 +103,7 @@ def string_gen(_complexity, _length): # generates and returns a random string b if _complexity == 's': _character_pool = string.ascii_letters + string.digits else: - _character_pool = string.printable.replace('/', '').replace('\\', '') + _character_pool = string.digits + string.ascii_letters + string.punctuation.replace('/', '').replace('\\', '') _gen = ''.join(SystemRandom().choice(_character_pool) for _ in range(_length)) _min_special, _special = round(.2 * _length), 0 for _character in _gen: