Skip to content

Commit

Permalink
Merge pull request #635 from mxsasha/ehlo-reject-verbose
Browse files Browse the repository at this point in the history
Include SMTP EHLO rejection response in raised exception
  • Loading branch information
nabla-c0d3 committed Feb 24, 2024
2 parents 49380c1 + 7de4dc2 commit ef91317
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sslyze/connection_helpers/opportunistic_tls_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ def prepare_socket_for_tls_handshake(self, sock: socket.socket) -> None:

# Send a EHLO and wait for the 250 status
sock.send(b"EHLO sslyze.scan\r\n")
if b"250 " not in sock.recv(2048):
raise OpportunisticTlsError("SMTP EHLO was rejected")
data = sock.recv(2048)
if b"250 " not in data:
raise OpportunisticTlsError(f"SMTP EHLO was rejected: {repr(data)}")

# Send a STARTTLS
sock.send(b"STARTTLS\r\n")
Expand Down

0 comments on commit ef91317

Please sign in to comment.