From 1a8725d491383fa15ca3fd27a29b1a18ce2b8d1f Mon Sep 17 00:00:00 2001 From: Joe Testa Date: Sat, 29 Jun 2024 18:57:52 -0400 Subject: [PATCH] Now prints the IP address in the UI, instead of hostname. --- src/ssh_audit/dheat.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ssh_audit/dheat.py b/src/ssh_audit/dheat.py index 3f005441..87000402 100644 --- a/src/ssh_audit/dheat.py +++ b/src/ssh_audit/dheat.py @@ -329,6 +329,11 @@ def _close_socket(socket_dict: Dict[socket.socket, float], s: socket.socket) -> 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) + out.d("Resolved %s to %s (address family %u)" % (aconf.host, target_ip_address, target_address_family)) + spinner = ["-", "\\", "|", "/"] spinner_index = 0 @@ -354,7 +359,7 @@ def _close_socket(socket_dict: Dict[socket.socket, float], s: socket.socket) -> rate_str = " at a max rate of %s%u%s connections per second" % (DHEat.WHITEB, aconf.conn_rate_test_target_rate, DHEat.CLEAR) print() - print("Performing non-disruptive rate test against %s[%s]:%u%s with %s%u%s concurrent sockets%s. No Diffie-Hellman requests will be sent." % (DHEat.WHITEB, aconf.host, aconf.port, DHEat.CLEAR, DHEat.WHITEB, concurrent_sockets, DHEat.CLEAR, rate_str)) + print("Performing non-disruptive rate test against %s[%s]:%u%s with %s%u%s concurrent sockets%s. No Diffie-Hellman requests will be sent." % (DHEat.WHITEB, target_ip_address, aconf.port, DHEat.CLEAR, DHEat.WHITEB, concurrent_sockets, DHEat.CLEAR, rate_str)) print() # Make room for the multi-line output. @@ -374,11 +379,6 @@ def _close_socket(socket_dict: Dict[socket.socket, float], s: socket.socket) -> else: out.d("DHEat.dh_rate_test(): starting test; parameters: %f seconds, %u max connections, %u concurrent sockets." % (max_time, max_connections, concurrent_sockets), write_now=True) - # 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) - out.d("Resolved %s to %s (address family %u)" % (aconf.host, target_ip_address, target_address_family)) - num_attempted_connections = 0 num_opened_connections = 0 num_exceeded_maxstartups = 0 @@ -777,7 +777,7 @@ def _run(self) -> bool: if sys.platform == "win32": self.output("%sWARNING:%s this feature has not been thoroughly tested on Windows. It may perform worse than on UNIX OSes." % (self.YELLOWB, self.CLEAR)) - self.output("Running DHEat test against %s[%s]:%u%s with %s%u%s concurrent sockets..." % (self.WHITEB, self.target, self.port, self.CLEAR, self.WHITEB, self.concurrent_connections, self.CLEAR)) + self.output("Running DHEat test against %s[%s]:%u%s with %s%u%s concurrent sockets..." % (self.WHITEB, self.target_ip_address, self.port, self.CLEAR, self.WHITEB, self.concurrent_connections, self.CLEAR)) # If the user didn't specify an exact kex algorithm to test, check our prioritized list against what the server supports. Larger p-values (such as group18: 8192-bits) cause the most strain on the server. chosen_alg = ""