From bfa9e6f9364d0825dd6b30017f5df2f9bf4d5d81 Mon Sep 17 00:00:00 2001 From: Andris Raugulis Date: Tue, 13 Sep 2016 13:17:41 +0300 Subject: [PATCH] Do not hang when remote host closes connection fast. Fix security output. --- ssh-audit.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ssh-audit.py b/ssh-audit.py index 2ba277f..c844d7d 100755 --- a/ssh-audit.py +++ b/ssh-audit.py @@ -493,6 +493,7 @@ class SSH(object): if self.__banner is not None: continue self.__header.append(line) + s = 0 return self.__banner, self.__header def recv(self, size=2048): @@ -888,9 +889,10 @@ def output_security_sub(sub, software, padlen): def output_security(banner, padlen): with OutputBuffer() as obuf: - software = SSH.Software.parse(banner) - output_security_sub('cve', software, padlen) - output_security_sub('txt', software, padlen) + if banner: + software = SSH.Software.parse(banner) + output_security_sub('cve', software, padlen) + output_security_sub('txt', software, padlen) if len(obuf) > 0: out.head('# security') obuf.flush()