mirror of
https://github.com/jtesta/ssh-audit.git
synced 2024-12-23 06:27:41 +01:00
Add fingerprint support.
This commit is contained in:
parent
5bc31ea70c
commit
b16ef4d040
24
ssh-audit.py
24
ssh-audit.py
@ -24,7 +24,7 @@
|
|||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os, io, sys, socket, struct, random, errno, getopt, re
|
import os, io, sys, socket, struct, random, errno, getopt, re, hashlib, base64
|
||||||
|
|
||||||
VERSION = 'v1.0.20160915'
|
VERSION = 'v1.0.20160915'
|
||||||
|
|
||||||
@ -278,6 +278,12 @@ class SSH1(object):
|
|||||||
def host_key_public_modulus(self):
|
def host_key_public_modulus(self):
|
||||||
return self.__host_key[2]
|
return self.__host_key[2]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def host_key_fingerprint_data(self):
|
||||||
|
mod = WriteBuf._create_mpint(self.host_key_public_modulus, False)
|
||||||
|
e = WriteBuf._create_mpint(self.host_key_public_exponent, False)
|
||||||
|
return mod + e
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def protocol_flags(self):
|
def protocol_flags(self):
|
||||||
return self.__protocol_flags
|
return self.__protocol_flags
|
||||||
@ -686,6 +692,22 @@ class SSH(object):
|
|||||||
comments = (mx.group(4) or '').strip() or None
|
comments = (mx.group(4) or '').strip() or None
|
||||||
return cls(protocol, software, comments)
|
return cls(protocol, software, comments)
|
||||||
|
|
||||||
|
class Fingerprint(object):
|
||||||
|
def __init__(self, fpd):
|
||||||
|
self.__fpd = fpd
|
||||||
|
|
||||||
|
@property
|
||||||
|
def md5(self):
|
||||||
|
h = hashlib.md5(self.__fpd).hexdigest()
|
||||||
|
h = u':'.join(h[i:i + 2] for i in range(0, len(h), 2))
|
||||||
|
return u'MD5:{0}'.format(h)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def sha256(self):
|
||||||
|
h = base64.b64encode(hashlib.sha256(self.__fpd).digest())
|
||||||
|
h = h.decode().rstrip('=')
|
||||||
|
return u'SHA256:{0}'.format(h)
|
||||||
|
|
||||||
class Security(object):
|
class Security(object):
|
||||||
CVE = {
|
CVE = {
|
||||||
'Dropbear SSH': [
|
'Dropbear SSH': [
|
||||||
|
Loading…
Reference in New Issue
Block a user