From 221b08cf1660b4b92396c6344afacb40a51d9a58 Mon Sep 17 00:00:00 2001 From: Joe Testa Date: Sat, 28 Sep 2024 18:26:59 -0400 Subject: [PATCH] Fixed DH rate testing on Windows. (#261) --- src/ssh_audit/dheat.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/ssh_audit/dheat.py b/src/ssh_audit/dheat.py index 757313ab..6c7e99f1 100644 --- a/src/ssh_audit/dheat.py +++ b/src/ssh_audit/dheat.py @@ -324,12 +324,6 @@ def _close_socket(socket_dict: Dict[socket.socket, float], s: socket.socket) -> del socket_dict[s] - if sys.platform == "win32": - DHEat.YELLOWB = "\033[1;93m" - DHEat.CLEAR = "\033[0m" - print("\n%sUnfortunately, this feature is not currently functional under Windows.%s This should get fixed in a future release. See: " % (DHEat.YELLOWB, DHEat.CLEAR)) - return "" - # Resolve the target into an IP address out.d("Resolving target %s..." % aconf.host) target_address_family, target_ip_address = DHEat._resolve_hostname(aconf.host, aconf.ip_version_preference) @@ -443,7 +437,7 @@ def _close_socket(socket_dict: Dict[socket.socket, float], s: socket.socket) -> # out.d("Creating socket (%u of %u already exist)..." % (len(socket_dict), concurrent_sockets), write_now=True) ret = s.connect_ex((target_ip_address, aconf.port)) num_attempted_connections += 1 - if ret in [0, errno.EINPROGRESS]: + if ret in [0, errno.EINPROGRESS, errno.EWOULDBLOCK]: socket_dict[s] = now else: out.d("connect_ex() returned: %s (%d)" % (os.strerror(ret), ret), write_now=True)