From dc615cef7fbf60690d7fd31e966ee6c2eb8466a7 Mon Sep 17 00:00:00 2001 From: Joe Testa Date: Sat, 28 Sep 2024 18:39:55 -0400 Subject: [PATCH] Fixed DH rate testing on Windows. (#261) --- README.md | 1 + src/ssh_audit/dheat.py | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5ea4c0b..b577a94 100644 --- a/README.md +++ b/README.md @@ -230,6 +230,7 @@ For convenience, a web front-end on top of the command-line tool is available at - 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. + - Fixed `--conn-rate-test` feature on Windows. - When scanning multiple targets (using `-T`/`--targets`), the `-p`/`--port` option will now be used as the default port (set to 22 if `-p`/`--port` is not given). Hosts specified in the file can override this default with an explicit port number (i.e.: "host1:1234"). For example, when using `-T targets.txt -p 222`, all hosts in `targets.txt` that do not explicitly include a port number will default to 222; when using `-T targets.txt` (without `-p`), all hosts will use a default of 22. - Now reports ECDSA and DSS fingerprints when in verbose mode; partial credit [Daniel Lenski](https://github.com/dlenskiSB). - Added 1 new cipher: `grasshopper-ctr128`. diff --git a/src/ssh_audit/dheat.py b/src/ssh_audit/dheat.py index 757313a..6c7e99f 100644 --- a/src/ssh_audit/dheat.py +++ b/src/ssh_audit/dheat.py @@ -324,12 +324,6 @@ class DHEat: 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 @@ class DHEat: # 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)