Skip to content

Commit

Permalink
Now prints the IP address in the UI, instead of hostname.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtesta committed Jun 29, 2024
1 parent c94824e commit 1a8725d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/ssh_audit/dheat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: <https://github.com/jtesta/ssh-audit/issues/261>" % (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

Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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 = ""
Expand Down

0 comments on commit 1a8725d

Please sign in to comment.