mirror of
https://github.com/jtesta/ssh-audit.git
synced 2024-12-23 06:27:41 +01:00
Refactor result output.
This commit is contained in:
parent
f6b40d63bb
commit
96da1af9ef
15
ssh-audit.py
15
ssh-audit.py
@ -442,7 +442,13 @@ def process_algorithm(alg_type, alg_name, alg_max_len=0):
|
|||||||
else:
|
else:
|
||||||
f(' ' * len(prefix + alg_name) + padding + ' `- ' + text)
|
f(' ' * len(prefix + alg_name) + padding + ' `- ' + text)
|
||||||
|
|
||||||
def process_kex(kex):
|
def output(banner, kex):
|
||||||
|
out.head('# general')
|
||||||
|
out.good('[info] banner: ' + banner)
|
||||||
|
if banner.startswith('SSH-1.99-'):
|
||||||
|
out.fail('[fail] protocol SSH1 enabled')
|
||||||
|
if kex is None:
|
||||||
|
return
|
||||||
compressions = [x for x in kex.server.compression if x != 'none']
|
compressions = [x for x in kex.server.compression if x != 'none']
|
||||||
if len(compressions) > 0:
|
if len(compressions) > 0:
|
||||||
cmptxt = 'enabled ({0})'.format(', '.join(compressions))
|
cmptxt = 'enabled ({0})'.format(', '.join(compressions))
|
||||||
@ -492,16 +498,13 @@ def main():
|
|||||||
host, port = parse_args()
|
host, port = parse_args()
|
||||||
s = SSH.Socket(host, port)
|
s = SSH.Socket(host, port)
|
||||||
banner = s.get_banner()
|
banner = s.get_banner()
|
||||||
out.head('# general')
|
|
||||||
out.good('[info] banner: ' + banner)
|
|
||||||
if banner.startswith('SSH-1.99-'):
|
|
||||||
out.fail('[fail] protocol SSH1 enabled')
|
|
||||||
packet_type, payload = s.read_packet()
|
packet_type, payload = s.read_packet()
|
||||||
if packet_type != SSH.MSG_KEXINIT:
|
if packet_type != SSH.MSG_KEXINIT:
|
||||||
|
output(banner, None)
|
||||||
out.fail('[exception] did not receive MSG_KEXINIT (20), instead received unknown message ({0})'.format(packet_type))
|
out.fail('[exception] did not receive MSG_KEXINIT (20), instead received unknown message ({0})'.format(packet_type))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
kex = Kex.parse(payload)
|
kex = Kex.parse(payload)
|
||||||
process_kex(kex)
|
output(banner, kex)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
out = Output()
|
out = Output()
|
||||||
|
Loading…
Reference in New Issue
Block a user