This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gobroker. commit 1ff72ddf58f522226e8676efe7313ccb72ba8b54 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Apr 30 14:47:28 2018 +0200 x2gobroker/utils.py: Provide helper functions for pretty-formatting key fingerprints. --- x2gobroker/utils.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/x2gobroker/utils.py b/x2gobroker/utils.py index a5a0d4b..291dd25 100644 --- a/x2gobroker/utils.py +++ b/x2gobroker/utils.py @@ -24,6 +24,7 @@ import netaddr import distutils.version import pwd, grp import socket +import binascii def _checkConfigFileDefaults(data_structure): """\ @@ -283,3 +284,36 @@ def portscan(addr, port=22): sock.close() return True + +def get_key_fingerprint(key): + """\ + Retrieve the host key fingerprint of the server to be validated. + + + :returns: host key fingerprint + + :rtype: ``str`` + + """ + return binascii.hexlify(key.get_fingerprint()).decode() + +def get_key_fingerprint_with_colons(key): + """\ + Retrieve the (colonized) host key fingerprint of the server + to be validated. + + + :returns: host key fingerprint (with colons) + + :rtype: ``str`` + + """ + _fingerprint = get_key_fingerprint(key) + _colon_fingerprint = '' + idx = 0 + for char in _fingerprint: + idx += 1 + _colon_fingerprint += char + if idx % 2 == 0: + _colon_fingerprint += ':' + return _colon_fingerprint.rstrip(':') -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git