mirror of
https://github.com/jtesta/ssh-audit.git
synced 2024-12-23 06:27:41 +01:00
Support simple software output (without patch).
This commit is contained in:
parent
15d24cde08
commit
1fda7b2a3e
20
ssh-audit.py
20
ssh-audit.py
@ -517,15 +517,15 @@ class SSH(object):
|
|||||||
return -1
|
return -1
|
||||||
elif self.version > oversion:
|
elif self.version > oversion:
|
||||||
return 1
|
return 1
|
||||||
spatch = self.patch
|
spatch = self.patch or ''
|
||||||
if self.product == SSH.Product.DropbearSSH:
|
if self.product == SSH.Product.DropbearSSH:
|
||||||
if not re.match(r'^test\d.*$', opatch):
|
if not re.match(r'^test\d.*$', opatch):
|
||||||
opatch = 'z{0}'.format(opatch)
|
opatch = 'z{0}'.format(opatch)
|
||||||
if not re.match(r'^test\d.*$', self.patch):
|
if not re.match(r'^test\d.*$', spatch):
|
||||||
spatch = 'z{0}'.format(self.patch)
|
spatch = 'z{0}'.format(spatch)
|
||||||
elif self.product == SSH.Product.OpenSSH:
|
elif self.product == SSH.Product.OpenSSH:
|
||||||
mx1 = re.match(r'^p\d(.*)', opatch)
|
mx1 = re.match(r'^p\d(.*)', opatch)
|
||||||
mx2 = re.match(r'^p\d(.*)', self.patch)
|
mx2 = re.match(r'^p\d(.*)', spatch)
|
||||||
if not (mx1 and mx2):
|
if not (mx1 and mx2):
|
||||||
if mx1:
|
if mx1:
|
||||||
opatch = mx1.group(1)
|
opatch = mx1.group(1)
|
||||||
@ -544,23 +544,27 @@ class SSH(object):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def __str__(self):
|
def display(self, full=True):
|
||||||
out = '{0} '.format(self.vendor) if self.vendor else ''
|
out = '{0} '.format(self.vendor) if self.vendor else ''
|
||||||
out += self.product
|
out += self.product
|
||||||
if self.version:
|
if self.version:
|
||||||
out += ' {0}'.format(self.version)
|
out += ' {0}'.format(self.version)
|
||||||
patch = self.patch
|
if full:
|
||||||
|
patch = self.patch or ''
|
||||||
if self.product == SSH.Product.OpenSSH:
|
if self.product == SSH.Product.OpenSSH:
|
||||||
mx = re.match('^(p\d)(.*)$', self.patch)
|
mx = re.match('^(p\d)(.*)$', patch)
|
||||||
if mx is not None:
|
if mx is not None:
|
||||||
out += mx.group(1)
|
out += mx.group(1)
|
||||||
patch = mx.group(2).strip()
|
patch = mx.group(2).strip()
|
||||||
if patch:
|
if patch:
|
||||||
out += ' ({0})'.format(self.patch)
|
out += ' ({0})'.format(patch)
|
||||||
if self.os:
|
if self.os:
|
||||||
out += ' running on {0}'.format(self.os)
|
out += ' running on {0}'.format(self.os)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.display()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
out = 'vendor={0} '.format(self.vendor) if self.vendor else ''
|
out = 'vendor={0} '.format(self.vendor) if self.vendor else ''
|
||||||
if self.product:
|
if self.product:
|
||||||
|
Loading…
Reference in New Issue
Block a user