Perform simple check to see if connection was successful. Returns True is connection was successful, server replied with ServerHello and ServerHelloDone messages, and the cipher selected was present in ciphers advertised by client, False otherwise
(result)
| 35 | |
| 36 | |
| 37 | def simple_inspector(result): |
| 38 | """ |
| 39 | Perform simple check to see if connection was successful. |
| 40 | |
| 41 | Returns True is connection was successful, server replied with |
| 42 | ServerHello and ServerHelloDone messages, and the cipher selected |
| 43 | was present in ciphers advertised by client, False otherwise |
| 44 | """ |
| 45 | if any(isinstance(x, ServerHelloDone) for x in result): |
| 46 | ch = next((x for x in result if isinstance(x, ClientHello)), None) |
| 47 | sh = next((x for x in result if isinstance(x, ServerHello)), None) |
| 48 | if ch and sh: |
| 49 | if sh.cipher_suite not in ch.cipher_suites: |
| 50 | # FAILURE cipher suite mismatch |
| 51 | return False |
| 52 | return True |
| 53 | # incomplete response or error |
| 54 | return False |
| 55 | |
| 56 | |
| 57 | def verbose_inspector(desc, result): |
no outgoing calls
no test coverage detected