-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught TypeError while handling "Network is unreachable" exception (OS Error 101) leads to crash #672
Comments
I just commited one suggested fix with a pull request. There is a different one that might be more resilient because it makes fewer assumptions about e.args:
That way you can perform the string comparison on the stringified array and it is ensured that a) the match happens no matter which index the error message is at, and b) you do not need to check for types. |
Submitted the second option as a PR as well. Choose whichever you think is more suitable and/or resilient. |
…ng-network-exception-option-2 #672-fix-type-issue-while-handling-network-exception-option-2
Describe the bug
When network connectivity changes during an ongoing scan with SSLyze and the network briefly becomes unavailable (e.g. because you plug in and plug out the Ethernet cable, or because the WiFi is shortly disconnected, or because a virtual machine network interface is detached and reattached), the following chain of exceptions happens:
nassl._nassl.WantReadError
(nassl/ssl_client.py", line 193, in do_handshake
)OSError: [Errno 101] Network is unreachable
(sslyze/connection_helpers/tls_connection.py", line 298, in connect self.ssl_client.do_handshake()
)TypeError: argument of type 'int' is not iterable
(sslyze/connection_helpers/tls_connection.py", line 318, in connect if "Nassl SSL handshake failed" in e.args[0]
)The root cause seems to be that, as the Exceptions/Errors are passed from steps 1 and 2 to 3, the exception handling in step 3 assumes that
e.args[0]
is astr
. In the case of the above two exceptions, however, it is anint
.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Error handling should not assume that
e.args[0]
is iterable (specifically astring
). A type check should be implemented before checking for substring memership within
ine.args[0]
Python environment (please complete the following information):
Additional context
Trace:
The text was updated successfully, but these errors were encountered: