mirror of
https://github.com/jtesta/ssh-audit.git
synced 2024-12-22 22:15:22 +01:00
Fix compatibility with Python 2.6. Fixes #3.
This commit is contained in:
parent
e8bd764cdb
commit
ef8d727356
12
ssh-audit.py
12
ssh-audit.py
@ -31,7 +31,7 @@ SSH_BANNER = 'SSH-2.0-OpenSSH_7.3'
|
|||||||
def usage():
|
def usage():
|
||||||
p = os.path.basename(sys.argv[0])
|
p = os.path.basename(sys.argv[0])
|
||||||
out.head('# {0} v1.0.20160812, moo@arthepsy.eu'.format(p))
|
out.head('# {0} v1.0.20160812, moo@arthepsy.eu'.format(p))
|
||||||
out.info('\nusage: {} [-nv] host[:port]\n'.format(p))
|
out.info('\nusage: {0} [-nv] host[:port]\n'.format(p))
|
||||||
out.info(' -v verbose')
|
out.info(' -v verbose')
|
||||||
out.info(' -n disable colors' + os.linesep)
|
out.info(' -n disable colors' + os.linesep)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -169,7 +169,7 @@ class SSH(object):
|
|||||||
self.__sock = socket.create_connection((host, port), cto)
|
self.__sock = socket.create_connection((host, port), cto)
|
||||||
self.__sock.settimeout(rto)
|
self.__sock.settimeout(rto)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
out.fail('[fail] {}'.format(e))
|
out.fail('[fail] {0}'.format(e))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
@ -526,14 +526,14 @@ def output_compatibility(kex, client=False):
|
|||||||
comp_text = []
|
comp_text = []
|
||||||
for sshd_name, v in ssh_timeframe.items():
|
for sshd_name, v in ssh_timeframe.items():
|
||||||
if v[cp] is None:
|
if v[cp] is None:
|
||||||
comp_text.append('{} {}+'.format(sshd_name, v[0]))
|
comp_text.append('{0} {1}+'.format(sshd_name, v[0]))
|
||||||
elif v[0] == v[1]:
|
elif v[0] == v[1]:
|
||||||
comp_text.append('{} {}'.format(sshd_name, v[0]))
|
comp_text.append('{0} {1}'.format(sshd_name, v[0]))
|
||||||
else:
|
else:
|
||||||
if v[1] < v[0]:
|
if v[1] < v[0]:
|
||||||
comp_text.append('{} {}+ (some functionality from {})'.format(sshd_name, v[0], v[1]))
|
comp_text.append('{0} {1}+ (some functionality from {2})'.format(sshd_name, v[0], v[1]))
|
||||||
else:
|
else:
|
||||||
comp_text.append('{} {}-{}'.format(sshd_name, v[0], v[1]))
|
comp_text.append('{0} {1}-{2}'.format(sshd_name, v[0], v[1]))
|
||||||
if len(comp_text) > 0:
|
if len(comp_text) > 0:
|
||||||
out.good('[info] compatibility: ' + ', '.join(comp_text))
|
out.good('[info] compatibility: ' + ', '.join(comp_text))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user