mirror of
https://github.com/jtesta/ssh-audit.git
synced 2026-10-27 11:31:29 +01:00
Select the least protocol if banner has double protocol.
This commit is contained in:
1 parent
19ee986e3d
commit
673b88b2b1
1 file changed
+6
@@ -246,6 +246,12 @@ class SSH(object):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def parse(cls, banner):
|
def parse(cls, banner):
|
||||||
|
mx = re.match(r'^SSH-(\d)\.\s*?(\d+)-SSH-(\d)\.\s*?(\d+)(|-.*)$', banner)
|
||||||
|
if mx is not None:
|
||||||
|
p1 = (int(mx.group(1)), int(mx.group(2)))
|
||||||
|
p2 = (int(mx.group(3)), int(mx.group(4)))
|
||||||
|
protocol = p1 if p1 < p2 else p2
|
||||||
|
banner = 'SSH-{0}.{1}{2}'.format(protocol[0], protocol[1], mx.group(5))
|
||||||
mx = re.match(r'^SSH-(\d)\.\s*?(\d+)(|-([^\s]*)(\s+(.*))?)$', banner)
|
mx = re.match(r'^SSH-(\d)\.\s*?(\d+)(|-([^\s]*)(\s+(.*))?)$', banner)
|
||||||
if mx is None:
|
if mx is None:
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in new issue
Block a user