From 0e6bcb5af0ad69155f60ba6eb655a82227db0a25 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 30 May 2019 17:25:24 +0100 Subject: [PATCH] Hex-encode master passwords, instead of b64, to avoid "strange" chars --- modules/permissions/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/permissions/__init__.py b/modules/permissions/__init__.py index 3075af6a..b53ff875 100644 --- a/modules/permissions/__init__.py +++ b/modules/permissions/__init__.py @@ -1,7 +1,7 @@ #--depends-on commands #--depends-on config -import base64, os +import base64, binascii, os import scrypt from src import ModuleManager, utils @@ -52,12 +52,12 @@ class Module(ModuleManager.BaseModule): return hash, salt def _random_string(self, n): - return base64.b64encode(os.urandom(n)).decode("utf8") def _make_salt(self): - return self._random_string(64) + return base64.b64encode(os.urandom(64)).decode("utf8") + def _random_password(self): - return self._random_string(32) + return binascii.hexlify(os.urandom(32)).decode("utf8") def _make_hash(self, password, salt=None): salt = salt or self._make_salt()