From ea3258151e8f4ddb0ef3078c28e47c90c73dd46f Mon Sep 17 00:00:00 2001 From: Joe Testa Date: Tue, 24 Sep 2024 15:48:14 -0400 Subject: [PATCH] Fixed invalid JSON output when a socket error occurs while performing a client audit. (#295) --- README.md | 1 + src/ssh_audit/ssh_socket.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ecfb074..469f444 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,7 @@ For convenience, a web front-end on top of the command-line tool is available at - Fixed crash when running with `-P` and `-T` options simultaneously. - Fixed host key tests from only reporting a key type at most once despite multiple hosts supporting it; credit [Daniel Lenski](https://github.com/dlenskiSB). - Fixed DHEat connection rate testing on MacOS X and BSD platforms; credit [Drew Noel](https://github.com/drewmnoel) and [Michael Osipov](https://github.com/michael-o). + - Fixed invalid JSON output when a socket error occurs while performing a client audit. - Added 1 new cipher: `grasshopper-ctr128`. - Added 2 new key exchanges: `mlkem768x25519-sha256`, `sntrup761x25519-sha512`. diff --git a/src/ssh_audit/ssh_socket.py b/src/ssh_audit/ssh_socket.py index 4afaa57..400bd50 100644 --- a/src/ssh_audit/ssh_socket.py +++ b/src/ssh_audit/ssh_socket.py @@ -108,7 +108,7 @@ class SSH_Socket(ReadBuf, WriteBuf): s.listen() self.__sock_map[s.fileno()] = s except Exception as e: - print("Warning: failed to listen on any IPv4 interfaces: %s" % str(e)) + print("Warning: failed to listen on any IPv4 interfaces: %s" % str(e), file=sys.stderr) try: # Socket to listen on all IPv6 addresses. @@ -119,11 +119,11 @@ class SSH_Socket(ReadBuf, WriteBuf): s.listen() self.__sock_map[s.fileno()] = s except Exception as e: - print("Warning: failed to listen on any IPv6 interfaces: %s" % str(e)) + print("Warning: failed to listen on any IPv6 interfaces: %s" % str(e), file=sys.stderr) # If we failed to listen on any interfaces, terminate. if len(self.__sock_map.keys()) == 0: - print("Error: failed to listen on any IPv4 and IPv6 interfaces!") + print("Error: failed to listen on any IPv4 and IPv6 interfaces!", file=sys.stderr) sys.exit(exitcodes.CONNECTION_ERROR) # Wait for an incoming connection. If a timeout was explicitly